Project

General

Profile

Actions

Feature #2356

closed

Fill the "Track Interface" prefix drop down list asynchronously

Added by Seth Mos about 12 years ago. Updated over 11 years ago.

Status:
Resolved
Priority:
Low
Assignee:
Category:
Interfaces
Target version:
Start date:
04/08/2012
Due date:
% Done:

100%

Estimated time:
Plus Target Version:
Release Notes:

Description

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.

Actions #1

Updated by Darren Embry about 12 years ago

  • Status changed from New to Assigned

Something other than that simple print loop is causing the page loads to take so long.
65,536 print statements doesn't really output very much.
Still looking.

Actions #2

Updated by Darren Embry about 12 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.

Actions #3

Updated by Chris Buechler about 12 years ago

as we discussed, I think it's fine as a text box, having a drop down with tens of thousands of values is nuts. will leave for feedback from Seth.

Actions #4

Updated by Seth Mos about 12 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.

if(in_array(strotolower($string), $array))
$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.

Actions #5

Updated by Darren Embry almost 12 years ago

The code displays and validates for the range already.

Actions #6

Updated by Darren Embry almost 12 years ago

P.S. The "array" would literally be every single value from 0 to (2 ^ n) - 1 for some value of n (at least that's how the existing code worked) so all we really need to do is a range check.

Actions #7

Updated by Darren Embry almost 12 years ago

aggh, stupid dumb idiot darren forgot to commit changes.

they're there now in 6b2d4b5a .

Actions #8

Updated by Darren Embry almost 12 years ago

  • Assignee changed from Darren Embry to Seth Mos

Seth, reassigning to you for you to test/close/assign back to me as needed.

Actions #9

Updated by Chris Buechler over 11 years ago

  • Status changed from Feedback to Resolved
Actions

Also available in: Atom PDF