7cc1504616
tests & ok benoit@, thanks
91 lines
3.1 KiB
Plaintext
91 lines
3.1 KiB
Plaintext
$OpenBSD: patch-libnetutil_netutil_cc,v 1.2 2012/07/16 07:39:31 giovanni Exp $
|
|
--- libnetutil/netutil.cc.orig Fri May 25 11:30:27 2012
|
|
+++ libnetutil/netutil.cc Fri May 25 11:32:11 2012
|
|
@@ -2997,7 +2997,6 @@ static int route_dst_netlink(const struct sockaddr_sto
|
|
const struct sockaddr_storage *spoofss) {
|
|
struct sockaddr_nl snl;
|
|
struct msghdr msg;
|
|
- struct iovec iov;
|
|
struct nlmsghdr *nlmsg;
|
|
struct rtmsg *rtmsg;
|
|
struct rtattr *rtattr;
|
|
@@ -3067,22 +3066,14 @@ static int route_dst_netlink(const struct sockaddr_sto
|
|
nlmsg->nlmsg_len = NLMSG_ALIGN(nlmsg->nlmsg_len) + rtattr->rta_len;
|
|
}
|
|
|
|
- iov.iov_base = nlmsg;
|
|
- iov.iov_len = nlmsg->nlmsg_len;
|
|
-
|
|
memset(&msg, 0, sizeof(msg));
|
|
msg.msg_name = &snl;
|
|
msg.msg_namelen = sizeof(snl);
|
|
- msg.msg_iov = &iov;
|
|
- msg.msg_iovlen = 1;
|
|
|
|
rc = sendmsg(fd, &msg, 0);
|
|
if (rc == -1)
|
|
netutil_fatal("%s: cannot sendmsg: %s", __func__, strerror(errno));
|
|
|
|
- iov.iov_base = buf;
|
|
- iov.iov_len = sizeof(buf);
|
|
-
|
|
len = recvmsg(fd, &msg, 0);
|
|
if (len <= 0)
|
|
netutil_fatal("%s: cannot recvmsg: %s", __func__, strerror(errno));
|
|
@@ -3702,7 +3693,6 @@ static const unsigned char *add_exthdr_ancillary(struc
|
|
static int send_ipv6_ip(const struct sockaddr_in6 *dst,
|
|
const unsigned char *packet, size_t packetlen) {
|
|
struct msghdr msg;
|
|
- struct iovec iov;
|
|
|
|
const unsigned char *end;
|
|
struct ip6_hdr *hdr;
|
|
@@ -3718,8 +3708,6 @@ static int send_ipv6_ip(const struct sockaddr_in6 *dst
|
|
/* Set up sendmsg data structure. iov is filled in below. */
|
|
msg.msg_name = (void *) dst;
|
|
msg.msg_namelen = sizeof(*dst);
|
|
- msg.msg_iov = &iov;
|
|
- msg.msg_iovlen = 1;
|
|
msg.msg_control = NULL;
|
|
msg.msg_controllen = 0;
|
|
msg.msg_flags = 0;
|
|
@@ -3778,8 +3766,6 @@ static int send_ipv6_ip(const struct sockaddr_in6 *dst
|
|
}
|
|
|
|
assert(packet <= end);
|
|
- iov.iov_base = (unsigned char *) packet;
|
|
- iov.iov_len = end - packet;
|
|
|
|
n = sendmsg(sd, &msg, 0);
|
|
if (n == -1)
|
|
@@ -3948,9 +3934,6 @@ int datalink_offset(int datalink)
|
|
{
|
|
if (datalink == DLT_EN10MB)
|
|
return ETH_HDR_LEN;
|
|
- else if (datalink == DLT_LINUX_SLL)
|
|
- /* The datalink type is Linux "cooked" sockets. See pcap-linktype(7). */
|
|
- return 16;
|
|
else
|
|
return -1;
|
|
}
|
|
@@ -3987,7 +3970,7 @@ static int read_reply_pcap(pcap_t *pd, long to_usec,
|
|
netutil_fatal("Cannot obtain datalink information: %s", pcap_geterr(pd));
|
|
ioffset = datalink_offset(*datalink);
|
|
if (ioffset < 0)
|
|
- netutil_fatal("datalink_offset failed for type %d (DLT_EN10MB = %d, DLT_LINUX_SLL = %d)", *datalink, DLT_EN10MB, DLT_LINUX_SLL);
|
|
+ netutil_fatal("datalink_offset failed for type %d (DLT_EN10MB = %d)", *datalink, DLT_EN10MB);
|
|
*offset = (unsigned int) ioffset;
|
|
|
|
if (to_usec > 0) {
|
|
@@ -4087,10 +4070,6 @@ static bool accept_arp(const unsigned char *p, const s
|
|
|
|
if (datalink == DLT_EN10MB) {
|
|
return ntohs(*((u16 *) (p + 12))) == ETH_TYPE_ARP;
|
|
- } else if (datalink == DLT_LINUX_SLL) {
|
|
- return ntohs(*((u16 *) (p + 2))) == ARPHRD_ETHER && /* sll_hatype */
|
|
- ntohs(*((u16 *) (p + 4))) == 6 && /* sll_halen */
|
|
- ntohs(*((u16 *) (p + 14))) == ETH_TYPE_ARP; /* sll_protocol */
|
|
} else {
|
|
return false;
|
|
}
|