To sort by IP change the following line in /usr/local/www/services_dnsmasq_edit.php:
return strcasecmp($a['host'], $b['host']);
to
return !ip_less_than($a['ip'], $b['ip']);
This will sort by IP in increasing order. Allowing a list of multiple names to be entered for the same IP is trickier because they will need to be exploded into an array, then checked individually against the existing names, which may also be a list which may need to be exploded if not stored as an array already, and checked.
I don't understand the underlying data structure well enough to be sure that I'm not going to damage it by changing the 'host' element to a linear array or a space delineated list of elements. Fortunately, space is not a valid host name component (look at the mess created by GNU make because it can't figure out if a file name has a space in it). Nor am I confident about editing such a list. Is there any overall guide to the data structure used by pfSense?
Thanks,
Andrew