summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorclaudio <claudio@openbsd.org>2010-03-08 17:02:19 +0000
committerclaudio <claudio@openbsd.org>2010-03-08 17:02:19 +0000
commitec8f8491dd5e77e76671652352aa407addef0a50 (patch)
tree9d686737e83ce5a8a603c2b3927bafceee775f31
parentUse properly initialised sockaddr_in/sockaddr_in6 struct when performing (diff)
downloadwireguard-openbsd-ec8f8491dd5e77e76671652352aa407addef0a50.tar.xz
wireguard-openbsd-ec8f8491dd5e77e76671652352aa407addef0a50.zip
res.flags is not only used by the irrfilter so initializing them with
irrfilter flags is causing strange behaviour on other commands (like show fib). Set the IPV4 and IPV6 flags at the end unless one of them got already set. OK henning, sthen, deraadt
-rw-r--r--usr.sbin/bgpctl/bgpctl.c7
-rw-r--r--usr.sbin/bgpctl/parser.c3
2 files changed, 6 insertions, 4 deletions
diff --git a/usr.sbin/bgpctl/bgpctl.c b/usr.sbin/bgpctl/bgpctl.c
index 36b892053d2..22b0933d55d 100644
--- a/usr.sbin/bgpctl/bgpctl.c
+++ b/usr.sbin/bgpctl/bgpctl.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: bgpctl.c,v 1.156 2010/02/11 12:25:12 claudio Exp $ */
+/* $OpenBSD: bgpctl.c,v 1.157 2010/03/08 17:02:19 claudio Exp $ */
/*
* Copyright (c) 2003 Henning Brauer <henning@openbsd.org>
@@ -127,8 +127,11 @@ main(int argc, char *argv[])
if ((res = parse(argc, argv)) == NULL)
exit(1);
- if (res->action == IRRFILTER)
+ if (res->action == IRRFILTER) {
+ if (!(res->flags & (F_IPV4|F_IPV6)))
+ res->flags |= (F_IPV4|F_IPV6);
irr_main(res->as.as, res->flags, res->irr_outdir);
+ }
memcpy(&neighbor.addr, &res->peeraddr, sizeof(neighbor.addr));
strlcpy(neighbor.descr, res->peerdesc, sizeof(neighbor.descr));
diff --git a/usr.sbin/bgpctl/parser.c b/usr.sbin/bgpctl/parser.c
index 52499e9bcfa..f1f560d97d0 100644
--- a/usr.sbin/bgpctl/parser.c
+++ b/usr.sbin/bgpctl/parser.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: parser.c,v 1.60 2010/01/13 06:04:00 claudio Exp $ */
+/* $OpenBSD: parser.c,v 1.61 2010/03/08 17:02:19 claudio Exp $ */
/*
* Copyright (c) 2003, 2004 Henning Brauer <henning@openbsd.org>
@@ -344,7 +344,6 @@ 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));