Alternative fix for FreeBSD-SA-03:14.arp

Bruce M Simpson bms at spc.org
Fri Sep 26 08:23:52 PDT 2003


Hi,

Based on discussion between ru@ and I, there's a patch attached which
tries to fix the problem without deleting GENMASK routes, and is
stricter about not touching STATIC routes.

Comments and reviews solicited, appreciated...

Thanks!
BMS
-------------- next part --------------
--- if_ether.c.orig	Mon Sep 22 21:11:59 2003
+++ if_ether.c	Fri Sep 26 13:43:20 2003
@@ -922,9 +922,19 @@
 	if (why && create) {
 		log(LOG_DEBUG, "arplookup %s failed: %s\n",
 		    inet_ntoa(sin.sin_addr), why);
-		return 0;
+
+		if ((rt->rt_refcnt == 0) &&
+		    (rt->rt_flags & RTF_STATIC) == 0 &&
+		    (rt->rt_flags & (RTF_HOST|RTF_WASCLONED)) ==
+		    (RTF_HOST|RTF_WASCLONED)) {
+			rtrequest(RTM_DELETE, (struct sockaddr *)rt_key(rt),
+				    rt->rt_gateway, rt_mask(rt),
+				    rt->rt_flags, 0);
+		}
+
+		return (0);
 	} else if (why) {
-		return 0;
+		return (0);
 	}
 	return ((struct llinfo_arp *)rt->rt_llinfo);
 }


More information about the freebsd-net mailing list