Skip to content

Commit

Permalink
By default disallow 23456 as origin
Browse files Browse the repository at this point in the history
Can be bypassed with '-p'
  • Loading branch information
job committed Jun 20, 2023
1 parent 841840b commit 26d631b
Show file tree
Hide file tree
Showing 4 changed files with 9 additions and 7 deletions.
2 changes: 1 addition & 1 deletion VERSION
Original file line number Diff line number Diff line change
@@ -1 +1 @@
1.10
1.11
3 changes: 2 additions & 1 deletion bgpq4.8
Original file line number Diff line number Diff line change
Expand Up @@ -114,7 +114,8 @@ generate config for Nokia SR Linux (Cisco IOS by default)
.It Fl N
generate config for Nokia SR OS classic CLI (Cisco IOS by default).
.It Fl p
emit prefixes where the origin ASN is in the private ASN range (disabled by default).
emit prefixes where the origin ASN is 23456 or in the private ASN range
(disabled by default).
.It Fl r Ar len
allow more specific routes starting with specified masklen too.
.It Fl R Ar len
Expand Down
10 changes: 5 additions & 5 deletions expander.c
Original file line number Diff line number Diff line change
Expand Up @@ -183,22 +183,22 @@ int
bgpq_expander_add_as(struct bgpq_expander *b, char *as)
{
char *eoa;
uint32_t asno = 0;
uint32_t asno = 0;
struct asn_entry *asne;

if (!b || !as)
return 0;

asno = strtoul(as + 2, &eoa, 10);
if (eoa && *eoa != 0) {
sx_report(SX_ERROR,"Invalid symbol in AS number: '%c' in %s\n",
sx_report(SX_ERROR, "Invalid symbol in AS number: '%c' in %s\n",
*eoa, as);
return 0;
}

if (!expand_special_asn &&
(asno >= 4200000000ul || (asno >= 64496 && asno <= 65551))) {
sx_report(SX_ERROR,"Invalid AS number: %u\n", asno);
if (!expand_special_asn && (asno == 23456 || asno >= 4200000000ul
|| (asno >= 64496 && asno <= 65551))) {
sx_report(SX_ERROR, "Invalid AS number: %u\n", asno);
return 0;
}

Expand Down
1 change: 1 addition & 0 deletions main.c
Original file line number Diff line number Diff line change
Expand Up @@ -94,6 +94,7 @@ usage(int ecode)
printf(" -M match : extra match conditions for JunOS route-filters\n");
printf(" -l name : use specified name for generated access/prefix/.."
" list\n");
printf(" -p : allow special ASNs like 23456 or in the private range");
printf(" -R len : allow more specific routes up to specified masklen\n");
printf(" -r len : allow more specific routes from masklen specified\n");
printf(" -s : generate sequence numbers in prefix-lists (IOS only)\n");
Expand Down

0 comments on commit 26d631b

Please sign in to comment.