diff options
author | 2006-02-23 14:15:53 +0000 | |
---|---|---|
committer | 2006-02-23 14:15:53 +0000 | |
commit | 6337d4fc2bc9843fb6400dfb77bd46c9f219e49d (patch) | |
tree | 0b0eeab619755aced66de01f1051dc021706080a /sys | |
parent | Let 'pkg_info -P' work with package distribution files and URLs to a (diff) | |
download | wireguard-openbsd-6337d4fc2bc9843fb6400dfb77bd46c9f219e49d.tar.xz wireguard-openbsd-6337d4fc2bc9843fb6400dfb77bd46c9f219e49d.zip |
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.h | 9 | ||||
-rw-r--r-- | sys/net/rtsock.c | 9 |
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; |