Fill the "Track Interface" prefix drop down list asynchronously
When a interface is selected as a IPv6 "Track interface" type it will calculate all possible prefix posibilities in a drop down.
For a 6to4 prefix that could be 65535 possible networks. This leads to a very slow loading page.
I've improved the printing of the select options somewhat using sprintf() but it's still slow but atleast it doesn't slow chrome as much as it did.
Ideally we have a piece of JS that "helps" fill this drop down asynchronously so that the page does not halt loading.
Not sure if this is worth it though, most ISPs are rolling with either /56 or /60 which is respectively 256 or 16 networks. Which makes the page load issue moot. So that would leave just the issue with 6to4, or if ISPs ever decide to go DHCP6 all in with /48 prefixes.
Updated by Darren Embry over 9 years ago
- Status changed from Assigned to Feedback
- % Done changed from 0 to 100
Converting to a text field because I've determined that, no matter how implemented, a dropdown with 65,536 possible values is ridiculous and hangs your browser.
If you really want to have it as a dropdown if there are less than some threshold (say 256) values, then we can discuss that, in which case please change ticket status from Feedback back to Assigned.
However for now I'd rather keep it simple because quite frankly interfaces.php is complex enough and the logic would be a little unwieldy. If you're fine with this please mark Resolved.
Updated by Seth Mos over 9 years ago
I'm fine with a text box, make sure the input validation is correct.
The math function the filled the drop down is probably a good spot for input validation.
Move that to the input validation, fill a array and see if the user value exists in the array.
If the length entered is too large it will also fail above check. This also prevents some delegations that use insane bit lengths such as /63 where the boundary is somewhere in the middle. E.g. it allows 0-1, and for /62 0-4 etc.
$valid = true;
A preg_match("/^[a-f0-9]+/i", $string) should succeed only on valid hex characters.
Edit: Show possible range. Starts at 0 and output highest dechex($end). Not sure if you already added that.