Previously, the libc sendto(3) and recvfrom(3) implementations would
blindly assume that any unrecognized socket is a raw-IP socket. This
is not only inconsistent but also messes with returned error codes.
Change-Id: Id0328f04ea8ca0968a4e8636bc441caa0c3579b7
#include <net/gen/udp_io.h>
#include <net/gen/ip_hdr.h>
+#include <net/gen/ip_io.h>
#define DEBUG 0
int r;
nwio_tcpconf_t tcpconf;
nwio_udpopt_t udpopt;
+ nwio_ipopt_t ipopt;
struct sockaddr_un uds_addr;
int uds_sotype = -1;
}
}
+ 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;
#include <net/gen/in.h>
#include <net/gen/ip_hdr.h>
+#include <net/gen/ip_io.h>
#include <net/gen/tcp.h>
#include <net/gen/tcp_io.h>
#include <net/gen/udp.h>
int r;
nwio_tcpopt_t tcpopt;
nwio_udpopt_t udpopt;
+ nwio_ipopt_t ipopt;
int uds_sotype = -1;
r= ioctl(sock, NWIOGTCPOPT, &tcpopt);
}
}
+ 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)
{