Restore -p functionality

This commit is contained in:
Job Snijders
2023-01-09 21:03:27 +00:00
parent b785c02e37
commit 975b577b2e
3 changed files with 12 additions and 4 deletions

View File

@@ -40,7 +40,7 @@
.Fl H Ar asn .Fl H Ar asn
.Fl t .Fl t
.Oc .Oc
.Op Fl 46ABbDdJjNnsXU .Op Fl 46ABbDdJjNnpsXU
.Op Fl a Ar asn .Op Fl a Ar asn
.Op Fl r Ar len .Op Fl r Ar len
.Op Fl R Ar len .Op Fl R Ar len
@@ -111,6 +111,8 @@ extra match conditions for Juniper route-filters.
generate config for Nokia SR OS MD-CLI (Cisco IOS by default) generate config for Nokia SR OS MD-CLI (Cisco IOS by default)
.It Fl N .It Fl N
generate config for Nokia SR OS classic CLI (Cisco IOS by default). 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).
.It Fl r Ar len .It Fl r Ar len
allow more specific routes starting with specified masklen too. allow more specific routes starting with specified masklen too.
.It Fl R Ar len .It Fl R Ar len

View File

@@ -50,6 +50,7 @@
int debug_expander = 0; int debug_expander = 0;
int pipelining = 1; int pipelining = 1;
int expand_special_asn = 0;
static inline int static inline int
tentry_cmp(struct sx_tentry *a, struct sx_tentry *b) tentry_cmp(struct sx_tentry *a, struct sx_tentry *b)
@@ -195,7 +196,8 @@ bgpq_expander_add_as(struct bgpq_expander *b, char *as)
return 0; return 0;
} }
if (asno >= 4200000000ul || (asno >= 64496 && asno <= 65551)) { if (!expand_special_asn &&
(asno >= 4200000000ul || (asno >= 64496 && asno <= 65551))) {
sx_report(SX_ERROR,"Invalid AS number: %u\n", asno); sx_report(SX_ERROR,"Invalid AS number: %u\n", asno);
return 0; return 0;
} }

8
main.c
View File

@@ -45,12 +45,13 @@
extern int debug_expander; extern int debug_expander;
extern int debug_aggregation; extern int debug_aggregation;
extern int pipelining; extern int pipelining;
extern int expand_special_asn;
static int static int
usage(int ecode) usage(int ecode)
{ {
printf("\nUsage: bgpq4 [-h host[:port]] [-S sources] [-E|G|H <num>" printf("\nUsage: bgpq4 [-h host[:port]] [-S sources] [-E|G|H <num>"
"|f <num>|t] [-46ABbdJjKNnwXz] [-R len] <OBJECTS> ... " "|f <num>|t] [-46ABbdJjKNnpwXz] [-R len] <OBJECTS> ... "
"[EXCEPT <OBJECTS> ...]\n"); "[EXCEPT <OBJECTS> ...]\n");
printf("\nVendor targets:\n"); printf("\nVendor targets:\n");
printf(" no option : Cisco IOS Classic (default)\n"); printf(" no option : Cisco IOS Classic (default)\n");
@@ -197,7 +198,7 @@ main(int argc, char* argv[])
expander.sources=getenv("IRRD_SOURCES"); expander.sources=getenv("IRRD_SOURCES");
while ((c = getopt(argc, argv, while ((c = getopt(argc, argv,
"467a:AbBdDEeF:S:jJKf:l:L:m:M:NnW:r:R:G:H:tTh:UuwXsvz")) != EOF) { "467a:AbBdDEeF:S:jJKf:l:L:m:M:NnpW:r:R:G:H:tTh:UuwXsvz")) != EOF) {
switch (c) { switch (c) {
case '4': case '4':
/* do nothing, expander already configured for IPv4 */ /* do nothing, expander already configured for IPv4 */
@@ -393,6 +394,9 @@ main(int argc, char* argv[])
vendor_exclusive(); vendor_exclusive();
expander.vendor = V_NOKIA_MD; expander.vendor = V_NOKIA_MD;
break; break;
case 'p':
expand_special_asn = 1;
break;
case 't': case 't':
if (expander.generation) if (expander.generation)
exclusive(); exclusive();