Remove end of line spaces

This commit is contained in:
netravnen 2020-01-28 19:56:14 +00:00
parent eb880446d8
commit 15075495fe
2 changed files with 23 additions and 23 deletions

View file

@ -15,7 +15,7 @@ $roas["_comments"]["modified"]["subject"] = shell_exec ("/usr/bin/git -C ../regi
$roas["_comments"]["modified"]["url"] = "https://git.dn42.us/dn42/registry/commit/"; $roas["_comments"]["modified"]["url"] = "https://git.dn42.us/dn42/registry/commit/";
$roas["_comments"]["modified"]["url"] .= $roas["_comments"]["modified"]["commit"]; $roas["_comments"]["modified"]["url"] .= $roas["_comments"]["modified"]["commit"];
$roas["validationOutputFilters"]["prefixFilters"] = array(); $roas["validationOutputFilters"]["prefixFilters"] = array();
$roas["validationOutputFilters"]["bgpsecFilters"] = array(); $roas["validationOutputFilters"]["bgpsecFilters"] = array();
$roas["locallyAddedAssertions"]["bgpsecAssertions"] = array(); $roas["locallyAddedAssertions"]["bgpsecAssertions"] = array();
/* /*
@ -33,7 +33,7 @@ foreach ($files6 as $file)
/* /*
* route6 with maxLength value set: * route6 with maxLength value set:
* - fd42:5d71:219::/48 * - fd42:5d71:219::/48
* *
* $ cat ../registry/data/route6/fd42:5d71:219::_48 * $ cat ../registry/data/route6/fd42:5d71:219::_48
* route6: fd42:5d71:219::/48 * route6: fd42:5d71:219::/48
* origin: AS4242420119 * origin: AS4242420119
@ -41,19 +41,19 @@ foreach ($files6 as $file)
* mnt-by: JRB0001-MNT * mnt-by: JRB0001-MNT
* source: DN42 * source: DN42
*/ */
$data = file("../registry/data/route6/$file"); $data = file("../registry/data/route6/$file");
foreach ($data as $str) foreach ($data as $str)
{ {
$str = trim_special_chars ($str); $str = trim_special_chars ($str);
if (startsWith ($str, "max", 3)) $raw_array[$i]["max"] = $str; if (startsWith ($str, "max", 3)) $raw_array[$i]["max"] = $str;
elseif (startsWith ($str, "source", 6)) $raw_array[$i]["source"] = $str; elseif (startsWith ($str, "source", 6)) $raw_array[$i]["source"] = $str;
elseif (startsWith ($str, "route6", 6)) $raw_array[$i]["route"] = $str; elseif (startsWith ($str, "route6", 6)) $raw_array[$i]["route"] = $str;
elseif (startsWith ($str, "origin", 6)) $raw_array[$i]["asn"][$j++] = $str; elseif (startsWith ($str, "origin", 6)) $raw_array[$i]["asn"][$j++] = $str;
elseif (startsWith ($str, "mnt", 3)) $raw_array[$i]["mnt"] = $str; elseif (startsWith ($str, "mnt", 3)) $raw_array[$i]["mnt"] = $str;
// Catch max-length not set in route object. // Catch max-length not set in route object.
if (empty ($raw_array[$i]["max"])) $raw_array[$i]["max"] = -1; if (empty ($raw_array[$i]["max"])) $raw_array[$i]["max"] = -1;
} }
@ -70,13 +70,13 @@ foreach ($raw_array as $sub_array)
preg_match ("/([a-f0-9\:]{0,128})\/(29|[3-5][0-9]|6[0-4]|80)/", preg_match ("/([a-f0-9\:]{0,128})\/(29|[3-5][0-9]|6[0-4]|80)/",
explode ("6: ", $sub_array["route"])[1], explode ("6: ", $sub_array["route"])[1],
$prefix); $prefix);
// Extract ta information // Extract ta information
$source = array(); $source = array();
preg_match ("/([A-Z0-4]+)/", preg_match ("/([A-Z0-4]+)/",
explode (":", $sub_array["source"])[1], explode (":", $sub_array["source"])[1],
$source); $source);
// Try to extract max-length information // Try to extract max-length information
$maxlength = array(); $maxlength = array();
if (($sub_array["max"]) != -1) if (($sub_array["max"]) != -1)
@ -100,7 +100,7 @@ foreach ($raw_array as $sub_array)
else else
// Do fallback to default prefix size if max-length was not set. // Do fallback to default prefix size if max-length was not set.
$_maxlength = ($prefix[2] < MAX_LEN_IPV6 ? MAX_LEN_IPV6 : $prefix[2]); $_maxlength = ($prefix[2] < MAX_LEN_IPV6 ? MAX_LEN_IPV6 : $prefix[2]);
$_mnt = $mnt[0]; $_mnt = $mnt[0];
// Loop through each asn in single route6 object and assign // Loop through each asn in single route6 object and assign
@ -109,7 +109,7 @@ 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"); $roas["locallyAddedAssertions"]["prefixAssertions"][$k]["asn"] = trim ($_asn[0], "AS");
$roas["locallyAddedAssertions"]["prefixAssertions"][$k]["prefix"] = $_prefix; $roas["locallyAddedAssertions"]["prefixAssertions"][$k]["prefix"] = $_prefix;
$roas["locallyAddedAssertions"]["prefixAssertions"][$k]["maxPrefixLength"] = ($_asn[0] != "AS0" ? $_maxlength : MAX_LEN_IPV6_AS0); $roas["locallyAddedAssertions"]["prefixAssertions"][$k]["maxPrefixLength"] = ($_asn[0] != "AS0" ? $_maxlength : MAX_LEN_IPV6_AS0);
@ -129,7 +129,7 @@ foreach ($raw_array as $sub_array)
*/ */
$i = 0; // Counter used with tmp $raw_array. $i = 0; // Counter used with tmp $raw_array.
$raw_array = array(); // tmp array() used for storing data to be processed $raw_array = array(); // tmp array() used for storing data to be processed
foreach ($files4 as $file) foreach ($files4 as $file)
{ {
$j = 0; $j = 0;
@ -137,7 +137,7 @@ foreach ($files4 as $file)
/* /*
* route with maxLength value set: * route with maxLength value set:
* - 172.20.1.0/24 * - 172.20.1.0/24
* *
* $ cat ../registry/data/route/172.20.1.0_24 * $ cat ../registry/data/route/172.20.1.0_24
* route: 172.20.1.0/24 * route: 172.20.1.0/24
* origin: AS4242420119 * origin: AS4242420119
@ -145,13 +145,13 @@ foreach ($files4 as $file)
* mnt-by: JRB0001-MNT * mnt-by: JRB0001-MNT
* source: DN42 * source: DN42
*/ */
$data = file("../registry/data/route/$file"); $data = file("../registry/data/route/$file");
foreach ($data as $str) foreach ($data as $str)
{ {
$str = trim_special_chars ($str); $str = trim_special_chars ($str);
if (startsWith ($str, "max", 3)) $raw_array[$i]["max"] = $str; if (startsWith ($str, "max", 3)) $raw_array[$i]["max"] = $str;
elseif (startsWith ($str, "source", 6)) $raw_array[$i]["source"] = $str; elseif (startsWith ($str, "source", 6)) $raw_array[$i]["source"] = $str;
elseif (startsWith ($str, "route", 5)) $raw_array[$i]["route"] = $str; elseif (startsWith ($str, "route", 5)) $raw_array[$i]["route"] = $str;
@ -172,13 +172,13 @@ foreach ($raw_array as $sub_array)
preg_match ("/([0-9\.]{7,15})\/([8-9]|[1-2][0-9]|3[0-2])/", preg_match ("/([0-9\.]{7,15})\/([8-9]|[1-2][0-9]|3[0-2])/",
explode (":", $sub_array["route"])[1], explode (":", $sub_array["route"])[1],
$prefix); $prefix);
// Extract ta information // Extract ta information
$source = array(); $source = array();
preg_match ("/([A-Z0-4]+)/", preg_match ("/([A-Z0-4]+)/",
explode (":", $sub_array["source"])[1], explode (":", $sub_array["source"])[1],
$source); $source);
// Try to extract max-length information // Try to extract max-length information
$maxlength = array(); $maxlength = array();
if (($sub_array["max"]) != -1) if (($sub_array["max"]) != -1)
@ -204,14 +204,14 @@ foreach ($raw_array as $sub_array)
$_maxlength = ($prefix[2] < MAX_LEN_IPV4 ? MAX_LEN_IPV4 : $prefix[2]); $_maxlength = ($prefix[2] < MAX_LEN_IPV4 ? MAX_LEN_IPV4 : $prefix[2]);
$_mnt = $mnt[0]; $_mnt = $mnt[0];
// Loop through each asn in single route6 object and assign // Loop through each asn in single route6 object and assign
// other values accordingly. // other values accordingly.
foreach ($sub_array["asn"] as $asn) foreach ($sub_array["asn"] as $asn)
{ {
// 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"); $roas["locallyAddedAssertions"]["prefixAssertions"][$k]["asn"] = trim ($_asn[0], "AS");
$roas["locallyAddedAssertions"]["prefixAssertions"][$k]["prefix"] = $_prefix; $roas["locallyAddedAssertions"]["prefixAssertions"][$k]["prefix"] = $_prefix;
$roas["locallyAddedAssertions"]["prefixAssertions"][$k]["maxPrefixLength"] = ($_asn[0] != "AS0" ? $_maxlength : MAX_LEN_IPV4_AS0); $roas["locallyAddedAssertions"]["prefixAssertions"][$k]["maxPrefixLength"] = ($_asn[0] != "AS0" ? $_maxlength : MAX_LEN_IPV4_AS0);

View file

@ -24,13 +24,13 @@ fi
php roagen.php php roagen.php
php rfc8416.php php rfc8416.php
# Ensure sub-repo is created to track roa file udpates # Ensure sub-repo is created to track roa file udpates
if [ ! -d roa/ ] ; then mkdir roa ; fi if [ ! -d roa/ ] ; then mkdir roa ; fi
if [ ! -f roa/.git/config ] ; then if [ ! -f roa/.git/config ] ; then
git -C roa/ init git -C roa/ init
if [ ! -f roa/README.md ; then if [ ! -f roa/README.md ; then
touch roa/README.md touch roa/README.md
echo '## roas' | tee roa/README.md ; fi echo '## roas' | tee roa/README.md ; fi
git -C roa/ commit --allow-empty -m "Initial commit" git -C roa/ commit --allow-empty -m "Initial commit"
git -C roa/ commit README.md -m "Add README.md" ; fi git -C roa/ commit README.md -m "Add README.md" ; fi
@ -96,5 +96,5 @@ git -C roa/ commit -m "Updated ROA files - $ISO_DATE" --quiet
# Push ROA repository to every remote configured # Push ROA repository to every remote configured
for REMOTE in $(git -C roa/ remote | egrep -v upstream | paste -sd " " -) ; do git -C roa/ push $REMOTE master:master --quiet ; done for REMOTE in $(git -C roa/ remote | egrep -v upstream | paste -sd " " -) ; do git -C roa/ push $REMOTE master:master --quiet ; done
# Push local roagen repository to every remote configured # Push local roagen repository to every remote configured
for REMOTE in $(git remote | egrep -v upstream | paste -sd " " -) ; do git push $REMOTE master:master --quiet ; done for REMOTE in $(git remote | egrep -v upstream | paste -sd " " -) ; do git push $REMOTE master:master --quiet ; done