From fc013607d29818409acc1be5a48cd1e78c9fcef7 Mon Sep 17 00:00:00 2001 From: Gerhard Rieger Date: Wed, 26 Mar 2014 20:24:58 +0100 Subject: [PATCH] struct cmsghdr.cmsg is system dependend; more print format corrections --- CHANGES | 3 +++ compat.h | 61 ++++++++++++++++++++++++++++++++++++-------------- config.h.in | 2 ++ configure.in | 2 ++ procan-cdefs.c | 2 +- sycls.c | 20 ++++++++--------- sycls.h | 4 ++-- test.sh | 14 ++++++++---- xio-listen.c | 8 +++---- xio-process.c | 2 +- xio-proxy.c | 2 +- xio-socket.c | 8 +++---- xio-socks.c | 4 ++-- xio-udp.c | 6 ++--- xioopts.c | 10 +++++++-- xiosigchld.c | 4 ++-- 16 files changed, 99 insertions(+), 53 deletions(-) diff --git a/CHANGES b/CHANGES index e09a943..522b073 100644 --- a/CHANGES +++ b/CHANGES @@ -174,6 +174,9 @@ porting: autoconf now prefers configure.ac over configure.in Thanks to Michael Vastola for sending a patch. + type of struct cmsghdr.cmsg is system dependend, determine it with + configure; some more print format corrections + libwrap always logs to syslog added actual text version of GPLv2 diff --git a/compat.h b/compat.h index 05f4816..643fbb6 100644 --- a/compat.h +++ b/compat.h @@ -99,7 +99,7 @@ # define SIZET_MAX UINT_MAX # define SSIZET_MIN INT_MIN # define SSIZET_MAX INT_MAX -# define F_Zd "%d" +# define F_Zd "%""d" # define F_Zu "%u" #elif HAVE_BASIC_SIZE_T==6 # define SIZET_MAX ULONG_MAX @@ -153,7 +153,7 @@ # elif HAVE_BASIC_PID_T==2 #define F_pid "%hu" # elif HAVE_BASIC_PID_T==3 -#define F_pid "%d" +#define F_pid "%""d" # elif HAVE_BASIC_PID_T==4 #define F_pid "%u" # elif HAVE_BASIC_PID_T==5 @@ -177,7 +177,7 @@ # elif HAVE_BASIC_UID_T==2 #define F_uid "%hu" # elif HAVE_BASIC_UID_T==3 -#define F_uid "%d" +#define F_uid "%""d" # elif HAVE_BASIC_UID_T==4 #define F_uid "%u" # elif HAVE_BASIC_UID_T==5 @@ -201,7 +201,7 @@ # elif HAVE_BASIC_GID_T==2 #define F_gid "%hu" # elif HAVE_BASIC_GID_T==3 -#define F_gid "%d" +#define F_gid "%""d" # elif HAVE_BASIC_GID_T==4 #define F_gid "%u" # elif HAVE_BASIC_GID_T==5 @@ -225,7 +225,7 @@ # elif HAVE_BASIC_TIME_T==2 #define F_time "%hu" # elif HAVE_BASIC_TIME_T==3 -#define F_time "%d" +#define F_time "%""d" # elif HAVE_BASIC_TIME_T==4 #define F_time "%u" # elif HAVE_BASIC_TIME_T==5 @@ -253,7 +253,7 @@ # elif HAVE_BASIC_SOCKLEN_T==2 #define F_socklen "%hu" # elif HAVE_BASIC_SOCKLEN_T==3 -#define F_socklen "%d" +#define F_socklen "%""d" # elif HAVE_BASIC_SOCKLEN_T==4 #define F_socklen "%u" # elif HAVE_BASIC_SOCKLEN_T==5 @@ -275,7 +275,7 @@ #endif #ifndef F_off # if HAVE_BASIC_OFF_T==3 -# define F_off "%d" +# define F_off "%""d" # elif HAVE_BASIC_OFF_T==5 # define F_off "%ld" # else @@ -294,7 +294,7 @@ # elif HAVE_BASIC_OFF64_T==2 #define F_off64 "%hu" # elif HAVE_BASIC_OFF64_T==3 -#define F_off64 "%d" +#define F_off64 "%""d" # elif HAVE_BASIC_OFF64_T==4 #define F_off64 "%u" # elif HAVE_BASIC_OFF64_T==5 @@ -322,7 +322,7 @@ # elif HAVE_BASIC_DEV_T==2 #define F_dev "%hu" # elif HAVE_BASIC_DEV_T==3 -#define F_dev "%d" +#define F_dev "%""d" # elif HAVE_BASIC_DEV_T==4 #define F_dev "%u" # elif HAVE_BASIC_DEV_T==5 @@ -349,7 +349,7 @@ # elif HAVE_TYPEOF_ST_INO==2 #define F_st_ino "%hu" # elif HAVE_TYPEOF_ST_INO==3 -#define F_st_ino "%d" +#define F_st_ino "%""d" # elif HAVE_TYPEOF_ST_INO==4 #define F_st_ino "%u" # elif HAVE_TYPEOF_ST_INO==5 @@ -376,7 +376,7 @@ # elif HAVE_TYPEOF_ST64_INO==2 #define F_st64_ino "%hu" # elif HAVE_TYPEOF_ST64_INO==3 -#define F_st64_ino "%d" +#define F_st64_ino "%""d" # elif HAVE_TYPEOF_ST64_INO==4 #define F_st64_ino "%u" # elif HAVE_TYPEOF_ST64_INO==5 @@ -403,7 +403,7 @@ # elif HAVE_TYPEOF_ST_NLINK==2 #define F_st_nlink "%hu" # elif HAVE_TYPEOF_ST_NLINK==3 -#define F_st_nlink "%d" +#define F_st_nlink "%""d" # elif HAVE_TYPEOF_ST_NLINK==4 #define F_st_nlink "%u" # elif HAVE_TYPEOF_ST_NLINK==5 @@ -430,7 +430,7 @@ # elif HAVE_TYPEOF_ST_SIZE==2 #define F_st_size "%hu" # elif HAVE_TYPEOF_ST_SIZE==3 -#define F_st_size "%d" +#define F_st_size "%""d" # elif HAVE_TYPEOF_ST_SIZE==4 #define F_st_size "%u" # elif HAVE_TYPEOF_ST_SIZE==5 @@ -457,7 +457,7 @@ # elif HAVE_TYPEOF_ST64_SIZE==2 #define F_st64_size "%hu" # elif HAVE_TYPEOF_ST64_SIZE==3 -#define F_st64_size "%d" +#define F_st64_size "%""d" # elif HAVE_TYPEOF_ST64_SIZE==4 #define F_st64_size "%u" # elif HAVE_TYPEOF_ST64_SIZE==5 @@ -484,7 +484,7 @@ # elif HAVE_TYPEOF_ST_BLKSIZE==2 #define F_st_blksize "%hu" # elif HAVE_TYPEOF_ST_BLKSIZE==3 -#define F_st_blksize "%d" +#define F_st_blksize "%""d" # elif HAVE_TYPEOF_ST_BLKSIZE==4 #define F_st_blksize "%u" # elif HAVE_TYPEOF_ST_BLKSIZE==5 @@ -511,7 +511,7 @@ # elif HAVE_TYPEOF_ST_BLOCKS==2 #define F_st_blocks "%hu" # elif HAVE_TYPEOF_ST_BLOCKS==3 -#define F_st_blocks "%d" +#define F_st_blocks "%""d" # elif HAVE_TYPEOF_ST_BLOCKS==4 #define F_st_blocks "%u" # elif HAVE_TYPEOF_ST_BLOCKS==5 @@ -538,7 +538,7 @@ # elif HAVE_TYPEOF_ST64_BLOCKS==2 #define F_st64_blocks "%hu" # elif HAVE_TYPEOF_ST64_BLOCKS==3 -#define F_st64_blocks "%d" +#define F_st64_blocks "%""d" # elif HAVE_TYPEOF_ST64_BLOCKS==4 #define F_st64_blocks "%u" # elif HAVE_TYPEOF_ST64_BLOCKS==5 @@ -612,6 +612,33 @@ # endif #endif +/* default: socklen_t */ +#if !defined(HAVE_TYPEOF_STRUCT_CMSGHDR_CMSG_LEN) || !HAVE_TYPEOF_STRUCT_CMSGHDR_CMSG_LEN +# undef HAVE_TYPEOF_STRUCT_CMSGHDR_CMSG_LEN +# define HAVE_TYPEOF_STRUCT_CMSGHDR_CMSG_LEN HAVE_BASIC_SOCKLEN_T +#endif +#ifndef F_cmsg_len +# if HAVE_TYPEOF_STRUCT_CMSGHDR_CMSG_LEN==1 +#define F_cmsg_len "%""hd" +# elif HAVE_TYPEOF_STRUCT_CMSGHDR_CMSG_LEN==2 +#define F_cmsg_len "%""hu" +# elif HAVE_TYPEOF_STRUCT_CMSGHDR_CMSG_LEN==3 +#define F_cmsg_len "%""d" +# elif HAVE_TYPEOF_STRUCT_CMSGHDR_CMSG_LEN==4 +#define F_cmsg_len "%""u" +# elif HAVE_TYPEOF_STRUCT_CMSGHDR_CMSG_LEN==5 +#define F_cmsg_len "%""ld" +# elif HAVE_TYPEOF_STRUCT_CMSGHDR_CMSG_LEN==6 +#define F_cmsg_len "%""lu" +# elif HAVE_TYPEOF_STRUCT_CMSGHDR_CMSG_LEN==7 +#define F_cmsg_len "%""Ld" +# elif HAVE_TYPEOF_STRUCT_CMSGHDR_CMSG_LEN==8 +#define F_cmsg_len "%""Lu" +# else +#error "HAVE_TYPEOF_STRUCT_CMSGHDR_CMSG_LEN is out of range:" HAVE_TYPEOF_STRUCT_CMSGHDR_CMSG_LEN +# endif +#endif + #define F_thread "%lu" /* Cygwin 1.3.22 has the prototypes, but not the type... */ diff --git a/config.h.in b/config.h.in index 9217954..c8f4fbe 100644 --- a/config.h.in +++ b/config.h.in @@ -495,6 +495,8 @@ #undef HAVE_TYPEOF_RLIM_MAX +#undef HAVE_TYPEOF_STRUCT_CMSGHDR_CMSG_LEN + /* Define if you have the /proc filesystem */ #undef HAVE_PROC_DIR diff --git a/configure.in b/configure.in index b26c23c..8c1318a 100644 --- a/configure.in +++ b/configure.in @@ -1710,6 +1710,8 @@ AC_TYPEOF_COMPONENT([#include #include ], struct rlimit, rlim_max, HAVE_TYPEOF_RLIM_MAX, sc_cv_type_rlimit_rlimmax_basic) +# Fedora-19 doc says it is socklen_t which is equivalent to unsigned int, but it is equivalent to size_t (x86_64) +AC_TYPEOF_COMPONENT([#include "sysincludes.h"], struct cmsghdr, cmsg_len, HAVE_TYPEOF_STRUCT_CMSGHDR_CMSG_LEN, sc_cv_typeof_struct_cmsghdr_cmsg_len) ### snprintf, vsnprintf diff --git a/procan-cdefs.c b/procan-cdefs.c index 2e4d41a..a592e21 100644 --- a/procan-cdefs.c +++ b/procan-cdefs.c @@ -20,7 +20,7 @@ int procan_cdefs(FILE *outfile) { fprintf(outfile, "#define FD_SETSIZE %u\n", FD_SETSIZE); #endif #ifdef NFDBITS - fprintf(outfile, "#define NFDBITS %d\n", NFDBITS); + fprintf(outfile, "#define NFDBITS %d\n", (int)NFDBITS); #endif #ifdef O_RDONLY fprintf(outfile, "#define O_RDONLY %u\n", O_RDONLY); diff --git a/sycls.c b/sycls.c index 7755f57..9d7485e 100644 --- a/sycls.c +++ b/sycls.c @@ -938,12 +938,12 @@ int Socket(int domain, int type, int protocol) { #endif /* _WITH_SOCKET */ #if _WITH_SOCKET -int Bind(int sockfd, struct sockaddr *my_addr, int addrlen) { +int Bind(int sockfd, struct sockaddr *my_addr, socklen_t addrlen) { int result, _errno; char infobuff[256]; sockaddr_info(my_addr, addrlen, infobuff, sizeof(infobuff)); - Debug3("bind(%d, %s, "F_Zd")", sockfd, infobuff, addrlen); + Debug3("bind(%d, %s, "F_socklen")", sockfd, infobuff, addrlen); result = bind(sockfd, my_addr, addrlen); _errno = errno; Debug1("bind() -> %d", result); @@ -953,14 +953,14 @@ int Bind(int sockfd, struct sockaddr *my_addr, int addrlen) { #endif /* _WITH_SOCKET */ #if _WITH_SOCKET -int Connect(int sockfd, const struct sockaddr *serv_addr, int addrlen) { +int Connect(int sockfd, const struct sockaddr *serv_addr, socklen_t addrlen) { int result, _errno; char infobuff[256]; /*sockaddr_info(serv_addr, infobuff, sizeof(infobuff)); Debug3("connect(%d, %s, "F_Zd")", sockfd, infobuff, addrlen);*/ #if 0 - Debug18("connect(%d,{0x%02x%02x%02x%02x %02x%02x%02x%02x%02x%02x%02x%02x%02x%02x%02x%02x}, "F_Zd")", + Debug18("connect(%d,{0x%02x%02x%02x%02x %02x%02x%02x%02x%02x%02x%02x%02x%02x%02x%02x%02x}, "F_socklen")", sockfd, ((unsigned char *)serv_addr)[0], ((unsigned char *)serv_addr)[1], ((unsigned char *)serv_addr)[2], ((unsigned char *)serv_addr)[3], @@ -1008,7 +1008,7 @@ int Accept(int s, struct sockaddr *addr, socklen_t *addrlen) { if (result >= 0) { char infobuff[256]; sockaddr_info(addr, *addrlen, infobuff, sizeof(infobuff)); - Info5("accept(%d, {%d, %s}, "F_Zd") -> %d", s, + Info5("accept(%d, {%d, %s}, "F_socklen") -> %d", s, addr->sa_family, sockaddr_info(addr, *addrlen, infobuff, sizeof(infobuff)), *addrlen, result); @@ -1057,7 +1057,7 @@ int Getpeername(int s, struct sockaddr *name, socklen_t *namelen) { #if _WITH_SOCKET int Getsockopt(int s, int level, int optname, void *optval, socklen_t *optlen) { int result, _errno; - Debug5("getsockopt(%d, %d, %d, %p, {"F_Zd"})", + Debug5("getsockopt(%d, %d, %d, %p, {"F_socklen"})", s, level, optname, optval, *optlen); result = getsockopt(s, level, optname, optval, optlen); _errno = errno; @@ -1105,12 +1105,12 @@ int Recvfrom(int s, void *buf, size_t len, int flags, struct sockaddr *from, socklen_t *fromlen) { int retval, _errno; char infobuff[256]; - Debug6("recvfrom(%d, %p, "F_Zu", %d, %p, "F_Zu")", + Debug6("recvfrom(%d, %p, "F_Zu", %d, %p, "F_socklen")", s, buf, len, flags, from, *fromlen); retval = recvfrom(s, buf, len, flags, from, fromlen); _errno = errno; if (from) { - Debug4("recvfrom(,,,, {%d,%s}, "F_Zd") -> %d", + Debug4("recvfrom(,,,, {%d,%s}, "F_socklen") -> %d", from->sa_family, sockaddr_info(from, *fromlen, infobuff, sizeof(infobuff)), *fromlen, retval); @@ -1138,7 +1138,7 @@ int Recvmsg(int s, struct msghdr *msgh, int flags) { retval = recvmsg(s, msgh, flags); _errno = errno; #if defined(HAVE_STRUCT_MSGHDR_MSGCONTROLLEN) - Debug5("recvmsg(, {%s,%u,,%u,,%u,}, ) -> %d", + Debug5("recvmsg(, {%s,%u,,"F_Zu",,"F_Zu",}, ) -> %d", msgh->msg_name?sockaddr_info(msgh->msg_name, msgh->msg_namelen, infobuff, sizeof(infobuff)):"NULL", msgh->msg_namelen, msgh->msg_iovlen, msgh->msg_controllen, retval); @@ -1259,7 +1259,7 @@ struct hostent *Gethostbyname(const char *name) { int Getaddrinfo(const char *node, const char *service, const struct addrinfo *hints, struct addrinfo **res) { int result; - Debug15("getaddrinfo(%s%s%s, %s%s%s, {%d,%d,%d,%d,"F_Zu",%p,%p,%p}, %p)", + Debug15("getaddrinfo(%s%s%s, %s%s%s, {%d,%d,%d,%d,"F_socklen",%p,%p,%p}, %p)", node?"\"":"", node?node:"NULL", node?"\"":"", service?"\"":"", service?service:"NULL", service?"\"":"", hints->ai_flags, hints->ai_family, hints->ai_socktype, diff --git a/sycls.h b/sycls.h index 90900f5..afcb391 100644 --- a/sycls.h +++ b/sycls.h @@ -96,8 +96,8 @@ int System(const char *string); int Socketpair(int d, int type, int protocol, int sv[2]); #if _WITH_SOCKET int Socket(int domain, int type, int protocol); -int Bind(int sockfd, struct sockaddr *my_addr, int addrlen); -int Connect(int sockfd, const struct sockaddr *serv_addr, int addrlen); +int Bind(int sockfd, struct sockaddr *my_addr, socklen_t addrlen); +int Connect(int sockfd, const struct sockaddr *serv_addr, socklen_t addrlen); int Listen(int s, int backlog); int Accept(int s, struct sockaddr *addr, socklen_t *addrlen); int Getsockname(int s, struct sockaddr *name, socklen_t *namelen); diff --git a/test.sh b/test.sh index eb14a49..409498c 100755 --- a/test.sh +++ b/test.sh @@ -9851,7 +9851,7 @@ test_proto="$(echo "$KEYW" |tr A-Z a-z)" NAME=${KEYW}LISTENENV case "$TESTS" in *%$N%*|*%functions%*|*%ip4%*|*%ipapp%*|*%tcp%*|*%$test_proto%*|*%envvar%*|*%$NAME%*) -TEST="$NAME: $KEYW-LISTEN fills environment variables with socket addresses" +TEST="$NAME: $KEYW-LISTEN sets environment variables with socket addresses" # have a server accepting a connection and invoking some shell code. The shell # code extracts and prints the SOCAT related environment vars. # outside code then checks if the environment contains the variables correctly @@ -9919,6 +9919,8 @@ else cat "${te}0" echo "$CMD1" cat "${te}1" + echo -e "SOCAT_SOCKADDR=$TEST_SOCKADDR\nSOCAT_PEERADDR=$TEST_PEERADDR\nSOCAT_SOCKPORT=$TEST_SOCKPORT\nSOCAT_PEERPORT=$TEST_PEERPORT" | + diff - "${tf}" numFAIL=$((numFAIL+1)) listFAIL="$listFAIL $N" fi @@ -11638,6 +11640,7 @@ else cat "${te}0" cat "${te}1" numFAIL=$((numFAIL+1)) + listFAIL="$listFAIL $N" fi fi # NUMCOND ;; @@ -11650,7 +11653,7 @@ N=$((N+1)) # Linux) with "Invalid argument". NAME=OPENSSL_CONNECT_BIND case "$TESTS" in -*%functions%*|*%bugs%*|*%socket%*|*%ssl%*|*%$NAME%*) +*%$N%*|*%functions%*|*%bugs%*|*%socket%*|*%ssl%*|*%$NAME%*) TEST="$NAME: test OPENSSL-CONNECT with bind option" # have a simple SSL server that just echoes data. # connect with socat using OPENSSL-CONNECT with bind, send data and check if the @@ -11678,6 +11681,7 @@ if [ "$rc1" -ne 0 ]; then cat "$te0" cat "$te1" numFAIL=$((numFAIL+1)) + listFAIL="$listFAIL $N" elif ! echo "$da" |diff - $tf1 >"$tdiff"; then $PRINTF "$FAILED\n" echo "$CMD0 &" @@ -11686,6 +11690,7 @@ elif ! echo "$da" |diff - $tf1 >"$tdiff"; then cat "${te}1" cat "$tdiff" numFAIL=$((numFAIL+1)) + listFAIL="$listFAIL $N" else $PRINTF "$OK\n" numOK=$((numOK+1)) @@ -11701,7 +11706,7 @@ N=$((N+1)) # had a bug that converted a bit mask of 0 internally to 0xffffffff NAME=TCP4RANGE_0BITS case "$TESTS" in -*%functions%*|*%tcp%*|*%tcp4%*|*%ip4%*|*%range%*|*%$NAME%*) +*%$N%*|*%functions%*|*%tcp%*|*%tcp4%*|*%ip4%*|*%range%*|*%$NAME%*) TEST="$NAME: correct evaluation of range mask 0" if ! eval $NUMCOND; then :; elif [ -z "$SECONDADDR" ]; then @@ -11732,6 +11737,7 @@ elif ! [ -f "$tf" ]; then cat "${te}0" cat "${te}1" numFAIL=$((numFAIL+1)) + listFAIL="$listFAIL $N" elif ! echo "$da" |diff - "$tf" >"$tdiff"; then $PRINTF "${YELLOW}diff failed${NORMAL}\n" numCANT=$((numCANT+1)) @@ -12171,7 +12177,7 @@ esac N=$((N+1)) -echo "summary: $((N-1)) tests, $((numOK+numFAILD+numCANT)) selected; $numOK ok, $numFAIL failed, $numCANT could not be performed" +echo "summary: $((N-1)) tests, $((numOK+numFAILED+numCANT)) selected; $numOK ok, $numFAIL failed, $numCANT could not be performed" if [ "$numFAIL" -gt 0 ]; then echo "FAILED: $listFAIL" diff --git a/xio-listen.c b/xio-listen.c index 4d4f0c6..a105dd8 100644 --- a/xio-listen.c +++ b/xio-listen.c @@ -153,7 +153,7 @@ int _xioopen_listen(struct single *xfd, int xioflags, struct sockaddr *us, sockl applyopts(xfd->rfd, opts, PH_PREBIND); applyopts(xfd->rfd, opts, PH_BIND); if (Bind(xfd->rfd, (struct sockaddr *)us, uslen) < 0) { - Msg4(level, "bind(%d, {%s}, "F_Zd"): %s", xfd->rfd, + Msg4(level, "bind(%d, {%s}, "F_socklen"): %s", xfd->rfd, sockaddr_info(us, uslen, infobuff, sizeof(infobuff)), uslen, strerror(errno)); Close(xfd->rfd); @@ -237,18 +237,18 @@ int _xioopen_listen(struct single *xfd, int xioflags, struct sockaddr *us, sockl Notice1("listening on %s", sockaddr_info(us, uslen, lisname, sizeof(lisname))); ps = Accept(xfd->rfd, (struct sockaddr *)&sa, &salen); if (ps >= 0) { - /*0 Info4("accept(%d, %p, {"F_Zu"}) -> %d", xfd->fd1, &sa, salen, ps);*/ + /*0 Info4("accept(%d, %p, {"F_socklen"}) -> %d", xfd->fd1, &sa, salen, ps);*/ break; /* success, break out of loop */ } if (errno == EINTR) { continue; } if (errno == ECONNABORTED) { - Notice4("accept(%d, %p, {"F_Zu"}): %s", + Notice4("accept(%d, %p, {"F_socklen"}): %s", xfd->rfd, &sa, salen, strerror(errno)); continue; } - Msg4(level, "accept(%d, %p, {"F_Zu"}): %s", + Msg4(level, "accept(%d, %p, {"F_socklen"}): %s", xfd->rfd, &sa, salen, strerror(errno)); Close(xfd->rfd); return STAT_RETRYLATER; diff --git a/xio-process.c b/xio-process.c index d76fac2..ca34eea 100644 --- a/xio-process.c +++ b/xio-process.c @@ -40,7 +40,7 @@ int _xioopen_setdelayeduser(void) { if (delayeduser) { #if HAVE_SETGROUPS if ((Setgroups(delayeduser_ngids, delayeduser_gids)) != 0) { - Error3("setgroups("F_Zu", %p): %s", + Error3("setgroups(%d, %p): %s", delayeduser_ngids, delayeduser_gids, strerror(errno)); } #endif /* HAVE_SETGROUPS */ diff --git a/xio-proxy.c b/xio-proxy.c index 24988e5..fdf905f 100644 --- a/xio-proxy.c +++ b/xio-proxy.c @@ -625,7 +625,7 @@ int _xioopen_proxy_connect(struct single *xfd, } if (offset >= BUFLEN) { - Msg1(level, "proxy answer exceeds "F_Zu" bytes, aborting", BUFLEN); + Msg1(level, "proxy answer exceeds %d bytes, aborting", BUFLEN); return STAT_NORETRY; } diff --git a/xio-socket.c b/xio-socket.c index 493ba47..6d983b3 100644 --- a/xio-socket.c +++ b/xio-socket.c @@ -829,7 +829,7 @@ int _xioopen_connect(struct single *xfd, struct sockaddr *us, size_t uslen, *port = htons(i); if (Bind(xfd->rfd, (struct sockaddr *)sinp, sizeof(*sinp)) < 0) { Msg4(errno==EADDRINUSE?E_INFO:level, - "bind(%d, {%s}, "F_Zd"): %s", xfd->rfd, + "bind(%d, {%s}, "F_socklen"): %s", xfd->rfd, sockaddr_info(&sinp->soa, sizeof(*sinp), infobuff, sizeof(infobuff)), sizeof(*sinp), strerror(errno)); if (errno != EADDRINUSE) { @@ -852,7 +852,7 @@ int _xioopen_connect(struct single *xfd, struct sockaddr *us, size_t uslen, if (us) { if (Bind(xfd->rfd, us, uslen) < 0) { - Msg4(level, "bind(%d, {%s}, "F_Zd"): %s", + Msg4(level, "bind(%d, {%s}, "F_socklen"): %s", xfd->rfd, sockaddr_info(us, uslen, infobuff, sizeof(infobuff)), uslen, strerror(errno)); Close(xfd->rfd); @@ -1100,7 +1100,7 @@ int _xioopen_dgram_sendto(/* them is already in xfd->peersa */ if (us) { if (Bind(xfd->rfd, (struct sockaddr *)us, uslen) < 0) { - Msg4(level, "bind(%d, {%s}, "F_Zd"): %s", + Msg4(level, "bind(%d, {%s}, "F_socklen"): %s", xfd->rfd, sockaddr_info((struct sockaddr *)us, uslen, infobuff, sizeof(infobuff)), uslen, strerror(errno)); Close(xfd->rfd); @@ -1680,7 +1680,7 @@ int xiodopacketinfo(struct msghdr *msgh, bool withlog, bool withenv) { xiodump(CMSG_DATA(cmsg), cmsg->cmsg_len-((char *)CMSG_DATA(cmsg)-(char *)cmsg), valbuff, sizeof(valbuff)-1, 0); - Debug4("ancillary message: len="F_socklen", level=%d, type=%d, data=%s", + Debug4("ancillary message: len="F_cmsg_len", level=%d, type=%d, data=%s", cmsg->cmsg_len, cmsg->cmsg_level, cmsg->cmsg_type, valbuff); } diff --git a/xio-socks.c b/xio-socks.c index e1fe20f..4f97784 100644 --- a/xio-socks.c +++ b/xio-socks.c @@ -422,7 +422,7 @@ int _xioopen_socks4_connect(struct single *xfd, char msgbuff[3*SIZEOF_STRUCT_SOCKS4]; * xiohexdump((const unsigned char *)replyhead+bytes, result, msgbuff) = '\0'; - Debug2("received socks4 reply data (offset %u): %s", bytes, msgbuff); + Debug2("received socks4 reply data (offset "F_Zd"): %s", bytes, msgbuff); } #endif /* WITH_MSGLEVEL <= E_DEBUG */ bytes += result; @@ -430,7 +430,7 @@ int _xioopen_socks4_connect(struct single *xfd, Debug1("received all "F_Zd" bytes", bytes); break; } - Debug2("received "F_Zd" bytes, waiting for "F_Zu" more bytes", + Debug2("received %d bytes, waiting for "F_Zu" more bytes", result, SIZEOF_STRUCT_SOCKS4-bytes); } if (result <= 0) { /* we had a problem while reading socks answer */ diff --git a/xio-udp.c b/xio-udp.c index 2e9c0ab..bae6bb0 100644 --- a/xio-udp.c +++ b/xio-udp.c @@ -214,7 +214,7 @@ int xioopen_ipdgram_listen(int argc, const char *argv[], struct opt *opts, applyopts(fd->stream.rfd, opts, PH_PREBIND); applyopts(fd->stream.rfd, opts, PH_BIND); if (Bind(fd->stream.rfd, &us.soa, uslen) < 0) { - Error4("bind(%d, {%s}, "F_Zd"): %s", fd->stream.rfd, + Error4("bind(%d, {%s}, "F_socklen"): %s", fd->stream.rfd, sockaddr_info(&us.soa, uslen, infobuff, sizeof(infobuff)), uslen, strerror(errno)); return STAT_RETRYLATER; @@ -240,7 +240,7 @@ int xioopen_ipdgram_listen(int argc, const char *argv[], struct opt *opts, &them->soa, &themlen); } while (result < 0 && errno == EINTR); if (result < 0) { - Error5("recvfrom(%d, %p, 1, MSG_PEEK, {%s}, {"F_Zu"}): %s", + Error5("recvfrom(%d, %p, 1, MSG_PEEK, {%s}, {"F_socklen"}): %s", fd->stream.rfd, buff1, sockaddr_info(&them->soa, themlen, infobuff, sizeof(infobuff)), themlen, strerror(errno)); @@ -283,7 +283,7 @@ int xioopen_ipdgram_listen(int argc, const char *argv[], struct opt *opts, applyopts(fd->stream.rfd, opts, PH_CONNECT); if ((result = Connect(fd->stream.rfd, &them->soa, themlen)) < 0) { - Error4("connect(%d, {%s}, "F_Zd"): %s", + Error4("connect(%d, {%s}, "F_socklen"): %s", fd->stream.rfd, sockaddr_info(&them->soa, themlen, infobuff, sizeof(infobuff)), themlen, strerror(errno)); diff --git a/xioopts.c b/xioopts.c index 8df97a6..81bb45c 100644 --- a/xioopts.c +++ b/xioopts.c @@ -733,7 +733,9 @@ const struct optname optionnames[] = { #endif IF_IP ("iptos", &opt_ip_tos) IF_IP ("ipttl", &opt_ip_ttl) +#ifdef IPV6_JOIN_GROUP IF_IP6 ("ipv6-add-membership", &opt_ipv6_join_group) +#endif #ifdef IPV6_AUTHHDR IF_IP6 ("ipv6-authhdr", &opt_ipv6_authhdr) #endif @@ -749,7 +751,9 @@ const struct optname optionnames[] = { #ifdef IPV6_HOPOPTS IF_IP6 ("ipv6-hopopts", &opt_ipv6_hopopts) #endif +#ifdef IPV6_JOIN_GROUP IF_IP6 ("ipv6-join-group", &opt_ipv6_join_group) +#endif #ifdef IPV6_PKTINFO IF_IP6 ("ipv6-pktinfo", &opt_ipv6_pktinfo) #endif @@ -799,7 +803,9 @@ const struct optname optionnames[] = { IF_TERMIOS("ixany", &opt_ixany) IF_TERMIOS("ixoff", &opt_ixoff) IF_TERMIOS("ixon", &opt_ixon) +#ifdef IPV6_JOIN_GROUP IF_IP6 ("join-group", &opt_ipv6_join_group) +#endif #if WITH_EXT2 && defined(EXT2_JOURNAL_DATA_FL) IF_ANY ("journal", &opt_ext2_journal_data) IF_ANY ("journal-data", &opt_ext2_journal_data) @@ -3039,7 +3045,7 @@ int applyopts(int fd, struct opt *opts, enum e_phase phase) { if (Setsockopt(fd, opt->desc->major, opt->desc->minor, opt->value.u_bin.b_data, opt->value.u_bin.b_len) < 0) { - Error6("setsockopt(%d, %d, %d, %p, %d): %s", + Error6("setsockopt(%d, %d, %d, %p, "F_Zu"): %s", fd, opt->desc->major, opt->desc->minor, opt->value.u_bin.b_data, opt->value.u_bin.b_len, strerror(errno)); @@ -3171,7 +3177,7 @@ int applyopts(int fd, struct opt *opts, enum e_phase phase) { if (Getsockopt(fd, opt->desc->major, opt->desc->minor, data, &oldlen) < 0) { - Error6("getsockopt(%d, %d, %d, %p, {"F_Zu"}): %s", + Error6("getsockopt(%d, %d, %d, %p, {"F_socklen"}): %s", fd, opt->desc->major, opt->desc->minor, data, oldlen, strerror(errno)); opt->desc = ODESC_ERROR; ++opt; continue; diff --git a/xiosigchld.c b/xiosigchld.c index 1cca521..2416f52 100644 --- a/xiosigchld.c +++ b/xiosigchld.c @@ -1,5 +1,5 @@ /* source: xiosigchld.c */ -/* Copyright Gerhard Rieger 2001-2012 */ +/* Copyright Gerhard Rieger */ /* Published under the GNU General Public License V.2, see file COPYING */ /* this is the source of the extended child signal handler */ @@ -139,7 +139,7 @@ void childdied(int signum nextunknown = 0; } diedunknown[nextunknown++] = pid; - Debug1("saving pid in diedunknown%u", + Debug1("saving pid in diedunknown"F_Zu, nextunknown/*sic, for compatibility*/); } #else