Update roagenerator, check if ASN & prefix is not zero

This commit is contained in:
netravnen 2023-07-30 12:21:11 +00:00
parent 412f8a0647
commit 9a5f9e6a52
2 changed files with 40 additions and 28 deletions

View file

@ -103,13 +103,16 @@ foreach ($raw_array as $sub_array)
// Extract ASxxxxx from string. // Extract ASxxxxx from string.
preg_match ("/AS[0-9]+/", explode (":", $asn)[1], $_asn); preg_match ("/AS[0-9]+/", explode (":", $asn)[1], $_asn);
$roas["locallyAddedAssertions"]["prefixAssertions"][$k]["asn"] = trim ($_asn[0], "AS"); // Catch if ASN is actually an integer and larger than zero
$roas["locallyAddedAssertions"]["prefixAssertions"][$k]["prefix"] = $_prefix; if (strlen ($_asn[0]) > 0 && strlen ($_prefix) > 0) {
$roas["locallyAddedAssertions"]["prefixAssertions"][$k]["maxPrefixLength"] = ($_asn[0] != "AS0" ? $_maxlength : MAX_LEN_IPV6_AS0); $roas["locallyAddedAssertions"]["prefixAssertions"][$k]["asn"] = trim ($_asn[0], "AS");
$roas["locallyAddedAssertions"]["prefixAssertions"][$k]["source"] = "$_ta"; $roas["locallyAddedAssertions"]["prefixAssertions"][$k]["prefix"] = $_prefix;
$roas["locallyAddedAssertions"]["prefixAssertions"][$k]["mnt-by"] = "$_mnt"; $roas["locallyAddedAssertions"]["prefixAssertions"][$k]["maxPrefixLength"] = ($_asn[0] != "AS0" ? $_maxlength : MAX_LEN_IPV6_AS0);
$roas["locallyAddedAssertions"]["prefixAssertions"][$k]["source"] = "$_ta";
$roas["locallyAddedAssertions"]["prefixAssertions"][$k]["mnt-by"] = "$_mnt";
$k++; $k++;
}
} }
} }
@ -203,13 +206,16 @@ foreach ($raw_array as $sub_array)
// Extract ASxxxxx from string. // Extract ASxxxxx from string.
preg_match ("/AS[0-9]+/", explode (":", $asn)[1], $_asn); preg_match ("/AS[0-9]+/", explode (":", $asn)[1], $_asn);
$roas["locallyAddedAssertions"]["prefixAssertions"][$k]["asn"] = trim ($_asn[0], "AS"); // Catch if ASN is actually an integer and larger than zero
$roas["locallyAddedAssertions"]["prefixAssertions"][$k]["prefix"] = $_prefix; if (strlen ($_asn[0]) > 0 && strlen ($_prefix) > 0) {
$roas["locallyAddedAssertions"]["prefixAssertions"][$k]["maxPrefixLength"] = ($_asn[0] != "AS0" ? $_maxlength : MAX_LEN_IPV4_AS0); $roas["locallyAddedAssertions"]["prefixAssertions"][$k]["asn"] = trim ($_asn[0], "AS");
$roas["locallyAddedAssertions"]["prefixAssertions"][$k]["source"] = "$_ta"; $roas["locallyAddedAssertions"]["prefixAssertions"][$k]["prefix"] = $_prefix;
$roas["locallyAddedAssertions"]["prefixAssertions"][$k]["mnt-by"] = "$_mnt"; $roas["locallyAddedAssertions"]["prefixAssertions"][$k]["maxPrefixLength"] = ($_asn[0] != "AS0" ? $_maxlength : MAX_LEN_IPV4_AS0);
$roas["locallyAddedAssertions"]["prefixAssertions"][$k]["source"] = "$_ta";
$roas["locallyAddedAssertions"]["prefixAssertions"][$k]["mnt-by"] = "$_mnt";
$k++; $k++;
}
} }
} }

View file

@ -97,15 +97,18 @@ foreach ($raw_array as $sub_array)
// Extract ASxxxxx from string. // Extract ASxxxxx from string.
preg_match ("/AS[0-9]+/", explode (":", $asn)[1], $_asn); preg_match ("/AS[0-9]+/", explode (":", $asn)[1], $_asn);
$roas["roas"][$k]["asn"] = trim ($_asn[0], "AS"); // Catch if ASN is actually an integer and larger than zero
$roas["roas"][$k]["prefix"] = $_prefix; if (strlen ($_asn[0]) > 0 && strlen ($_prefix) > 0) {
$roas["roas"][$k]["maxLength"] = ($_asn[0] != "AS0" ? $_maxlength : MAX_LEN_IPV6_AS0); $roas["roas"][$k]["asn"] = trim ($_asn[0], "AS");
//$roas["roas"][$k]["url"]["inetnum"] = "$web_registry_url/data/inet6num/$prefix[1]_$prefix[2]"; $roas["roas"][$k]["prefix"] = $_prefix;
//$roas["roas"][$k]["url"]["route"] = "$web_registry_url/data/route6/$prefix[1]_$prefix[2]"; $roas["roas"][$k]["maxLength"] = ($_asn[0] != "AS0" ? $_maxlength : MAX_LEN_IPV6_AS0);
$roas["roas"][$k]["ta"] = $_ta; //$roas["roas"][$k]["url"]["inetnum"] = "$web_registry_url/data/inet6num/$prefix[1]_$prefix[2]";
$roas["roas"][$k]["mnt-by"] = $_mnt; //$roas["roas"][$k]["url"]["route"] = "$web_registry_url/data/route6/$prefix[1]_$prefix[2]";
$roas["roas"][$k]["ta"] = $_ta;
$roas["roas"][$k]["mnt-by"] = $_mnt;
$k++; $k++;
}
} }
} }
@ -199,15 +202,18 @@ foreach ($raw_array as $sub_array)
// Extract ASxxxxx from string. // Extract ASxxxxx from string.
preg_match ("/AS[0-9]+/", explode (":", $asn)[1], $_asn); preg_match ("/AS[0-9]+/", explode (":", $asn)[1], $_asn);
$roas["roas"][$k]["asn"] = trim ($_asn[0], "AS"); // Catch if ASN is actually an integer and larger than zero
$roas["roas"][$k]["prefix"] = $_prefix; if (strlen ($_asn[0]) > 0 && strlen ($_prefix) > 0) {
$roas["roas"][$k]["maxLength"] = ($_asn[0] != "AS0" ? $_maxlength : MAX_LEN_IPV4_AS0); $roas["roas"][$k]["asn"] = trim ($_asn[0], "AS");
//$roas["roas"][$k]["url"]["inetnum"] = "$web_registry_url/data/inetnum/$prefix[1]_$prefix[2]"; $roas["roas"][$k]["prefix"] = $_prefix;
//$roas["roas"][$k]["url"]["route"] = "$web_registry_url/data/route/$prefix[1]_$prefix[2]"; $roas["roas"][$k]["maxLength"] = ($_asn[0] != "AS0" ? $_maxlength : MAX_LEN_IPV4_AS0);
$roas["roas"][$k]["ta"] = $_ta; //$roas["roas"][$k]["url"]["inetnum"] = "$web_registry_url/data/inetnum/$prefix[1]_$prefix[2]";
$roas["roas"][$k]["mnt-by"] = $_mnt; //$roas["roas"][$k]["url"]["route"] = "$web_registry_url/data/route/$prefix[1]_$prefix[2]";
$roas["roas"][$k]["ta"] = $_ta;
$roas["roas"][$k]["mnt-by"] = $_mnt;
$k++; $k++;
}
} }
} }