diff --git a/CHANGES b/CHANGES index 78e15fd..f8748a9 100644 --- a/CHANGES +++ b/CHANGES @@ -1,3 +1,8 @@ +0.1.20-todo (2013-10-07) + - socket close code fixed. Thanks to Martin J. Levy. + - new flag -4, "force ipv4". Actually does a little more than allowing + for pedantic checks. Thanks to Martin J. Levy. + 0.1.19 (2013-05-09) - CLANG compilation issues fixed. - bgpq3.spec added. Thanks to Arnoud Vermeer. diff --git a/Makefile.in b/Makefile.in index c2d7e96..46d77b0 100644 --- a/Makefile.in +++ b/Makefile.in @@ -4,6 +4,7 @@ LDADD=@LDFLAGS@ @LIBS@ INSTALL=@INSTALL@ prefix = @prefix@ +bindir = @bindir@ exec_prefix = @exec_prefix@ datarootdir = @datarootdir@ datadir = @datadir@ @@ -36,5 +37,5 @@ install: bgpq3 depend: makedepend -- $(CFLAGS) -- $(SRCS) -bgpq3.html: bgpq3.txt - markdown2 bgpq3.txt > bgpq3.html +bgpq3.html: README.md + markdown2 README.md > bgpq3.html diff --git a/bgpq3.txt b/README.md similarity index 99% rename from bgpq3.txt rename to README.md index e5bbbcc..86024aa 100644 --- a/bgpq3.txt +++ b/README.md @@ -34,6 +34,10 @@ The options are as follows: > assume that your device is asn32-capable. +- -4 + + > generate IPv4 prefix/access-lists (default). + - -6 > generate IPv6 prefix/access-lists (IPv4 by default). diff --git a/bgpq3.8 b/bgpq3.8 index f4c4902..e59961c 100644 --- a/bgpq3.8 +++ b/bgpq3.8 @@ -1,4 +1,4 @@ -.\" Copyright (c) 2007-2011 Alexandre Snarskii +.\" Copyright (c) 2007-2013 Alexandre Snarskii .\" All rights reserved. .\" .\" Redistribution and use in source and binary forms, with or without @@ -21,7 +21,7 @@ .\" LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY .\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF .\" SUCH DAMAGE. -.\" "$Id: bgpq3.8,v 1.9 2013/01/08 12:21:14 snar Exp $ +.\" "$Id: bgpq3.8,v 1.10 2013/10/08 10:50:34 snar Exp $ .\" .Dd Oct 27, 2008 .Dt BGPQ3 8 @@ -38,7 +38,7 @@ .Fl f Ar asn | .Fl G Ar asn .Oc -.Op Fl 36ADdJjX +.Op Fl 346ADdJjX .Op Fl R Ar len .Op Fl m Ar max .Ar OBJECTS @@ -53,6 +53,8 @@ The options are as follows: .Bl -tag -width Ds .It Fl 3 assume that your device is asn32-safe. +.It Fl 4 +generate IPv4 prefix/access-lists (default). .It Fl 6 generate IPv6 prefix/access-lists (IPv4 by default). .It Fl A diff --git a/bgpq3.c b/bgpq3.c index d424157..a4d3799 100644 --- a/bgpq3.c +++ b/bgpq3.c @@ -24,8 +24,9 @@ int usage(int ecode) { printf("\nUsage: bgpq3 [-h host] [-S sources] [-P|E|G |f ]" - " [-36ADJjXd] [-R len] ...\n"); + " [-346ADJjXd] [-R len] ...\n"); printf(" -3 : assume that your device is asn32-safe\n"); + printf(" -4 : generate IPv4 prefix-lists (default)\n"); printf(" -6 : generate IPv6 prefix-lists (IPv4 by default)\n"); printf(" -A : try to aggregate Cisco prefix-lists or Juniper " "route-filters\n as much as possible\n"); @@ -112,19 +113,32 @@ main(int argc, char* argv[]) { int c; struct bgpq_expander expander; - int af=AF_INET; + int af=AF_INET, selectedipv4 = 0; int widthSet=0, aggregate=0, refine=0; unsigned long maxlen=0; bgpq_expander_init(&expander,af); expander.sources=getenv("IRRD_SOURCES"); - while((c=getopt(argc,argv,"36AdDES:jJf:l:m:M:W:PR:G:Th:X"))!=EOF) { + while((c=getopt(argc,argv,"346AdDES:jJf:l:m:M:W:PR:G:Th:X"))!=EOF) { switch(c) { case '3': expander.asn32=1; break; - case '6': af=AF_INET6; + case '4': + /* do nothing, expander already configured for IPv4 */ + if (expander.family == AF_INET6) { + sx_report(SX_FATAL, "-4 and -6 are mutually exclusive\n"); + exit(1); + }; + selectedipv4=1; + break; + case '6': + if (selectedipv4) { + sx_report(SX_FATAL, "-4 and -6 are mutually exclusive\n"); + exit(1); + }; + af=AF_INET6; expander.family=AF_INET6; expander.tree->family=AF_INET6; break; diff --git a/bgpq_expander.c b/bgpq_expander.c index 0f27ac0..f99846a 100644 --- a/bgpq_expander.c +++ b/bgpq_expander.c @@ -694,9 +694,8 @@ bgpq_expand(struct bgpq_expander* b) }; }; - write(fd,"!q\n",3); - shutdown(fd,SHUT_RDWR); - close(fd); + fwrite("!q\n",1,3,f); + fclose(f); return 1; }; diff --git a/configure b/configure index d925534..5cc2828 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.19. +# Generated by GNU Autoconf 2.69 for bgpq3 0.1.20. # # Report bugs to . # @@ -579,8 +579,8 @@ MAKEFLAGS= # Identity of this package. PACKAGE_NAME='bgpq3' PACKAGE_TARNAME='bgpq3' -PACKAGE_VERSION='0.1.19' -PACKAGE_STRING='bgpq3 0.1.19' +PACKAGE_VERSION='0.1.20' +PACKAGE_STRING='bgpq3 0.1.20' PACKAGE_BUGREPORT='snar@snar.spb.ru' PACKAGE_URL='' @@ -1186,7 +1186,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.19 to adapt to many kinds of systems. +\`configure' configures bgpq3 0.1.20 to adapt to many kinds of systems. Usage: $0 [OPTION]... [VAR=VALUE]... @@ -1247,7 +1247,7 @@ fi if test -n "$ac_init_help"; then case $ac_init_help in - short | recursive ) echo "Configuration of bgpq3 0.1.19:";; + short | recursive ) echo "Configuration of bgpq3 0.1.20:";; esac cat <<\_ACEOF @@ -1326,7 +1326,7 @@ fi test -n "$ac_init_help" && exit $ac_status if $ac_init_version; then cat <<\_ACEOF -bgpq3 configure 0.1.19 +bgpq3 configure 0.1.20 generated by GNU Autoconf 2.69 Copyright (C) 2012 Free Software Foundation, Inc. @@ -1494,7 +1494,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.19, which was +It was created by bgpq3 $as_me 0.1.20, which was generated by GNU Autoconf 2.69. Invocation command line was $ $0 $@ @@ -3368,7 +3368,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.19, which was +This file was extended by bgpq3 $as_me 0.1.20, which was generated by GNU Autoconf 2.69. Invocation command line was CONFIG_FILES = $CONFIG_FILES @@ -3430,7 +3430,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.19 +bgpq3 config.status 0.1.20 configured by $0, generated by GNU Autoconf 2.69, with options \\"\$ac_cs_config\\" diff --git a/configure.in b/configure.in index 9b31af1..1301c6d 100644 --- a/configure.in +++ b/configure.in @@ -1,4 +1,4 @@ -AC_INIT(bgpq3,0.1.19,snar@snar.spb.ru) +AC_INIT(bgpq3,0.1.20,snar@snar.spb.ru) AC_CONFIG_HEADER(config.h) AC_PROG_CC AC_PROG_INSTALL