diff options
author | Martin Pieuchot <mpi@cvs.openbsd.org> | 2016-09-01 09:22:59 +0000 |
---|---|---|
committer | Martin Pieuchot <mpi@cvs.openbsd.org> | 2016-09-01 09:22:59 +0000 |
commit | f60ac8e408c85e6fa3759b0ac04648c85c5153bd (patch) | |
tree | e65334c60be0d2709a0795279a1db5af70e4d1a4 | |
parent | b01ef3171eafa4f3aacadf99b311b6aa59a4da1b (diff) |
RTM_CHANGE should not allow to change the gateway of a mpath route.
Fix rttest13.
ok claudio@
-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) { |