Date: Thu, 28 Feb 2019 01:39:51 +0000 From: "Bjoern A. Zeeb" <bz@FreeBSD.org> To: "Rick Macklem" <rmacklem@uoguelph.ca> Cc: "FreeBSD Net" <freebsd-net@freebsd.org>, rgrimes@freebsd.org Subject: Re: use of #ifdef INET and #ifdef INET6 in the kernel sources Message-ID: <8EDE90B3-0C33-47B5-88D8-964B131AEE2E@FreeBSD.org> In-Reply-To: <QB1PR01MB353721C2A0CA0E38C7A8571EDD750@QB1PR01MB3537.CANPRD01.PROD.OUTLOOK.COM> References: <QB1PR01MB353721C2A0CA0E38C7A8571EDD750@QB1PR01MB3537.CANPRD01.PROD.OUTLOOK.COM>
next in thread | previous in thread | raw e-mail | index | archive | help
On 28 Feb 2019, at 1:11, Rick Macklem wrote: > 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. Not sure who said this. > 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. We all agree on 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? Yes. > 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. 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. 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. /bz
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?8EDE90B3-0C33-47B5-88D8-964B131AEE2E>