summaryrefslogtreecommitdiff
path: root/sys
diff options
context:
space:
mode:
authorClaudio Jeker <claudio@cvs.openbsd.org>2006-02-23 14:15:54 +0000
committerClaudio Jeker <claudio@cvs.openbsd.org>2006-02-23 14:15:54 +0000
commit02f70d316e2b1fab7065eb4b91f04d359651b629 (patch)
tree1ee7babacfef9e54dd372c5067db4f3b0fc463e1 /sys
parent9704b0e5264a052e2e3e2a4acec4e6d46da82778 (diff)
Until now it was only possible to unset the RTF_JUMBO flag on a RTM_CHANGE
request. Extend the "hack" to include more flags (RTF_PROTO[123] flags, RTF_BLACKHOLE, RTF_REJECT and RTF_STATIC). Because rtm_use is "abused" -- rtm_use was replaced long time ago with rtm_rmx->rmx_pksent -- it is now forced to 0 in RTM_GET requests and sysctl_dumpentry(). This is done to prevent false changes because of a reused RTM_GET message. OK henning@, mcbride@, makes sense markus@
Diffstat (limited to 'sys')
-rw-r--r--sys/net/route.h9
-rw-r--r--sys/net/rtsock.c9
2 files changed, 12 insertions, 6 deletions
diff --git a/sys/net/route.h b/sys/net/route.h
index 9d935799fed..59a8d5f369f 100644
--- a/sys/net/route.h
+++ b/sys/net/route.h
@@ -1,4 +1,4 @@
-/* $OpenBSD: route.h,v 1.34 2005/11/29 02:59:42 jolan Exp $ */
+/* $OpenBSD: route.h,v 1.35 2006/02/23 14:15:53 claudio Exp $ */
/* $NetBSD: route.h,v 1.9 1996/02/13 22:00:49 christos Exp $ */
/*
@@ -141,6 +141,11 @@ struct rtentry {
#define RTF_MPATH 0x40000 /* multipath route or operation */
#define RTF_JUMBO 0x80000 /* try to use jumbo frames */
+/* mask of RTF flags that are allowed to be modified by RTM_CHANGE */
+#define RTF_FMASK \
+ (RTF_JUMBO | RTF_PROTO1 | RTF_PROTO2 | RTF_PROTO3 | RTF_BLACKHOLE | \
+ RTF_REJECT | RTF_STATIC)
+
#ifndef _KERNEL
/* obsoleted */
#define RTF_TUNNEL 0x100000 /* Tunnelling bit. */
@@ -170,7 +175,7 @@ struct rt_msghdr {
pid_t rtm_pid; /* identify sender */
int rtm_seq; /* for sender to identify action */
int rtm_errno; /* why failed */
- int rtm_use; /* from rtentry */
+ int rtm_use; /* deprecated use rtm_rmx->rmx_pksent */
#define rtm_fmask rtm_use /* bitmask used in RTM_CHANGE message */
u_long rtm_inits; /* which metrics we are initializing */
struct rt_metrics rtm_rmx; /* metrics themselves */
diff --git a/sys/net/rtsock.c b/sys/net/rtsock.c
index 3b8e46653a7..1286e9be466 100644
--- a/sys/net/rtsock.c
+++ b/sys/net/rtsock.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: rtsock.c,v 1.52 2006/02/02 13:59:45 claudio Exp $ */
+/* $OpenBSD: rtsock.c,v 1.53 2006/02/23 14:15:53 claudio Exp $ */
/* $NetBSD: rtsock.c,v 1.18 1996/03/29 00:32:10 cgd Exp $ */
/*
@@ -353,6 +353,7 @@ report:
}
rt_msg2(rtm->rtm_type, &info, (caddr_t)rtm, NULL);
rtm->rtm_flags = rt->rt_flags;
+ rtm->rtm_use = 0;
rt_getmetrics(&rt->rt_rmx, &rtm->rtm_rmx);
rtm->rtm_addrs = info.rti_addrs;
break;
@@ -390,8 +391,8 @@ report:
}
}
- /* XXX Hack to allow the jumbo flag to be toggled */
- if (rtm->rtm_use & RTF_JUMBO)
+ /* XXX Hack to allow some flags to be toggled */
+ if (rtm->rtm_fmask & RTF_FMASK)
rt->rt_flags = (rt->rt_flags &
~rtm->rtm_fmask) |
(rtm->rtm_flags & rtm->rtm_fmask);
@@ -808,7 +809,7 @@ sysctl_dumpentry(struct radix_node *rn, void *v)
struct rt_msghdr *rtm = (struct rt_msghdr *)w->w_tmem;
rtm->rtm_flags = rt->rt_flags;
- rtm->rtm_use = rt->rt_use;
+ rtm->rtm_use = 0;
rt_getmetrics(&rt->rt_rmx, &rtm->rtm_rmx);
rtm->rtm_index = rt->rt_ifp->if_index;
rtm->rtm_errno = rtm->rtm_pid = rtm->rtm_seq = 0;