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

BIRD: do not generate empty lists at all: BIRD is not able to handle them.

This commit is contained in:
Alexandre Snarskii
2015-07-06 18:08:18 +03:00
parent c4d924ae6e
commit 6107c97efb
4 changed files with 31 additions and 16 deletions

View File

@@ -1,3 +1,7 @@
0.1.32-rc4 (2015-07-06)
- change: BIRD can't handle empty lists (NAME = []), so they are not
generated at all.
0.1.32-rc3 (2015-07-01)
- feature: option -s can be used to generate sequence numbers in IOS
prefix-lists

View File

@@ -14,6 +14,8 @@
#include "bgpq3.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);
@@ -357,7 +359,8 @@ int
bgpq3_print_bird_aspath(FILE* f, struct bgpq_expander* b)
{
int nc=0, i, j, k, empty=1;
fprintf(f, "%s = [", b->name?b->name:"NN");
char buffer[2048];
snprintf(buffer, sizeof(buffer), "%s = [", b->name?b->name:"NN");
for(k=0;k<65536;k++) {
if(!b->asn32s[k]) continue;
@@ -365,6 +368,9 @@ bgpq3_print_bird_aspath(FILE* f, struct bgpq_expander* b)
for(i=0;i<8192;i++) {
for(j=0;j<8;j++) {
if(b->asn32s[k][i]&(0x80>>j)) {
if(buffer[0])
fprintf(f, "%s", buffer);
buffer[0]=0;
if(!nc) {
fprintf(f, "%s%u", empty?"":",\n ", k*65536+i*8+j);
empty = 0;
@@ -379,7 +385,8 @@ bgpq3_print_bird_aspath(FILE* f, struct bgpq_expander* b)
};
};
};
fprintf(f,"];\n");
if(!empty)
fprintf(f,"];\n");
return 0;
};
@@ -611,10 +618,14 @@ bgpq3_print_json_prefixlist(FILE* f, struct bgpq_expander* b)
int
bgpq3_print_bird_prefixlist(FILE* f, struct bgpq_expander* b)
{
fprintf(f,"%s = [",
b->name?b->name:"NN");
sx_radix_tree_foreach(b->tree,bgpq3_print_bird_prefix,f);
fprintf(f,"\n];\n");
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);
fprintf(f,"\n];\n");
} else {
SX_DEBUG(debug_expander, "skip empty prefix-list in BIRD format\n");
};
return 0;
};

18
configure vendored
View File

@@ -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.32-rc3.
# Generated by GNU Autoconf 2.69 for bgpq3 0.1.32-rc4.
#
# Report bugs to <snar@snar.spb.ru>.
#
@@ -579,8 +579,8 @@ MAKEFLAGS=
# Identity of this package.
PACKAGE_NAME='bgpq3'
PACKAGE_TARNAME='bgpq3'
PACKAGE_VERSION='0.1.32-rc3'
PACKAGE_STRING='bgpq3 0.1.32-rc3'
PACKAGE_VERSION='0.1.32-rc4'
PACKAGE_STRING='bgpq3 0.1.32-rc4'
PACKAGE_BUGREPORT='snar@snar.spb.ru'
PACKAGE_URL=''
@@ -1187,7 +1187,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.32-rc3 to adapt to many kinds of systems.
\`configure' configures bgpq3 0.1.32-rc4 to adapt to many kinds of systems.
Usage: $0 [OPTION]... [VAR=VALUE]...
@@ -1248,7 +1248,7 @@ fi
if test -n "$ac_init_help"; then
case $ac_init_help in
short | recursive ) echo "Configuration of bgpq3 0.1.32-rc3:";;
short | recursive ) echo "Configuration of bgpq3 0.1.32-rc4:";;
esac
cat <<\_ACEOF
@@ -1327,7 +1327,7 @@ fi
test -n "$ac_init_help" && exit $ac_status
if $ac_init_version; then
cat <<\_ACEOF
bgpq3 configure 0.1.32-rc3
bgpq3 configure 0.1.32-rc4
generated by GNU Autoconf 2.69
Copyright (C) 2012 Free Software Foundation, Inc.
@@ -1495,7 +1495,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.32-rc3, which was
It was created by bgpq3 $as_me 0.1.32-rc4, which was
generated by GNU Autoconf 2.69. Invocation command line was
$ $0 $@
@@ -3413,7 +3413,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.32-rc3, which was
This file was extended by bgpq3 $as_me 0.1.32-rc4, which was
generated by GNU Autoconf 2.69. Invocation command line was
CONFIG_FILES = $CONFIG_FILES
@@ -3475,7 +3475,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.32-rc3
bgpq3 config.status 0.1.32-rc4
configured by $0, generated by GNU Autoconf 2.69,
with options \\"\$ac_cs_config\\"

View File

@@ -1,4 +1,4 @@
AC_INIT(bgpq3,0.1.32-rc3,snar@snar.spb.ru)
AC_INIT(bgpq3,0.1.32-rc4,snar@snar.spb.ru)
AC_CONFIG_HEADER(config.h)
AC_PROG_CC
AC_PROG_INSTALL