From owner-p4-projects@FreeBSD.ORG Fri Sep 26 10:28:43 2003 Return-Path: Delivered-To: p4-projects@freebsd.org Received: by hub.freebsd.org (Postfix, from userid 32767) id A86D916A4C0; Fri, 26 Sep 2003 10:28:43 -0700 (PDT) Delivered-To: perforce@freebsd.org Received: from mx1.FreeBSD.org (mx1.freebsd.org [216.136.204.125]) by hub.freebsd.org (Postfix) with ESMTP id 7EA3F16A4B3 for ; Fri, 26 Sep 2003 10:28:43 -0700 (PDT) Received: from repoman.freebsd.org (repoman.freebsd.org [216.136.204.115]) by mx1.FreeBSD.org (Postfix) with ESMTP id 848E343FFB for ; Fri, 26 Sep 2003 10:28:42 -0700 (PDT) (envelope-from sam@freebsd.org) Received: from repoman.freebsd.org (localhost [127.0.0.1]) by repoman.freebsd.org (8.12.9/8.12.9) with ESMTP id h8QHSgXJ033993 for ; Fri, 26 Sep 2003 10:28:42 -0700 (PDT) (envelope-from sam@freebsd.org) Received: (from perforce@localhost) by repoman.freebsd.org (8.12.9/8.12.9/Submit) id h8QHSgLB033990 for perforce@freebsd.org; Fri, 26 Sep 2003 10:28:42 -0700 (PDT) (envelope-from sam@freebsd.org) Date: Fri, 26 Sep 2003 10:28:42 -0700 (PDT) Message-Id: <200309261728.h8QHSgLB033990@repoman.freebsd.org> X-Authentication-Warning: repoman.freebsd.org: perforce set sender to sam@freebsd.org using -f From: Sam Leffler To: Perforce Change Reviews Subject: PERFORCE change 38662 for review X-BeenThere: p4-projects@freebsd.org X-Mailman-Version: 2.1.1 Precedence: list List-Id: p4 projects tree changes List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 26 Sep 2003 17:28:44 -0000 http://perforce.freebsd.org/chv.cgi?CH=38662 Change 38662 by sam@sam_ebb on 2003/09/26 10:28:38 IFC arp bug fix + fixup locking Affected files ... .. //depot/projects/netperf/sys/netinet/if_ether.c#7 integrate Differences ... ==== //depot/projects/netperf/sys/netinet/if_ether.c#7 (text+ko) ==== @@ -31,7 +31,7 @@ * SUCH DAMAGE. * * @(#)if_ether.c 8.1 (Berkeley) 6/10/93 - * $FreeBSD: src/sys/netinet/if_ether.c,v 1.104 2003/03/04 23:19:52 jlemon Exp $ + * $FreeBSD: src/sys/netinet/if_ether.c,v 1.106 2003/09/24 20:52:25 bms Exp $ */ /* @@ -920,7 +920,6 @@ rt = rtalloc1((struct sockaddr *)&sin, create, 0UL); if (rt == 0) return (0); - rt->rt_refcnt--; if (rt->rt_flags & RTF_GATEWAY) why = "host is not on local network"; @@ -929,16 +928,27 @@ else if (rt->rt_gateway->sa_family != AF_LINK) why = "gateway route is not ours"; - RT_UNLOCK(rt); - - if (why && create) { - log(LOG_DEBUG, "arplookup %s failed: %s\n", - inet_ntoa(sin.sin_addr), why); - return 0; - } else if (why) { - return 0; + if (why) { + if (create) + log(LOG_DEBUG, "arplookup %s failed: %s\n", + inet_ntoa(sin.sin_addr), why); + /* + * If this is the only references to a protocol + * cloned route, remove it. + */ + if (rt->rt_refcnt == 1 && (rt->rt_flags & RTF_WASCLONED)) { + rtrequest(RTM_DELETE, + (struct sockaddr *)rt_key(rt), + rt->rt_gateway, rt_mask(rt), + rt->rt_flags, 0); + } + RTFREE(rt); + return (0); + } else { + rt->rt_refcnt--; + RT_UNLOCK(rt); + return ((struct llinfo_arp *)rt->rt_llinfo); } - return ((struct llinfo_arp *)rt->rt_llinfo); } void