summaryrefslogtreecommitdiffstats
path: root/bpf.c
diff options
context:
space:
mode:
authorRoy Marples <roy@marples.name>2008-07-10 15:32:03 +0000
committerRoy Marples <roy@marples.name>2008-07-10 15:32:03 +0000
commitdca5f15979da882c8d2b3fdf471c3410f64f996a (patch)
tree93c49b7c0c7c067cb1f273dc80ca7fc8661febbb /bpf.c
parent6c738c7f9efef4523256517ad63b272c26f5e4ce (diff)
downloaddhcpcd-dca5f15979da882c8d2b3fdf471c3410f64f996a.tar.xz
Fix sending of ARP packets.
Diffstat (limited to 'bpf.c')
-rw-r--r--bpf.c9
1 files changed, 8 insertions, 1 deletions
diff --git a/bpf.c b/bpf.c
index f015344b..e37b5073 100644
--- a/bpf.c
+++ b/bpf.c
@@ -142,6 +142,7 @@ send_raw_packet(const struct interface *iface, int protocol,
{
struct iovec iov[2];
struct ether_header hw;
+ int fd;
memset(&hw, 0, ETHER_HDR_LEN);
memset(&hw.ether_dhost, 0xff, ETHER_ADDR_LEN);
@@ -150,7 +151,13 @@ send_raw_packet(const struct interface *iface, int protocol,
iov[0].iov_len = ETHER_HDR_LEN;
iov[1].iov_base = UNCONST(data);
iov[1].iov_len = len;
- return writev(iface->fd, iov, 2);
+#ifdef ENABLE_ARP
+ if (protocol == ETHERTYPE_ARP)
+ fd = iface->arp_fd;
+ else
+#endif
+ fd = iface->fd;
+ return writev(fd, iov, 2);
}
/* BPF requires that we read the entire buffer.