diff options
author | Henning Brauer <henning@cvs.openbsd.org> | 2004-02-07 01:28:14 +0000 |
---|---|---|
committer | Henning Brauer <henning@cvs.openbsd.org> | 2004-02-07 01:28:14 +0000 |
commit | 3592cdfe091a6541fe5f500b03d14037a8b8b068 (patch) | |
tree | ffabd31b634bf22aa9e476e278a896931a0ef00d /usr.sbin | |
parent | b4f79bca9b6b4f93d6e4b3744855b89e7518d067 (diff) |
the sockaddr holding the netmask and advertised by rtm_addrs might
mave sa_len == 0 to indicate a mask of /0
Diffstat (limited to 'usr.sbin')
-rw-r--r-- | usr.sbin/bgpd/kroute.c | 11 |
1 files changed, 6 insertions, 5 deletions
diff --git a/usr.sbin/bgpd/kroute.c b/usr.sbin/bgpd/kroute.c index ddc66d9e273..7c352c6a616 100644 --- a/usr.sbin/bgpd/kroute.c +++ b/usr.sbin/bgpd/kroute.c @@ -1,4 +1,4 @@ -/* $OpenBSD: kroute.c,v 1.83 2004/02/07 00:16:14 henning Exp $ */ +/* $OpenBSD: kroute.c,v 1.84 2004/02/07 01:28:13 henning Exp $ */ /* * Copyright (c) 2003, 2004 Henning Brauer <henning@openbsd.org> @@ -1155,10 +1155,11 @@ dispatch_rtmsg(void) ((struct sockaddr_in *)sa)->sin_addr.s_addr; sa_in = (struct sockaddr_in *) rti_info[RTAX_NETMASK]; - if (sa_in != NULL) - prefixlen = mask2prefixlen( - sa_in->sin_addr.s_addr); - else if (rtm->rtm_flags & RTF_HOST) + if (sa_in != NULL) { + if (sa_in->sin_len != 0) + prefixlen = mask2prefixlen( + sa_in->sin_addr.s_addr); + } else if (rtm->rtm_flags & RTF_HOST) prefixlen = 32; else prefixlen = |