use of #ifdef INET and #ifdef INET6 in the kernel sources

Rick Macklem rmacklem at uoguelph.ca
Thu Feb 28 01:11:50 UTC 2019


I thought (can't remember when/how I was told) that it was no longer
recommended to add
#ifdef INET
or
#ifdef INET6
to the kernel sources.

I'll admit I think #ifdef'ng code when it isn't necessary to get it to build makes the
code less readable and, as such, I prefer not to do this.

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?

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.)

rick



More information about the freebsd-net mailing list