-W len option documented.

This commit is contained in:
Alexandre Snarskii
2014-10-29 19:53:11 +03:00
parent 61c23c53b3
commit 43233d6ef5
5 changed files with 19 additions and 20 deletions

View File

@@ -10,6 +10,7 @@
]}
Based on suggestion by Henrik Thostrup Jensen.
- -W len option documented.
0.1.24 (2014-07-31)
- empty prefix-lists (Cisco), extended access-lists (Cisco), as-path

View File

@@ -6,7 +6,7 @@ NAME
SYNOPSIS
--------
bgpq3 [-h host] [-S sources] [-EP] [-f asn | -G asn] [-346AbDdJjX] [-r len] [-R len] [-m max] OBJECTS [...]
bgpq3 [-h host] [-S sources] [-EP] [-f asn | -G asn] [-346AbDdJjX] [-r len] [-R len] [-m max] [-W len] OBJECTS [...]
DESCRIPTION
-----------
@@ -107,6 +107,10 @@ The options are as follows:
> disable pipelining.
- -W len
> generate as-path strings of a given length maximum (0 for infinity).
- -X
> generate config for Cisco IOS XR devices (plain IOS by default).

View File

@@ -41,6 +41,7 @@
.Op Fl r Ar len
.Op Fl R Ar len
.Op Fl m Ar max
.Op Fl W Ar len
.Ar OBJECTS
.Op "..."
.Sh DESCRIPTION
@@ -96,6 +97,8 @@ allow more specific routes up to specified masklen too.
use specified sources only (default: RADB,RIPE,APNIC).
.It Fl T
disable pipelining.
.It Fl W Ar len
generate as-path strings of no more than len items (use 0 for inifinity).
.It Fl X
generate config for Cisco IOS XR devices (plain IOS by default).
.It Ar OBJECTS

10
bgpq3.c
View File

@@ -32,7 +32,7 @@ usage(int ecode)
"route-filters\n as much as possible\n");
printf(" -b : generate BIRD output (Cisco IOS by default)\n");
printf(" -d : generate some debugging output\n");
printf(" -D : use asdot notation in as-path\n");
printf(" -D : use asdot notation in as-path (Cisco only)\n");
printf(" -E : generate extended access-list(Cisco) or "
"route-filter(Juniper)\n");
printf(" -f number : generate input as-path access-list\n");
@@ -53,6 +53,8 @@ usage(int ecode)
printf(" -S sources: use only specified sources (default:"
" RADB,RIPE,APNIC)\n");
printf(" -T : disable pipelining (experimental, faster mode)\n");
printf(" -W len : specify max-entries on as-path line (use 0 for "
"infinity)\n");
printf(" -X : generate config for IOS XR (Cisco IOS by default)\n");
printf("\n" PACKAGE_NAME " version: " PACKAGE_VERSION "\n");
printf("Copyright(c) Alexandre Snarskii <snar@snar.spb.ru> 2007-2014\n\n");
@@ -238,7 +240,7 @@ main(int argc, char* argv[])
case 'S': expander.sources=optarg;
break;
case 'W': expander.aswidth=atoi(optarg);
if(expander.aswidth<1) {
if(expander.aswidth<0) {
sx_report(SX_FATAL,"Invalid as-width: %s\n", optarg);
exit(1);
};
@@ -288,8 +290,8 @@ main(int argc, char* argv[])
};
if(expander.asdot && expander.vendor!=V_CISCO) {
sx_report(SX_FATAL,"asdot notation supported only for Cisco, Juniper"
" uses asplain only\n");
sx_report(SX_FATAL,"asdot notation supported only for Cisco, "
"other formats use asplain only\n");
};
if(!expander.asn32 && expander.asnumber>65535) {

View File

@@ -306,22 +306,11 @@ bgpq3_print_json_aspath(FILE* f, struct bgpq_expander* b)
for(j=0;j<8;j++) {
if(b->asn32s[k][i]&(0x80>>j)) {
if(!nc) {
if(b->asdot && k>0) {
fprintf(f,"%s\n %i.%i",needscomma?",":"", k,i*8+j);
needscomma=1;
} else {
fprintf(f,"%s\n %i",needscomma?",":"",
k*65536+i*8+j);
needscomma=1;
};
fprintf(f,"%s\n %i",needscomma?",":"", k*65536+i*8+j);
needscomma=1;
} else {
if(b->asdot && k>0) {
fprintf(f,"%s%i.%i,",needscomma?",":"", k,i*8+j);
needscomma=1;
} else {
fprintf(f,"%s%i",needscomma?",":"", k*65536+i*8+j);
needscomma=1;
};
fprintf(f,"%s%i",needscomma?",":"", k*65536+i*8+j);
needscomma=1;
}
nc++;
if(nc==b->aswidth) {