Date: Tue, 25 Mar 2008 02:28:28 GMT From: Qing Li <qingli@FreeBSD.org> To: Perforce Change Reviews <perforce@freebsd.org> Subject: PERFORCE change 138489 for review Message-ID: <200803250228.m2P2SSpo036555@repoman.freebsd.org>
next in thread | raw e-mail | index | archive | help
http://perforce.freebsd.org/chv.cgi?CH=138489 Change 138489 by qingli@FreeBSD-newarp on 2008/03/25 02:28:08 Checking in the missing files from the last commit. Fixed a locking issue, but there is one more radix head locking issue that is causing a panic... debugging is in progress. Affected files ... .. //depot/projects/qingli_mpath/src/sys/net/radix_mpath.c#2 edit .. //depot/projects/qingli_mpath/src/sys/net/rtsock.c#4 edit .. //depot/projects/qingli_mpath/src/sys/netinet/ip_output.c#3 edit .. //depot/projects/qingli_mpath/src/sys/netinet6/in6_src.c#3 edit .. //depot/projects/qingli_mpath/src/sys/netinet6/nd6_nbr.c#2 edit Differences ... ==== //depot/projects/qingli_mpath/src/sys/net/radix_mpath.c#2 (text+ko) ==== @@ -103,12 +103,12 @@ rn = (struct radix_node *)rt; do { rt = (struct rtentry *)rn; - /* Qing - * we are removing an address alias that has - * the same prefix as another address - * we need to compare the interface address because - * rt_gateway is a special sockadd_dl structure - */ + /* + * we are removing an address alias that has + * the same prefix as another address + * we need to compare the interface address because + * rt_gateway is a special sockadd_dl structure + */ if (rt->rt_gateway->sa_family == AF_LINK) { if (!memcmp(rt->rt_ifa->ifa_addr, gate, gate->sa_len)) break; @@ -274,8 +274,10 @@ ro->ro_rt = rtalloc1(&ro->ro_dst, 1, 0UL); /* if the route does not exist or it is not multipath, don't care */ - if (!ro->ro_rt || !rn_mpath_next((struct radix_node *)ro->ro_rt)) + if (!ro->ro_rt || !rn_mpath_next((struct radix_node *)ro->ro_rt)) { + RT_UNLOCK(ro->ro_rt); return; + } /* beyond here, we use rn as the master copy */ rn0 = rn = (struct radix_node *)ro->ro_rt; @@ -294,12 +296,16 @@ /* XXX try filling rt_gwroute and avoid unreachable gw */ /* if gw selection fails, use the first match (default) */ - if (!rn) + if (!rn) { + RT_UNLOCK(ro->ro_rt); return; - + } + rtfree(ro->ro_rt); ro->ro_rt = (struct rtentry *)rn; + RT_LOCK(ro->ro_rt); ro->ro_rt->rt_refcnt++; + RT_UNLOCK(ro->ro_rt); } extern int in6_inithead __P((void **head, int off)); ==== //depot/projects/qingli_mpath/src/sys/net/rtsock.c#4 (text+ko) ==== @@ -434,7 +434,6 @@ if (rn_mpath_capable(rnh) && (rtm->rtm_type != RTM_GET || info.rti_info[RTAX_GATEWAY])) { rt = rt_mpath_matchgate(rt, info.rti_info[RTAX_GATEWAY]); - rnh = (struct radix_node_head *)rt; if (!rt) { RADIX_NODE_HEAD_UNLOCK(rnh); senderr(ESRCH); ==== //depot/projects/qingli_mpath/src/sys/netinet/ip_output.c#3 (text+ko) ==== @@ -36,6 +36,7 @@ #include "opt_ipsec.h" #include "opt_mac.h" #include "opt_mbuf_stress_test.h" +#include "opt_mpath.h" #include <sys/param.h> #include <sys/systm.h> @@ -54,6 +55,9 @@ #include <net/netisr.h> #include <net/pfil.h> #include <net/route.h> +#ifdef RADIX_MPATH +#include <net/radix_mpath.h> +#endif #include <netinet/in.h> #include <netinet/in_systm.h> @@ -225,7 +229,12 @@ * operation (as it is for ARP). */ if (ro->ro_rt == NULL) +#ifdef RADIX_MPATH + rtalloc_mpath(ro, + ntohl(ip->ip_src.s_addr ^ ip->ip_dst.s_addr)); +#else rtalloc_ign(ro, 0); +#endif if (ro->ro_rt == NULL) { ipstat.ips_noroute++; error = EHOSTUNREACH; ==== //depot/projects/qingli_mpath/src/sys/netinet6/in6_src.c#3 (text+ko) ==== @@ -65,6 +65,7 @@ #include "opt_inet.h" #include "opt_inet6.h" +#include "opt_mpath.h" #include <sys/param.h> #include <sys/systm.h> @@ -84,6 +85,9 @@ #include <net/if.h> #include <net/route.h> +#ifdef RADIX_MPATH +#include <net/radix_mpath.h> +#endif #include <netinet/in.h> #include <netinet/in_var.h> @@ -568,7 +572,12 @@ sa6->sin6_scope_id = 0; if (clone) { +#ifdef RADIX_MPATH + rtalloc_mpath((struct route *)ro, + ntohl(sa6->sin6_addr.s6_addr32[3])); +#else rtalloc((struct route *)ro); +#endif } else { ro->ro_rt = rtalloc1(&((struct route *)ro) ->ro_dst, 0, 0UL); ==== //depot/projects/qingli_mpath/src/sys/netinet6/nd6_nbr.c#2 (text+ko) ==== @@ -36,6 +36,7 @@ #include "opt_inet6.h" #include "opt_ipsec.h" #include "opt_carp.h" +#include "opt_mpath.h" #include <sys/param.h> #include <sys/systm.h> @@ -55,6 +56,9 @@ #include <net/if_dl.h> #include <net/if_var.h> #include <net/route.h> +#ifdef RADIX_MPATH +#include <net/radix_mpath.h> +#endif #include <netinet/in.h> #include <netinet/in_var.h> @@ -208,13 +212,23 @@ struct rtentry *rt; struct sockaddr_in6 tsin6; int need_proxy; +#ifdef RADIX_MPATH + struct route_in6 ro; +#endif bzero(&tsin6, sizeof tsin6); tsin6.sin6_len = sizeof(struct sockaddr_in6); tsin6.sin6_family = AF_INET6; tsin6.sin6_addr = taddr6; +#ifdef RADIX_MPATH + bzero(&ro, sizeof(ro)); + ro.ro_dst = tsin6; + rtalloc_mpath((struct route *)&ro, RTF_ANNOUNCE); + rt = ro.ro_rt; +#else rt = rtalloc1((struct sockaddr *)&tsin6, 0, 0); +#endif need_proxy = (rt && (rt->rt_flags & RTF_ANNOUNCE) != 0 && rt->rt_gateway->sa_family == AF_LINK); if (rt)
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?200803250228.m2P2SSpo036555>