netdriver.c (honggfuzz-2.4) | : | netdriver.c (honggfuzz-2.5) | ||
---|---|---|---|---|
skipping to change at line 21 | skipping to change at line 21 | |||
#include <stdlib.h> | #include <stdlib.h> | |||
#include <string.h> | #include <string.h> | |||
#include <sys/socket.h> | #include <sys/socket.h> | |||
#include <sys/stat.h> | #include <sys/stat.h> | |||
#include <sys/types.h> | #include <sys/types.h> | |||
#include <sys/un.h> | #include <sys/un.h> | |||
#include <unistd.h> | #include <unistd.h> | |||
#if defined(_HF_ARCH_LINUX) | #if defined(_HF_ARCH_LINUX) | |||
#include <sched.h> | #include <sched.h> | |||
#endif /* defined(_HF_ARCH_LINUX) */ | #endif /* defined(_HF_ARCH_LINUX) */ | |||
#if defined(__FreeBSD__) | ||||
#define SOL_TCP IPPROTO_TCP | ||||
#endif | ||||
#include "honggfuzz.h" | #include "honggfuzz.h" | |||
#include "libhfcommon/common.h" | #include "libhfcommon/common.h" | |||
#include "libhfcommon/files.h" | #include "libhfcommon/files.h" | |||
#include "libhfcommon/log.h" | #include "libhfcommon/log.h" | |||
#include "libhfcommon/ns.h" | #include "libhfcommon/ns.h" | |||
#include "libhfcommon/util.h" | #include "libhfcommon/util.h" | |||
__attribute__((visibility("default"))) __attribute__((used)) | __attribute__((visibility("default"))) __attribute__((used)) | |||
const char *const LIBHFNETDRIVER_module_netdriver = _HF_NETDRIVER_SIG; | const char *const LIBHFNETDRIVER_module_netdriver = _HF_NETDRIVER_SIG; | |||
skipping to change at line 162 | skipping to change at line 165 | |||
files_sockAddrToStr(addr, socklen), type, protocol); | files_sockAddrToStr(addr, socklen), type, protocol); | |||
return -1; | return -1; | |||
} | } | |||
if (addr->sa_family == AF_INET || addr->sa_family == AF_INET6) { | if (addr->sa_family == AF_INET || addr->sa_family == AF_INET6) { | |||
int val = 1; | int val = 1; | |||
if (setsockopt(sock, SOL_SOCKET, SO_REUSEADDR, &val, (socklen_t)sizeof(v al)) == -1 && | if (setsockopt(sock, SOL_SOCKET, SO_REUSEADDR, &val, (socklen_t)sizeof(v al)) == -1 && | |||
errno == ENOPROTOOPT) { | errno == ENOPROTOOPT) { | |||
PLOG_W("setsockopt(sock=%d, SOL_SOCKET, SO_REUSEADDR, %d)", sock, va l); | PLOG_W("setsockopt(sock=%d, SOL_SOCKET, SO_REUSEADDR, %d)", sock, va l); | |||
} | } | |||
#if defined(SOL_TCP) && defined(TCP_NODELAY) | #if defined(SOL_TCP) && defined(TCP_NODELAY) | |||
val = 1; | ||||
if (setsockopt(sock, SOL_TCP, TCP_NODELAY, &val, (socklen_t)sizeof(val)) == -1) { | if (setsockopt(sock, SOL_TCP, TCP_NODELAY, &val, (socklen_t)sizeof(val)) == -1) { | |||
PLOG_W("setsockopt(sock=%d, SOL_TCP, TCP_NODELAY, %d)", sock, val); | PLOG_W("setsockopt(sock=%d, SOL_TCP, TCP_NODELAY, %d)", sock, val); | |||
} | } | |||
#endif /* defined(SOL_TCP) && defined(TCP_NODELAY) */ | #endif /* defined(SOL_TCP) && defined(TCP_NODELAY) */ | |||
#if defined(SOL_TCP) && defined(TCP_QUICKACK) | #if defined(SOL_TCP) && defined(TCP_QUICKACK) | |||
val = 1; | val = 1; | |||
if (setsockopt(sock, SOL_TCP, TCP_QUICKACK, &val, (socklen_t)sizeof(val) ) == -1) { | if (setsockopt(sock, SOL_TCP, TCP_QUICKACK, &val, (socklen_t)sizeof(val) ) == -1) { | |||
PLOG_D("setsockopt(sock=%d, SOL_TCP, TCP_QUICKACK, %d)", sock, val); | PLOG_D("setsockopt(sock=%d, SOL_TCP, TCP_QUICKACK, %d)", sock, val); | |||
} | } | |||
#endif /* defined(SOL_TCP) && defined(TCP_QUICKACK) */ | #endif /* defined(SOL_TCP) && defined(TCP_QUICKACK) */ | |||
End of changes. 2 change blocks. | ||||
1 lines changed or deleted | 3 lines changed or added |