lib: add constants to define max-length

o MAX_LEN_IPV4
o MAX_LEN_IPV6
This commit is contained in:
netravnen 2018-12-26 21:46:34 +00:00
parent b93f428e97
commit 585b867394
3 changed files with 6 additions and 4 deletions

View file

@ -9,4 +9,6 @@ $files4 = scandir ("../registry/data/route/");
// Define array() we are gonna store data inside.
$roas = array();
define ("MAX_LEN_IPV4", 28);
define ("MAX_LEN_IPV6", 64);
?>

View file

@ -91,7 +91,7 @@ foreach ($raw_array as $sub_array)
$_maxlength = (isset ($maxlength[0]) ? $maxlength[0] : "");
else
// Do fallback to default prefix size if max-length was not set.
$_maxlength = ($prefix[2] < 64 ? 64 : $prefix[2]);
$_maxlength = ($prefix[2] < MAX_LEN_IPV6 ? MAX_LEN_IPV6 : $prefix[2]);
$_mnt = $mnt[0];
@ -190,7 +190,7 @@ foreach ($raw_array as $sub_array)
$_maxlength = (isset ($maxlength[0]) ? $maxlength[0] : "");
else
// Do fallback to default prefix size if max-length was not set.
$_maxlength = ($prefix[2] < 29 ? 29 : $prefix[2]);
$_maxlength = ($prefix[2] < MAX_LEN_IPV4 ? MAX_LEN_IPV4 : $prefix[2]);
$_mnt = $mnt[0];

View file

@ -77,7 +77,7 @@ foreach ($raw_array as $sub_array)
$_maxlength = (isset ($maxlength[0]) ? $maxlength[0] : "");
else
// Do fallback to default prefix size if max-length was not set.
$_maxlength = ($prefix[2] < 64 ? 64 : $prefix[2]);
$_maxlength = ($prefix[2] < MAX_LEN_IPV6 ? MAX_LEN_IPV6 : $prefix[2]);
// Loop through each asn in single route6 object and assign
// other values accordingly.
@ -167,7 +167,7 @@ foreach ($raw_array as $sub_array)
$_maxlength = (isset ($maxlength[0]) ? $maxlength[0] : "");
else
// Do fallback to default prefix size if max-length was not set.
$_maxlength = ($prefix[2] < 29 ? 29 : $prefix[2]);
$_maxlength = ($prefix[2] < MAX_LEN_IPV4 ? MAX_LEN_IPV4 : $prefix[2]);
// Loop through each asn in single route6 object and assign
// other values accordingly.