Bug 37261

Summary: (pr: 33833): [patch] kernel is not linking without "device ether" in the config
Product: Base System Reporter: Eugene Polovnikov <eugene>
Component: kernAssignee: Remko Lodder <remko>
Status: Closed FIXED    
Severity: Affects Only Me CC: galasten
Priority: Normal    
Version: 4.5-STABLE   
Hardware: Any   
OS: Any   
Attachments:
Description Flags
file.diff none

Description Eugene Polovnikov 2002-04-19 20:50:03 UTC
    kernel is not linking without "device ether" in the kernel's config

How-To-Repeat: 	delete "device ether" and all drivers of ethernet NIC's from kernel's config
	and try to build new kernel
Comment 1 Crist J. Clark freebsd_committer freebsd_triage 2002-04-21 09:35:29 UTC
Responsible Changed
From-To: freebsd-bugs->luigi

It was a change by luigi that introduced this problem. Is the 
submitted (simple) fix really a fix, luigi?
Comment 2 ru freebsd_committer freebsd_triage 2002-09-28 14:01:27 UTC
Hi Luigi!

Could you please take a look at PR 37261?

The suggested fix is incorrect, and the correct
fix for 4.x would be to check for:

#if defined(INET) && (NETHER > 0)

The analogous check for 5.0, where there's no NETHER
defined by config(8), is to use something like
ip_fw_chk_ptr (the below is only compile-tested):

%%%
Index: sys/net/if.c
===================================================================
RCS file: /home/ncvs/src/sys/net/if.c,v
retrieving revision 1.148
diff -u -p -r1.148 if.c
--- sys/net/if.c	19 Aug 2002 17:20:03 -0000	1.148
+++ sys/net/if.c	28 Sep 2002 12:48:42 -0000
@@ -75,6 +75,7 @@
 #endif
 #ifdef INET
 #include <netinet/if_ether.h>
+void	(*arp_ifinit_ptr)(struct ifnet *, struct ifaddr *);
 #endif
 
 static int	ifconf(u_long, caddr_t);
@@ -1948,10 +1949,11 @@ if_setlladdr(struct ifnet *ifp, const u_
 		 * Also send gratuitous ARPs to notify other nodes about
 		 * the address change.
 		 */
+		if (arp_ifinit_ptr != NULL)
 		TAILQ_FOREACH(ifa, &ifp->if_addrhead, ifa_link) {
 			if (ifa->ifa_addr != NULL &&
 			    ifa->ifa_addr->sa_family == AF_INET)
-				arp_ifinit(ifp, ifa);
+				(*arp_ifinit_ptr)(ifp, ifa);
 		}
 #endif
 	}
Index: sys/netinet/if_ether.c
===================================================================
RCS file: /home/ncvs/src/sys/netinet/if_ether.c,v
retrieving revision 1.96
diff -u -p -r1.96 if_ether.c
--- sys/netinet/if_ether.c	31 Jul 2002 16:45:16 -0000	1.96
+++ sys/netinet/if_ether.c	28 Sep 2002 12:24:00 -0000
@@ -950,6 +950,7 @@ arp_init(void)
 	arpintrq.ifq_maxlen = 50;
 	mtx_init(&arpintrq.ifq_mtx, "arp_inq", NULL, MTX_DEF);
 	LIST_INIT(&llinfo_arp);
+	arp_ifinit_ptr = arp_ifinit;
 	register_netisr(NETISR_ARP, arpintr);
 }
 
Index: sys/netinet/if_ether.h
===================================================================
RCS file: /home/ncvs/src/sys/netinet/if_ether.h,v
retrieving revision 1.27
diff -u -p -r1.27 if_ether.h
--- sys/netinet/if_ether.h	24 Mar 2002 10:19:10 -0000	1.27
+++ sys/netinet/if_ether.h	28 Sep 2002 12:48:17 -0000
@@ -117,6 +117,7 @@ extern struct	ifqueue arpintrq;
 int	arpresolve(struct ifnet *, struct rtentry *, struct mbuf *,
 	    struct sockaddr *, u_char *, struct rtentry *);
 void	arp_ifinit(struct ifnet *, struct ifaddr *);
+extern void	(*arp_ifinit_ptr)(struct ifnet *, struct ifaddr *);
 #endif
 
 #endif
%%%

-- 
Ruslan Ermilov		Sysadmin and DBA,
ru@sunbay.com		Sunbay Software AG,
ru@FreeBSD.org		FreeBSD committer,
+380.652.512.251	Simferopol, Ukraine

http://www.FreeBSD.org	The Power To Serve
http://www.oracle.com	Enabling The Information Age
Comment 3 Eugene Grosbein 2003-03-01 17:01:31 UTC
Hi!

Any chance this PR and related kern/33833 will be closed before 4.8-RELEASE?

Eugene Grosbein
Comment 4 Remko Lodder freebsd_committer freebsd_triage 2006-12-31 11:09:14 UTC
State Changed
From-To: open->feedback

This probably did not make it into 4.8, do you happen to 
know whether this ever was committed in one form or the 
other?. Please note that i also linked the PR to the 
other PR I just put in feedback mode, this way it's 
easier to track in the topic. 

Reference: PR/33833 


Comment 5 Remko Lodder freebsd_committer freebsd_triage 2006-12-31 11:09:14 UTC
Responsible Changed
From-To: luigi->remko

Grab the PR
Comment 6 Remko Lodder freebsd_committer freebsd_triage 2007-01-27 19:03:29 UTC
State Changed
From-To: feedback->closed

no feedback had been recieved
Comment 7 galasten 2018-01-19 16:08:13 UTC
In FreeBSD 11.1 (i386) same problem appeared:

--- kernel ---
linking kernel
if.o: In function `if_etherbpfmtap':
/usr/src/sys/net/if.c:(.text+0x624f): undefined reference to `ether_vlan_mtap'
*** [kernel] Error code 1

In FreeBSD 10.3 was ok.