summaryrefslogtreecommitdiffstats
path: root/usr.sbin/bgpctl/parser.c
diff options
context:
space:
mode:
authorsthen <sthen@openbsd.org>2009-09-08 16:11:36 +0000
committersthen <sthen@openbsd.org>2009-09-08 16:11:36 +0000
commita4fc69eb825480c25b1d68ad9153799a16788afc (patch)
treef88e41ae4fabe10a3cd7c87c61235fd06d73462c /usr.sbin/bgpctl/parser.c
parentUpdate to tzdata2009m from elsie.nci.nih.gov (diff)
downloadwireguard-openbsd-a4fc69eb825480c25b1d68ad9153799a16788afc.tar.xz
wireguard-openbsd-a4fc69eb825480c25b1d68ad9153799a16788afc.zip
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;