summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorClaudio Jeker <claudio@cvs.openbsd.org>2007-03-13 16:48:04 +0000
committerClaudio Jeker <claudio@cvs.openbsd.org>2007-03-13 16:48:04 +0000
commit2e063390807faa5f1b687ba3d47fe61cef81cd61 (patch)
tree1664a7b3e1fc842c335936d4534f86e6aebb05f0
parentadc954c9407a161c08c0e59fb6f2d190e5083e56 (diff)
rtm_tableid is only valid for RTM_ADD, RTM_CHANGE and RTM_DELETE but not
for stuff like RTM_IFINFO or RTM_IFANNOUNCE. So move check to a save location. Always check rtm_type before accessing some random value inside the route message.
-rw-r--r--usr.sbin/ospfd/kroute.c8
1 files changed, 4 insertions, 4 deletions
diff --git a/usr.sbin/ospfd/kroute.c b/usr.sbin/ospfd/kroute.c
index afbcadb7a69..cc8c2937b8a 100644
--- a/usr.sbin/ospfd/kroute.c
+++ b/usr.sbin/ospfd/kroute.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: kroute.c,v 1.42 2007/02/25 18:10:47 deraadt Exp $ */
+/* $OpenBSD: kroute.c,v 1.43 2007/03/13 16:48:03 claudio Exp $ */
/*
* Copyright (c) 2004 Esben Norby <norby@openbsd.org>
@@ -1089,14 +1089,14 @@ dispatch_rtmsg(void)
flags = F_KERNEL;
nexthop.s_addr = 0;
- if (rtm->rtm_tableid != 0)
- continue;
-
if (rtm->rtm_type == RTM_ADD || rtm->rtm_type == RTM_CHANGE ||
rtm->rtm_type == RTM_DELETE) {
sa = (struct sockaddr *)(rtm + 1);
get_rtaddrs(rtm->rtm_addrs, sa, rti_info);
+ if (rtm->rtm_tableid != 0)
+ continue;
+
if (rtm->rtm_pid == kr_state.pid) /* cause by us */
continue;