Updated roagen.php
This commit is contained in:
parent
d846811613
commit
1631048bc5
30
roagen.php
30
roagen.php
|
@ -68,10 +68,11 @@ foreach($files as $file)
|
|||
$mask = $prefix[2];
|
||||
}
|
||||
// extract var $maxLength
|
||||
$maxLength = ''; // ensure var is null when starting new loop
|
||||
if (startsWith($line,'max-length')) {
|
||||
$maxLength = array();
|
||||
preg_match('/([0-9]+)/',explode(':', $line)[1], $maxLength);
|
||||
$maxLength = $maxLength[1];
|
||||
$maxLength = (empty($maxLength[1]) ? '' : $maxLength[1]);
|
||||
}
|
||||
// extract var $asn
|
||||
if (startsWith($line, 'origin')) {
|
||||
|
@ -83,15 +84,13 @@ foreach($files as $file)
|
|||
$roas['roas'][$i]['asn'] = $asn[0];
|
||||
$roas['roas'][$i]['prefix'] = $route;
|
||||
if (isset($ta)) {
|
||||
if ($ta != ('ICVPN' || 'CHAOSVPN')) {
|
||||
if ($ta == 'DN42') {
|
||||
$mask = ($mask <= 64 ? '64' : $mask);
|
||||
if ($maxLength != '') $mask = $maxLength;
|
||||
}
|
||||
} else {
|
||||
$ta = 'NULL';
|
||||
}
|
||||
if ($ta == 'DN42' && isset($maxLength)) {
|
||||
$mask = $maxLength;
|
||||
}
|
||||
$roas['roas'][$i]['maxLength'] = $mask;
|
||||
$roas['roas'][$i]['ta'] = $ta;
|
||||
$i++;
|
||||
|
@ -101,15 +100,13 @@ foreach($files as $file)
|
|||
$roas['roas'][$i]['asn'] = $asn[0];
|
||||
$roas['roas'][$i]['prefix'] = $route;
|
||||
if (isset($ta)) {
|
||||
if ($ta != ('ICVPN' || 'CHAOSVPN')) {
|
||||
if ($ta == 'DN42') {
|
||||
$mask = ($mask <= 64 ? '64' : $mask);
|
||||
if ($maxLength != '') $mask = $maxLength;
|
||||
}
|
||||
} else {
|
||||
$ta = 'NULL';
|
||||
}
|
||||
if ($ta == 'DN42' && isset($maxLength)) {
|
||||
$mask = $maxLength;
|
||||
}
|
||||
$roas['roas'][$i]['maxLength'] = $mask;
|
||||
$roas['roas'][$i]['ta'] = $ta;
|
||||
$i++;
|
||||
|
@ -151,10 +148,11 @@ foreach($files as $file)
|
|||
$mask = $prefix[5];
|
||||
}
|
||||
// extract var $maxLength
|
||||
$maxLength = ''; // ensure var is null when starting new loop
|
||||
if (startsWith($line,'max-length')) {
|
||||
$maxLength = array();
|
||||
preg_match('/([0-9]+)/',explode(':', $line)[1], $maxLength);
|
||||
$maxLength = $maxLength[1];
|
||||
$maxLength = (empty($maxLength[1]) ? '' : $maxLength[1]);
|
||||
}
|
||||
// extract var $asn
|
||||
if (startsWith($line, 'origin')) {
|
||||
|
@ -166,15 +164,13 @@ foreach($files as $file)
|
|||
$roas['roas'][$i]['asn'] = $asn[0];
|
||||
$roas['roas'][$i]['prefix'] = $route;
|
||||
if (isset($ta)) {
|
||||
if ($ta != ('ICVPN' || 'CHAOSVPN')) {
|
||||
if ($ta == 'DN42') {
|
||||
$mask = ($mask <= 28 ? '28' : $mask);
|
||||
if ($maxLength != '') $mask = $maxLength;
|
||||
}
|
||||
} else {
|
||||
$ta = 'NULL';
|
||||
}
|
||||
if ($ta == 'DN42' && isset($maxLength)) {
|
||||
$mask = $maxLength;
|
||||
}
|
||||
$roas['roas'][$i]['maxLength'] = $mask;
|
||||
$roas['roas'][$i]['ta'] = $ta;
|
||||
$i++;
|
||||
|
@ -184,15 +180,13 @@ foreach($files as $file)
|
|||
$roas['roas'][$i]['asn'] = $asn[0];
|
||||
$roas['roas'][$i]['prefix'] = $route;
|
||||
if (isset($ta)) {
|
||||
if ($ta != ('ICVPN' || 'CHAOSVPN')) {
|
||||
if ($ta == 'DN42') {
|
||||
$mask = ($mask <= 28 ? '28' : $mask);
|
||||
if ($maxLength != '') $mask = $maxLength;
|
||||
}
|
||||
} else {
|
||||
$ta = 'NULL';
|
||||
}
|
||||
if ($ta == 'DN42' && isset($maxLength)) {
|
||||
$mask = $maxLength;
|
||||
}
|
||||
$roas['roas'][$i]['maxLength'] = $mask;
|
||||
$roas['roas'][$i]['ta'] = $ta;
|
||||
$i++;
|
||||
|
|
Loading…
Reference in a new issue