Page MenuHomeFreeBSD

syslogd: Reduce INET/INET6 ifdef cruft
AbandonedPublic

Authored by jfree on Aug 8 2023, 3:00 PM.
Tags
None
Referenced Files
Unknown Object (File)
Fri, Dec 20, 2:30 AM
Unknown Object (File)
Fri, Dec 20, 2:04 AM
Unknown Object (File)
Tue, Dec 3, 10:18 PM
Unknown Object (File)
Nov 7 2024, 3:34 AM
Unknown Object (File)
Nov 7 2024, 1:36 AM
Unknown Object (File)
Oct 21 2024, 3:36 AM
Unknown Object (File)
Oct 18 2024, 11:40 PM
Unknown Object (File)
Sep 25 2024, 5:41 AM
Subscribers

Details

Reviewers
markj
emaste
Summary

Avoid using ifdefs throughout syslogd. Instead, define HAS_INET and HAS_INET6 to true/false and use standard if/else blocks to check for INET/INET6 availability.

Diff Detail

Repository
rG FreeBSD src repository
Lint
Lint Skipped
Unit
Tests Skipped

Event Timeline

Did you test compiling with WITHOUT_INET_SUPPORT=or WITHOUT_INET6_SUPPORT= defined? I suspect it will fail, because the #include <netinet/in.h> at the beginning of syslogd is still conditional on INET or INET6 being defined. While the ifdefs are ugly, I'm not sure we can do much better without adding some dummy definitions to replace those in netinet/in.h.

usr.sbin/syslogd/syslogd.c
3348

Don't you still need something like

if (HAS_INET6 && (<original condition>))

?

usr.sbin/syslogd/syslogd.c
3348

Don't you still need something like

if (HAS_INET6 && (<original condition>))

?

There is no original condition. The code technically isn't necessary when INET6 is disabled, but it won't disrupt INET/ipv4 parsing.

Did you test compiling with WITHOUT_INET_SUPPORT=or WITHOUT_INET6_SUPPORT= defined? I suspect it will fail, because the #include <netinet/in.h> at the beginning of syslogd is still conditional on INET or INET6 being defined. While the ifdefs are ugly, I'm not sure we can do much better without adding some dummy definitions to replace those in netinet/in.h.

Yeah... Tried fixing the broken compilation with WITHOUT_INET_SUPPORT. It's a compilation nightmare. I'm just going to drop this.