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,
|
||||
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
|
||||
@ -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
|
||||
with prefix-length greater than specified length will be always allowed.)
|
||||
|
||||
#### -s
|
||||
|
||||
Generate sequence numbers in IOS-style prefix-lists.
|
||||
|
||||
#### -S `sources`
|
||||
|
||||
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.
|
||||
.It Fl R Ar len
|
||||
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
|
||||
use specified sources only (default: RADB,RIPE,APNIC).
|
||||
.It Fl T
|
||||
|
17
bgpq3.c
17
bgpq3.c
@ -54,6 +54,7 @@ usage(int ecode)
|
||||
" compatibility)\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(" -s : generate sequence numbers in prefix-lists (IOS only)\n");
|
||||
printf(" -S sources: use only specified sources (default:"
|
||||
" RADB,RIPE,APNIC)\n");
|
||||
printf(" -T : disable pipelining (experimental, faster mode)\n");
|
||||
@ -129,7 +130,7 @@ main(int argc, char* argv[])
|
||||
if (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) {
|
||||
case '2':
|
||||
expand_as23456=1;
|
||||
@ -248,6 +249,8 @@ main(int argc, char* argv[])
|
||||
break;
|
||||
case 'T': pipelining=0;
|
||||
break;
|
||||
case 's': expander.sequence=1;
|
||||
break;
|
||||
case 'S': expander.sources=optarg;
|
||||
break;
|
||||
case 'W': expander.aswidth=atoi(optarg);
|
||||
@ -326,6 +329,18 @@ main(int argc, char* argv[])
|
||||
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(expander.family == AF_INET)
|
||||
refine = 32;
|
||||
|
1
bgpq3.h
1
bgpq3.h
@ -40,6 +40,7 @@ struct bgpq_expander {
|
||||
bgpq_vendor_t vendor;
|
||||
bgpq_gen_t generation;
|
||||
int identify;
|
||||
int sequence;
|
||||
unsigned char asn32;
|
||||
unsigned char* asn32s[65536];
|
||||
struct bgpq_prequest* firstpipe, *lastpipe;
|
||||
|
@ -408,28 +408,32 @@ checkSon:
|
||||
|
||||
|
||||
static char* bname=NULL;
|
||||
static int seq=0;
|
||||
|
||||
void
|
||||
bgpq3_print_cprefix(struct sx_radix_node* n, void* ff)
|
||||
{
|
||||
char prefix[128];
|
||||
char prefix[128], seqno[16]="";
|
||||
FILE* f=(FILE*)ff;
|
||||
if(!f) f=stdout;
|
||||
if(n->isGlue) goto checkSon;
|
||||
sx_prefix_snprintf(&n->prefix,prefix,sizeof(prefix));
|
||||
if(seq)
|
||||
snprintf(seqno, sizeof(seqno), " seq %i", seq++);
|
||||
if(n->isAggregate) {
|
||||
if(n->aggregateLow>n->prefix.masklen) {
|
||||
fprintf(f,"%s prefix-list %s permit %s ge %u le %u\n",
|
||||
n->prefix.family==AF_INET?"ip":"ipv6",bname?bname:"NN",prefix,
|
||||
n->aggregateLow,n->aggregateHi);
|
||||
fprintf(f,"%s prefix-list %s%s permit %s ge %u le %u\n",
|
||||
n->prefix.family==AF_INET?"ip":"ipv6",bname?bname:"NN",seqno,
|
||||
prefix,n->aggregateLow,n->aggregateHi);
|
||||
} else {
|
||||
fprintf(f,"%s prefix-list %s permit %s le %u\n",
|
||||
n->prefix.family==AF_INET?"ip":"ipv6",bname?bname:"NN",prefix,
|
||||
n->aggregateHi);
|
||||
fprintf(f,"%s prefix-list %s%s permit %s le %u\n",
|
||||
n->prefix.family==AF_INET?"ip":"ipv6",bname?bname:"NN",seqno,
|
||||
prefix,n->aggregateHi);
|
||||
};
|
||||
} else {
|
||||
fprintf(f,"%s prefix-list %s permit %s\n",
|
||||
(n->prefix.family==AF_INET)?"ip":"ipv6",bname?bname:"NN",prefix);
|
||||
fprintf(f,"%s prefix-list %s%s permit %s\n",
|
||||
(n->prefix.family==AF_INET)?"ip":"ipv6",bname?bname:"NN",seqno,
|
||||
prefix);
|
||||
};
|
||||
checkSon:
|
||||
if(n->son)
|
||||
@ -570,6 +574,7 @@ int
|
||||
bgpq3_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)) {
|
||||
|
18
configure
vendored
18
configure
vendored
@ -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-rc2.
|
||||
# Generated by GNU Autoconf 2.69 for bgpq3 0.1.32-rc3.
|
||||
#
|
||||
# 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-rc2'
|
||||
PACKAGE_STRING='bgpq3 0.1.32-rc2'
|
||||
PACKAGE_VERSION='0.1.32-rc3'
|
||||
PACKAGE_STRING='bgpq3 0.1.32-rc3'
|
||||
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-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]...
|
||||
|
||||
@ -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-rc2:";;
|
||||
short | recursive ) echo "Configuration of bgpq3 0.1.32-rc3:";;
|
||||
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-rc2
|
||||
bgpq3 configure 0.1.32-rc3
|
||||
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-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
|
||||
|
||||
$ $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-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
|
||||
|
||||
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-rc2
|
||||
bgpq3 config.status 0.1.32-rc3
|
||||
configured by $0, generated by GNU Autoconf 2.69,
|
||||
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_PROG_CC
|
||||
AC_PROG_INSTALL
|
||||
|
Reference in New Issue
Block a user