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

-4 option added. Thanks to Martin J. Levy.

This commit is contained in:
Alexandre Snarskii
2013-10-07 18:24:27 +04:00
parent 9e9ba20de2
commit 7e662857d9
5 changed files with 33 additions and 7 deletions

4
.gitignore vendored
View File

@@ -1,3 +1,7 @@
CVS/ CVS/
Makefile Makefile
config.h config.h
*.o
bgpq3
config.log
config.status

View File

@@ -1,5 +1,7 @@
0.1.20 (2013-10-07) 0.1.20-todo (2013-10-07)
- socket close code fixed. Thanks to Martin J. Levy. - 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) 0.1.19 (2013-05-09)
- CLANG compilation issues fixed. - CLANG compilation issues fixed.

View File

@@ -34,6 +34,10 @@ The options are as follows:
> assume that your device is asn32-capable. > assume that your device is asn32-capable.
- -4
> generate IPv4 prefix/access-lists (default).
- -6 - -6
> generate IPv6 prefix/access-lists (IPv4 by default). > generate IPv6 prefix/access-lists (IPv4 by default).

View File

@@ -1,4 +1,4 @@
.\" Copyright (c) 2007-2011 Alexandre Snarskii .\" Copyright (c) 2007-2013 Alexandre Snarskii
.\" All rights reserved. .\" All rights reserved.
.\" .\"
.\" Redistribution and use in source and binary forms, with or without .\" Redistribution and use in source and binary forms, with or without
@@ -38,7 +38,7 @@
.Fl f Ar asn | .Fl f Ar asn |
.Fl G Ar asn .Fl G Ar asn
.Oc .Oc
.Op Fl 36ADdJjX .Op Fl 346ADdJjX
.Op Fl R Ar len .Op Fl R Ar len
.Op Fl m Ar max .Op Fl m Ar max
.Ar OBJECTS .Ar OBJECTS
@@ -53,6 +53,8 @@ The options are as follows:
.Bl -tag -width Ds .Bl -tag -width Ds
.It Fl 3 .It Fl 3
assume that your device is asn32-safe. assume that your device is asn32-safe.
.It Fl 4
generate IPv4 prefix/access-lists (default).
.It Fl 6 .It Fl 6
generate IPv6 prefix/access-lists (IPv4 by default). generate IPv6 prefix/access-lists (IPv4 by default).
.It Fl A .It Fl A

22
bgpq3.c
View File

@@ -24,8 +24,9 @@ int
usage(int ecode) usage(int ecode)
{ {
printf("\nUsage: bgpq3 [-h host] [-S sources] [-P|E|G <num>|f <num>]" printf("\nUsage: bgpq3 [-h host] [-S sources] [-P|E|G <num>|f <num>]"
" [-36ADJjXd] [-R len] <OBJECTS>...\n"); " [-346ADJjXd] [-R len] <OBJECTS>...\n");
printf(" -3 : assume that your device is asn32-safe\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(" -6 : generate IPv6 prefix-lists (IPv4 by default)\n");
printf(" -A : try to aggregate Cisco prefix-lists or Juniper " printf(" -A : try to aggregate Cisco prefix-lists or Juniper "
"route-filters\n as much as possible\n"); "route-filters\n as much as possible\n");
@@ -112,19 +113,32 @@ main(int argc, char* argv[])
{ {
int c; int c;
struct bgpq_expander expander; struct bgpq_expander expander;
int af=AF_INET; int af=AF_INET, selectedipv4 = 0;
int widthSet=0, aggregate=0, refine=0; int widthSet=0, aggregate=0, refine=0;
unsigned long maxlen=0; unsigned long maxlen=0;
bgpq_expander_init(&expander,af); bgpq_expander_init(&expander,af);
expander.sources=getenv("IRRD_SOURCES"); 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) { switch(c) {
case '3': case '3':
expander.asn32=1; expander.asn32=1;
break; 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.family=AF_INET6;
expander.tree->family=AF_INET6; expander.tree->family=AF_INET6;
break; break;