Simplify, remove #ifdefs for INET6, always defined

Signed-off-by: Joachim Nilsson <troglobit@gmail.com>
This commit is contained in:
Joachim Nilsson 2019-10-23 15:00:52 +02:00
parent 33411f8a0c
commit 1ba3dc5b87
3 changed files with 6 additions and 14 deletions

View File

@ -25,7 +25,7 @@ AM_CFLAGS += -Wno-unused-result -Wno-unused-parameter
AM_CFLAGS += -fomit-frame-pointer -fno-strength-reduce
syslogd_SOURCES = syslogd.c pidfile.c pidfile.h
syslogd_CPPFLAGS = -DINET6 -D_BSD_SOURCE -D_DEFAULT_SOURCE
syslogd_CPPFLAGS = -D_BSD_SOURCE -D_DEFAULT_SOURCE
klogd_SOURCES = klogd.c klogd.h syslog.c pidfile.c pidfile.h \
ksym.c ksyms.h ksym_mod.c module.h
@ -35,6 +35,6 @@ logger_SOURCES = logger.c syslog.c
logger_CPPFLAGS = -D_XOPEN_SOURCE=600 -D_BSD_SOURCE -D_GNU_SOURCE -D_DEFAULT_SOURCE
tsyslogd_SOURCES = syslogd.c pidfile.c pidfile.h
tsyslogd_CPPFLAGS = -DINET6 -D_BSD_SOURCE -D_DEFAULT_SOURCE -DTESTING
tsyslogd_CPPFLAGS = -D_BSD_SOURCE -D_DEFAULT_SOURCE -DTESTING
syslog_tst_SOURCES = syslog_tst.c

View File

@ -63,7 +63,7 @@ MAN_PERMS = 644
# ballot below.
SYSLOGD_PIDNAME = -DSYSLOGD_PIDNAME=\"syslogd.pid\"
SYSLOGD_FLAGS= -DINET6 ${SYSLOGD_PIDNAME}
SYSLOGD_FLAGS= ${SYSLOGD_PIDNAME}
SYSLOG_FLAGS= -DALLOW_KERNEL_LOGGING
KLOGD_FLAGS = ${KLOGD_START_DELAY}
DEB =

View File

@ -814,11 +814,7 @@ int InetInuse = 0; /* non-zero if INET sockets are being used */
int *finet = NULL; /* Internet datagram sockets */
int Initialized = 0; /* set when we have initialized ourselves */
int MarkInterval = 20 * 60; /* interval between marks in seconds */
#ifdef INET6
int family = PF_UNSPEC; /* protocol family (IPv4, IPv6 or both) */
#else
int family = PF_INET; /* protocol family (IPv4 only) */
#endif
int family = PF_UNSPEC; /* protocol family (IPv4, IPv6 or both) */
int send_to_all = 0; /* send message to all IPv4/IPv6 addresses */
int MarkSeq = 0; /* mark sequence number */
int LastAlarm = 0; /* last value passed to alarm() (seconds) */
@ -919,11 +915,9 @@ int main(int argc, char *argv[])
family = PF_INET;
break;
#ifdef INET6
case '6':
family = PF_INET6;
break;
#endif
case 'A':
send_to_all++;
@ -1381,15 +1375,13 @@ static int *create_inet_sockets(void)
continue;
}
if (r->ai_family == AF_INET6) {
if (setsockopt(*s, IPPROTO_IPV6, IPV6_V6ONLY,
(char *)&on, sizeof(on)) < 0) {
if (setsockopt(*s, IPPROTO_IPV6, IPV6_V6ONLY, &on, sizeof(on)) < 0) {
logerror("setsockopt (IPV6_ONLY), suspending IPv6");
close(*s);
continue;
}
}
if (setsockopt(*s, SOL_SOCKET, SO_REUSEADDR,
(char *)&on, sizeof(on)) < 0) {
if (setsockopt(*s, SOL_SOCKET, SO_REUSEADDR, &on, sizeof(on)) < 0) {
logerror("setsockopt(REUSEADDR), suspending inet");
close(*s);
continue;