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, Jun 21, 5:43 AM
Unknown Object (File)
Tue, Jun 4, 10:14 AM
Unknown Object (File)
Apr 22 2024, 7:49 PM
Unknown Object (File)
Apr 20 2024, 9:14 PM
Unknown Object (File)
Mar 16 2024, 2:12 AM
Unknown Object (File)
Jan 8 2024, 9:12 AM
Unknown Object (File)
Dec 25 2023, 7:46 PM
Unknown Object (File)
Dec 21 2023, 8:14 PM
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.