Page MenuHomeFreeBSD

Fix LINT-NOINET kernels
AbandonedPublic

Authored by ngie on Jan 12 2016, 3:36 AM.
Tags
None
Referenced Files
Unknown Object (File)
Nov 28 2024, 5:42 AM
Unknown Object (File)
Nov 21 2024, 3:05 PM
Unknown Object (File)
Nov 21 2024, 10:40 AM
Unknown Object (File)
Nov 21 2024, 5:29 AM
Unknown Object (File)
Nov 18 2024, 7:11 PM
Unknown Object (File)
Nov 16 2024, 11:50 PM
Unknown Object (File)
Nov 13 2024, 5:46 PM
Unknown Object (File)
Nov 13 2024, 1:14 PM
Subscribers

Details

Reviewers
ae
Summary

Fix LINT-NOINET kernels

  • Generate opt_inet.h appropriately according to MK_INET_SUPPORT
  • Only add in_gif.c to SRCS if MK_INET_SUPPORT != no

MFC after: 1 week
Sponsored by: EMCC / Isilon Storage Division

Test Plan

I built the kernel module like so and ran..

ifconfig gif0 create
ifconfig gif0 destroy

.. without error:

INET | INET6
 no  |  no
yes  |  no
 no  |  yes
yes  |  yes

make tinderbox passed (finally) on universe10a.freebsd.org:

--------------------------------------------------------------
>>> make universe completed on Tue Jan 12 05:46:57 UTC 2016
                      (started Tue Jan 12 00:48:41 UTC 2016)
--------------------------------------------------------------

Diff Detail

Repository
rS FreeBSD src repository - subversion
Lint
Lint Passed
Unit
No Test Coverage
Build Status
Buildable 2048
Build 2056: arc lint + arc unit

Event Timeline

ngie retitled this revision from to Fix LINT-NOINET kernels.
ngie updated this object.
ngie edited the test plan for this revision. (Show Details)
ngie added a reviewer: ae.
ngie added subscribers: bz, bdrewery, imp.

Fold the two !defined(KERNBUILDDIR) expressions into one expression

sys/modules/if_gif/Makefile
16

opt_inet.h can contain several options, e.g. TCP_OFFLOAD, TCP_SIGNATURE. So, in general this expression can give wrong result.

ngie marked an inline comment as done.Jan 12 2016, 8:44 AM
ngie added inline comments.
sys/modules/if_gif/Makefile
16

I agree in principle, but disagree for the following reasons:

  • this is the lowest common denominator on stable/10 (cxgbe is the only thing that defines TCP_OFFLOAD on stable/10).
  • TCP_SIGNATURE isn't defined on ^/head in sys/conf/config.mk along with the handful of other options in sys/conf/options.
  • TCP_* isn't used in if_gif(4).
