NetBSD Problem Report #55782

From mouse@Stone.Rodents-Montreal.ORG  Wed Nov  4 02:55:53 2020
Return-Path: <mouse@Stone.Rodents-Montreal.ORG>
Received: from mail.netbsd.org (mail.netbsd.org [199.233.217.200])
	(using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits))
	(Client CN "mail.NetBSD.org", Issuer "mail.NetBSD.org CA" (not verified))
	by mollari.NetBSD.org (Postfix) with ESMTPS id 74F5C1A921F
	for <gnats-bugs@gnats.NetBSD.org>; Wed,  4 Nov 2020 02:55:53 +0000 (UTC)
Message-Id: <202011040255.VAA20301@Stone.Rodents-Montreal.ORG>
Date: Tue, 3 Nov 2020 21:55:50 -0500 (EST)
From: Mouse <mouse@Rodents-Montreal.ORG>
Reply-To: mouse@Rodents-Montreal.ORG
To: gnats-bugs@NetBSD.org
Subject: INET/INET6 only semi-optional
X-Send-Pr-Version: 3.95

>Number:         55782
>Category:       kern
>Synopsis:       options INET/INET6 only semi-optional
>Confidential:   no
>Severity:       non-critical
>Priority:       low
>Responsible:    kern-bug-people
>State:          open
>Class:          sw-bug
>Submitter-Id:   net
>Arrival-Date:   Wed Nov 04 03:00:00 +0000 2020
>Last-Modified:  Wed Nov 04 12:15:01 +0000 2020
>Originator:     Mouse
>Release:        NetBSD 9.1
>Organization:
	Dis-
>Environment:
System: NetBSD Aaeon.Rodents-Montreal.ORG 9.1 NetBSD 9.1 (GEN91) #3: Tue Oct 27 09:41:42 EDT 2020 mouse@Aaeon.Rodents-Montreal.ORG:/home/mouse/kbuild/GEN91 amd64
Architecture: x86_64
Machine: amd64
>Description:
	A kernel configured with neither INET nor INET6 does not build.
>How-To-Repeat:
	Try it: copy GENERIC, remove INET and INET6, configure, and try
	to build the result.  I get errors in

	dev/ic/gem.c
	net/if_fddisubr.c
	net/if_loop.c
	net/if_ppp.c
	net/if_sl.c
	net/if_spppsubr.c
	net/if_strip.c
	net/if_vlan.c
	netipsec/ipsec_input.c
	netipsec/ipsec_output.c
	dev/pci/ixgbe/ix_txrx.c
	net/slcompress.c
	dev/usb/uhso.c
	netipsec/xform_ah.c
	netipsec/xform_ipip.c

	and a disturbing number of warnings elsewhere (mostly "this
	statement may fall through", to which my reaction is "if NetBSD
	cares about this, why hasn't it been fixed? if not, why is the
	warning turned on?" - but those in general do not look related
	to the INET/INET6 removal).

	Some of the above (eg, all the IPsec files) are not surprising
	and probably don't really call for fixing, but some, I think,
	are real issues.

	This discovery arose from an attempt to build a cut-back kernel
	for work, for an application which uses Ethernet but not IP; in
	that kernel I removed IPsec, PPP, and a bunch of devices (such
	as sl and vlan), but I recognize gem.c, if_loop.c, and
	ix_txrx.c in the above list as being ones I had to fix.
>Fix:
	These fix the ones that were causing me trouble with the
	cut-back kernel.  Depending on which of the others people care
	about, perhaps some or all of the others of the above list
	should be fixed too.

	These should be relative to stock 9.1 source.  There are other
	commits between this commit and by base 9.1 import, but none of
	them touch any of these three files.

diff --git a/usr/src/sys/dev/ic/gem.c b/usr/src/sys/dev/ic/gem.c
index 6b39db1..26cf79d 100644
--- a/usr/src/sys/dev/ic/gem.c
+++ b/usr/src/sys/dev/ic/gem.c
@@ -1389,7 +1389,9 @@ gem_start(struct ifnet *ifp)
 	 * until we drain the queue, or use up all available transmit
 	 * descriptors.
 	 */
+#ifdef INET
 next:
