Skip site navigation (1)Skip section navigation (2)
Date:      Tue, 28 Apr 1998 01:38:19 +0300 (EEST)
From:      lx@hosix.ntu-kpi.kiev.ua
To:        FreeBSD-gnats-submit@FreeBSD.ORG
Subject:   kern/6432: IFF_NOARP does not affect ethernet interfaces.
Message-ID:  <199804272238.BAA01959@hosix.ntu-kpi.kiev.ua>

index | next in thread | raw e-mail


>Number:         6432
>Category:       kern
>Synopsis:       IFF_NOARP does not affect ethernet interfaces.
>Confidential:   no
>Severity:       non-critical
>Priority:       medium
>Responsible:    freebsd-bugs
>State:          open
>Quarter:
>Keywords:
>Date-Required:
>Class:          sw-bug
>Submitter-Id:   current-users
>Arrival-Date:   Mon Apr 27 15:50:00 PDT 1998
>Last-Modified:
>Originator:     Alexander Matey
>Organization:
National Technical University of Ukraine /KPI/
>Release:        FreeBSD 2.2.6-STABLE i386
>Environment:

    FreeBSD 2.2.6-STABLE, with ethernet network interfaces configured.

>Description:

    Setting IFF_NOARP (by the help of ifconfig <iface> -arp) on a particular
ethernet interface has no effect. This flag is ignored by the kernel for
ethernet interfaces.

>How-To-Repeat:

    Configure any ethernet interface. Set IFF_NOARP on it through ifconfig
<iface> -arp. Then tcpdump -i <iface> arp host <our host>

>Fix:
	
    Patch to netinet/if_ether.c included which fixes this. -DARP_HACK enables 
replies to who-has arp queries but still leaves requests disabled.

--- /sys/netinet/if_ether.c.org	Wed May 14 19:43:56 1997
+++ /sys/netinet/if_ether.c	Sun Apr 26 16:47:25 1998
@@ -277,8 +277,14 @@
 	register struct ether_header *eh;
 	register struct ether_arp *ea;
 	struct sockaddr sa;
 
+/* PATCH BEGIN -lx- */
+	if((ac->ac_if.if_flags & IFF_NOARP) != 0) {
+		return;
+	}
+/* PATCH END */
+
 	if ((m = m_gethdr(M_DONTWAIT, MT_DATA)) == NULL)
 		return;
 	m->m_len = sizeof(*ea);
 	m->m_pkthdr.len = sizeof(*ea);
@@ -353,8 +359,14 @@
 	    sdl->sdl_family == AF_LINK && sdl->sdl_alen != 0) {
 		bcopy(LLADDR(sdl), desten, sdl->sdl_alen);
 		return 1;
 	}
+/* PATCH BEGIN -lx- */
+	if((ac->ac_if.if_flags & IFF_NOARP) != 0) {
+		m_freem(m);
+		return (0);
+	} 
+/* PATCH END */
 	/*
 	 * There is an arptab entry, but no ethernet address
 	 * response yet.  Replace the held mbuf with this
 	 * latest one.
@@ -399,8 +411,13 @@
 		splx(s);
 		if (m == 0 || (m->m_flags & M_PKTHDR) == 0)
 			panic("arpintr");
 		if (m->m_len >= sizeof(struct arphdr) &&
+/* PATCH BEGIN -lx- */
+#ifndef ARP_HACK
+                    (m->m_pkthdr.rcvif->if_flags & IFF_NOARP) == 0 &&
+#endif
+/* PATCH END */
 		    (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)
@@ -481,8 +498,16 @@
 		   ea->arp_sha, ":", inet_ntoa(isaddr));
 		itaddr = myaddr;
 		goto reply;
 	}
+
+/* PATCH BEGIN -lx- */
+#ifdef ARP_HACK
+	if ((ac->ac_if.if_flags & IFF_NOARP) != 0) {
+		goto reply;
+	}
+#endif
+/* PATCH END */
 	la = arplookup(isaddr.s_addr, itaddr.s_addr == myaddr.s_addr, 0);
 	if (la && (rt = la->la_rt) && (sdl = SDL(rt->rt_gateway))) {
 		if (sdl->sdl_alen &&
 		    bcmp((caddr_t)ea->arp_sha, LLADDR(sdl), sdl->sdl_alen))
>Audit-Trail:
>Unformatted:

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


help

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