use of #ifdef INET and #ifdef INET6 in the kernel sources
Rodney W. Grimes
freebsd-rwg at pdx.rh.CN85.dnsmgr.net
Fri Mar 1 12:19:50 UTC 2019
> Bjoern A. Zeeb wrote:
> [stuff snipped]
> I wrote:
> >> So, is this still recommended for blocks of code that only execute for
> >> the version
> >> of IP, but will build for kernels that do not have the particular
> >> "options INET{6}"
> >> in the kernel config?
> >
> >Yes.
> Ok, I'll do it.
Thank you
> >> If it is still recommended, I will do it, but I'll admit I don't
> >> understand why it should
> >> be done? (All it does is reduce the size of the executable by a small
> >> amount and
> >> that doesn't seem significant to me.)
> >
> >That small amount is still relevant on some devices where people go to
> >great lengths to fit our constantly growing base into a tiny small
> >thingy.
> I doubt NFS gets squeezed into such devices and, yes, it is a small amount.
> Using source line counts via "wc" (ir includes comments, etc):
> - This will reduce the # of lines by about 6 for a module of about 7700 lines
> which is loaded when either the nfscl or nfsserver modules are loaded.
> (These are both about 25000 lines and require the krpc, which is another 10000.
> I haven't included the Kerberos stuff, because I can't remember if that gets loaded
> unless Kerberos mounts get used.)
> --> A savings of 6 lines in something like 43000.
That means that nfsusrd is an extremly well behaved ipv4/ipv6
agnostic deamon that only takes a small change to make it able
to run as either v4/v6 as a single stack or dual stacked, at a cost
that also sounds minial, even if it took an #ifdef for each of these
lines that is only 6 in 43000 lines of code, which is a small cost.
The same analysis on other code probably comes out no place near
this.
Also didnt this use to use a unix domain? Could the unix domain
be put back and knobbed so that I could actually run this without
it doing the localnet thing at all? I know that it had issues
as the socket is in /tmp and if /tmp isnt a right type file system,
etc... But some of us do know that and do run with a /tmp that
would support AF_UNIX type nfsusrd.
If it takes 6 lines of ifdef to do v4 vs v6, how many lines of
ifdef is it to add AF_UNIX back and make it run time choice?
(Goes looking for more Nomex clothing :-)
> >And it allows you to lose code from your kernel that you don?t
> >need/want, such as if you?d want to rip out all INET sources from a
> >tree.
> Ok, I can buy into this argument. I doubt I'll see IPv4 removed in my lifetime, but
> it does document where the code is.
> (In Canada, network providers only give out IPv4 addresses to end users, from
> what I've seen.)
>
> >I know both of these groups still do exist.
> >
> >Also every code not compiled in is not an attack surface, where you
> >think it?s executed or not.
>
> rick
--
Rod Grimes rgrimes at freebsd.org
More information about the freebsd-net
mailing list