Skip site navigation (1)Skip section navigation (2)
Date:      Fri, 26 Sep 2003 16:23:49 +0100
From:      Bruce M Simpson <bms@spc.org>
To:        freebsd-net@freebsd.org
Subject:   Alternative fix for FreeBSD-SA-03:14.arp
Message-ID:  <20030926152349.GI662@saboteur.dek.spc.org>

next in thread | raw e-mail | index | archive | help

--NPukt5Otb9an/u20
Content-Type: text/plain; charset=us-ascii
Content-Disposition: inline

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

--NPukt5Otb9an/u20
Content-Type: text/plain; charset=us-ascii
Content-Disposition: attachment; filename="newarp.diff"

--- 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);
 }

--NPukt5Otb9an/u20--



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?20030926152349.GI662>