From 5025e2b2f48b57d19a96a517b6c6ff5206a934f1 Mon Sep 17 00:00:00 2001 From: Christoffer Date: Thu, 3 Jan 2019 13:37:29 +0000 Subject: [PATCH] roagen: update compability for ROA files for Bird 2.x, too. - Update the following files: - lib/functions.php - roa/README.md - update.sh - New ROA files being generated for Bird 2.x - roa/bird_route_dn42.conf - roa/bird4_route_dn42.conf - roa/bird6_route_dn42.conf --- lib/functions.php | 48 +++++++++++++++++++++++++++++++++-------------- update.sh | 13 ++++++++++++- 2 files changed, 46 insertions(+), 15 deletions(-) diff --git a/lib/functions.php b/lib/functions.php index 008dfb4..539a91e 100755 --- a/lib/functions.php +++ b/lib/functions.php @@ -57,13 +57,21 @@ function writeBirdConfig ($roas) { $json = json_encode($roas, JSON_UNESCAPED_SLASHES|JSON_PRETTY_PRINT); - $fq = fopen ('roa/bird_roa_dn42.conf', 'w'); - $fq4 = fopen ('roa/bird4_roa_dn42.conf', 'w'); - $fq6 = fopen ('roa/bird6_roa_dn42.conf', 'w'); + $bird1_fq = fopen ('roa/bird_roa_dn42.conf', 'w'); + $bird1_fq4 = fopen ('roa/bird4_roa_dn42.conf', 'w'); + $bird1_fq6 = fopen ('roa/bird6_roa_dn42.conf', 'w'); - fwrite ($fq, shell_exec ("/usr/bin/git -C ../registry/ show | sed 's/^/# /g'")); - fwrite ($fq4, shell_exec ("/usr/bin/git -C ../registry/ show | sed 's/^/# /g'")); - fwrite ($fq6, shell_exec ("/usr/bin/git -C ../registry/ show | sed 's/^/# /g'")); + $bird2_fq = fopen ('roa/bird_route_dn42.conf', 'w'); + $bird2_fq4 = fopen ('roa/bird4_route_dn42.conf', 'w'); + $bird2_fq6 = fopen ('roa/bird6_route_dn42.conf', 'w'); + + fwrite ($bird1_fq, shell_exec ("/usr/bin/git -C ../registry/ show | sed 's/^/# /g'")); + fwrite ($bird1_fq4, shell_exec ("/usr/bin/git -C ../registry/ show | sed 's/^/# /g'")); + fwrite ($bird1_fq6, shell_exec ("/usr/bin/git -C ../registry/ show | sed 's/^/# /g'")); + + fwrite ($bird2_fq, shell_exec ("/usr/bin/git -C ../registry/ show | sed 's/^/# /g'")); + fwrite ($bird2_fq4, shell_exec ("/usr/bin/git -C ../registry/ show | sed 's/^/# /g'")); + fwrite ($bird2_fq6, shell_exec ("/usr/bin/git -C ../registry/ show | sed 's/^/# /g'")); foreach ($roas["roas"] as $roa) { @@ -71,19 +79,31 @@ function writeBirdConfig ($roas) $mxLngth = $roa["maxLength"]; $sn = $roa["asn"]; - $strng = "roa $prfx max $mxLngth as $sn;\n"; + $bird1_strng = "roa $prfx max $mxLngth as $sn;\n"; + $bird2_strng = "route $prfx max $mxLngth as $sn;\n"; + + fwrite ($bird1_fq, $bird1_strng); + fwrite ($bird2_fq, $bird2_strng); - fwrite ($fq, $strng); - if (strpos ($prfx, ":") !== false) - fwrite ($fq6, $strng); + { + fwrite ($bird1_fq6, $bird1_strng); + fwrite ($bird2_fq6, $bird2_strng); + } else - fwrite ($fq4, $strng); + { + fwrite ($bird1_fq4, $bird1_strng); + fwrite ($bird2_fq6, $bird2_strng); + } } - fclose ($fq); - fclose ($fq4); - fclose ($fq6); + fclose ($bird1_fq); + fclose ($bird1_fq4); + fclose ($bird1_fq6); + + fclose ($bird2_fq); + fclose ($bird2_fq4); + fclose ($bird2_fq6); } function writeRoutinatorExceptionFile ($roas) diff --git a/update.sh b/update.sh index 4dc7747..e546b3a 100755 --- a/update.sh +++ b/update.sh @@ -13,7 +13,18 @@ php roagen.php php rfc8416.php # Write out last commit to file -echo "## Last commit +echo "## Notes + +- These files are Bird 1.x compatible: + - bird_roa_dn42.conf + - bird4_roa_dn42.conf + - bird6_roa_dn42.conf +- These files are Bird 2.x compatible: + - bird_route_dn42.conf + - bird4_route_dn42.conf + - bird6_route_dn42.conf + +## Last commit \`\`\` $(git -C ../registry/ log -n 1)