From 26f49e46a5a847d682369b75aa8ec6d078e9f2f5 Mon Sep 17 00:00:00 2001 From: Job Snijders Date: Sat, 14 Dec 2019 14:37:59 +0100 Subject: [PATCH] Rename bgpq3 to bgpq4 --- CHANGES | 3 + Makefile.in | 22 +-- README.md | 32 ++-- bgpq3.8 => bgpq4.8 | 22 +-- bgpq3.c => bgpq4.c | 17 +- bgpq3.h => bgpq4.h | 16 +- bgpq3.html => bgpq4.html | 32 ++-- bgpq3.spec => bgpq4.spec | 15 +- bgpq3_printer.c => bgpq4_printer.c | 242 ++++++++++++++--------------- bgpq_expander.c | 2 +- configure | 28 ++-- configure.in | 2 +- 12 files changed, 218 insertions(+), 215 deletions(-) rename bgpq3.8 => bgpq4.8 (96%) rename bgpq3.c => bgpq4.c (97%) rename bgpq3.h => bgpq4.h (82%) rename bgpq3.html => bgpq4.html (91%) rename bgpq3.spec => bgpq4.spec (86%) rename bgpq3_printer.c => bgpq4_printer.c (81%) diff --git a/CHANGES b/CHANGES index b429dd7..dc8f1b7 100644 --- a/CHANGES +++ b/CHANGES @@ -1,3 +1,6 @@ +0.0.1 (2019-12-14): + - fork bgpq3 into bgpq4 + 0.1.36-pre (2019-11-08): - minor documentation cleanup: bgpq3 supports much more vendors than just Cisco and Juniper. Copyright years updated. diff --git a/Makefile.in b/Makefile.in index 8515939..8893357 100644 --- a/Makefile.in +++ b/Makefile.in @@ -12,31 +12,31 @@ infodir = @infodir@ mandir = @mandir@ -OBJECTS=bgpq3.o sx_report.o bgpq_expander.o sx_slentry.o bgpq3_printer.o \ +OBJECTS=bgpq4.o sx_report.o bgpq_expander.o sx_slentry.o bgpq4_printer.o \ sx_prefix.o strlcpy.o sx_maxsockbuf.o -SRCS=bgpq3.c sx_report.c bgpq_expander.c sx_slentry.c bgpq3_printer.c \ +SRCS=bgpq4.c sx_report.c bgpq_expander.c sx_slentry.c bgpq4_printer.c \ sx_prefix.c strlcpy.c sx_maxsockbuf.c -all: bgpq3 +all: bgpq4 -bgpq3: ${OBJECTS} - ${CC} ${CFLAGS} -o bgpq3 ${OBJECTS} ${LDADD} +bgpq4: ${OBJECTS} + ${CC} ${CFLAGS} -o bgpq4 ${OBJECTS} ${LDADD} .c.o: ${CC} ${CFLAGS} -c $< clean: - rm -rf Makefile autom4te.cache bgpq3 config.h config.log config.status + rm -rf Makefile autom4te.cache bgpq4 config.h config.log config.status rm -rf *.o *.core core.* core -install: bgpq3 +install: bgpq4 if test ! -d @bindir@ ; then mkdir -p @bindir@ ; fi - ${INSTALL} -c -s -m 755 bgpq3 @bindir@ + ${INSTALL} -c -s -m 755 bgpq4 @bindir@ if test ! -d @prefix@/man/man8 ; then mkdir -p @prefix@/man/man8 ; fi - ${INSTALL} -m 644 bgpq3.8 @prefix@/man/man8 + ${INSTALL} -m 644 bgpq4.8 @prefix@/man/man8 depend: makedepend -- $(CFLAGS) -- $(SRCS) -bgpq3.html: readme.header README.md - cat readme.header README.md | @MARKDOWN@ > bgpq3.html +bgpq4.html: readme.header README.md + cat readme.header README.md | @MARKDOWN@ > bgpq4.html diff --git a/README.md b/README.md index 4e7b98e..49e8dc5 100644 --- a/README.md +++ b/README.md @@ -1,19 +1,19 @@ NAME ---- -`bgpq3` - bgp filtering automation tool +`bgpq4` - bgp filtering automation tool SYNOPSIS -------- ``` - bgpq3 [-h host[:port]] [-S sources] [-EPz] [-f asn | -F fmt | -G asn | -t] [-2346ABbDdJjNnpsUX] [-a asn] [-r len] [-R len] [-m max] [-W len] OBJECTS [...] EXCEPT OBJECTS + bgpq4 [-h host[:port]] [-S sources] [-EPz] [-f asn | -F fmt | -G asn | -t] [-2346ABbDdJjNnpsUX] [-a asn] [-r len] [-R len] [-m max] [-W len] OBJECTS [...] EXCEPT OBJECTS ``` DESCRIPTION ----------- -The bgpq3 utility used to generate configuration (prefix-lists, +The bgpq4 utility used to generate configuration (prefix-lists, extended access-lists, policy-statement terms and as-path lists) based on RADB data. @@ -112,7 +112,7 @@ Generate config for Nokia SR OS (former Alcatel-Lucent) classic CLI (default: Ci #### -L `limit` -Limit recursion depth when expanding. This slows `bgpq3` a bit, but sometimes +Limit recursion depth when expanding. This slows `bgpq4` a bit, but sometimes is a useful feature to prevent generated filters from growing too big. #### -p @@ -181,7 +181,7 @@ EXAMPLES Generating named Juniper prefix-filter for `AS20597`: - user@host:~>bgpq3 -Jl eltel AS20597 + user@host:~>bgpq4 -Jl eltel AS20597 policy-options { replace: prefix-list eltel { @@ -204,7 +204,7 @@ Generating named Juniper prefix-filter for `AS20597`: For Cisco we can use aggregation (-A) flag to make this prefix-filter more compact: - user@host:~>bgpq3 -Al eltel AS20597 + user@host:~>bgpq4 -Al eltel AS20597 no ip prefix-list eltel ip prefix-list eltel permit 81.9.0.0/20 ip prefix-list eltel permit 81.9.32.0/20 @@ -227,7 +227,7 @@ Well, for Juniper we can generate even more interesting policy-statement, using `-M `, `-r `, `-R ` and hierarchical names: - user@host:~>bgpq3 -AJEl eltel/specifics -r 29 -R 32 -M "community blackhole" AS20597 + user@host:~>bgpq4 -AJEl eltel/specifics -r 29 -R 32 -M "community blackhole" AS20597 policy-options { policy-statement eltel { term specifics { @@ -253,9 +253,9 @@ generated policy-option term now allows more-specific routes in range /29 - /32 for eltel networks if they marked with community 'blackhole' (defined elsewhere in configuration). -Of course, `bgpq3` supports IPv6 (-6): +Of course, `bgpq4` supports IPv6 (-6): - user@host:~>bgpq3 -6l as-retn-6 AS-RETN6 + user@host:~>bgpq4 -6l as-retn-6 AS-RETN6 no ipv6 prefix-list as-retn-6 ipv6 prefix-list as-retn-6 permit 2001:7fb:fe00::/48 ipv6 prefix-list as-retn-6 permit 2001:7fb:fe01::/48 @@ -263,7 +263,7 @@ Of course, `bgpq3` supports IPv6 (-6): and ASN32 - user@host:~>bgpq3 -J3f 112 AS-SPACENET + user@host:~>bgpq4 -J3f 112 AS-SPACENET policy-options { replace: as-path-group NN { @@ -279,7 +279,7 @@ see `AS196611` in the end of the list ? That's `AS3.3` in 'asplain' notation. If your router does not support ASN32 (yet) you should not use switch -3, and the result will be next: - user@host:~>bgpq3 -f 112 AS-SPACENET + user@host:~>bgpq4 -f 112 AS-SPACENET no ip as-path access-list NN ip as-path access-list NN permit ^112( 112)*$ ip as-path access-list NN permit ^112( [0-9]+)* (1898|5539|8495|8763)$ @@ -298,7 +298,7 @@ If you want to generate configuration not for routers, but for some other programs/systems, you may use user-defined formatting, like in example below: - user@host:~>bgpq3 -F "ipfw add pass all from %n/%l to any\\n" as3254 + user@host:~>bgpq4 -F "ipfw add pass all from %n/%l to any\\n" as3254 ipfw add pass all from 62.244.0.0/18 to any ipfw add pass all from 91.219.29.0/24 to any ipfw add pass all from 91.219.30.0/24 to any @@ -311,20 +311,20 @@ Please note that no new lines inserted automatically after each sentence, you have to add them into format string manually, elsewhere output will be in one line (sometimes it makes sense): - user@host:~>bgpq3 -6F "%n/%l; " as-eltel + user@host:~>bgpq4 -6F "%n/%l; " as-eltel 2001:1b00::/32; 2620:4f:8000::/48; 2a04:bac0::/29; 2a05:3a80::/48; DIAGNOSTICS ----------- -When everything is OK, `bgpq3` generates result to standard output and +When everything is OK, `bgpq4` generates result to standard output and exits with status == 0. In case of errors they are printed to stderr and program exits with non-zero status. NOTES ON ULTRA-LARGE PREFIX-LISTS --------------------------------- -To improve `bgpq3` performance when expanding extra-large AS-SETs you +To improve `bgpq4` performance when expanding extra-large AS-SETs you shall tune OS settings to enlarge TCP send buffer. FreeBSD can be tuned in the following way: @@ -362,5 +362,5 @@ Alexandre Snarskii [snar@snar.spb.ru](mailto:snar@snar.spb.ru) Program Homepage ---------------- -[http://snar.spb.ru/prog/bgpq3/](http://snar.spb.ru/prog/bgpq3/) +[http://snar.spb.ru/prog/bgpq4/](http://snar.spb.ru/prog/bgpq4/) diff --git a/bgpq3.8 b/bgpq4.8 similarity index 96% rename from bgpq3.8 rename to bgpq4.8 index 42a75c0..883e560 100644 --- a/bgpq3.8 +++ b/bgpq4.8 @@ -22,11 +22,11 @@ .\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF .\" SUCH DAMAGE. .\" -.Dd Oct 27, 2008 -.Dt BGPQ3 8 +.Dd Dec 1, 2019 +.Dt BGPQ4 8 .Os .Sh NAME -.Nm bgpq3 +.Nm bgpq4 .Nd "bgp filtering automation tool" .Sh SYNOPSIS .Nm @@ -139,7 +139,7 @@ those objects will be excluded from expansion. Generating named juniper prefix-filter for AS20597: .nf .RS -~>bgpq3 -Jl eltel AS20597 +~>bgpq4 -Jl eltel AS20597 policy-options { replace: prefix-list eltel { @@ -165,7 +165,7 @@ For Cisco we can use aggregation (-A) flag to make this prefix-filter more compact: .nf .RS -~>bgpq3 -Al eltel AS20597 +~>bgpq4 -Al eltel AS20597 no ip prefix-list eltel ip prefix-list eltel permit 81.9.0.0/20 ip prefix-list eltel permit 81.9.32.0/20 @@ -187,7 +187,7 @@ Well, for Juniper we can generate even more interesting policy-options, using -M , -R and hierarchical names: .nf .RS -~>bgpq3 -AJEl eltel/specifics -r 29 -R 32 -M "community blackhole" AS20597 +~>bgpq4 -AJEl eltel/specifics -r 29 -R 32 -M "community blackhole" AS20597 policy-options { policy-statement eltel { term specifics { @@ -216,7 +216,7 @@ blackhole (defined elsewhere in configuration). Of course, this version supports IPv6 (-6): .nf .RS -~>bgpq3 -6l as-retn-6 AS-RETN6 +~>bgpq4 -6l as-retn-6 AS-RETN6 no ipv6 prefix-list as-retn-6 ipv6 prefix-list as-retn-6 permit 2001:7fb:fe00::/48 ipv6 prefix-list as-retn-6 permit 2001:7fb:fe01::/48 @@ -226,7 +226,7 @@ ipv6 prefix-list as-retn-6 permit 2001:7fb:fe01::/48 and support for ASN 32 is also here .nf .RS -~>bgpq3 -J3f 112 AS-SPACENET +~>bgpq4 -J3f 112 AS-SPACENET policy-options { replace: as-path-group NN { @@ -244,7 +244,7 @@ For non-ASN32 capable routers you should not use switch -3, and the result will be next: .nf .RS -~>bgpq3 -f 112 AS-SPACENET +~>bgpq4 -f 112 AS-SPACENET no ip as-path access-list NN ip as-path access-list NN permit ^112(_112)*$ ip as-path access-list NN permit ^112(_[0-9]+)*_(1898|5539|8495|8763)$ @@ -263,7 +263,7 @@ other programs/systems, you may use user-defined formatting, like in example below: .nf .RS -user@host:~>bgpq3 -F "ipfw add pass all from %n/%l to any\\n" as3254 +user@host:~>bgpq4 -F "ipfw add pass all from %n/%l to any\\n" as3254 ipfw add pass all from 62.244.0.0/18 to any ipfw add pass all from 91.219.29.0/24 to any ipfw add pass all from 91.219.30.0/24 to any @@ -279,7 +279,7 @@ you have to add them into format string manually, elsewhere output will be in one line (sometimes it makes sense): .nf .RS -user@host:~>bgpq3 -6F "%n/%l; " as-eltel +user@host:~>bgpq4 -6F "%n/%l; " as-eltel 2001:1b00::/32; 2620:4f:8000::/48; 2a04:bac0::/29; 2a05:3a80::/48; .RE .fi diff --git a/bgpq3.c b/bgpq4.c similarity index 97% rename from bgpq3.c rename to bgpq4.c index 0dd4843..b58066e 100644 --- a/bgpq3.c +++ b/bgpq4.c @@ -14,7 +14,7 @@ #include #include -#include "bgpq3.h" +#include "bgpq4.h" #include "sx_report.h" extern int debug_expander; @@ -26,7 +26,7 @@ extern int expand_special_asn; int usage(int ecode) { - printf("\nUsage: bgpq3 [-h host[:port]] [-S sources] [-P|E|G |f |t]" + printf("\nUsage: bgpq4 [-h host[:port]] [-S sources] [-P|E|G |f |t]" " [-2346ABbDdJjNnwXz] [-R len] ...\n"); printf(" -2 : allow routes belonging to as23456 (transition-as) " "(default: false)\n"); @@ -77,7 +77,6 @@ usage(int ecode) "registered routes\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 2007-2018\n\n"); exit(ecode); }; @@ -625,18 +624,18 @@ main(int argc, char* argv[]) switch(expander.generation) { case T_NONE: sx_report(SX_FATAL,"Unreachable point... call snar\n"); exit(1); - case T_ASPATH: bgpq3_print_aspath(stdout,&expander); + case T_ASPATH: bgpq4_print_aspath(stdout,&expander); break; - case T_OASPATH: bgpq3_print_oaspath(stdout,&expander); + case T_OASPATH: bgpq4_print_oaspath(stdout,&expander); break; - case T_ASSET: bgpq3_print_asset(stdout,&expander); + case T_ASSET: bgpq4_print_asset(stdout,&expander); break; - case T_PREFIXLIST: bgpq3_print_prefixlist(stdout,&expander); + case T_PREFIXLIST: bgpq4_print_prefixlist(stdout,&expander); break; - case T_EACL: bgpq3_print_eacl(stdout,&expander); + case T_EACL: bgpq4_print_eacl(stdout,&expander); break; case T_ROUTE_FILTER_LIST: - bgpq3_print_route_filter_list(stdout, &expander); + bgpq4_print_route_filter_list(stdout, &expander); break; }; diff --git a/bgpq3.h b/bgpq4.h similarity index 82% rename from bgpq3.h rename to bgpq4.h index b7d8af1..36f74ac 100644 --- a/bgpq3.h +++ b/bgpq4.h @@ -1,5 +1,5 @@ -#ifndef BGPQ3_H_ -#define BGPQ3_H_ +#ifndef BGPQ4_H_ +#define BGPQ4_H_ #if HAVE_SYS_QUEUE_H && HAVE_STAILQ_IN_SYS_QUEUE #include @@ -83,12 +83,12 @@ int bgpq_expander_add_stop(struct bgpq_expander* b, char* object); int bgpq_expand(struct bgpq_expander* b); -int bgpq3_print_prefixlist(FILE* f, struct bgpq_expander* b); -int bgpq3_print_eacl(FILE* f, struct bgpq_expander* b); -int bgpq3_print_aspath(FILE* f, struct bgpq_expander* b); -int bgpq3_print_asset(FILE* f, struct bgpq_expander* b); -int bgpq3_print_oaspath(FILE* f, struct bgpq_expander* b); -int bgpq3_print_route_filter_list(FILE* f, struct bgpq_expander* b); +int bgpq4_print_prefixlist(FILE* f, struct bgpq_expander* b); +int bgpq4_print_eacl(FILE* f, struct bgpq_expander* b); +int bgpq4_print_aspath(FILE* f, struct bgpq_expander* b); +int bgpq4_print_asset(FILE* f, struct bgpq_expander* b); +int bgpq4_print_oaspath(FILE* f, struct bgpq_expander* b); +int bgpq4_print_route_filter_list(FILE* f, struct bgpq_expander* b); #ifndef HAVE_STRLCPY size_t strlcpy(char* dst, const char* src, size_t size); diff --git a/bgpq3.html b/bgpq4.html similarity index 91% rename from bgpq3.html rename to bgpq4.html index bd92858..3a9afd5 100644 --- a/bgpq3.html +++ b/bgpq4.html @@ -13,17 +13,17 @@ ul { list-style: none; }

NAME

-

bgpq3 - bgp filtering automation for Cisco and Juniper routers

+

bgpq4 - bgp filtering automation for Cisco and Juniper routers

SYNOPSIS

- bgpq3 [-h host] [-S sources] [-EP] [-f asn | -G asn] [-2346AbDdJjpX] [-r len] [-R len] [-m max] [-W len] OBJECTS [...] + bgpq4 [-h host] [-S sources] [-EP] [-f asn | -G asn] [-2346AbDdJjpX] [-r len] [-R len] [-m max] [-W len] OBJECTS [...]

DESCRIPTION

-

The bgpq3 utility used to generate Cisco and Juniper prefix-lists, +

The bgpq4 utility used to generate Cisco and Juniper prefix-lists, extended access-lists, policy-statement terms and as-path lists based on RADB data.

@@ -139,7 +139,7 @@ route-sets. If multiple objects are specified they will be merged.

Generating named Juniper prefix-filter for AS20597:

-
 user@host:~>bgpq3 -Jl eltel AS20597
+
 user@host:~>bgpq4 -Jl eltel AS20597
  policy-options {
  replace:
   prefix-list eltel {
@@ -163,7 +163,7 @@ route-sets. If multiple objects are specified they will be merged.

For Cisco we can use aggregation (-A) flag to make this prefix-filter more compact:

-
 user@host:~>bgpq3 -Al eltel AS20597
+
 user@host:~>bgpq4 -Al eltel AS20597
  no ip prefix-list eltel
  ip prefix-list eltel permit 81.9.0.0/20
  ip prefix-list eltel permit 81.9.32.0/20
@@ -188,7 +188,7 @@ into single entry 

using -M <extra match conditions>, -r <len>, -R <len> and hierarchical names:

-
 user@host:~>bgpq3 -AJEl eltel/specifics -r 29 -R 32 -M "community blackhole" AS20597
+
 user@host:~>bgpq4 -AJEl eltel/specifics -r 29 -R 32 -M "community blackhole" AS20597
 policy-options {
  policy-statement eltel {
   term specifics {
@@ -214,9 +214,9 @@ replace:
 /29 - /32 for eltel networks if they marked with community 'blackhole' 
 (defined elsewhere in configuration).

-

Of course, bgpq3 supports IPv6 (-6):

+

Of course, bgpq4 supports IPv6 (-6):

-
 user@host:~>bgpq3 -6l as-retn-6 AS-RETN6
+
 user@host:~>bgpq4 -6l as-retn-6 AS-RETN6
  no ipv6 prefix-list as-retn-6
  ipv6 prefix-list as-retn-6 permit 2001:7fb:fe00::/48
  ipv6 prefix-list as-retn-6 permit 2001:7fb:fe01::/48
@@ -225,7 +225,7 @@ replace:
 
 

and ASN32

-
 user@host:~>bgpq3 -J3f 112 AS-SPACENET
+
 user@host:~>bgpq4 -J3f 112 AS-SPACENET
  policy-options {
  replace:
   as-path-group NN {
@@ -242,7 +242,7 @@ replace:
 

If your router does not support ASN32 (yet) you should not use switch -3, and the result will be next:

-
 user@host:~>bgpq3 -f 112 AS-SPACENET
+
 user@host:~>bgpq4 -f 112 AS-SPACENET
  no ip as-path access-list NN
  ip as-path access-list NN permit ^112( 112)*$
  ip as-path access-list NN permit ^112( [0-9]+)* (1898|5539|8495|8763)$
@@ -257,13 +257,13 @@ have been added to list if it were not present.

DIAGNOSTICS

-

When everything is OK, bgpq3 generates result to standard output and +

When everything is OK, bgpq4 generates result to standard output and exits with status == 0. In case of errors they are printed to stderr and program exits with non-zero status.

NOTES ON ULTRA-LARGE PREFIX-LISTS

-

To improve bgpq3 performance when expanding extra-large AS-SETs you +

To improve bgpq4 performance when expanding extra-large AS-SETs you shall tune OS settings to enlarge TCP send buffer.

FreeBSD can be tuned in the following way:

@@ -295,10 +295,8 @@ each prefix-list JunOS prefix-lists limitation -

AUTHOR

+

AUTHORS

-

Alexandre Snarskii snar@snar.spb.ru

+

Alexandre Snarskii snar@snar.spb.ru maintained bgpq3

-

Program Homepage

- -

http://snar.spb.ru/prog/bgpq3/

+

Job Snijders job@ntt.net maintains bgpq4

diff --git a/bgpq3.spec b/bgpq4.spec similarity index 86% rename from bgpq3.spec rename to bgpq4.spec index 30c13db..b25297a 100644 --- a/bgpq3.spec +++ b/bgpq4.spec @@ -1,12 +1,12 @@ -Name: bgpq3 -Version: 0.1.35 +Name: bgpq4 +Version: 0.0.1 Release: 0%{?dist} Group: System/Utilities Summary: Automate BGP filter generation based on routing database information -URL: http://snar.spb.ru/prog/bgpq3/ +URL: https://github.com/bgp/bgpq4 License: BSD -Source0: https://github.com/snar/bgpq3/archive/v0.1.35.tar.gz +Source0: https://github.com/bgp/bgpq4 BuildRoot: %{_tmppath}/%{name}-%{version}-%{release}-root-%(%{__id_u} -n) %description @@ -28,14 +28,17 @@ make install %files %defattr(-,root,root,-) -/usr/bin/bgpq3 -/usr/man/man8/bgpq3.8.gz +/usr/bin/bgpq4 +/usr/man/man8/bgpq4.8.gz %doc COPYRIGHT CHANGES %clean rm -rf $RPM_BUILD_ROOT %changelog +* Sat Dec 14 2019 Job Snijders 0.0.1 +- fork from bgpq3 + * Tue Nov 30 2018 Alexandre Snarskii 0.1.35 - Version updated diff --git a/bgpq3_printer.c b/bgpq4_printer.c similarity index 81% rename from bgpq3_printer.c rename to bgpq4_printer.c index 2842b06..529dae1 100644 --- a/bgpq3_printer.c +++ b/bgpq4_printer.c @@ -11,18 +11,18 @@ #include #include -#include "bgpq3.h" +#include "bgpq4.h" #include "sx_report.h" extern int debug_expander; -int bgpq3_print_json_aspath(FILE* f, struct bgpq_expander* b); -int bgpq3_print_bird_aspath(FILE* f, struct bgpq_expander* b); -int bgpq3_print_openbgpd_aspath(FILE* f, struct bgpq_expander* b); -int bgpq3_print_openbgpd_asset(FILE* f, struct bgpq_expander* b); +int bgpq4_print_json_aspath(FILE* f, struct bgpq_expander* b); +int bgpq4_print_bird_aspath(FILE* f, struct bgpq_expander* b); +int bgpq4_print_openbgpd_aspath(FILE* f, struct bgpq_expander* b); +int bgpq4_print_openbgpd_asset(FILE* f, struct bgpq_expander* b); int -bgpq3_print_cisco_aspath(FILE* f, struct bgpq_expander* b) +bgpq4_print_cisco_aspath(FILE* f, struct bgpq_expander* b) { int nc=0, i, j, k, empty=1; fprintf(f,"no ip as-path access-list %s\n", b->name?b->name:"NN"); @@ -84,7 +84,7 @@ bgpq3_print_cisco_aspath(FILE* f, struct bgpq_expander* b) }; int -bgpq3_print_cisco_xr_aspath(FILE* f, struct bgpq_expander* b) +bgpq4_print_cisco_xr_aspath(FILE* f, struct bgpq_expander* b) { int nc=0, i, j, k, comma=0; fprintf(f, "as-path-set %s", b->name?b->name:"NN"); @@ -122,7 +122,7 @@ bgpq3_print_cisco_xr_aspath(FILE* f, struct bgpq_expander* b) return 0; }; int -bgpq3_print_cisco_oaspath(FILE* f, struct bgpq_expander* b) +bgpq4_print_cisco_oaspath(FILE* f, struct bgpq_expander* b) { int nc=0, i, j, k, empty=1; fprintf(f,"no ip as-path access-list %s\n", b->name?b->name:"NN"); @@ -181,7 +181,7 @@ bgpq3_print_cisco_oaspath(FILE* f, struct bgpq_expander* b) }; int -bgpq3_print_cisco_xr_oaspath(FILE* f, struct bgpq_expander* b) +bgpq4_print_cisco_xr_oaspath(FILE* f, struct bgpq_expander* b) { int nc=0, i, j, k, comma=0; fprintf(f, "as-path-set %s", b->name?b->name:"NN"); @@ -219,7 +219,7 @@ bgpq3_print_cisco_xr_oaspath(FILE* f, struct bgpq_expander* b) }; int -bgpq3_print_juniper_aspath(FILE* f, struct bgpq_expander* b) +bgpq4_print_juniper_aspath(FILE* f, struct bgpq_expander* b) { int nc=0, lineNo=0, i, j, k; fprintf(f,"policy-options {\nreplace:\n as-path-group %s {\n", @@ -262,7 +262,7 @@ bgpq3_print_juniper_aspath(FILE* f, struct bgpq_expander* b) }; int -bgpq3_print_juniper_oaspath(FILE* f, struct bgpq_expander* b) +bgpq4_print_juniper_oaspath(FILE* f, struct bgpq_expander* b) { int nc=0, lineNo=0, i, j, k; fprintf(f,"policy-options {\nreplace:\n as-path-group %s {\n", @@ -306,7 +306,7 @@ bgpq3_print_juniper_oaspath(FILE* f, struct bgpq_expander* b) }; int -bgpq3_print_openbgpd_oaspath(FILE* f, struct bgpq_expander* b) +bgpq4_print_openbgpd_oaspath(FILE* f, struct bgpq_expander* b) { int i, j, k, lineNo=0; @@ -329,7 +329,7 @@ bgpq3_print_openbgpd_oaspath(FILE* f, struct bgpq_expander* b) }; int -bgpq3_print_nokia_aspath(FILE* f, struct bgpq_expander* b) +bgpq4_print_nokia_aspath(FILE* f, struct bgpq_expander* b) { int nc=0, lineNo=1, i, j, k; @@ -371,7 +371,7 @@ bgpq3_print_nokia_aspath(FILE* f, struct bgpq_expander* b) }; int -bgpq3_print_nokia_md_aspath(FILE* f, struct bgpq_expander* b) +bgpq4_print_nokia_md_aspath(FILE* f, struct bgpq_expander* b) { int nc=0, lineNo=1, i, j, k; @@ -415,7 +415,7 @@ bgpq3_print_nokia_md_aspath(FILE* f, struct bgpq_expander* b) int -bgpq3_print_huawei_aspath(FILE* f, struct bgpq_expander* b) +bgpq4_print_huawei_aspath(FILE* f, struct bgpq_expander* b) { int nc=0, i, j, k, empty=1; @@ -459,7 +459,7 @@ bgpq3_print_huawei_aspath(FILE* f, struct bgpq_expander* b) }; int -bgpq3_print_huawei_oaspath(FILE* f, struct bgpq_expander* b) +bgpq4_print_huawei_oaspath(FILE* f, struct bgpq_expander* b) { int nc=0, i, j, k, empty=1; @@ -503,7 +503,7 @@ bgpq3_print_huawei_oaspath(FILE* f, struct bgpq_expander* b) }; int -bgpq3_print_nokia_oaspath(FILE* f, struct bgpq_expander* b) +bgpq4_print_nokia_oaspath(FILE* f, struct bgpq_expander* b) { int nc=0, lineNo=1, i, j, k; @@ -545,7 +545,7 @@ bgpq3_print_nokia_oaspath(FILE* f, struct bgpq_expander* b) }; int -bgpq3_print_nokia_md_oaspath(FILE* f, struct bgpq_expander* b) +bgpq4_print_nokia_md_oaspath(FILE* f, struct bgpq_expander* b) { int nc=0, lineNo=1, i, j, k; @@ -589,26 +589,26 @@ bgpq3_print_nokia_md_oaspath(FILE* f, struct bgpq_expander* b) }; int -bgpq3_print_aspath(FILE* f, struct bgpq_expander* b) +bgpq4_print_aspath(FILE* f, struct bgpq_expander* b) { if(b->vendor==V_JUNIPER) { - return bgpq3_print_juniper_aspath(f,b); + return bgpq4_print_juniper_aspath(f,b); } else if(b->vendor==V_CISCO) { - return bgpq3_print_cisco_aspath(f,b); + return bgpq4_print_cisco_aspath(f,b); } else if(b->vendor==V_CISCO_XR) { - return bgpq3_print_cisco_xr_aspath(f,b); + return bgpq4_print_cisco_xr_aspath(f,b); } else if(b->vendor==V_JSON) { - return bgpq3_print_json_aspath(f,b); + return bgpq4_print_json_aspath(f,b); } else if(b->vendor==V_BIRD) { - return bgpq3_print_bird_aspath(f,b); + return bgpq4_print_bird_aspath(f,b); } else if(b->vendor==V_OPENBGPD) { - return bgpq3_print_openbgpd_aspath(f,b); + return bgpq4_print_openbgpd_aspath(f,b); } else if(b->vendor==V_NOKIA) { - return bgpq3_print_nokia_aspath(f,b); + return bgpq4_print_nokia_aspath(f,b); } else if(b->vendor==V_NOKIA_MD) { - return bgpq3_print_nokia_md_aspath(f,b); + return bgpq4_print_nokia_md_aspath(f,b); } else if(b->vendor==V_HUAWEI) { - return bgpq3_print_huawei_aspath(f,b); + return bgpq4_print_huawei_aspath(f,b); } else { sx_report(SX_FATAL,"Unknown vendor %i\n", b->vendor); }; @@ -616,22 +616,22 @@ bgpq3_print_aspath(FILE* f, struct bgpq_expander* b) }; int -bgpq3_print_oaspath(FILE* f, struct bgpq_expander* b) +bgpq4_print_oaspath(FILE* f, struct bgpq_expander* b) { if(b->vendor==V_JUNIPER) { - return bgpq3_print_juniper_oaspath(f,b); + return bgpq4_print_juniper_oaspath(f,b); } else if(b->vendor==V_CISCO) { - return bgpq3_print_cisco_oaspath(f,b); + return bgpq4_print_cisco_oaspath(f,b); } else if(b->vendor==V_CISCO_XR) { - return bgpq3_print_cisco_xr_oaspath(f,b); + return bgpq4_print_cisco_xr_oaspath(f,b); } else if(b->vendor==V_OPENBGPD) { - return bgpq3_print_openbgpd_oaspath(f,b); + return bgpq4_print_openbgpd_oaspath(f,b); } else if(b->vendor==V_NOKIA) { - return bgpq3_print_nokia_oaspath(f,b); + return bgpq4_print_nokia_oaspath(f,b); } else if(b->vendor==V_NOKIA_MD) { - return bgpq3_print_nokia_md_oaspath(f,b); + return bgpq4_print_nokia_md_oaspath(f,b); } else if(b->vendor==V_HUAWEI) { - return bgpq3_print_huawei_oaspath(f,b); + return bgpq4_print_huawei_oaspath(f,b); } else { sx_report(SX_FATAL,"Unknown vendor %i\n", b->vendor); }; @@ -639,15 +639,15 @@ bgpq3_print_oaspath(FILE* f, struct bgpq_expander* b) }; int -bgpq3_print_asset(FILE* f, struct bgpq_expander* b) +bgpq4_print_asset(FILE* f, struct bgpq_expander* b) { switch(b->vendor) { case V_JSON: - return bgpq3_print_json_aspath(f,b); + return bgpq4_print_json_aspath(f,b); case V_OPENBGPD: - return bgpq3_print_openbgpd_asset(f,b); + return bgpq4_print_openbgpd_asset(f,b); case V_BIRD: - return bgpq3_print_bird_aspath(f,b); + return bgpq4_print_bird_aspath(f,b); default: sx_report(SX_FATAL, "as-sets (-t) supported for JSON, OpenBGPD " "and BIRD only\n"); @@ -656,7 +656,7 @@ bgpq3_print_asset(FILE* f, struct bgpq_expander* b) }; void -bgpq3_print_jprefix(struct sx_radix_node* n, void* ff) +bgpq4_print_jprefix(struct sx_radix_node* n, void* ff) { char prefix[128]; FILE* f=(FILE*)ff; @@ -669,7 +669,7 @@ bgpq3_print_jprefix(struct sx_radix_node* n, void* ff) static int needscomma=0; void -bgpq3_print_json_prefix(struct sx_radix_node* n, void* ff) +bgpq4_print_json_prefix(struct sx_radix_node* n, void* ff) { char prefix[128]; FILE* f=(FILE*)ff; @@ -694,11 +694,11 @@ bgpq3_print_json_prefix(struct sx_radix_node* n, void* ff) needscomma=1; checkSon: if(n->son) - bgpq3_print_json_prefix(n->son, ff); + bgpq4_print_json_prefix(n->son, ff); }; int -bgpq3_print_json_aspath(FILE* f, struct bgpq_expander* b) +bgpq4_print_json_aspath(FILE* f, struct bgpq_expander* b) { int nc=0, i, j, k; fprintf(f,"{\"%s\": [", b->name?b->name:"NN"); @@ -729,7 +729,7 @@ bgpq3_print_json_aspath(FILE* f, struct bgpq_expander* b) }; void -bgpq3_print_bird_prefix(struct sx_radix_node* n, void* ff) +bgpq4_print_bird_prefix(struct sx_radix_node* n, void* ff) { char prefix[128]; FILE* f=(FILE*)ff; @@ -751,11 +751,11 @@ bgpq3_print_bird_prefix(struct sx_radix_node* n, void* ff) needscomma=1; checkSon: if(n->son) - bgpq3_print_bird_prefix(n->son, ff); + bgpq4_print_bird_prefix(n->son, ff); }; int -bgpq3_print_bird_aspath(FILE* f, struct bgpq_expander* b) +bgpq4_print_bird_aspath(FILE* f, struct bgpq_expander* b) { int nc=0, i, j, k, empty=1; char buffer[2048]; @@ -790,7 +790,7 @@ bgpq3_print_bird_aspath(FILE* f, struct bgpq_expander* b) }; void -bgpq3_print_openbgpd_prefix(struct sx_radix_node* n, void* ff) +bgpq4_print_openbgpd_prefix(struct sx_radix_node* n, void* ff) { char prefix[128]; FILE* f=(FILE*)ff; @@ -812,11 +812,11 @@ bgpq3_print_openbgpd_prefix(struct sx_radix_node* n, void* ff) }; checkSon: if(n->son) - bgpq3_print_openbgpd_prefix(n->son, ff); + bgpq4_print_openbgpd_prefix(n->son, ff); }; int -bgpq3_print_openbgpd_asset(FILE* f, struct bgpq_expander* b) +bgpq4_print_openbgpd_asset(FILE* f, struct bgpq_expander* b) { int i, j, k, nc=0; @@ -841,7 +841,7 @@ bgpq3_print_openbgpd_asset(FILE* f, struct bgpq_expander* b) }; int -bgpq3_print_openbgpd_aspath(FILE* f, struct bgpq_expander* b) +bgpq4_print_openbgpd_aspath(FILE* f, struct bgpq_expander* b) { int i, j, k, lineNo=0; @@ -866,7 +866,7 @@ bgpq3_print_openbgpd_aspath(FILE* f, struct bgpq_expander* b) static int jrfilter_prefixed=1; void -bgpq3_print_jrfilter(struct sx_radix_node* n, void* ff) +bgpq4_print_jrfilter(struct sx_radix_node* n, void* ff) { char prefix[128]; FILE* f=(FILE*)ff; @@ -889,7 +889,7 @@ bgpq3_print_jrfilter(struct sx_radix_node* n, void* ff) }; checkSon: if(n->son) - bgpq3_print_jrfilter(n->son, ff); + bgpq4_print_jrfilter(n->son, ff); }; @@ -897,7 +897,7 @@ static char* bname=NULL; static int seq=0; void -bgpq3_print_cprefix(struct sx_radix_node* n, void* ff) +bgpq4_print_cprefix(struct sx_radix_node* n, void* ff) { char prefix[128], seqno[16]=""; FILE* f=(FILE*)ff; @@ -923,11 +923,11 @@ bgpq3_print_cprefix(struct sx_radix_node* n, void* ff) }; checkSon: if(n->son) - bgpq3_print_cprefix(n->son,ff); + bgpq4_print_cprefix(n->son,ff); }; void -bgpq3_print_cprefixxr(struct sx_radix_node* n, void* ff) +bgpq4_print_cprefixxr(struct sx_radix_node* n, void* ff) { char prefix[128]; FILE* f=(FILE*)ff; @@ -948,11 +948,11 @@ bgpq3_print_cprefixxr(struct sx_radix_node* n, void* ff) needscomma=1; checkSon: if(n->son) - bgpq3_print_cprefixxr(n->son,ff); + bgpq4_print_cprefixxr(n->son,ff); }; void -bgpq3_print_hprefix(struct sx_radix_node* n, void* ff) +bgpq4_print_hprefix(struct sx_radix_node* n, void* ff) { char prefix[128]; FILE* f=(FILE*)ff; @@ -977,12 +977,12 @@ bgpq3_print_hprefix(struct sx_radix_node* n, void* ff) }; checkSon: if(n->son) - bgpq3_print_hprefix(n->son,ff); + bgpq4_print_hprefix(n->son,ff); }; void -bgpq3_print_ceacl(struct sx_radix_node* n, void* ff) +bgpq4_print_ceacl(struct sx_radix_node* n, void* ff) { char prefix[128]; FILE* f=(FILE*)ff; @@ -1043,11 +1043,11 @@ bgpq3_print_ceacl(struct sx_radix_node* n, void* ff) }; checkSon: if(n->son) - bgpq3_print_ceacl(n->son,ff); + bgpq4_print_ceacl(n->son,ff); }; void -bgpq3_print_nokia_ipfilter(struct sx_radix_node* n, void* ff) +bgpq4_print_nokia_ipfilter(struct sx_radix_node* n, void* ff) { char prefix[128]; FILE* f=(FILE*)ff; @@ -1057,11 +1057,11 @@ bgpq3_print_nokia_ipfilter(struct sx_radix_node* n, void* ff) fprintf(f," prefix %s\n", prefix); checkSon: if(n->son) - bgpq3_print_nokia_ipfilter(n->son, ff); + bgpq4_print_nokia_ipfilter(n->son, ff); }; void -bgpq3_print_nokia_md_ipfilter(struct sx_radix_node* n, void* ff) +bgpq4_print_nokia_md_ipfilter(struct sx_radix_node* n, void* ff) { char prefix[128]; FILE* f=(FILE*)ff; @@ -1071,11 +1071,11 @@ bgpq3_print_nokia_md_ipfilter(struct sx_radix_node* n, void* ff) fprintf(f," prefix %s { }\n", prefix); checkSon: if(n->son) - bgpq3_print_nokia_md_ipfilter(n->son, ff); + bgpq4_print_nokia_md_ipfilter(n->son, ff); }; void -bgpq3_print_nokia_prefix(struct sx_radix_node* n, void* ff) +bgpq4_print_nokia_prefix(struct sx_radix_node* n, void* ff) { char prefix[128]; FILE* f=(FILE*)ff; @@ -1095,12 +1095,12 @@ bgpq3_print_nokia_prefix(struct sx_radix_node* n, void* ff) }; checkSon: if(n->son) - bgpq3_print_nokia_prefix(n->son, ff); + bgpq4_print_nokia_prefix(n->son, ff); }; void -bgpq3_print_nokia_md_prefix(struct sx_radix_node* n, void* ff) +bgpq4_print_nokia_md_prefix(struct sx_radix_node* n, void* ff) { char prefix[128]; FILE* f=(FILE*)ff; @@ -1122,22 +1122,22 @@ bgpq3_print_nokia_md_prefix(struct sx_radix_node* n, void* ff) }; checkSon: if(n->son) - bgpq3_print_nokia_md_prefix(n->son, ff); + bgpq4_print_nokia_md_prefix(n->son, ff); }; int -bgpq3_print_juniper_prefixlist(FILE* f, struct bgpq_expander* b) +bgpq4_print_juniper_prefixlist(FILE* f, struct bgpq_expander* b) { fprintf(f,"policy-options {\nreplace:\n prefix-list %s {\n", b->name?b->name:"NN"); - sx_radix_tree_foreach(b->tree,bgpq3_print_jprefix,f); + sx_radix_tree_foreach(b->tree,bgpq4_print_jprefix,f); fprintf(f," }\n}\n"); return 0; }; int -bgpq3_print_juniper_routefilter(FILE* f, struct bgpq_expander* b) +bgpq4_print_juniper_routefilter(FILE* f, struct bgpq_expander* b) { char* c=NULL; if(b->name && (c=strchr(b->name,'/'))) { @@ -1154,7 +1154,7 @@ bgpq3_print_juniper_routefilter(FILE* f, struct bgpq_expander* b) }; if(!sx_radix_tree_empty(b->tree)) { jrfilter_prefixed=1; - sx_radix_tree_foreach(b->tree,bgpq3_print_jrfilter,f); + sx_radix_tree_foreach(b->tree,bgpq4_print_jrfilter,f); } else { fprintf(f," route-filter %s/0 orlonger reject;\n", b->tree->family == AF_INET ? "0.0.0.0" : "::"); @@ -1168,7 +1168,7 @@ bgpq3_print_juniper_routefilter(FILE* f, struct bgpq_expander* b) }; int -bgpq3_print_openbgpd_prefixlist(FILE* f, struct bgpq_expander* b) +bgpq4_print_openbgpd_prefixlist(FILE* f, struct bgpq_expander* b) { bname=b->name ? b->name : "NN"; if (sx_radix_tree_empty(b->tree)) { @@ -1185,7 +1185,7 @@ bgpq3_print_openbgpd_prefixlist(FILE* f, struct bgpq_expander* b) } } fprintf(f,"prefix { "); - sx_radix_tree_foreach(b->tree,bgpq3_print_openbgpd_prefix,f); + sx_radix_tree_foreach(b->tree,bgpq4_print_openbgpd_prefix,f); fprintf(f, "\n\t}"); if(b->name){ if(strcmp(b->name, "NN") != 0) { @@ -1200,25 +1200,25 @@ bgpq3_print_openbgpd_prefixlist(FILE* f, struct bgpq_expander* b) }; int -bgpq3_print_openbgpd_prefixset(FILE* f, struct bgpq_expander* b) +bgpq4_print_openbgpd_prefixset(FILE* f, struct bgpq_expander* b) { bname=b->name ? b->name : "NN"; fprintf(f,"prefix-set %s {", b->name); if (!sx_radix_tree_empty(b->tree)) - sx_radix_tree_foreach(b->tree,bgpq3_print_openbgpd_prefix,f); + sx_radix_tree_foreach(b->tree,bgpq4_print_openbgpd_prefix,f); fprintf(f, "\n}\n"); return 0; }; int -bgpq3_print_cisco_prefixlist(FILE* f, struct bgpq_expander* b) +bgpq4_print_cisco_prefixlist(FILE* f, struct bgpq_expander* b) { bname=b->name ? b->name : "NN"; seq=b->sequence; fprintf(f,"no %s prefix-list %s\n", (b->family==AF_INET)?"ip":"ipv6",bname); if (!sx_radix_tree_empty(b->tree)) { - sx_radix_tree_foreach(b->tree,bgpq3_print_cprefix,f); + sx_radix_tree_foreach(b->tree,bgpq4_print_cprefix,f); } else { fprintf(f, "! generated prefix-list %s is empty\n", bname); fprintf(f, "%s prefix-list %s deny %s\n", @@ -1229,32 +1229,32 @@ bgpq3_print_cisco_prefixlist(FILE* f, struct bgpq_expander* b) }; int -bgpq3_print_ciscoxr_prefixlist(FILE* f, struct bgpq_expander* b) +bgpq4_print_ciscoxr_prefixlist(FILE* f, struct bgpq_expander* b) { bname=b->name ? b->name : "NN"; fprintf(f,"no prefix-set %s\nprefix-set %s\n", bname, bname); - sx_radix_tree_foreach(b->tree,bgpq3_print_cprefixxr,f); + sx_radix_tree_foreach(b->tree,bgpq4_print_cprefixxr,f); fprintf(f, "\nend-set\n"); return 0; }; int -bgpq3_print_json_prefixlist(FILE* f, struct bgpq_expander* b) +bgpq4_print_json_prefixlist(FILE* f, struct bgpq_expander* b) { fprintf(f,"{ \"%s\": [", b->name?b->name:"NN"); - sx_radix_tree_foreach(b->tree,bgpq3_print_json_prefix,f); + sx_radix_tree_foreach(b->tree,bgpq4_print_json_prefix,f); fprintf(f,"\n] }\n"); return 0; }; int -bgpq3_print_bird_prefixlist(FILE* f, struct bgpq_expander* b) +bgpq4_print_bird_prefixlist(FILE* f, struct bgpq_expander* b) { if (!sx_radix_tree_empty(b->tree)) { fprintf(f,"%s = [", b->name?b->name:"NN"); - sx_radix_tree_foreach(b->tree,bgpq3_print_bird_prefix,f); + sx_radix_tree_foreach(b->tree,bgpq4_print_bird_prefix,f); fprintf(f,"\n];\n"); } else { SX_DEBUG(debug_expander, "skip empty prefix-list in BIRD format\n"); @@ -1263,14 +1263,14 @@ bgpq3_print_bird_prefixlist(FILE* f, struct bgpq_expander* b) }; int -bgpq3_print_huawei_prefixlist(FILE* f, struct bgpq_expander* b) +bgpq4_print_huawei_prefixlist(FILE* f, struct bgpq_expander* b) { bname=b->name ? b->name : "NN"; seq=b->sequence; fprintf(f,"undo ip %s-prefix %s\n", (b->family==AF_INET)?"ip":"ipv6",bname); if (!sx_radix_tree_empty(b->tree)) { - sx_radix_tree_foreach(b->tree,bgpq3_print_hprefix,f); + sx_radix_tree_foreach(b->tree,bgpq4_print_hprefix,f); } else { fprintf(f, "ip %s-prefix %s deny %s\n", (b->family==AF_INET) ? "ip" : "ipv6", bname, @@ -1286,7 +1286,7 @@ struct fpcbdata { }; void -bgpq3_print_format_prefix(struct sx_radix_node* n, void* ff) +bgpq4_print_format_prefix(struct sx_radix_node* n, void* ff) { char prefix[128]; struct fpcbdata* fpc=(struct fpcbdata*)ff; @@ -1304,35 +1304,35 @@ bgpq3_print_format_prefix(struct sx_radix_node* n, void* ff) int -bgpq3_print_format_prefixlist(FILE* f, struct bgpq_expander* b) +bgpq4_print_format_prefixlist(FILE* f, struct bgpq_expander* b) { struct fpcbdata ff = {.f=f, .b=b}; - sx_radix_tree_foreach(b->tree,bgpq3_print_format_prefix,&ff); + sx_radix_tree_foreach(b->tree,bgpq4_print_format_prefix,&ff); if (strcmp(b->format+strlen(b->format-2), "\n")) fprintf(f, "\n"); return 0; }; int -bgpq3_print_nokia_prefixlist(FILE* f, struct bgpq_expander* b) +bgpq4_print_nokia_prefixlist(FILE* f, struct bgpq_expander* b) { bname=b->name ? b->name : "NN"; fprintf(f,"configure router policy-options\nbegin\nno prefix-list \"%s\"\n", bname); fprintf(f,"prefix-list \"%s\"\n", bname); - sx_radix_tree_foreach(b->tree,bgpq3_print_nokia_prefix,f); + sx_radix_tree_foreach(b->tree,bgpq4_print_nokia_prefix,f); fprintf(f,"exit\ncommit\n"); return 0; }; int -bgpq3_print_cisco_eacl(FILE* f, struct bgpq_expander* b) +bgpq4_print_cisco_eacl(FILE* f, struct bgpq_expander* b) { bname=b->name ? b->name : "NN"; fprintf(f,"no ip access-list extended %s\n", bname); if (!sx_radix_tree_empty(b->tree)) { fprintf(f,"ip access-list extended %s\n", bname); - sx_radix_tree_foreach(b->tree,bgpq3_print_ceacl,f); + sx_radix_tree_foreach(b->tree,bgpq4_print_ceacl,f); } else { fprintf(f,"! generated access-list %s is empty\n", bname); fprintf(f,"ip access-list extended %s deny any any\n", bname); @@ -1341,14 +1341,14 @@ bgpq3_print_cisco_eacl(FILE* f, struct bgpq_expander* b) }; int -bgpq3_print_nokia_ipprefixlist(FILE* f, struct bgpq_expander* b) +bgpq4_print_nokia_ipprefixlist(FILE* f, struct bgpq_expander* b) { bname=b->name ? b->name : "NN"; fprintf(f,"configure filter match-list\nno %s-prefix-list \"%s\"\n", b->tree->family==AF_INET?"ip":"ipv6", bname); fprintf(f,"%s-prefix-list \"%s\" create\n", b->tree->family==AF_INET?"ip":"ipv6", bname); if (!sx_radix_tree_empty(b->tree)) { - sx_radix_tree_foreach(b->tree,bgpq3_print_nokia_ipfilter,f); + sx_radix_tree_foreach(b->tree,bgpq4_print_nokia_ipfilter,f); } else { fprintf(f,"# generated ip-prefix-list %s is empty\n", bname); }; @@ -1357,7 +1357,7 @@ bgpq3_print_nokia_ipprefixlist(FILE* f, struct bgpq_expander* b) }; int -bgpq3_print_nokia_md_prefixlist(FILE* f, struct bgpq_expander* b) +bgpq4_print_nokia_md_prefixlist(FILE* f, struct bgpq_expander* b) { bname=b->name ? b->name : "NN"; fprintf(f,"/configure filter match-list\ndelete %s-prefix-list \"%s\"\n", @@ -1365,7 +1365,7 @@ bgpq3_print_nokia_md_prefixlist(FILE* f, struct bgpq_expander* b) fprintf(f,"%s-prefix-list \"%s\" {\n", b->tree->family==AF_INET?"ip":"ipv6", bname); if (!sx_radix_tree_empty(b->tree)) { - sx_radix_tree_foreach(b->tree,bgpq3_print_nokia_md_ipfilter,f); + sx_radix_tree_foreach(b->tree,bgpq4_print_nokia_md_ipfilter,f); } else { fprintf(f,"# generated %s-prefix-list %s is empty\n", b->tree->family==AF_INET?"ip":"ipv6", bname); @@ -1375,56 +1375,56 @@ bgpq3_print_nokia_md_prefixlist(FILE* f, struct bgpq_expander* b) }; int -bgpq3_print_nokia_md_ipprefixlist(FILE* f, struct bgpq_expander* b) +bgpq4_print_nokia_md_ipprefixlist(FILE* f, struct bgpq_expander* b) { bname=b->name ? b->name : "NN"; fprintf(f,"/configure policy-options\ndelete prefix-list \"%s\"\n", bname); fprintf(f,"prefix-list \"%s\" {\n", bname); if (!sx_radix_tree_empty(b->tree)) { - sx_radix_tree_foreach(b->tree,bgpq3_print_nokia_md_prefix,f); + sx_radix_tree_foreach(b->tree,bgpq4_print_nokia_md_prefix,f); }; fprintf(f,"}\n"); return 0; }; int -bgpq3_print_prefixlist(FILE* f, struct bgpq_expander* b) +bgpq4_print_prefixlist(FILE* f, struct bgpq_expander* b) { switch(b->vendor) { - case V_JUNIPER: return bgpq3_print_juniper_prefixlist(f,b); - case V_CISCO: return bgpq3_print_cisco_prefixlist(f,b); - case V_CISCO_XR: return bgpq3_print_ciscoxr_prefixlist(f,b); - case V_JSON: return bgpq3_print_json_prefixlist(f,b); - case V_BIRD: return bgpq3_print_bird_prefixlist(f,b); - case V_OPENBGPD: return bgpq3_print_openbgpd_prefixlist(f,b); - case V_FORMAT: return bgpq3_print_format_prefixlist(f,b); - case V_NOKIA: return bgpq3_print_nokia_prefixlist(f,b); - case V_NOKIA_MD: return bgpq3_print_nokia_md_ipprefixlist(f,b); - case V_HUAWEI: return bgpq3_print_huawei_prefixlist(f,b); + case V_JUNIPER: return bgpq4_print_juniper_prefixlist(f,b); + case V_CISCO: return bgpq4_print_cisco_prefixlist(f,b); + case V_CISCO_XR: return bgpq4_print_ciscoxr_prefixlist(f,b); + case V_JSON: return bgpq4_print_json_prefixlist(f,b); + case V_BIRD: return bgpq4_print_bird_prefixlist(f,b); + case V_OPENBGPD: return bgpq4_print_openbgpd_prefixlist(f,b); + case V_FORMAT: return bgpq4_print_format_prefixlist(f,b); + case V_NOKIA: return bgpq4_print_nokia_prefixlist(f,b); + case V_NOKIA_MD: return bgpq4_print_nokia_md_ipprefixlist(f,b); + case V_HUAWEI: return bgpq4_print_huawei_prefixlist(f,b); }; return 0; }; int -bgpq3_print_eacl(FILE* f, struct bgpq_expander* b) +bgpq4_print_eacl(FILE* f, struct bgpq_expander* b) { switch(b->vendor) { - case V_JUNIPER: return bgpq3_print_juniper_routefilter(f,b); - case V_CISCO: return bgpq3_print_cisco_eacl(f,b); + case V_JUNIPER: return bgpq4_print_juniper_routefilter(f,b); + case V_CISCO: return bgpq4_print_cisco_eacl(f,b); case V_CISCO_XR: sx_report(SX_FATAL, "unreachable point\n"); case V_JSON: sx_report(SX_FATAL, "unreachable point\n"); case V_BIRD: sx_report(SX_FATAL, "unreachable point\n"); - case V_OPENBGPD: return bgpq3_print_openbgpd_prefixset(f,b); + case V_OPENBGPD: return bgpq4_print_openbgpd_prefixset(f,b); case V_FORMAT: sx_report(SX_FATAL, "unreachable point\n"); - case V_NOKIA: return bgpq3_print_nokia_ipprefixlist(f,b); - case V_NOKIA_MD: return bgpq3_print_nokia_md_prefixlist(f,b); + case V_NOKIA: return bgpq4_print_nokia_ipprefixlist(f,b); + case V_NOKIA_MD: return bgpq4_print_nokia_md_prefixlist(f,b); case V_HUAWEI: return sx_report(SX_FATAL, "unreachable point\n"); }; return 0; }; int -bgpq3_print_juniper_route_filter_list(FILE* f, struct bgpq_expander* b) +bgpq4_print_juniper_route_filter_list(FILE* f, struct bgpq_expander* b) { fprintf(f, "policy-options {\nreplace:\n route-filter-list %s {\n", b->name?b->name:"NN"); @@ -1433,17 +1433,17 @@ bgpq3_print_juniper_route_filter_list(FILE* f, struct bgpq_expander* b) b->tree->family == AF_INET ? "0.0.0.0" : "::"); } else { jrfilter_prefixed=0; - sx_radix_tree_foreach(b->tree,bgpq3_print_jrfilter,f); + sx_radix_tree_foreach(b->tree,bgpq4_print_jrfilter,f); }; fprintf(f, " }\n}\n"); return 0; }; int -bgpq3_print_route_filter_list(FILE* f, struct bgpq_expander* b) +bgpq4_print_route_filter_list(FILE* f, struct bgpq_expander* b) { switch(b->vendor) { - case V_JUNIPER: return bgpq3_print_juniper_route_filter_list(f,b); + case V_JUNIPER: return bgpq4_print_juniper_route_filter_list(f,b); default: sx_report(SX_FATAL, "unreachable point\n"); }; return 0; diff --git a/bgpq_expander.c b/bgpq_expander.c index 3740674..c16826d 100644 --- a/bgpq_expander.c +++ b/bgpq_expander.c @@ -22,7 +22,7 @@ #include #include -#include "bgpq3.h" +#include "bgpq4.h" #include "sx_report.h" #include "sx_maxsockbuf.h" diff --git a/configure b/configure index f5b6297..3fcc200 100755 --- a/configure +++ b/configure @@ -1,6 +1,6 @@ #! /bin/sh # Guess values for system-dependent variables and create Makefiles. -# Generated by GNU Autoconf 2.69 for bgpq3 0.1.35. +# Generated by GNU Autoconf 2.69 for bgpq4 0.1.35. # # Report bugs to . # @@ -578,12 +578,12 @@ MFLAGS= MAKEFLAGS= # Identity of this package. -PACKAGE_NAME='bgpq3' -PACKAGE_TARNAME='bgpq3' -PACKAGE_VERSION='0.1.35' -PACKAGE_STRING='bgpq3 0.1.35' -PACKAGE_BUGREPORT='snar@snar.spb.ru' -PACKAGE_URL='' +PACKAGE_NAME='bgpq4' +PACKAGE_TARNAME='bgpq4' +PACKAGE_VERSION='0.0.1' +PACKAGE_STRING='bgpq4 0.0.1' +PACKAGE_BUGREPORT='job@ntt.net' +PACKAGE_URL='https://github.com/bgp/bgpq4' # Factoring default headers for most tests. ac_includes_default="\ @@ -1228,7 +1228,7 @@ if test "$ac_init_help" = "long"; then # Omit some internal or obsolete options to make the list less imposing. # This message is too long to be a string in the A/UX 3.1 sh. cat <<_ACEOF -\`configure' configures bgpq3 0.1.35 to adapt to many kinds of systems. +\`configure' configures bgpq4 0.1.35 to adapt to many kinds of systems. Usage: $0 [OPTION]... [VAR=VALUE]... @@ -1276,7 +1276,7 @@ Fine tuning of the installation directories: --infodir=DIR info documentation [DATAROOTDIR/info] --localedir=DIR locale-dependent data [DATAROOTDIR/locale] --mandir=DIR man documentation [DATAROOTDIR/man] - --docdir=DIR documentation root [DATAROOTDIR/doc/bgpq3] + --docdir=DIR documentation root [DATAROOTDIR/doc/bgpq4] --htmldir=DIR html documentation [DOCDIR] --dvidir=DIR dvi documentation [DOCDIR] --pdfdir=DIR pdf documentation [DOCDIR] @@ -1289,7 +1289,7 @@ fi if test -n "$ac_init_help"; then case $ac_init_help in - short | recursive ) echo "Configuration of bgpq3 0.1.35:";; + short | recursive ) echo "Configuration of bgpq4 0.1.35:";; esac cat <<\_ACEOF @@ -1369,7 +1369,7 @@ fi test -n "$ac_init_help" && exit $ac_status if $ac_init_version; then cat <<\_ACEOF -bgpq3 configure 0.1.35 +bgpq4 configure 0.1.35 generated by GNU Autoconf 2.69 Copyright (C) 2012 Free Software Foundation, Inc. @@ -1738,7 +1738,7 @@ cat >config.log <<_ACEOF This file contains any messages produced by compilers while running configure, to aid debugging if configure makes a mistake. -It was created by bgpq3 $as_me 0.1.35, which was +It was created by bgpq4 $as_me 0.1.35, which was generated by GNU Autoconf 2.69. Invocation command line was $ $0 $@ @@ -4102,7 +4102,7 @@ cat >>$CONFIG_STATUS <<\_ACEOF || ac_write_fail=1 # report actual input values of CONFIG_FILES etc. instead of their # values after options handling. ac_log=" -This file was extended by bgpq3 $as_me 0.1.35, which was +This file was extended by bgpq4 $as_me 0.1.35, which was generated by GNU Autoconf 2.69. Invocation command line was CONFIG_FILES = $CONFIG_FILES @@ -4164,7 +4164,7 @@ _ACEOF cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1 ac_cs_config="`$as_echo "$ac_configure_args" | sed 's/^ //; s/[\\""\`\$]/\\\\&/g'`" ac_cs_version="\\ -bgpq3 config.status 0.1.35 +bgpq4 config.status 0.0.1 configured by $0, generated by GNU Autoconf 2.69, with options \\"\$ac_cs_config\\" diff --git a/configure.in b/configure.in index bbd4285..54a7347 100644 --- a/configure.in +++ b/configure.in @@ -1,4 +1,4 @@ -AC_INIT(bgpq3,0.1.35,snar@snar.spb.ru) +AC_INIT(bgpq4,0.0.1,job@ntt.net) AC_CONFIG_HEADER(config.h) AC_PROG_CC AC_PROG_INSTALL