summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorChristopher Pascoe <pascoe@cvs.openbsd.org>2006-06-17 17:20:01 +0000
committerChristopher Pascoe <pascoe@cvs.openbsd.org>2006-06-17 17:20:01 +0000
commit178f58f21c615fbb0c74a71b1b1732da8ccd7abe (patch)
treedc1947a2374c6a60e4c556427dcfc1371b44dbdb
parentc9509bb2ddfd989bafe6b23d1d0fafc96be2e872 (diff)
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@
-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) {