+#endif
 	while ((txs = SIMPLEQ_FIRST(&sc->sc_txfreeq)) != NULL &&
 	    sc->sc_txfree != 0) {
 		/*
diff --git a/usr/src/sys/dev/pci/ixgbe/ix_txrx.c b/usr/src/sys/dev/pci/ixgbe/ix_txrx.c
index b7b9144..1104792 100644
--- a/usr/src/sys/dev/pci/ixgbe/ix_txrx.c
+++ b/usr/src/sys/dev/pci/ixgbe/ix_txrx.c
@@ -829,8 +829,9 @@ ixgbe_tx_ctx_setup(struct tx_ring *txr, struct mbuf *mp,
 	u16                              vtag = 0;
 	u16                              etype;
 	u8                               ipproto = 0;
+#if defined(INET) || defined(INET6)
 	char                             *l3d;
-
+#endif

 	/* First check if TSO is to be used */
 	if (mp->m_pkthdr.csum_flags & (M_CSUM_TSOv4 | M_CSUM_TSOv6)) {
@@ -884,6 +885,7 @@ ixgbe_tx_ctx_setup(struct tx_ring *txr, struct mbuf *mp,
 	if (offload == FALSE)
 		goto no_offloads;

+#if defined(INET) || defined(INET6)
 	/*
 	 * If the first mbuf only includes the ethernet header,
 	 * jump to the next one
@@ -895,7 +897,7 @@ ixgbe_tx_ctx_setup(struct tx_ring *txr, struct mbuf *mp,
 		l3d = mtod(mp->m_next, char *);
 	else
 		l3d = mtod(mp, char *) + ehdrlen;
-
+#endif
 	switch (etype) {
 #ifdef INET
 	case ETHERTYPE_IP:
diff --git a/usr/src/sys/net/if_loop.c b/usr/src/sys/net/if_loop.c
index 026b05a..7e4f6c2 100644
--- a/usr/src/sys/net/if_loop.c
+++ b/usr/src/sys/net/if_loop.c
@@ -248,7 +248,9 @@ looutput(struct ifnet *ifp, struct mbuf *m, const struct sockaddr *dst,
 	pktqueue_t *pktq = NULL;
 	struct ifqueue *ifq = NULL;
 	int s, isr = -1;
+#if defined(INET) || defined(INET6)
 	int csum_flags;
+#endif
 	int error = 0;
 	size_t pktlen;


/~\ The ASCII				  Mouse
\ / Ribbon Campaign
 X  Against HTML		mouse@rodents-montreal.org
/ \ Email!	     7D C8 61 52 5D E7 2D 39  4E F1 31 3E E8 B3 27 4B

>Audit-Trail:
From: matthew green <mrg@eterna.com.au>
To: gnats-bugs@netbsd.org
Cc: kern-bug-people@netbsd.org, gnats-admin@netbsd.org,
    netbsd-bugs@netbsd.org
Subject: re: kern/55782: INET/INET6 only semi-optional
Date: Wed, 04 Nov 2020 16:42:24 +1100

 FWIW, plain INET6-less is ok.  as a consumer of this, i've
 helped keep it working.  i don't personally care about this
 case (no inet at all), but i support it working.

 > 	and a disturbing number of warnings elsewhere (mostly "this
 > 	statement may fall through", to which my reaction is "if NetBSD
 > 	cares about this, why hasn't it been fixed? if not, why is the
 > 	warning turned on?" - but those in general do not look related
 > 	to the INET/INET6 removal).

 these warnings are in 3rd party code we don't want to modify
 just to avoid a useless warning message.

 if they come up as "warning" not "error", that means we have
 explicitly chosen to ignore this verbosely.

 the warning-as-error in general is useful, but not for this
 specific case.  some we flat out disable or don't use.

From: Mouse <mouse@Rodents-Montreal.ORG>
To: gnats-bugs@netbsd.org
Cc: 
Subject: Re: kern/55782: INET/INET6 only semi-optional
Date: Wed, 4 Nov 2020 07:11:15 -0500 (EST)

 > FWIW, plain INET6-less is ok.  as a consumer of this, i've helped
 > keep it working.  i don't personally care about this case (no inet at
 > all), but i support it working.

 I've also tried INET6 but no INET in the past; I don't recall what
 happened, but I think that, ideally, that case should work too.

 					Mouse

NetBSD Home
NetBSD PR Database Search

(Contact us) $NetBSD: query-full-pr,v 1.46 2020/01/03 16:35:01 leot Exp $
$NetBSD: gnats_config.sh,v 1.9 2014/08/02 14:16:04 spz Exp $
Copyright © 1994-2020 The NetBSD Foundation, Inc. ALL RIGHTS RESERVED.