summaryrefslogtreecommitdiffstats
path: root/sys
diff options
context:
space:
mode:
authorpascoe <pascoe@openbsd.org>2006-06-17 17:20:00 +0000
committerpascoe <pascoe@openbsd.org>2006-06-17 17:20:00 +0000
commit7b447b8bac913c92a2edcf34dc557cf646655f20 (patch)
treee45988d5fa791f535a9d55cf93f8d841e54973b5 /sys
parentDisplay multipath and jumbo flags in route get/monitor. (diff)
downloadwireguard-openbsd-7b447b8bac913c92a2edcf34dc557cf646655f20.tar.xz
wireguard-openbsd-7b447b8bac913c92a2edcf34dc557cf646655f20.zip
When multipath routes are inserted, ensure that RTF_MPATH is set for any
previous route that may not have been inserted with the -mpath flag. Similarly, when removing a multipath route and leaving only one route, clear the RTF_MPATH flag so this is clear. ok claudio@
Diffstat (limited to 'sys')
-rw-r--r--sys/net/route.c23
1 files changed, 22 insertions, 1 deletions
diff --git a/sys/net/route.c b/sys/net/route.c
index 34eb9142e59..d96c72f2617 100644
--- a/sys/net/route.c
+++ b/sys/net/route.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: route.c,v 1.79 2006/06/16 16:49:39 henning Exp $ */
+/* $OpenBSD: route.c,v 1.80 2006/06/17 17:20:00 pascoe Exp $ */
/* $NetBSD: route.c,v 1.14 1996/02/13 22:00:46 christos Exp $ */
/*
@@ -778,6 +778,15 @@ rtrequest1(int req, struct rt_addrinfo *info, struct rtentry **ret_nrt,
rt->rt_parent = NULL;
}
+#ifndef SMALL_KERNEL
+ if (rn_mpath_capable(rnh)) {
+ if ((rn = rnh->rnh_lookup(info->rti_info[RTAX_DST],
+ info->rti_info[RTAX_NETMASK], rnh)) != NULL &&
+ rn_mpath_next(rn) == NULL)
+ ((struct rtentry *)rn)->rt_flags &= ~RTF_MPATH;
+ }
+#endif
+
rt->rt_flags &= ~RTF_UP;
if ((ifa = rt->rt_ifa) && ifa->ifa_rtrequest)
ifa->ifa_rtrequest(RTM_DELETE, rt, info);
@@ -880,6 +889,18 @@ makeroute:
pool_put(&rtentry_pool, rt);
senderr(EEXIST);
}
+
+#ifndef SMALL_KERNEL
+ if (rn_mpath_capable(rnh)) {
+ rn = rnh->rnh_lookup(info->rti_info[RTAX_DST],
+ info->rti_info[RTAX_NETMASK], rnh);
+ if (rn_mpath_next(rn) == NULL)
+ ((struct rtentry *)rn)->rt_flags &= ~RTF_MPATH;
+ else
+ ((struct rtentry *)rn)->rt_flags |= RTF_MPATH;
+ }
+#endif
+
if (ifa->ifa_rtrequest)
ifa->ifa_rtrequest(req, rt, info);
if (ret_nrt) {