1
0
Fork 0

Updated roagen.php

This commit is contained in:
netravnen 2018-12-10 20:12:12 +01:00 committed by Christoffer
parent d846811613
commit 1631048bc5
1 changed files with 13 additions and 19 deletions

View File

@ -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++;
@ -150,11 +147,12 @@ foreach($files as $file)
$route = $prefix[0];
$mask = $prefix[5];
}
// extract var $maxLength
// 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++;