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

v0.1.27, some ipv6 prefixes were not parsed correctly.

This commit is contained in:
Alexandre Snarskii
2015-03-10 15:06:49 +03:00
parent d034047ca5
commit 190fd07057
5 changed files with 25 additions and 18 deletions

View File

@ -1,3 +1,7 @@
0.1.27 (2015-03-10)
- bugfix: some ipv6 prefixes were not parsed correctly since 0.1.26.
Thanks to Job Snijders.
0.1.26 (2015-02-19)
- RPSL <address-prefix-range> support, can be found in rs-esnetcustomers.
Thanks to Kris O'Connell for reporting.

View File

@ -543,8 +543,9 @@ bgpq3_print_cisco_prefixlist(FILE* f, struct bgpq_expander* b)
sx_radix_tree_foreach(b->tree,bgpq3_print_cprefix,f);
} else {
fprintf(f, "! generated prefix-list %s is empty\n", bname);
fprintf(f, "%s prefix-list %s deny 0.0.0.0/0\n",
(b->family==AF_INET) ? "ip" : "ipv6", bname);
fprintf(f, "%s prefix-list %s deny %s\n",
(b->family==AF_INET) ? "ip" : "ipv6", bname,
(b->family==AF_INET) ? "0.0.0.0/0" : "::/0");
};
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.26.
# Generated by GNU Autoconf 2.69 for bgpq3 0.1.27.
#
# 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.26'
PACKAGE_STRING='bgpq3 0.1.26'
PACKAGE_VERSION='0.1.27'
PACKAGE_STRING='bgpq3 0.1.27'
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.26 to adapt to many kinds of systems.
\`configure' configures bgpq3 0.1.27 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.26:";;
short | recursive ) echo "Configuration of bgpq3 0.1.27:";;
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.26
bgpq3 configure 0.1.27
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.26, which was
It was created by bgpq3 $as_me 0.1.27, 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.26, which was
This file was extended by bgpq3 $as_me 0.1.27, 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.26
bgpq3 config.status 0.1.27
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.26,snar@snar.spb.ru)
AC_INIT(bgpq3,0.1.27,snar@snar.spb.ru)
AC_CONFIG_HEADER(config.h)
AC_PROG_CC
AC_PROG_INSTALL

View File

@ -51,8 +51,8 @@ int
sx_prefix_parse(struct sx_prefix* p, int af, char* text)
{
char* c=NULL;
int masklen;
char mtext[strlen(text)+1];
int masklen, ret;
char mtext[INET6_ADDRSTRLEN+1];
strlcpy(mtext, text, sizeof(mtext));
c=strchr(mtext,'/');
@ -70,17 +70,18 @@ sx_prefix_parse(struct sx_prefix* p, int af, char* text)
};
if(!af) {
if(strchr(text,':')) af=AF_INET6;
if(strchr(mtext,':')) af=AF_INET6;
else
af=AF_INET;
};
if(inet_pton(af,text,&p->addr)!=1) {
ret = inet_pton(af, mtext, &p->addr);
if(ret != 1) {
int aparts[4];
/* contrary to documentation (man inet_ntop on FreeBSD),
addresses with leading zeros are not parsed correctly. Try to
workaround this issue manually */
if (af==AF_INET && sscanf(text, "%i.%i.%i.%i", aparts,
if (af==AF_INET && sscanf(mtext, "%i.%i.%i.%i", aparts,
aparts+1, aparts+2, aparts+3) == 4 && aparts[0]>=0 &&
aparts[0]<256 && aparts[1]>=0 && aparts[1]<256 &&
aparts[2]>=0 && aparts[2]<256 && aparts[3]>=0 &&
@ -89,7 +90,8 @@ sx_prefix_parse(struct sx_prefix* p, int af, char* text)
(aparts[1]<<16) + (aparts[2]<<8) + aparts[3]);
} else {
if(c) *c='/';
sx_report(SX_ERROR,"Unable to parse prefix %s, af=%i\n",text,af);
sx_report(SX_ERROR,"Unable to parse prefix '%s', af=%i (%s), "
"ret=%i\n", mtext, af, af==AF_INET ? "inet" : "inet6", ret);
goto fixups;
};
};