Fix for sorting DHCPv6 reservations
-
Hi everyone,
today I finally found the time to investigate why the DHCP reservation in Services -> DHCPv6 Server -> #Network# aren't sorted by IP address like they are in the DHCPv4 section.
It turns out the fix is pretty easy and I'd like to share it here.
The root cause is, that for sorting a PHP built-in function named ip2long is used. PHP.net states that this function only works for IPv4.The fix is, to use another (and simpler approach) in /usr/local/www/services_dhcpv6_edit.php for sorting:
old (ipcomp calls some other functions an finally ip2long):function staticmapcmp($a, $b) { return ipcmp($a['ipaddrv6'], $b['ipaddrv6']); }new:
function staticmapcmp($a, $b) { $ipA = inet_pton($a['ipaddrv6']); $ipB = inet_pton($b['ipaddrv6']); return strcmp($ipA, $ipB); }After changing, you only need to edit one entry for each network and save it (without changes) to trigger the sorting.
Pretty easy after all :)This file can be used to patch pfSense (be careful! I'm just a random stranger! Make backups!).
For some reason you have to copy/paste the content in System->Patches. pfSense rejects the file if you just upload (don't know why).
Path strip count: 1
Base directory: /
IPv6DhcpReservationSort.diffHave fun with it but be careful!
Privacy Policy · Cookie Policy