PERFORCE change 38662 for review
Sam Leffler
sam at FreeBSD.org
Fri Sep 26 10:28:44 PDT 2003
http://perforce.freebsd.org/chv.cgi?CH=38662
Change 38662 by sam at 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
More information about the p4-projects
mailing list