From owner-p4-projects@FreeBSD.ORG Tue Mar 25 02:28:29 2008 Return-Path: Delivered-To: p4-projects@freebsd.org Received: by hub.freebsd.org (Postfix, from userid 32767) id D97AE1065674; Tue, 25 Mar 2008 02:28:28 +0000 (UTC) Delivered-To: perforce@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 983EA1065672 for ; Tue, 25 Mar 2008 02:28:28 +0000 (UTC) (envelope-from qingli@freebsd.org) Received: from repoman.freebsd.org (repoman.freebsd.org [IPv6:2001:4f8:fff6::29]) by mx1.freebsd.org (Postfix) with ESMTP id 718548FC15 for ; Tue, 25 Mar 2008 02:28:28 +0000 (UTC) (envelope-from qingli@freebsd.org) Received: from repoman.freebsd.org (localhost [127.0.0.1]) by repoman.freebsd.org (8.14.1/8.14.1) with ESMTP id m2P2SSLZ036557 for ; Tue, 25 Mar 2008 02:28:28 GMT (envelope-from qingli@freebsd.org) Received: (from perforce@localhost) by repoman.freebsd.org (8.14.1/8.14.1/Submit) id m2P2SSpo036555 for perforce@freebsd.org; Tue, 25 Mar 2008 02:28:28 GMT (envelope-from qingli@freebsd.org) Date: Tue, 25 Mar 2008 02:28:28 GMT Message-Id: <200803250228.m2P2SSpo036555@repoman.freebsd.org> X-Authentication-Warning: repoman.freebsd.org: perforce set sender to qingli@freebsd.org using -f From: Qing Li To: Perforce Change Reviews Cc: Subject: PERFORCE change 138489 for review X-BeenThere: p4-projects@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: p4 projects tree changes List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 25 Mar 2008 02:28:29 -0000 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 #include @@ -54,6 +55,9 @@ #include #include #include +#ifdef RADIX_MPATH +#include +#endif #include #include @@ -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 #include @@ -84,6 +85,9 @@ #include #include +#ifdef RADIX_MPATH +#include +#endif #include #include @@ -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 #include @@ -55,6 +56,9 @@ #include #include #include +#ifdef RADIX_MPATH +#include +#endif #include #include @@ -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)