bgp / bgpq4

BGP Filter generator
https://github.com/bgp/bgpq4
BSD 2-Clause "Simplified" License
299 stars 44 forks source link

Comma added to as-path-set end #67

Closed pmawsonau closed 6 months ago

pmawsonau commented 2 years ago

Hi,

When AS-PATH set is long, it appears the script adds a comma to the end of the custom name defined when running, formatting for Cisco XR

Command being run bgpq4 -S APNIC,ARIN,RIPE,LACNIC,AFRINIC,NTTCOM,RADB -l AS-EQUINIX-AP -Xf 23686 AS-EQUINIX-AP as-path-set AS-EQUINIX-AP, ios-regex '^23686([0-9]+)*(703|1421|1668|1828|1921|3491)$', ios-regex '^23686([0-9]+)*(3731|4653|4739|4785|4983|5779)$', ios-regex '^23686([0-9]+)*(6404|7233|7280|7566|7594|7598)$', ios-regex '^23686([0-9]+)*(7647|7862|8360|8444|9219|9249)$', ios-regex '^23686([0-9]+)*(9280|9336|9351|9512|9554|9584)$', ios-regex '^23686([0-9]+)*(9651|9720|9745|9795|9797|9878)$', ios-regex '^23686([0-9]+)*(9997|10002|10015|10019|10084|10108)$', ios-regex '^23686([0-9]+)*(10121|10145|10211|10229|10230|10310)$', ios-regex '^23686([0-9]+)*(10467|10880|10940|11054|11228|11957)$', ios-regex '^23686([0-9]+)*(12041|12189|12222|13331|13335|13532)$', ios-regex '^23686([0-9]+)*(13533|13684|13750|13896|14076|14148)$', ios-regex '^23686([0-9]+)*(14196|14210|14294|14297|14418|14526)$', ios-regex '^23686([0-9]+)*(14678|14776|14777|14778|14779|14780)$', ios-regex '^23686([0-9]+)*(14781|14821|14853|15635|15896|16466)$', ios-regex '^23686([0-9]+)*(16515|16625|16702|16815|17110|17299)$', ios-regex '^23686([0-9]+)*(17457|17462|17481|17630|17732|17734)$',

That , as the end of "as-path-set AS-EQUINIX-AP" should not exist.

Issue doesn't exist if you use Juniper instead of Cisco bgpq4 -S APNIC,ARIN,RIPE,LACNIC,AFRINIC,NTTCOM,RADB -l AS-EQUINIX-AP -Jf 23686 AS-EQUINIX-AP | head policy-options { replace: as-path-group AS-EQUINIX-AP { as-path a0 "^23686(.)(703|1421|1668|1828|1921|3491|3731|4653)$"; as-path a1 "^23686(.)(4739|4785|4983|5779|6404|7233|7280|7566)$"; as-path a2 "^23686(.)(7594|7598|7647|7862|8360|8444|9219|9249)$"; as-path a3 "^23686(.)(9280|9336|9351|9512|9554|9584|9651|9720)$";

pmawsonau commented 2 years ago

Other examples, although is confusing.

AS1221:AS-TELSTRA is 1 member, plus sub member AS1221:AS-CUSTOMERS. However, it only breaks when running it on the sub-member

$ bgpq4 -S APNIC,ARIN,RIPE,LACNIC,AFRINIC,NTTCOM,RADB -l AS-TELSTRA -Xf 1221 AS1221:AS-TELSTRA | head as-path-set AS-TELSTRA ios-regex '^1221(1221)*$', ios-regex '^1221([0-9]+)(3|11|31|63|90|109)$', ios-regex '^1221([0-9]+)(111|156|243|557|714|792)$', ios-regex '^1221([0-9]+)(793|794|823|949|1140|1204)$', ios-regex '^1221([0-9]+)(1215|1216|1217|1219|1249|1256)$', ios-regex '^1221([0-9]+)(1290|1294|1351|1396|1397|1398)$', ios-regex '^1221([0-9]+)(1399|1400|1421|1448|1508|1547)$', ios-regex '^1221([0-9]+)(1608|1696|1738|1742|1766|1828)$', ios-regex '^1221([0-9]+)_(1851|1921|1929|1932|1958|1968)$',

$ bgpq4 -S APNIC,ARIN,RIPE,LACNIC,AFRINIC,NTTCOM,RADB -l AS-TELSTRA -Xf 1221 AS1221:AS-CUSTOMERS | head as-path-set AS-TELSTRA, ios-regex '^1221([0-9]+)*(3|11|31|63|90|109)$', ios-regex '^1221([0-9]+)*(111|156|243|557|714|792)$', ios-regex '^1221([0-9]+)*(793|794|823|949|1140|1204)$', ios-regex '^1221([0-9]+)*(1215|1216|1217|1219|1249|1256)$', ios-regex '^1221([0-9]+)*(1290|1294|1351|1396|1397|1398)$', ios-regex '^1221([0-9]+)*(1399|1400|1421|1448|1508|1547)$', ios-regex '^1221([0-9]+)*(1608|1696|1738|1742|1766|1828)$', ios-regex '^1221([0-9]+)*(1851|1921|1929|1932|1958|1968)$', ios-regex '^1221([0-9]+)*(2011|2047|2134|2198|2386|2516)$',

markduffell commented 1 year ago

@pmawsonau may be related to if peer-as is not found as a member of specified as-set.

// No comma added to as-path-set name when as-member AS1221 used as peer-as: $ bgpq4 -S APNIC,ARIN,RIPE,LACNIC,AFRINIC,NTTCOM,RADB -l TELSTRA -Xf 1221 AS1221:AS-TELSTRA | head as-path-set TELSTRA ios-regex '^1221(1221)*$', ios-regex '^1221([0-9]+)(3|11|31|59|63|90)$', ios-regex '^1221([0-9]+)(109|111|112|156|243|557)$', ios-regex '^1221([0-9]+)*_(714|792|793|794|800|823)$',

// No comma added to as-path-set name when a recursive as-member used as peer-as: $ bgpq4 -S APNIC,ARIN,RIPE,LACNIC,AFRINIC,NTTCOM,RADB -l TELSTRA -Xf 4637 AS1221:AS-TELSTRA | head as-path-set TELSTRA ios-regex '^4637(4637)*$', ios-regex '^4637([0-9]+)*_(3|11|31|59|63|90)$',

// Comma added/no peer prepend line when a non-as-member used as peer-as AS4826: $ bgpq4 -S APNIC,ARIN,RIPE,LACNIC,AFRINIC,NTTCOM,RADB -l TELSTRA -Xf 4826 AS1221:AS-TELSTRA | head as-path-set TELSTRA, ios-regex '^4826([0-9]+)*(3|11|31|59|63|90)$', ios-regex '^4826([0-9]+)*(109|111|112|156|243|557)$', ios-regex '^4826([0-9]+)*(714|792|793|794|800|823)$',

job commented 6 months ago

Folks, can you give this commit a test and confirm it now correctly prints commas? https://github.com/bgp/bgpq4/commit/0a83c7598d13e8d13d13f959ae5308536689317e

job commented 6 months ago

Fixed via https://github.com/bgp/bgpq4/releases/tag/1.13