Skip site navigation (1)Skip section navigation (2)
Date:      Wed, 10 Mar 1999 01:05:40 +0200
From:      Alexander Matey <lx@hosix.ntu-kpi.kiev.ua>
To:        freebsd-hackers@freebsd.org
Subject:   Static ARP again. kern/6432 revisited.
Message-ID:  <19990310010540.A441@hosix.ntu-kpi.kiev.ua>

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

--sdtB3X0nJg68CQEu
Content-Type: text/plain; charset=us-ascii

Hello,

I'm taking the courage :) to bring up the "static ARP on ethernet
interfaces" issue again. The audit trail of kern/6432 gives sufficient
background and I only want to refresh your memory by mentioning that all 
this is about making -arp parameter of ifconfig(8) work for ethernet 
interfaces.

Attached are diffs for LINT, conf/options and netinet/if_ether.c
made against 3.1-STABLE cvsupped few hours ago. 

The purpose of STATIC_ARP_HACK option is covered in the LINT diff.
I tried to keep everything clean and straightforward.

If someone could take time to review these diffs and comment on them
while paying special attention to the correctness of updated if_ether.c 
I would be very grateful.

-- 
Alexander Matey
Kyiv, Ukraine

--sdtB3X0nJg68CQEu
Content-Type: text/plain; charset=us-ascii
Content-Disposition: attachment; filename="if_ether.c.diff"

--- /sys/netinet/if_ether.c.orig	Thu Mar  4 06:04:48 1999
+++ /sys/netinet/if_ether.c	Wed Mar 10 00:37:48 1999
@@ -30,9 +30,9 @@
  * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
  * SUCH DAMAGE.
  *
  *	@(#)if_ether.c	8.1 (Berkeley) 6/10/93
- * $Id: if_ether.c,v 1.52.2.1 1999/03/04 04:04:48 wpaul Exp $
+ * $Id: if_ether.c,v 1.52 1999/01/19 23:17:03 fenner Exp $
  */
 
 /*
  * Ethernet address resolution protocol.
@@ -41,8 +41,9 @@
  */
 
 #include "opt_inet.h"
 #include "opt_bdg.h"
+#include "opt_static_arp_hack.h"
 
 #include <sys/param.h>
 #include <sys/kernel.h>
 #include <sys/sysctl.h>
@@ -284,8 +285,11 @@
 	register struct ether_header *eh;
 	register struct ether_arp *ea;
 	struct sockaddr sa;
 
+	if ((ac->ac_if.if_flags & IFF_NOARP) != 0) {
+		return;
+	}
 	if ((m = m_gethdr(M_DONTWAIT, MT_DATA)) == NULL)
 		return;
 	m->m_len = sizeof(*ea);
 	m->m_pkthdr.len = sizeof(*ea);
@@ -362,8 +366,12 @@
 	    sdl->sdl_family == AF_LINK && sdl->sdl_alen != 0) {
 		bcopy(LLADDR(sdl), desten, sdl->sdl_alen);
 		return 1;
 	}
+	if ((ac->ac_if.if_flags & IFF_NOARP) != 0) {
+		m_freem(m);
+		return (0);
+	} 
 	/*
 	 * There is an arptab entry, but no ethernet address
 	 * response yet.  Replace the held mbuf with this
 	 * latest one.
@@ -407,8 +415,11 @@
 		splx(s);
 		if (m == 0 || (m->m_flags & M_PKTHDR) == 0)
 			panic("arpintr");
 		if (m->m_len >= sizeof(struct arphdr) &&
+#ifndef STATIC_ARP_HACK
+                    (m->m_pkthdr.rcvif->if_flags & IFF_NOARP) == 0 &&
+#endif
 		    (ar = mtod(m, struct arphdr *)) &&
 		    ntohs(ar->ar_hrd) == ARPHRD_ETHER &&
 		    m->m_len >=
 		      sizeof(struct arphdr) + 2 * ar->ar_hln + 2 * ar->ar_pln)
@@ -502,8 +513,13 @@
 		   ea->arp_sha, ":", inet_ntoa(isaddr));
 		itaddr = myaddr;
 		goto reply;
 	}
+#ifdef STATIC_ARP_HACK
+	if ((ac->ac_if.if_flags & IFF_NOARP) != 0) {
+		goto reply;
+	}
+#endif
 	la = arplookup(isaddr.s_addr, itaddr.s_addr == myaddr.s_addr, 0);
 	if (la && (rt = la->la_rt) && (sdl = SDL(rt->rt_gateway))) {
 #ifndef BRIDGE /* the following is not an error when doing bridging */
 		if (rt->rt_ifp != &ac->ac_if) {

--sdtB3X0nJg68CQEu
Content-Type: text/plain; charset=us-ascii
Content-Disposition: attachment; filename="options.diff"

--- /sys/conf/options.orig	Mon Feb  8 21:05:55 1999
+++ /sys/conf/options	Wed Mar 10 00:11:37 1999
@@ -67,8 +67,9 @@
 SYSVSEM		opt_sysvipc.h
 SYSVSHM		opt_sysvipc.h
 UCONSOLE
 ICMP_BANDLIM
+STATIC_ARP_HACK
 
 # POSIX kernel options
 P1003_1B	opt_posix.h
 _KPOSIX_PRIORITY_SCHEDULING opt_posix.h

--sdtB3X0nJg68CQEu
Content-Type: text/plain; charset=us-ascii
Content-Disposition: attachment; filename="LINT.diff"

--- /sys/i386/conf/LINT.orig	Sun Feb 21 23:12:26 1999
+++ /sys/i386/conf/LINT	Wed Mar 10 00:11:26 1999
@@ -481,8 +481,15 @@
 # You can use IPFIREWALL and dummynet together with bridging.
 options	DUMMYNET
 options	BRIDGE
 
+# STATIC_ARP_HACK enables sending responses to ARP who-has queries 
+# received on an ethernet interface with ARP disabled (see ifconfig(8) for
+# info on -arp parameter). Default is to disable ARP completely on 
+# such interface. With ARP disabled internal ARP table should be setup 
+# manually with arp(8) before any routing daemons have been started.
+options         STATIC_ARP_HACK
+
 #
 # ATM (HARP version) options
 #
 # ATM_CORE includes the base ATM functionality code.  This must be included

--sdtB3X0nJg68CQEu--


To Unsubscribe: send mail to majordomo@FreeBSD.org
with "unsubscribe freebsd-hackers" in the body of the message




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