summaryrefslogtreecommitdiff
path: root/sys
diff options
context:
space:
mode:
authorClaudio Jeker <claudio@cvs.openbsd.org>2013-10-20 12:35:49 +0000
committerClaudio Jeker <claudio@cvs.openbsd.org>2013-10-20 12:35:49 +0000
commit3d5b0b57ceaa5c3a2726736e32195258fcd1f4ec (patch)
tree1e389f02938e103dad73f6a94d6d04cc43cc9ec8 /sys
parent0aa00137a93a13b05b8de39830e23019f3972c1e (diff)
Make sure that the RTM_DESYNC message is not filtered out. Also ensure that
rtm_flags and rtm_fmask do not change flags that are kernel specific (e.g. RTF_CLONED). OK henning@
Diffstat (limited to 'sys')
-rw-r--r--sys/net/route.h4
-rw-r--r--sys/net/rtsock.c15
2 files changed, 11 insertions, 8 deletions
diff --git a/sys/net/route.h b/sys/net/route.h
index 960362ebd67..2521d03e38d 100644
--- a/sys/net/route.h
+++ b/sys/net/route.h
@@ -1,4 +1,4 @@
-/* $OpenBSD: route.h,v 1.78 2012/09/19 16:14:01 blambert Exp $ */
+/* $OpenBSD: route.h,v 1.79 2013/10/20 12:35:47 claudio Exp $ */
/* $NetBSD: route.h,v 1.9 1996/02/13 22:00:49 christos Exp $ */
/*
@@ -149,7 +149,7 @@ struct rtentry {
/* mask of RTF flags that are allowed to be modified by RTM_CHANGE */
#define RTF_FMASK \
(RTF_PROTO1 | RTF_PROTO2 | RTF_PROTO3 | RTF_BLACKHOLE | \
- RTF_REJECT | RTF_STATIC)
+ RTF_REJECT | RTF_STATIC | RTF_MPLS)
#ifndef _KERNEL
/* obsoleted */
diff --git a/sys/net/rtsock.c b/sys/net/rtsock.c
index df3a1f426db..398ff8b0e08 100644
--- a/sys/net/rtsock.c
+++ b/sys/net/rtsock.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: rtsock.c,v 1.127 2013/08/28 06:58:57 mpi Exp $ */
+/* $OpenBSD: rtsock.c,v 1.128 2013/10/20 12:35:48 claudio Exp $ */
/* $NetBSD: rtsock.c,v 1.18 1996/03/29 00:32:10 cgd Exp $ */
/*
@@ -368,8 +368,9 @@ route_input(struct mbuf *m0, ...)
/* filter messages that the process does not want */
rop = (struct routecb *)rp;
rtm = mtod(m, struct rt_msghdr *);
- if (rop->msgfilter != 0 && !(rop->msgfilter & (1 <<
- rtm->rtm_type)))
+ /* but RTM_DESYNC can't be filtered */
+ if (rtm->rtm_type != RTM_DESYNC && rop->msgfilter != 0 &&
+ !(rop->msgfilter & (1 << rtm->rtm_type)))
continue;
switch (rtm->rtm_type) {
case RTM_IFANNOUNCE:
@@ -543,6 +544,8 @@ route_output(struct mbuf *m, ...)
/* make sure that kernel-only bits are not set */
rtm->rtm_priority &= RTP_MASK;
+ rtm->rtm_flags &= ~(RTF_DONE|RTF_CLONED|RTF_MPATH);
+ rtm->rtm_fmask &= RTF_FMASK;
if (rtm->rtm_priority != 0) {
if (rtm->rtm_priority > RTP_MAX) {
@@ -837,9 +840,9 @@ report:
}
#endif
/* Hack to allow some flags to be toggled */
- if (rtm->rtm_fmask & RTF_FMASK)
- rt->rt_flags = (rt->rt_flags &
- ~rtm->rtm_fmask) |
+ if (rtm->rtm_fmask)
+ rt->rt_flags =
+ (rt->rt_flags & ~rtm->rtm_fmask) |
(rtm->rtm_flags & rtm->rtm_fmask);
rt_setmetrics(rtm->rtm_inits, &rtm->rtm_rmx,