summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorClaudio Jeker <claudio@cvs.openbsd.org>2005-12-30 23:13:45 +0000
committerClaudio Jeker <claudio@cvs.openbsd.org>2005-12-30 23:13:45 +0000
commit3688d389f67751b482ed49a87b627504b1af6227 (patch)
tree75fac99451b55c99198035a60a62913319a2ef3b
parentaaf04e4e4f0096edc118e01161b39850155c3a3b (diff)
Fix parse_prefix() for IPv4 addresses. Looks like fallout after IPv6 addition.
Now bgpctl show rib 129.128.5.191 works again.
-rw-r--r--usr.sbin/bgpctl/parser.c6
1 files changed, 2 insertions, 4 deletions
diff --git a/usr.sbin/bgpctl/parser.c b/usr.sbin/bgpctl/parser.c
index 33cdbfb7fa2..0124338126c 100644
--- a/usr.sbin/bgpctl/parser.c
+++ b/usr.sbin/bgpctl/parser.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: parser.c,v 1.23 2005/11/29 20:41:30 claudio Exp $ */
+/* $OpenBSD: parser.c,v 1.24 2005/12/30 23:13:44 claudio Exp $ */
/*
* Copyright (c) 2003, 2004 Henning Brauer <henning@openbsd.org>
@@ -533,7 +533,6 @@ parse_addr(const char *word, struct bgpd_addr *addr)
int
parse_prefix(const char *word, struct bgpd_addr *addr, u_int8_t *prefixlen)
{
- struct in_addr ina;
char *p, *ps;
const char *errstr;
int mask = -1;
@@ -542,7 +541,6 @@ parse_prefix(const char *word, struct bgpd_addr *addr, u_int8_t *prefixlen)
return (0);
bzero(addr, sizeof(struct bgpd_addr));
- bzero(&ina, sizeof(ina));
if ((p = strrchr(word, '/')) != NULL) {
mask = strtonum(p + 1, 0, 128, &errstr);
@@ -567,7 +565,7 @@ parse_prefix(const char *word, struct bgpd_addr *addr, u_int8_t *prefixlen)
mask = 32;
if (mask > 32)
errx(1, "invalid netmask: too large");
- addr->v4.s_addr = ina.s_addr & htonl(prefixlen2mask(mask));
+ addr->v4.s_addr = addr->v4.s_addr & htonl(prefixlen2mask(mask));
break;
case AF_INET6:
if (mask == -1)