1
0
mirror of https://github.com/bgp/bgpq4.git synced 2024-05-11 05:55:05 +00:00

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 t
.Oc
.Op Fl 46ABbDdJjNnsXU
.Op Fl 46ABbDdJjNnpsXU
.Op Fl a Ar asn
.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)
.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).
.It Fl r Ar len
allow more specific routes starting with specified masklen too.
.It Fl R Ar len

View File

@ -50,6 +50,7 @@
int debug_expander = 0;
int pipelining = 1;
int expand_special_asn = 0;
static inline int
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;
}
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);
return 0;
}

8
main.c
View File

@ -45,12 +45,13 @@
extern int debug_expander;
extern int debug_aggregation;
extern int pipelining;
extern int expand_special_asn;
static int
usage(int ecode)
{
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");
printf("\nVendor targets:\n");
printf(" no option : Cisco IOS Classic (default)\n");
@ -197,7 +198,7 @@ main(int argc, char* argv[])
expander.sources=getenv("IRRD_SOURCES");
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) {
case '4':
/* do nothing, expander already configured for IPv4 */
@ -393,6 +394,9 @@ main(int argc, char* argv[])
vendor_exclusive();
expander.vendor = V_NOKIA_MD;
break;
case 'p':
expand_special_asn = 1;
break;
case 't':
if (expander.generation)
exclusive();