$ grep -r TCP_ ../../*/*_gif.c || echo not found
not found
  • This might introduce further instability for what I'm trying to make just be a simple bug fix for make tinderbox so it no longer errors out on my other branch and for others on ^/stable/10.

I'm all for fixing this up, but I would rather invest time in backporting config.mk as it makes a lot more sense than dealing with piecemeal backports of opt_net.h.

20–22

I'll remove lines 20 and 22 to fold the expressions into one expression

ngie marked 2 inline comments as done.Jan 12 2016, 8:44 AM

This is how it works in my understanding. You have builded LINT-NOINET kernel. opt_inet.h in KERNBUILDDIR will contain TCP_SIGNATURE option and when modules will be build, this expression will give wrong result. I.e. it will try build kernel module with INET.

In D4864#103523, @ae wrote:

This is how it works in my understanding. You have builded LINT-NOINET kernel. opt_inet.h in KERNBUILDDIR will contain TCP_SIGNATURE option and when modules will be build, this expression will give wrong result. I.e. it will try build kernel module with INET.

In this case though, opt_inet.h (if it doesn't already exist in /usr/obj/sys/modules/if_gif/) will only contain #define INET 1, or will be empty.

Just tried:

# pwd
/usr/obj/home/devel/freebsd/base/stable/10/sys/LINT-NOINET/modules/home/devel/freebsd/base/stable/10/sys/modules/if_gif
# ll
total 30
-rw-r--r--  1 root  wheel   6236 12 янв 09:48 .depend
lrwxr-xr-x  1 root  wheel     38 12 янв 09:48 @ -> /home/devel/freebsd/base/stable/10/sys
-rw-r--r--  1 root  wheel  19720 12 янв 09:50 if_gif.o
lrwxr-xr-x  1 root  wheel     52 12 янв 09:48 machine -> /home/devel/freebsd/base/stable/10/sys/amd64/include
lrwxr-xr-x  1 root  wheel     69 12 янв 09:48 opt_inet.h -> /usr/obj/home/devel/freebsd/base/stable/10/sys/LINT-NOINET/opt_inet.h
lrwxr-xr-x  1 root  wheel     70 12 янв 09:48 opt_inet6.h -> /usr/obj/home/devel/freebsd/base/stable/10/sys/LINT-NOINET/opt_inet6.h
lrwxr-xr-x  1 root  wheel     73 12 янв 09:48 opt_mrouting.h -> /usr/obj/home/devel/freebsd/base/stable/10/sys/LINT-NOINET/opt_mrouting.h
lrwxr-xr-x  1 root  wheel     50 12 янв 09:48 x86 -> /home/devel/freebsd/base/stable/10/sys/x86/include
# cat opt_inet.h 
#define TCP_OFFLOAD 1
#define TCP_SIGNATURE 1

In the head/ we use awk to parse opt_inet.h, maybe just replace 'cat' with 'awk'?

In D4864#103605, @ae wrote:

Just tried:

# pwd
/usr/obj/home/devel/freebsd/base/stable/10/sys/LINT-NOINET/modules/home/devel/freebsd/base/stable/10/sys/modules/if_gif
# ll
total 30
-rw-r--r--  1 root  wheel   6236 12 янв 09:48 .depend
lrwxr-xr-x  1 root  wheel     38 12 янв 09:48 @ -> /home/devel/freebsd/base/stable/10/sys
-rw-r--r--  1 root  wheel  19720 12 янв 09:50 if_gif.o
lrwxr-xr-x  1 root  wheel     52 12 янв 09:48 machine -> /home/devel/freebsd/base/stable/10/sys/amd64/include
lrwxr-xr-x  1 root  wheel     69 12 янв 09:48 opt_inet.h -> /usr/obj/home/devel/freebsd/base/stable/10/sys/LINT-NOINET/opt_inet.h
lrwxr-xr-x  1 root  wheel     70 12 янв 09:48 opt_inet6.h -> /usr/obj/home/devel/freebsd/base/stable/10/sys/LINT-NOINET/opt_inet6.h
lrwxr-xr-x  1 root  wheel     73 12 янв 09:48 opt_mrouting.h -> /usr/obj/home/devel/freebsd/base/stable/10/sys/LINT-NOINET/opt_mrouting.h
lrwxr-xr-x  1 root  wheel     50 12 янв 09:48 x86 -> /home/devel/freebsd/base/stable/10/sys/x86/include
# cat opt_inet.h 
#define TCP_OFFLOAD 1
#define TCP_SIGNATURE 1

I'm not surprised it works, but this is orthogonal to what is trying to be accomplished here. I'm merely trying to unbreak if_gif(4) with MK_INET == no. No more, no less.

opt_inet.h is defined in 52 Makefiles, but only 5 add TCP_OFFLOAD, and none of them add TCP_SIGNATURE:

$ grep -A 3 -lr opt_inet.h: sys/modules/
sys/modules/patm/Makefile
sys/modules/sfxge/Makefile
sys/modules/igb/Makefile
sys/modules/fatm/Makefile
sys/modules/ip_mroute_mod/Makefile
sys/modules/arcnet/Makefile
sys/modules/sppp/Makefile
sys/modules/ixlv/Makefile
sys/modules/pflog/Makefile
sys/modules/if_gif/Makefile
sys/modules/ipdivert/Makefile
sys/modules/mlx4ib/Makefile
sys/modules/ipoib/Makefile
sys/modules/firewire/fwip/Makefile
sys/modules/virtio/network/Makefile
sys/modules/carp/Makefile
sys/modules/if_tap/Makefile
sys/modules/pf/Makefile
sys/modules/netgraph/ipfw/Makefile
sys/modules/netgraph/gif/Makefile
sys/modules/netgraph/iface/Makefile
sys/modules/if_bridge/Makefile
sys/modules/hatm/Makefile
sys/modules/an/Makefile
sys/modules/wlan/Makefile
sys/modules/if_faith/Makefile
sys/modules/vmware/vmxnet3/Makefile
sys/modules/smbfs/Makefile
sys/modules/if_stf/Makefile
sys/modules/mlxen/Makefile
sys/modules/cxgb/tom/Makefile
sys/modules/cxgb/iw_cxgb/Makefile
sys/modules/cxgb/cxgb/Makefile
sys/modules/if_lagg/Makefile
sys/modules/ixl/Makefile
sys/modules/ipfw/Makefile
sys/modules/if_tun/Makefile
sys/modules/em/Makefile
sys/modules/en/Makefile
sys/modules/snc/Makefile
sys/modules/lmc/Makefile
sys/modules/nfsclient/Makefile
sys/modules/if_gre/Makefile
sys/modules/mthca/Makefile
sys/modules/if_disc/Makefile
sys/modules/pfsync/Makefile
sys/modules/nfscl/Makefile
sys/modules/if_ef/Makefile
sys/modules/cxgbe/if_cxgbe/Makefile
sys/modules/cxgbe/iw_cxgbe/Makefile
sys/modules/cxgbe/tom/Makefile
sys/modules/mlx4/Makefile
$ for i in `grep -A 3 -lr opt_inet.h: sys/modules/`; do grep -l TCP_OFFLOAD $i; done
sys/modules/cxgb/tom/Makefile
sys/modules/cxgb/iw_cxgb/Makefile
sys/modules/cxgb/cxgb/Makefile
sys/modules/cxgbe/if_cxgbe/Makefile
sys/modules/cxgbe/iw_cxgbe/Makefile
sys/modules/cxgbe/tom/Makefile
$ for i in `grep -A 3 -lr opt_inet.h: sys/modules/`; do grep -l TCP_SIGNATURE $i; done
In D4864#103610, @ae wrote:

In the head/ we use awk to parse opt_inet.h, maybe just replace 'cat' with 'awk'?

I'm for improvement, but I'd (again) rather stick with how it has historically evolved in head and use cat in this commit to be consistent with the other code and how things evolved historically instead of inventing another mechanism, which will confuse someone potentially that follows history of the code and might apply patches in series assuming that it "just works".

So what's wrong with just MFCing the changes I made to make current work without all this crazy?

In D4864#103904, @ngie wrote:

I'm not surprised it works, but this is orthogonal to what is trying to be accomplished here. I'm merely trying to unbreak if_gif(4) with MK_INET == no. No more, no less.

I feel you don't understand what I'm trying to say. These options (TCP_SIGNATURE and TCP_OFFLOAD) by themselves don't needed to build if_gif(4) module. They are orthogonal to it.
When you build the LINT-NOINET kernel where all these options are included, opt_inet.h will be generated and it will not empty and 'cat opt_inet.h' will give not empty result. Thus even when the kernel has no INET support, module that builded together with it should be build with INET.
The question is why it works and does it work as expected? Probably I just understood how it works wrongly :)
Anyway I have no objection against this. If it works for you, feel free to commit :)

In D4864#103909, @imp wrote:

So what's wrong with just MFCing the changes I made to make current work without all this crazy?

I didn't have the time to do this right at the moment, but I will setup another branch and pull in your changes and bz's changes to get things working.

Part of the pain stems from src.opts.mk and other build related changes that have a large degree of potential impact, which I haven't assessed yet.

ngie marked an inline comment as done.