diff options
author | Martin Pieuchot <mpi@cvs.openbsd.org> | 2015-12-09 09:23:09 +0000 |
---|---|---|
committer | Martin Pieuchot <mpi@cvs.openbsd.org> | 2015-12-09 09:23:09 +0000 |
commit | edd7413029d4af0825d8737c05ef5ec3162ab202 (patch) | |
tree | 8da4e94a7e182427a424f5692d03a8c20f8555c0 /sys/net | |
parent | 816cc1ea4a069a761e7320a34750e7b7cce27542 (diff) |
Do not trigger a KASSERT() if the route we're trying to remove does not
exist and we get another matching one instead.
This bug has been here since the KAME area and recently exposed by a
refactoring at n2k15. The problem is that rtrequest(9) does not check
on which interface the route entry is attached when issuing a RTM_DELETE.
So the kernel would end up deleting the route attached on a different ifp
when in_ifinit() fails.
This fix is currently a workaround, a better fix is in the pipeline.
Reported by Laurence Tratt <laurie AT tratt DOT net>, thanks!
Diffstat (limited to 'sys/net')
-rw-r--r-- | sys/net/route.c | 9 |
1 files changed, 8 insertions, 1 deletions
diff --git a/sys/net/route.c b/sys/net/route.c index 814d2644e28..ae06da7f9b4 100644 --- a/sys/net/route.c +++ b/sys/net/route.c @@ -1,4 +1,4 @@ -/* $OpenBSD: route.c,v 1.290 2015/12/09 09:02:02 mpi Exp $ */ +/* $OpenBSD: route.c,v 1.291 2015/12/09 09:23:08 mpi Exp $ */ /* $NetBSD: route.c,v 1.14 1996/02/13 22:00:46 christos Exp $ */ /* @@ -830,6 +830,13 @@ rtrequest_delete(struct rt_addrinfo *info, u_int8_t prio, struct ifnet *ifp, info->rti_info[RTAX_NETMASK], info->rti_info[RTAX_GATEWAY], prio); if (rt == NULL) return (ESRCH); + + /* Make sure that's the route the caller want to delete. */ + if (ifp != NULL && ifp->if_index != rt->rt_ifidx) { + rtfree(rt); + return (ESRCH); + } + #ifndef SMALL_KERNEL /* * If we got multipath routes, we require users to specify |