Updated roagen.php

This commit is contained in:
netravnen 2018-12-10 19:31:49 +01:00 committed by Christoffer
parent b22e984abb
commit 8cd64c4f3e

View file

@ -67,6 +67,12 @@ foreach($files as $file)
$route = $prefix[0]; $route = $prefix[0];
$mask = $prefix[2]; $mask = $prefix[2];
} }
// extract var $maxLength
if (startsWith($line,'max-length')) {
$maxLength = array();
preg_match('/([0-9]{2,3})/',explode(':', $line)[1], $maxLength);
$maxLength = $maxLength[1];
}
// extract var $asn // extract var $asn
if (startsWith($line, 'origin')) { if (startsWith($line, 'origin')) {
$asn = array(); $asn = array();
@ -83,7 +89,10 @@ foreach($files as $file)
} else { } else {
$ta = 'NULL'; $ta = 'NULL';
} }
$roas['roas'][$i]['maxLength'] = $mask; if (empty($maxLength)) {
$maxLength = $mask;
}
$roas['roas'][$i]['maxLength'] = $maxLength;
$roas['roas'][$i]['ta'] = $ta; $roas['roas'][$i]['ta'] = $ta;
$i++; $i++;
} }
@ -98,7 +107,10 @@ foreach($files as $file)
} else { } else {
$ta = 'NULL'; $ta = 'NULL';
} }
$roas['roas'][$i]['maxLength'] = $mask; if (empty($maxLength)) {
$maxLength = $mask;
}
$roas['roas'][$i]['maxLength'] = $maxLength;
$roas['roas'][$i]['ta'] = $ta; $roas['roas'][$i]['ta'] = $ta;
$i++; $i++;
} }
@ -138,6 +150,12 @@ foreach($files as $file)
$route = $prefix[0]; $route = $prefix[0];
$mask = $prefix[5]; $mask = $prefix[5];
} }
// extract var $maxLength
if (startsWith($line,'max-length')) {
$maxLength = array();
preg_match('/([0-9]{2,3})/',explode(':', $line)[1], $maxLength);
$maxLength = $maxLength[1];
}
// extract var $asn // extract var $asn
if (startsWith($line, 'origin')) { if (startsWith($line, 'origin')) {
$asn = array(); $asn = array();
@ -154,6 +172,9 @@ foreach($files as $file)
} else { } else {
$ta = 'NULL'; $ta = 'NULL';
} }
if (empty($maxLength)) {
$maxLength = $mask;
}
$roas['roas'][$i]['maxLength'] = $mask; $roas['roas'][$i]['maxLength'] = $mask;
$roas['roas'][$i]['ta'] = $ta; $roas['roas'][$i]['ta'] = $ta;
$i++; $i++;
@ -169,7 +190,10 @@ foreach($files as $file)
} else { } else {
$ta = 'NULL'; $ta = 'NULL';
} }
$roas['roas'][$i]['maxLength'] = $mask; if (empty($maxLength)) {
$maxLength = $mask;
}
$roas['roas'][$i]['maxLength'] = $maxLength;
$roas['roas'][$i]['ta'] = $ta; $roas['roas'][$i]['ta'] = $ta;
$i++; $i++;
} }