From: Sascha Wildner Date: Tue, 28 Aug 2012 22:16:01 +0000 (+0200) Subject: wpa_supplicant(8): Use libpcap functions. X-Git-Tag: v3.2.0~233 X-Git-Url: https://gitweb.dragonflybsd.org/dragonfly.git/commitdiff_plain/578f4d502281825ee8a04978e83501f2e6f09327 wpa_supplicant(8): Use libpcap functions. --- diff --git a/usr.sbin/802_11/wpa_supplicant/Packet32.c b/usr.sbin/802_11/wpa_supplicant/Packet32.c index 98765154f1..3e263e4b73 100644 --- a/usr.sbin/802_11/wpa_supplicant/Packet32.c +++ b/usr.sbin/802_11/wpa_supplicant/Packet32.c @@ -363,53 +363,3 @@ PacketCloseAdapter(void *iface) return; } - -#if __FreeBSD_version < 600000 - -/* - * The version of libpcap in FreeBSD 5.2.1 doesn't have these routines. - * Call me insane if you will, but I still run 5.2.1 on my laptop, and - * I'd like to use WPA there. - */ - -int -pcap_get_selectable_fd(pcap_t *p) -{ - return(pcap_fileno(p)); -} - -/* - * The old version of libpcap opens its BPF descriptor in read-only - * mode. We need to temporarily create a new one we can write to. - */ - -int -pcap_inject(pcap_t *p, const void *buf, size_t len) -{ - int fd; - int res, n = 0; - char device[sizeof "/dev/bpf0000000000"]; - struct ifreq ifr; - - /* - * Go through all the minors and find one that isn't in use. - */ - do { - (void)snprintf(device, sizeof(device), "/dev/bpf%d", n++); - fd = open(device, O_RDWR); - } while (fd < 0 && errno == EBUSY); - - if (fd == -1) - return(-1); - - bzero((char *)&ifr, sizeof(ifr)); - ioctl(pcap_fileno(p), BIOCGETIF, (caddr_t)&ifr); - ioctl(fd, BIOCSETIF, (caddr_t)&ifr); - - res = write(fd, buf, len); - - close(fd); - - return(res); -} -#endif