Subject: | [PATCH] allow source MAC spoofing in BPF |
From FreeBSD's bpf(4):
BIOCSHDRCMPLT
BIOCGHDRCMPLT (u_int) Set or get the status of the “header complete”
flag. Set to zero if the link level source address
should be filled in automatically by the interface output
routine. Set to one if the link level source address
will be written, as provided, to the wire. This flag is
initialized to zero by default.
This means that currently it is not possible to spoof source MAC with Net::RawIP on FreeBSD (and likely on other systems using BPF).
The attached patch fixes the problem.
A side note: I can see that there is a large number of open issues which has not been reacted to for years;
the module has not been updated for almost 7 years as well.
If you guys do not have tuits for taking care of it, I'd be glad to help, so how about giving me a comaint status?
Thanks!
Subject: | eth-c.patch |
--- eth.c.orig 2007-04-03 12:59:40.000000000 +0200
+++ eth.c 2015-02-06 13:45:21.000000000 +0100
@@ -238,6 +238,7 @@ tap(char *dev,unsigned int *my_eth_ip,un
int fd,v,s;
struct ifreq ifr;
(void)strcpy(ifr.ifr_name, dev);
+ u_int complete;
#ifndef _BPF_
if ((fd = socket(AF_INET, SOCK_PACKET, htons(ETH_P_ALL))) < 0) {
@@ -282,6 +283,15 @@ tap(char *dev,unsigned int *my_eth_ip,un
croak("(tap) Can't get interface HW address");
}
#endif
+
+#ifdef _BPF_
+ complete = 1;
+ if (ioctl(fd, BIOCSHDRCMPLT, &complete) < 0) {
+ close(fd);
+ croak("(tap) cannot set \"header complete\" status");
+ }
+#endif
+
return fd;
}