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)
Mon, Oct 21, 3:36 AM
Unknown Object (File)
Fri, Oct 18, 11:40 PM
Unknown Object (File)
Sep 25 2024, 5:41 AM
Unknown Object (File)
Sep 24 2024, 4:09 PM
Unknown Object (File)
Sep 20 2024, 5:18 PM
Unknown Object (File)
Sep 20 2024, 2:04 AM
Unknown Object (File)
Sep 19 2024, 10:20 PM
Unknown Object (File)
Sep 17 2024, 3:10 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.