summaryrefslogtreecommitdiff
path: root/usr.sbin
diff options
context:
space:
mode:
authorHenning Brauer <henning@cvs.openbsd.org>2004-01-09 01:23:13 +0000
committerHenning Brauer <henning@cvs.openbsd.org>2004-01-09 01:23:13 +0000
commitfafafbcd0e00986b2bc9dc18845676d5aaa89d8b (patch)
treecc111cdbdf780dfa059eed1335c232cb41686818 /usr.sbin
parentd58a4eefa3e52297d871ff8421649fad933fa161 (diff)
for RTM_IFINFO messages showing up on the routing socket do not ever
look into the first sockaddr structure after the msg header; does not contain what we expect there and caused messages to get missed in some cases
Diffstat (limited to 'usr.sbin')
-rw-r--r--usr.sbin/bgpd/kroute.c40
1 files changed, 21 insertions, 19 deletions
diff --git a/usr.sbin/bgpd/kroute.c b/usr.sbin/bgpd/kroute.c
index f8707d2ce09..47175ab392c 100644
--- a/usr.sbin/bgpd/kroute.c
+++ b/usr.sbin/bgpd/kroute.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: kroute.c,v 1.57 2004/01/08 17:06:50 henning Exp $ */
+/* $OpenBSD: kroute.c,v 1.58 2004/01/09 01:23:12 henning Exp $ */
/*
* Copyright (c) 2003, 2004 Henning Brauer <henning@openbsd.org>
@@ -980,25 +980,27 @@ dispatch_rtmsg(void)
if (rtm->rtm_errno) /* failed attempts... */
continue;
- switch (sa->sa_family) {
- case AF_INET:
- prefix = ((struct sockaddr_in *)sa)->sin_addr.s_addr;
- sa_in = (struct sockaddr_in *)rti_info[RTAX_NETMASK];
- if (sa_in != NULL) {
- if (sa_in->sin_family != AF_INET)
- continue;
- prefixlen =
- mask2prefixlen(sa_in->sin_addr.s_addr);
- } else if (rtm->rtm_flags & RTF_HOST)
- prefixlen = 32;
- else
- prefixlen = prefixlen_classful(prefix);
- break;
- default:
- if (rtm->rtm_type != RTM_IFINFO)
+ if (rtm->rtm_type != RTM_IFINFO)
+ switch (sa->sa_family) {
+ case AF_INET:
+ prefix =
+ ((struct sockaddr_in *)sa)->sin_addr.s_addr;
+ sa_in = (struct sockaddr_in *)
+ rti_info[RTAX_NETMASK];
+ if (sa_in != NULL) {
+ if (sa_in->sin_family != AF_INET)
+ continue;
+ prefixlen = mask2prefixlen(
+ sa_in->sin_addr.s_addr);
+ } else if (rtm->rtm_flags & RTF_HOST)
+ prefixlen = 32;
+ else
+ prefixlen = prefixlen_classful(prefix);
+ break;
+ default:
continue;
- break;
- }
+ /* not reached */
+ }
if ((sa = rti_info[RTAX_GATEWAY]) != NULL)
switch (sa->sa_family) {