diff --git a/minix/lib/libc/sys/recvfrom.c b/minix/lib/libc/sys/recvfrom.c index 05a711839..b66e0a720 100644 --- a/minix/lib/libc/sys/recvfrom.c +++ b/minix/lib/libc/sys/recvfrom.c @@ -19,6 +19,7 @@ #include #include +#include #define DEBUG 0 @@ -42,6 +43,7 @@ ssize_t recvfrom(int sock, void *__restrict buffer, size_t length, int r; nwio_tcpconf_t tcpconf; nwio_udpopt_t udpopt; + nwio_ipopt_t ipopt; struct sockaddr_un uds_addr; int uds_sotype = -1; @@ -85,11 +87,17 @@ ssize_t recvfrom(int sock, void *__restrict buffer, size_t length, } } + r= ioctl(sock, NWIOGIPOPT, &ipopt); + if (r != -1 || errno != ENOTTY) { ip_hdr_t *ip_hdr; int rd; struct sockaddr_in sin; + if (r == -1) { + return r; + } + rd = read(sock, buffer, length); if(rd < 0) return rd; diff --git a/minix/lib/libc/sys/sendto.c b/minix/lib/libc/sys/sendto.c index ddfa8ae10..18d484df8 100644 --- a/minix/lib/libc/sys/sendto.c +++ b/minix/lib/libc/sys/sendto.c @@ -13,6 +13,7 @@ #include #include +#include #include #include #include @@ -37,6 +38,7 @@ ssize_t sendto(int sock, const void *message, size_t length, int flags, int r; nwio_tcpopt_t tcpopt; nwio_udpopt_t udpopt; + nwio_ipopt_t ipopt; int uds_sotype = -1; r= ioctl(sock, NWIOGTCPOPT, &tcpopt); @@ -75,12 +77,18 @@ ssize_t sendto(int sock, const void *message, size_t length, int flags, } } + r= ioctl(sock, NWIOGIPOPT, &ipopt); + if (r != -1 || errno != ENOTTY) { ip_hdr_t *ip_hdr; const struct sockaddr_in *sinp; ssize_t retval; int saved_errno; + if (r == -1) { + return r; + } + sinp = (const struct sockaddr_in *)dest_addr; if (sinp->sin_family != AF_INET) {