svn commit: r260379 - head/sys/net
Alexander V. Chernikov
melifaro at FreeBSD.org
Mon Jan 6 22:36:21 UTC 2014
Author: melifaro
Date: Mon Jan 6 22:36:20 2014
New Revision: 260379
URL: http://svnweb.freebsd.org/changeset/base/260379
Log:
Partially fix IPv4 interface routes deletion in RADIX_MPATH.
Noticed by: Nikolay Denev <ndenev at gmail.com>
MFC after: 1 month
Modified:
head/sys/net/radix_mpath.c
head/sys/net/route.c
Modified: head/sys/net/radix_mpath.c
==============================================================================
--- head/sys/net/radix_mpath.c Mon Jan 6 19:14:46 2014 (r260378)
+++ head/sys/net/radix_mpath.c Mon Jan 6 22:36:20 2014 (r260379)
@@ -112,11 +112,16 @@ rt_mpath_matchgate(struct rtentry *rt, s
if (rt->rt_gateway->sa_family == AF_LINK) {
if (!memcmp(rt->rt_ifa->ifa_addr, gate, gate->sa_len))
break;
- } else {
- if (rt->rt_gateway->sa_len == gate->sa_len &&
- !memcmp(rt->rt_gateway, gate, gate->sa_len))
- break;
}
+
+ /*
+ * Check for other options:
+ * 1) Routes with 'real' IPv4/IPv6 gateway
+ * 2) Loopback host routes (another AF_LINK/sockadd_dl check)
+ * */
+ if (rt->rt_gateway->sa_len == gate->sa_len &&
+ !memcmp(rt->rt_gateway, gate, gate->sa_len))
+ break;
} while ((rn = rn_mpath_next(rn)) != NULL);
return (struct rtentry *)rn;
Modified: head/sys/net/route.c
==============================================================================
--- head/sys/net/route.c Mon Jan 6 19:14:46 2014 (r260378)
+++ head/sys/net/route.c Mon Jan 6 22:36:20 2014 (r260379)
@@ -1547,10 +1547,10 @@ rtinit1(struct ifaddr *ifa, int cmd, int
/* this table doesn't exist but others might */
continue;
RADIX_NODE_HEAD_RLOCK(rnh);
+ rn = rnh->rnh_lookup(dst, netmask, rnh);
#ifdef RADIX_MPATH
if (rn_mpath_capable(rnh)) {
- rn = rnh->rnh_matchaddr(dst, rnh);
if (rn == NULL)
error = ESRCH;
else {
@@ -1564,13 +1564,11 @@ rtinit1(struct ifaddr *ifa, int cmd, int
*/
rt = rt_mpath_matchgate(rt,
ifa->ifa_addr);
- if (!rt)
+ if (rt == NULL)
error = ESRCH;
}
}
- else
#endif
- rn = rnh->rnh_lookup(dst, netmask, rnh);
error = (rn == NULL ||
(rn->rn_flags & RNF_ROOT) ||
RNTORT(rn)->rt_ifa != ifa);
More information about the svn-src-all
mailing list