BUG: fix bird ASNs from invalid string value to valid integer value

This commit is contained in:
netravnen 2019-01-05 23:58:13 +00:00
parent df0e9c1d59
commit 7e8927f375
2 changed files with 9 additions and 2 deletions

View file

@ -119,6 +119,13 @@ function writeRoutinatorExceptionFile ($roas)
function writeExportJSON ($roas)
{
$n = 0;
foreach ($roas['roas'] as $object)
{
$roas['roas'][$n]['asn'] = "AS" . $roas['roas'][$n]['asn'];
$n++;
}
$json = json_encode($roas, JSON_UNESCAPED_SLASHES|JSON_PRETTY_PRINT);
$fp = fopen ('roa/export_dn42.json', 'w');

View file

@ -97,7 +97,7 @@ foreach ($raw_array as $sub_array)
// Extract ASxxxxx from string.
preg_match ("/AS[0-9]+/", explode (":", $asn)[1], $_asn);
$roas["roas"][$k]["asn"] = $_asn[0];
$roas["roas"][$k]["asn"] = trim ($_asn[0], "AS");
$roas["roas"][$k]["prefix"] = $_prefix;
$roas["roas"][$k]["maxLength"] = ($_asn[0] != "AS0" ? $_maxlength : MAX_LEN_IPV6_AS0);
$roas["roas"][$k]["ta"] = $_ta;
@ -187,7 +187,7 @@ foreach ($raw_array as $sub_array)
// Extract ASxxxxx from string.
preg_match ("/AS[0-9]+/", explode (":", $asn)[1], $_asn);
$roas["roas"][$k]["asn"] = $_asn[0];
$roas["roas"][$k]["asn"] = trim ($_asn[0], "AS");
$roas["roas"][$k]["prefix"] = $_prefix;
$roas["roas"][$k]["maxLength"] = ($_asn[0] != "AS0" ? $_maxlength : MAX_LEN_IPV4_AS0);
$roas["roas"][$k]["ta"] = $_ta;