91 lines
2.9 KiB
Plaintext
91 lines
2.9 KiB
Plaintext
$OpenBSD: patch-libnetutil_netutil_cc,v 1.10 2016/12/22 21:58:40 sthen Exp $
|
|
|
|
first chunk:
|
|
http://marc.info/?l=openbsd-ports&m=140284432321370&w=2
|
|
|
|
similar diff to DLT_LINUX_SLL chunks sent upstream but they seem uninterested.
|
|
http://marc.info/?l=nmap-dev&m=140179174718457&w=2
|
|
|
|
chunks dealing with iovec: ???
|
|
|
|
--- libnetutil/netutil.cc.orig Wed Dec 14 00:12:23 2016
|
|
+++ libnetutil/netutil.cc Thu Dec 22 05:45:11 2016
|
|
@@ -3179,7 +3179,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;
|
|
@@ -3231,22 +3230,14 @@ static int route_dst_netlink(const struct sockaddr_sto
|
|
add_rtattr_addr(nlmsg, &rtattr, &len, RTA_SRC, spoofss, intf_index);
|
|
}
|
|
|
|
- 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));
|
|
@@ -3877,7 +3868,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;
|
|
@@ -3896,8 +3886,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;
|
|
@@ -3956,8 +3944,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)
|
|
@@ -4160,9 +4146,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;
|
|
}
|
|
@@ -4288,10 +4271,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;
|
|
}
|