mirror of
https://github.com/bgp/bgpq4.git
synced 2024-05-11 05:55:05 +00:00
-s option is back again, for prefix-lists
This commit is contained in:
6
CHANGES
6
CHANGES
@@ -1,4 +1,8 @@
|
|||||||
0.1.32-rc2 (2015-06-28)
|
0.1.32-rc3 (2015-07-01)
|
||||||
|
- feature: option -s can be used to generate sequence numbers in IOS
|
||||||
|
prefix-lists
|
||||||
|
|
||||||
|
0.1.32-rc2 (2015-07-01)
|
||||||
- bugfix: when no sources provided in command line and via IRRD_SOURCES env,
|
- bugfix: when no sources provided in command line and via IRRD_SOURCES env,
|
||||||
no source limitation were sent to IRRd. Thanks to Mikhail A. Grishin.
|
no source limitation were sent to IRRd. Thanks to Mikhail A. Grishin.
|
||||||
|
|
||||||
|
|||||||
@@ -7,7 +7,7 @@ SYNOPSIS
|
|||||||
--------
|
--------
|
||||||
|
|
||||||
```
|
```
|
||||||
bgpq3 [-h host] [-S sources] [-EP] [-f asn | -G asn] [-2346AbDdJjpX] [-r len] [-R len] [-m max] [-W len] OBJECTS [...]
|
bgpq3 [-h host] [-S sources] [-EP] [-f asn | -G asn] [-2346AbDdJjpsX] [-r len] [-R len] [-m max] [-W len] OBJECTS [...]
|
||||||
```
|
```
|
||||||
|
|
||||||
DESCRIPTION
|
DESCRIPTION
|
||||||
@@ -104,6 +104,10 @@ Allow more-specific routes with masklen starting with specified length.
|
|||||||
Allow more-specific routes up to specified masklen too. (Please, note: objects
|
Allow more-specific routes up to specified masklen too. (Please, note: objects
|
||||||
with prefix-length greater than specified length will be always allowed.)
|
with prefix-length greater than specified length will be always allowed.)
|
||||||
|
|
||||||
|
#### -s
|
||||||
|
|
||||||
|
Generate sequence numbers in IOS-style prefix-lists.
|
||||||
|
|
||||||
#### -S `sources`
|
#### -S `sources`
|
||||||
|
|
||||||
Use specified sources only (default: RADB,RIPE,APNIC).
|
Use specified sources only (default: RADB,RIPE,APNIC).
|
||||||
|
|||||||
2
bgpq3.8
2
bgpq3.8
@@ -93,6 +93,8 @@ generate prefix-list (default, backward compatibility).
|
|||||||
allow more specific routes starting with specified masklen too.
|
allow more specific routes starting with specified masklen too.
|
||||||
.It Fl R Ar len
|
.It Fl R Ar len
|
||||||
allow more specific routes up to specified masklen too.
|
allow more specific routes up to specified masklen too.
|
||||||
|
.It Fl s
|
||||||
|
generate sequence numbers in IOS-style prefix-lists.
|
||||||
.It Fl S Ar sources
|
.It Fl S Ar sources
|
||||||
use specified sources only (default: RADB,RIPE,APNIC).
|
use specified sources only (default: RADB,RIPE,APNIC).
|
||||||
.It Fl T
|
.It Fl T
|
||||||
|
|||||||
17
bgpq3.c
17
bgpq3.c
@@ -54,6 +54,7 @@ usage(int ecode)
|
|||||||
" compatibility)\n");
|
" compatibility)\n");
|
||||||
printf(" -r len : allow more specific routes from masklen specified\n");
|
printf(" -r len : allow more specific routes from masklen specified\n");
|
||||||
printf(" -R len : allow more specific routes up to specified masklen\n");
|
printf(" -R len : allow more specific routes up to specified masklen\n");
|
||||||
|
printf(" -s : generate sequence numbers in prefix-lists (IOS only)\n");
|
||||||
printf(" -S sources: use only specified sources (default:"
|
printf(" -S sources: use only specified sources (default:"
|
||||||
" RADB,RIPE,APNIC)\n");
|
" RADB,RIPE,APNIC)\n");
|
||||||
printf(" -T : disable pipelining (experimental, faster mode)\n");
|
printf(" -T : disable pipelining (experimental, faster mode)\n");
|
||||||
@@ -129,7 +130,7 @@ main(int argc, char* argv[])
|
|||||||
if (getenv("IRRD_SOURCES"))
|
if (getenv("IRRD_SOURCES"))
|
||||||
expander.sources=getenv("IRRD_SOURCES");
|
expander.sources=getenv("IRRD_SOURCES");
|
||||||
|
|
||||||
while((c=getopt(argc,argv,"2346AbdDES:jJf:l:m:M:W:Ppr:R:G:Th:X"))!=EOF) {
|
while((c=getopt(argc,argv,"2346AbdDES:jJf:l:m:M:W:Ppr:R:G:Th:Xs"))!=EOF) {
|
||||||
switch(c) {
|
switch(c) {
|
||||||
case '2':
|
case '2':
|
||||||
expand_as23456=1;
|
expand_as23456=1;
|
||||||
@@ -248,6 +249,8 @@ main(int argc, char* argv[])
|
|||||||
break;
|
break;
|
||||||
case 'T': pipelining=0;
|
case 'T': pipelining=0;
|
||||||
break;
|
break;
|
||||||
|
case 's': expander.sequence=1;
|
||||||
|
break;
|
||||||
case 'S': expander.sources=optarg;
|
case 'S': expander.sources=optarg;
|
||||||
break;
|
break;
|
||||||
case 'W': expander.aswidth=atoi(optarg);
|
case 'W': expander.aswidth=atoi(optarg);
|
||||||
@@ -326,6 +329,18 @@ main(int argc, char* argv[])
|
|||||||
exit(1);
|
exit(1);
|
||||||
};
|
};
|
||||||
|
|
||||||
|
if (expander.sequence && expander.vendor!=V_CISCO) {
|
||||||
|
sx_report(SX_FATAL, "Sorry, prefix-lists sequencing (-s) supported"
|
||||||
|
" only for IOS\n");
|
||||||
|
exit(1);
|
||||||
|
};
|
||||||
|
|
||||||
|
if (expander.sequence && expander.generation<T_PREFIXLIST) {
|
||||||
|
sx_report(SX_FATAL, "Sorry, prefix-lists sequencing (-s) can't be "
|
||||||
|
" used for non prefix-list\n");
|
||||||
|
exit(1);
|
||||||
|
};
|
||||||
|
|
||||||
if(refineLow && !refine) {
|
if(refineLow && !refine) {
|
||||||
if(expander.family == AF_INET)
|
if(expander.family == AF_INET)
|
||||||
refine = 32;
|
refine = 32;
|
||||||
|
|||||||
1
bgpq3.h
1
bgpq3.h
@@ -40,6 +40,7 @@ struct bgpq_expander {
|
|||||||
bgpq_vendor_t vendor;
|
bgpq_vendor_t vendor;
|
||||||
bgpq_gen_t generation;
|
bgpq_gen_t generation;
|
||||||
int identify;
|
int identify;
|
||||||
|
int sequence;
|
||||||
unsigned char asn32;
|
unsigned char asn32;
|
||||||
unsigned char* asn32s[65536];
|
unsigned char* asn32s[65536];
|
||||||
struct bgpq_prequest* firstpipe, *lastpipe;
|
struct bgpq_prequest* firstpipe, *lastpipe;
|
||||||
|
|||||||
@@ -408,28 +408,32 @@ checkSon:
|
|||||||
|
|
||||||
|
|
||||||
static char* bname=NULL;
|
static char* bname=NULL;
|
||||||
|
static int seq=0;
|
||||||
|
|
||||||
void
|
void
|
||||||
bgpq3_print_cprefix(struct sx_radix_node* n, void* ff)
|
bgpq3_print_cprefix(struct sx_radix_node* n, void* ff)
|
||||||
{
|
{
|
||||||
char prefix[128];
|
char prefix[128], seqno[16]="";
|
||||||
FILE* f=(FILE*)ff;
|
FILE* f=(FILE*)ff;
|
||||||
if(!f) f=stdout;
|
if(!f) f=stdout;
|
||||||
if(n->isGlue) goto checkSon;
|
if(n->isGlue) goto checkSon;
|
||||||
sx_prefix_snprintf(&n->prefix,prefix,sizeof(prefix));
|
sx_prefix_snprintf(&n->prefix,prefix,sizeof(prefix));
|
||||||
|
if(seq)
|
||||||
|
snprintf(seqno, sizeof(seqno), " seq %i", seq++);
|
||||||
if(n->isAggregate) {
|
if(n->isAggregate) {
|
||||||
if(n->aggregateLow>n->prefix.masklen) {
|
if(n->aggregateLow>n->prefix.masklen) {
|
||||||
fprintf(f,"%s prefix-list %s permit %s ge %u le %u\n",
|
fprintf(f,"%s prefix-list %s%s permit %s ge %u le %u\n",
|
||||||
n->prefix.family==AF_INET?"ip":"ipv6",bname?bname:"NN",prefix,
|
n->prefix.family==AF_INET?"ip":"ipv6",bname?bname:"NN",seqno,
|
||||||
n->aggregateLow,n->aggregateHi);
|
prefix,n->aggregateLow,n->aggregateHi);
|
||||||
} else {
|
} else {
|
||||||
fprintf(f,"%s prefix-list %s permit %s le %u\n",
|
fprintf(f,"%s prefix-list %s%s permit %s le %u\n",
|
||||||
n->prefix.family==AF_INET?"ip":"ipv6",bname?bname:"NN",prefix,
|
n->prefix.family==AF_INET?"ip":"ipv6",bname?bname:"NN",seqno,
|
||||||
n->aggregateHi);
|
prefix,n->aggregateHi);
|
||||||
};
|
};
|
||||||
} else {
|
} else {
|
||||||
fprintf(f,"%s prefix-list %s permit %s\n",
|
fprintf(f,"%s prefix-list %s%s permit %s\n",
|
||||||
(n->prefix.family==AF_INET)?"ip":"ipv6",bname?bname:"NN",prefix);
|
(n->prefix.family==AF_INET)?"ip":"ipv6",bname?bname:"NN",seqno,
|
||||||
|
prefix);
|
||||||
};
|
};
|
||||||
checkSon:
|
checkSon:
|
||||||
if(n->son)
|
if(n->son)
|
||||||
@@ -570,6 +574,7 @@ int
|
|||||||
bgpq3_print_cisco_prefixlist(FILE* f, struct bgpq_expander* b)
|
bgpq3_print_cisco_prefixlist(FILE* f, struct bgpq_expander* b)
|
||||||
{
|
{
|
||||||
bname=b->name ? b->name : "NN";
|
bname=b->name ? b->name : "NN";
|
||||||
|
seq=b->sequence;
|
||||||
fprintf(f,"no %s prefix-list %s\n",
|
fprintf(f,"no %s prefix-list %s\n",
|
||||||
(b->family==AF_INET)?"ip":"ipv6",bname);
|
(b->family==AF_INET)?"ip":"ipv6",bname);
|
||||||
if (!sx_radix_tree_empty(b->tree)) {
|
if (!sx_radix_tree_empty(b->tree)) {
|
||||||
|
|||||||
18
configure
vendored
18
configure
vendored
@@ -1,6 +1,6 @@
|
|||||||
#! /bin/sh
|
#! /bin/sh
|
||||||
# Guess values for system-dependent variables and create Makefiles.
|
# Guess values for system-dependent variables and create Makefiles.
|
||||||
# Generated by GNU Autoconf 2.69 for bgpq3 0.1.32-rc2.
|
# Generated by GNU Autoconf 2.69 for bgpq3 0.1.32-rc3.
|
||||||
#
|
#
|
||||||
# Report bugs to <snar@snar.spb.ru>.
|
# Report bugs to <snar@snar.spb.ru>.
|
||||||
#
|
#
|
||||||
@@ -579,8 +579,8 @@ MAKEFLAGS=
|
|||||||
# Identity of this package.
|
# Identity of this package.
|
||||||
PACKAGE_NAME='bgpq3'
|
PACKAGE_NAME='bgpq3'
|
||||||
PACKAGE_TARNAME='bgpq3'
|
PACKAGE_TARNAME='bgpq3'
|
||||||
PACKAGE_VERSION='0.1.32-rc2'
|
PACKAGE_VERSION='0.1.32-rc3'
|
||||||
PACKAGE_STRING='bgpq3 0.1.32-rc2'
|
PACKAGE_STRING='bgpq3 0.1.32-rc3'
|
||||||
PACKAGE_BUGREPORT='snar@snar.spb.ru'
|
PACKAGE_BUGREPORT='snar@snar.spb.ru'
|
||||||
PACKAGE_URL=''
|
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.
|
# 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.
|
# This message is too long to be a string in the A/UX 3.1 sh.
|
||||||
cat <<_ACEOF
|
cat <<_ACEOF
|
||||||
\`configure' configures bgpq3 0.1.32-rc2 to adapt to many kinds of systems.
|
\`configure' configures bgpq3 0.1.32-rc3 to adapt to many kinds of systems.
|
||||||
|
|
||||||
Usage: $0 [OPTION]... [VAR=VALUE]...
|
Usage: $0 [OPTION]... [VAR=VALUE]...
|
||||||
|
|
||||||
@@ -1248,7 +1248,7 @@ fi
|
|||||||
|
|
||||||
if test -n "$ac_init_help"; then
|
if test -n "$ac_init_help"; then
|
||||||
case $ac_init_help in
|
case $ac_init_help in
|
||||||
short | recursive ) echo "Configuration of bgpq3 0.1.32-rc2:";;
|
short | recursive ) echo "Configuration of bgpq3 0.1.32-rc3:";;
|
||||||
esac
|
esac
|
||||||
cat <<\_ACEOF
|
cat <<\_ACEOF
|
||||||
|
|
||||||
@@ -1327,7 +1327,7 @@ fi
|
|||||||
test -n "$ac_init_help" && exit $ac_status
|
test -n "$ac_init_help" && exit $ac_status
|
||||||
if $ac_init_version; then
|
if $ac_init_version; then
|
||||||
cat <<\_ACEOF
|
cat <<\_ACEOF
|
||||||
bgpq3 configure 0.1.32-rc2
|
bgpq3 configure 0.1.32-rc3
|
||||||
generated by GNU Autoconf 2.69
|
generated by GNU Autoconf 2.69
|
||||||
|
|
||||||
Copyright (C) 2012 Free Software Foundation, Inc.
|
Copyright (C) 2012 Free Software Foundation, Inc.
|
||||||
@@ -1495,7 +1495,7 @@ cat >config.log <<_ACEOF
|
|||||||
This file contains any messages produced by compilers while
|
This file contains any messages produced by compilers while
|
||||||
running configure, to aid debugging if configure makes a mistake.
|
running configure, to aid debugging if configure makes a mistake.
|
||||||
|
|
||||||
It was created by bgpq3 $as_me 0.1.32-rc2, which was
|
It was created by bgpq3 $as_me 0.1.32-rc3, which was
|
||||||
generated by GNU Autoconf 2.69. Invocation command line was
|
generated by GNU Autoconf 2.69. Invocation command line was
|
||||||
|
|
||||||
$ $0 $@
|
$ $0 $@
|
||||||
@@ -3413,7 +3413,7 @@ cat >>$CONFIG_STATUS <<\_ACEOF || ac_write_fail=1
|
|||||||
# report actual input values of CONFIG_FILES etc. instead of their
|
# report actual input values of CONFIG_FILES etc. instead of their
|
||||||
# values after options handling.
|
# values after options handling.
|
||||||
ac_log="
|
ac_log="
|
||||||
This file was extended by bgpq3 $as_me 0.1.32-rc2, which was
|
This file was extended by bgpq3 $as_me 0.1.32-rc3, which was
|
||||||
generated by GNU Autoconf 2.69. Invocation command line was
|
generated by GNU Autoconf 2.69. Invocation command line was
|
||||||
|
|
||||||
CONFIG_FILES = $CONFIG_FILES
|
CONFIG_FILES = $CONFIG_FILES
|
||||||
@@ -3475,7 +3475,7 @@ _ACEOF
|
|||||||
cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1
|
cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1
|
||||||
ac_cs_config="`$as_echo "$ac_configure_args" | sed 's/^ //; s/[\\""\`\$]/\\\\&/g'`"
|
ac_cs_config="`$as_echo "$ac_configure_args" | sed 's/^ //; s/[\\""\`\$]/\\\\&/g'`"
|
||||||
ac_cs_version="\\
|
ac_cs_version="\\
|
||||||
bgpq3 config.status 0.1.32-rc2
|
bgpq3 config.status 0.1.32-rc3
|
||||||
configured by $0, generated by GNU Autoconf 2.69,
|
configured by $0, generated by GNU Autoconf 2.69,
|
||||||
with options \\"\$ac_cs_config\\"
|
with options \\"\$ac_cs_config\\"
|
||||||
|
|
||||||
|
|||||||
@@ -1,4 +1,4 @@
|
|||||||
AC_INIT(bgpq3,0.1.32-rc2,snar@snar.spb.ru)
|
AC_INIT(bgpq3,0.1.32-rc3,snar@snar.spb.ru)
|
||||||
AC_CONFIG_HEADER(config.h)
|
AC_CONFIG_HEADER(config.h)
|
||||||
AC_PROG_CC
|
AC_PROG_CC
|
||||||
AC_PROG_INSTALL
|
AC_PROG_INSTALL
|
||||||
|
|||||||
Reference in New Issue
Block a user