summaryrefslogtreecommitdiff
path: root/sys/net/rtsock.c
diff options
context:
space:
mode:
authorClaudio Jeker <claudio@cvs.openbsd.org>2014-05-27 19:38:16 +0000
committerClaudio Jeker <claudio@cvs.openbsd.org>2014-05-27 19:38:16 +0000
commit2b58aefd5505ea606db84ed38ce527bcaa2eab24 (patch)
treebc1b94fb902bb2c33cac8aa2abaad90a9f01f4db /sys/net/rtsock.c
parent8481d5dfd4ae4de6716a8c7064906056a6f53fc7 (diff)
Big refactoring of the radix code (mainly rn_addroute but also part
of rn_delete was changed). The mpath code gets a much better rn_mpath_next() function that allows looping through the dupedkey list based on prio, any or only active routes. This solves the issues seen with failed deletes of down routes. Commit this now so that it gets tested. Both sthen@ and blambert@ agree.
Diffstat (limited to 'sys/net/rtsock.c')
-rw-r--r--sys/net/rtsock.c46
1 files changed, 12 insertions, 34 deletions
diff --git a/sys/net/rtsock.c b/sys/net/rtsock.c
index e52e3504019..017ac635149 100644
--- a/sys/net/rtsock.c
+++ b/sys/net/rtsock.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: rtsock.c,v 1.145 2014/05/27 09:39:58 mpi Exp $ */
+/* $OpenBSD: rtsock.c,v 1.146 2014/05/27 19:38:15 claudio Exp $ */
/* $NetBSD: rtsock.c,v 1.18 1996/03/29 00:32:10 cgd Exp $ */
/*
@@ -625,45 +625,23 @@ route_output(struct mbuf *m, ...)
*
* for RTM_GET, info.rti_info[RTAX_GATEWAY] is optional
* even with multipath.
- * if it is NULL the first match is returned (no need to
- * call rt_mpath_matchgate).
*/
if (rn_mpath_capable(rnh)) {
- /* first find correct priority bucket */
- rn = rn_mpath_prio(rn, prio);
- rt = (struct rtentry *)rn;
- if (prio != RTP_ANY &&
- (rt->rt_priority & RTP_MASK) != prio) {
+ rt = rt_mpath_matchgate(rt,
+ info.rti_info[RTAX_GATEWAY], prio);
+ if (!rt) {
error = ESRCH;
- rt->rt_refcnt++;
goto flush;
}
- /* if multipath routes */
- if (rt_mpath_next(rt)) { /* XXX ignores down routes */
- if (info.rti_info[RTAX_GATEWAY] != NULL) {
- rt = rt_mpath_matchgate(rt,
- info.rti_info[RTAX_GATEWAY], prio);
- } else if (rtm->rtm_type != RTM_GET) {
- /*
- * only RTM_GET may use an empty
- * gateway on multipath ...
- */
- rt = NULL;
- }
- } else if ((info.rti_info[RTAX_GATEWAY] != NULL) &&
- (rtm->rtm_type == RTM_GET ||
- rtm->rtm_type == RTM_LOCK)) {
- /*
- * ... but if a gateway is specified RTM_GET
- * and RTM_LOCK must match the gateway no matter
- * what.
- */
- rt = rt_mpath_matchgate(rt,
- info.rti_info[RTAX_GATEWAY], prio);
- }
-
- if (!rt) {
+ /*
+ * only RTM_GET may use an empty gateway
+ * on multipath routes
+ */
+ if (!info.rti_info[RTAX_GATEWAY] &&
+ rt->rt_flags & RTF_MPATH &&
+ rtm->rtm_type != RTM_GET) {
+ rt = NULL;
error = ESRCH;
goto flush;
}