summaryrefslogtreecommitdiff
path: root/usr.sbin/bgpctl/parser.c
diff options
context:
space:
mode:
authorStuart Henderson <sthen@cvs.openbsd.org>2009-09-08 16:11:37 +0000
committerStuart Henderson <sthen@cvs.openbsd.org>2009-09-08 16:11:37 +0000
commit202030fc169db12100b9f53a1b16bfb686d53034 (patch)
tree93e7dd1d7e8d374b7884622c56f0088e062567f8 /usr.sbin/bgpctl/parser.c
parent8d8c0a2391f308d5be9d53997dd3b209abc4112d (diff)
Add -4 and -6 flags to irrfilter mode, allowing you to only fetch (you
guessed it) v4 or v6 from the IRR. Reduces size of the filter file (and thus router resource use) when you only speak IPv4 but you want to filter peers who announce lots of v6 space. ok claudio@
Diffstat (limited to 'usr.sbin/bgpctl/parser.c')
-rw-r--r--usr.sbin/bgpctl/parser.c11
1 files changed, 9 insertions, 2 deletions
diff --git a/usr.sbin/bgpctl/parser.c b/usr.sbin/bgpctl/parser.c
index 646f26a4598..423e997e7c4 100644
--- a/usr.sbin/bgpctl/parser.c
+++ b/usr.sbin/bgpctl/parser.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: parser.c,v 1.55 2009/08/31 10:17:35 claudio Exp $ */
+/* $OpenBSD: parser.c,v 1.56 2009/09/08 16:11:36 sthen Exp $ */
/*
* Copyright (c) 2003, 2004 Henning Brauer <henning@openbsd.org>
@@ -336,6 +336,7 @@ parse(int argc, char *argv[])
bzero(&res, sizeof(res));
res.community.as = COMMUNITY_UNSET;
res.community.type = COMMUNITY_UNSET;
+ res.flags = (F_IPV4 | F_IPV6);
TAILQ_INIT(&res.set);
if ((res.irr_outdir = getcwd(NULL, 0)) == NULL) {
fprintf(stderr, "getcwd failed: %s", strerror(errno));
@@ -882,8 +883,14 @@ bgpctl_getopt(int *argc, char **argv[], int type)
int ch;
optind = optreset = 1;
- while ((ch = getopt((*argc) + 1, (*argv) - 1, "o:")) != -1) {
+ while ((ch = getopt((*argc) + 1, (*argv) - 1, "46o:")) != -1) {
switch (ch) {
+ case '4':
+ res.flags = (res.flags | F_IPV4) & ~F_IPV6;
+ break;
+ case '6':
+ res.flags = (res.flags | F_IPV6) & ~F_IPV4;
+ break;
case 'o':
res.irr_outdir = optarg;
break;