Remove ASDOT support

This commit is contained in:
Job Snijders
2019-12-14 15:09:30 +01:00
parent 59b750857b
commit 2e427a0f47
7 changed files with 5 additions and 66 deletions

View File

@@ -1,4 +1,3 @@
=======
0.0.2 (2019-12-14):
- Add Mikrotik support
- remove ASDDOT support

View File

@@ -56,10 +56,6 @@ Generate output in BIRD format (default: Cisco).
Enable some debugging output.
#### -D
Use asdot notation for Cisco as-path access-lists.
#### -E
Generate extended access-list (Cisco) or policy-statement term using
@@ -365,11 +361,9 @@ SEE ALSO
--------
1. [Routing Arbiter](http://www.radb.net/)
2. [draft-michaelson-4byte-as-representation-05](https://tools.ietf.org/html/draft-michaelson-4byte-as-representation-05)
for information on 'asdot' and 'asplain' notations.
3. [Cisco documentation](http://www.cisco.com/en/US/prod/collateral/iosswrel/ps6537/ps6554/ps6599/data_sheet_C78-521821.html)
2. [Cisco documentation](http://www.cisco.com/en/US/prod/collateral/iosswrel/ps6537/ps6554/ps6599/data_sheet_C78-521821.html)
for information on Cisco implementation of ASN32.
4. [JunOS prefix-lists limitation](http://www.juniper.net/techpubs/en_US/junos11.4/topics/reference/configuration-statement/prefix-list-edit-policy-options.html)
3. [JunOS prefix-lists limitation](http://www.juniper.net/techpubs/en_US/junos11.4/topics/reference/configuration-statement/prefix-list-edit-policy-options.html)
AUTHORS
-------

View File

@@ -75,8 +75,6 @@ generate output in OpenBGPD format (default: Cisco)
generate output in BIRD format (default: Cisco).
.It Fl d
enable some debugging output.
.It Fl D
use asdot notation for Cisco as-path access-lists.
.It Fl E
generate extended access-list (Cisco), policy-statement term using
route-filters (Juniper), [ip|ipv6]-prefix-list (Nokia) or prefix-sets
@@ -294,8 +292,6 @@ non-zero status.
.Sh SEE ALSO
.Sy http://www.radb.net/
Routing Arbiter project
.Sy http://tools.ietf.org/html/draft-michaelson-4byte-as-representation-05
for information on 'asdot' and 'asplain' notations.
.Sy http://www.cisco.com/en/US/docs/ios/12_0s/release/ntes/120SNEWF.html#wp3521658
for information on Cisco implementation of ASN32.
.Sh AUTHORS

10
bgpq4.c
View File

@@ -27,7 +27,7 @@ int
usage(int ecode)
{
printf("\nUsage: bgpq4 [-h host[:port]] [-S sources] [-P|E|G <num>|f <num>|t]"
" [-2346ABbDdJjNnwXz] [-R len] <OBJECTS>...\n");
" [-2346ABbdJjNnwXz] [-R len] <OBJECTS>...\n");
printf(" -2 : allow routes belonging to as23456 (transition-as) "
"(default: false)\n");
printf(" -3 : assume that your device is asn32-safe\n");
@@ -36,7 +36,6 @@ usage(int ecode)
printf(" -A : try to aggregate prefix-lists/route-filters\n");
printf(" -B : generate OpenBGPD output (Cisco IOS by default)\n");
printf(" -b : generate BIRD output (Cisco IOS by default)\n");
printf(" -D : use asdot notation in as-path (Cisco only)\n");
printf(" -d : generate some debugging output\n");
printf(" -E : generate extended access-list(Cisco), "
"route-filter(Juniper)\n"
@@ -188,8 +187,6 @@ main(int argc, char* argv[])
expander.vendor=V_OPENBGPD;
expander.asn32=1;
break;
case 'D': expander.asdot=1;
break;
case 'd': debug_expander++;
break;
case 'E': if(expander.generation) exclusive();
@@ -414,11 +411,6 @@ main(int argc, char* argv[])
"(-B) and BIRD (-b) output only\n");
};
if(expander.asdot && expander.vendor!=V_CISCO) {
sx_report(SX_FATAL,"asdot notation supported only for Cisco, "
"other formats use asplain only\n");
};
if(!expander.asn32 && expander.asnumber>65535) {
expander.asnumber=23456;
};

View File

@@ -52,7 +52,7 @@ struct bgpq_expander {
int family;
char* sources;
uint32_t asnumber;
int aswidth, asdot;
int aswidth;
char* name;
bgpq_vendor_t vendor;
bgpq_gen_t generation;

View File

@@ -54,10 +54,6 @@ supported).</p>
<p>Enable some debugging output.</p>
<h4>-D</h4>
<p>Use asdot notation for Cisco as-path access-lists.</p>
<h4>-E</h4>
<p>Generate extended access-list (Cisco) or policy-statement term using
@@ -288,8 +284,6 @@ each prefix-list <a href="http://www.juniper.net/techpubs/en_US/junos11.4/topics
<ol>
<li><a href="http://www.radb.net/">Routing Arbiter</a></li>
<li><a href="http://www.ietf.org/internet-drafts/draft-michaelson-4byte-as-representation-05.txt">draft-michaelson-4byte-as-representation-05.txt</a>
for information on 'asdot' and 'asplain' notations.</li>
<li><a href="http://www.cisco.com/en/US/prod/collateral/iosswrel/ps6537/ps6554/ps6599/data_sheet_C78-521821.html">Cisco documentation</a>
for information on Cisco implementation of ASN32.</li>
<li><a href="http://www.juniper.net/techpubs/en_US/junos11.4/topics/reference/configuration-statement/prefix-list-edit-policy-options.html">JunOS prefix-lists limitation</a></li>

View File

@@ -29,17 +29,10 @@ bgpq4_print_cisco_aspath(FILE* f, struct bgpq_expander* b)
if(b->asn32s[b->asnumber/65536] &&
b->asn32s[b->asnumber/65536][(b->asnumber%65536)/8]&
(0x80>>(b->asnumber%8))) {
if(b->asdot && b->asnumber>65535) {
fprintf(f,"ip as-path access-list %s permit ^%u.%u(_%u.%u)*$\n",
b->name?b->name:"NN",b->asnumber/65536,b->asnumber%65536,
b->asnumber/65536,b->asnumber%65536);
empty=0;
} else {
fprintf(f,"ip as-path access-list %s permit ^%u(_%u)*$\n",
b->name?b->name:"NN",b->asnumber,b->asnumber);
empty=0;
};
};
};
for(k=0;k<65536;k++) {
if(!b->asn32s[k]) continue;
@@ -48,22 +41,12 @@ bgpq4_print_cisco_aspath(FILE* f, struct bgpq_expander* b)
if(b->asn32s[k][i]&(0x80>>j)) {
if(k*65536+i*8+j==b->asnumber) continue;
if(!nc) {
if(b->asdot && k>0) {
fprintf(f,"ip as-path access-list %s permit"
" ^%u(_[0-9]+)*_(%u.%u", b->name?b->name:"NN",
b->asnumber,k,i*8+j);
empty=0;
} else {
fprintf(f,"ip as-path access-list %s permit"
" ^%u(_[0-9]+)*_(%u", b->name?b->name:"NN",
b->asnumber,k*65536+i*8+j);
empty=0;
};
} else {
if(b->asdot && k>0) {
fprintf(f,"|%u.%u",k,i*8+j);
empty=0;
} else {
fprintf(f,"|%u",k*65536+i*8+j);
empty=0;
};
@@ -75,8 +58,6 @@ bgpq4_print_cisco_aspath(FILE* f, struct bgpq_expander* b)
};
};
};
};
};
if(nc) fprintf(f,")$\n");
if(empty)
fprintf(f,"ip as-path access-list %s deny .*\n", b->name?b->name:"NN");
@@ -129,15 +110,10 @@ bgpq4_print_cisco_oaspath(FILE* f, struct bgpq_expander* b)
if(b->asn32s[b->asnumber/65536] &&
b->asn32s[b->asnumber/65536][(b->asnumber%65536)/8]&
(0x80>>(b->asnumber%8))) {
if(b->asdot && b->asnumber>65535) {
fprintf(f,"ip as-path access-list %s permit ^(_%u.%u)*$\n",
b->name?b->name:"NN",b->asnumber/65536,b->asnumber%65536);
} else {
fprintf(f,"ip as-path access-list %s permit ^(_%u)*$\n",
b->name?b->name:"NN",b->asnumber);
};
empty=0;
};
for(k=0;k<65536;k++) {
if(!b->asn32s[k]) continue;
for(i=0;i<8192;i++) {
@@ -145,22 +121,12 @@ bgpq4_print_cisco_oaspath(FILE* f, struct bgpq_expander* b)
if(b->asn32s[k][i]&(0x80>>j)) {
if(k*65536+i*8+j==b->asnumber) continue;
if(!nc) {
if(b->asdot && k>0) {
fprintf(f,"ip as-path access-list %s permit"
" ^(_[0-9]+)*_(%u.%u", b->name?b->name:"NN",
k,i*8+j);
empty=0;
} else {
fprintf(f,"ip as-path access-list %s permit"
" ^(_[0-9]+)*_(%u", b->name?b->name:"NN",
k*65536+i*8+j);
empty=0;
};
} else {
if(b->asdot && k>0) {
fprintf(f,"|%u.%u",k,i*8+j);
empty=0;
} else {
fprintf(f,"|%u",k*65536+i*8+j);
empty=0;
};
@@ -172,8 +138,6 @@ bgpq4_print_cisco_oaspath(FILE* f, struct bgpq_expander* b)
};
};
};
};
};
if(nc) fprintf(f,")$\n");
if(empty)
fprintf(f,"ip as-path access-list %s deny .*\n", b->name?b->name:"NN");