Portability improvements:

grep -q is non portable

avoid IP_RECVDSTADDR until we need it

Spotted by:	Ronan Flood
This commit is contained in:
Poul-Henning Kamp 2015-01-16 20:17:35 +00:00
parent 3da3e4bde3
commit 76ccc26b27
2 changed files with 1 additions and 16 deletions

2
configure vendored
View File

@ -75,7 +75,7 @@ SRCS='
udp.c
'
if make -v 2>&1 | grep -q GNU ; then
if make -v 2>&1 | grep GNU > /dev/null 2>&1 ; then
echo "make(1) is GNU make."
BSD=false
elif [ -f /usr/share/mk/bsd.prog.mk ] ; then

15
udp.c
View File

@ -53,13 +53,6 @@ udp_sock(int fam)
if (fd < 0)
return (fd);
#ifdef IP_RECVDSTADDR
i = 1;
if (setsockopt(fd, IPPROTO_IP, IP_RECVDSTADDR, &i, sizeof i) != 0) {
AZ(close(fd));
Fail(ocx, 1, "setsockopt(IP_RECVDSTADDR) failed");
}
#endif
#ifdef SO_TIMESTAMPNS
i = 1;
(void)setsockopt(fd, SOL_SOCKET, SO_TIMESTAMPNS, &i, sizeof i);
@ -177,14 +170,6 @@ UdpTimedRx(struct ocx *ocx, const struct udp_socket *usc,
(void)TS_Nanosec(ts, tv.tv_sec, tv.tv_usec * 1000LL);
continue;
}
#endif
#ifdef IP_RECVDSTADDR
if (cmsg->cmsg_level == IPPROTO_IP &&
cmsg->cmsg_type == IP_RECVDSTADDR &&
cmsg->cmsg_len == CMSG_LEN(sizeof(in_addr_t))) {
continue;
/* XXX */
}
#endif
Debug(ocx, "RX-msg: %d %d %u ",
cmsg->cmsg_level, cmsg->cmsg_type, cmsg->cmsg_len);