diff options
author | 2016-09-01 09:22:58 +0000 | |
---|---|---|
committer | 2016-09-01 09:22:58 +0000 | |
commit | a1a297aa827b2e2df1b3606239fc08f852916828 (patch) | |
tree | 117c516cab609d8ccca135e65183518c9bf18ae7 /sys | |
parent | one less sparc (diff) | |
download | wireguard-openbsd-a1a297aa827b2e2df1b3606239fc08f852916828.tar.xz wireguard-openbsd-a1a297aa827b2e2df1b3606239fc08f852916828.zip |
RTM_CHANGE should not allow to change the gateway of a mpath route.
Fix rttest13.
ok claudio@
Diffstat (limited to 'sys')
-rw-r--r-- | sys/net/rtsock.c | 11 |
1 files changed, 9 insertions, 2 deletions
diff --git a/sys/net/rtsock.c b/sys/net/rtsock.c index 633134f9f6e..ac8ecbe3ab6 100644 --- a/sys/net/rtsock.c +++ b/sys/net/rtsock.c @@ -1,4 +1,4 @@ -/* $OpenBSD: rtsock.c,v 1.196 2016/08/23 13:07:26 mpi Exp $ */ +/* $OpenBSD: rtsock.c,v 1.197 2016/09/01 09:22:58 mpi Exp $ */ /* $NetBSD: rtsock.c,v 1.18 1996/03/29 00:32:10 cgd Exp $ */ /* @@ -675,7 +675,7 @@ route_output(struct mbuf *m, ...) rt = rtable_lookup(tableid, info.rti_info[RTAX_DST], info.rti_info[RTAX_NETMASK], info.rti_info[RTAX_GATEWAY], prio); -#ifdef SMALL_KERNEL +#ifndef SMALL_KERNEL /* * If we got multipath routes, we require users to specify * a matching gateway, except for RTM_GET. @@ -695,6 +695,13 @@ route_output(struct mbuf *m, ...) (rtm->rtm_type == RTM_CHANGE)) { rt = rtable_lookup(tableid, info.rti_info[RTAX_DST], info.rti_info[RTAX_NETMASK], NULL, prio); +#ifndef SMALL_KERNEL + /* Ensure we don't pick a multipath one. */ + if ((rt != NULL) && ISSET(rt->rt_flags, RTF_MPATH)) { + rtfree(rt); + rt = NULL; + } +#endif } if (rt == NULL) { |