$NetBSD: patch-ac,v 1.3 2008/10/28 11:06:38 adam Exp $ --- pcapsource.cc.orig 2008-05-21 17:56:43.000000000 +0200 +++ pcapsource.cc @@ -72,12 +72,15 @@ extern "C" { } #endif -#ifdef SYS_FREEBSD +#if defined(SYS_FREEBSD) || defined(__DragonFly__) #include #include #include -#ifdef HAVE_RADIOTAP +#if defined(__DragonFly__) +#include +#include +#elif defined HAVE_RADIOTAP #include #include #endif @@ -247,7 +250,7 @@ int PcapSource::DatalinkType() { datalink_type = pcap_datalink(pd); // Blow up if we're not valid 802.11 headers -#if (defined(SYS_FREEBSD) || defined(SYS_OPENBSD)) || defined(SYS_NETBSD) +#if (defined(SYS_FREEBSD) || defined(SYS_OPENBSD)) || defined(SYS_NETBSD) || defined(__DragonFly__) if (datalink_type == DLT_EN10MB) { fprintf(stderr, "WARNING: pcap reports link type of EN10MB but we'll fake " "it on BSD.\n" @@ -1167,7 +1170,7 @@ carrier_type PcapSourceWrt54g::IEEE80211 } #endif -#if (defined(HAVE_RADIOTAP) && (defined(SYS_NETBSD) || defined(SYS_OPENBSD) || defined(SYS_FREEBSD))) +#if (defined(HAVE_RADIOTAP) && (defined(SYS_NETBSD) || defined(SYS_OPENBSD) || defined(SYS_FREEBSD) || defined(__DragonFly__))) int PcapSourceRadiotap::OpenSource() { // XXX this is a hack to avoid duplicating code int s = PcapSource::OpenSource(); @@ -1289,7 +1292,7 @@ KisPacketSource *pcapsource_openbsdprism } #endif -#if (defined(HAVE_RADIOTAP) && (defined(SYS_NETBSD) || defined(SYS_OPENBSD) || defined(SYS_FREEBSD))) +#if (defined(HAVE_RADIOTAP) && (defined(SYS_NETBSD) || defined(SYS_OPENBSD) || defined(SYS_FREEBSD) || defined(__DragonFly__))) KisPacketSource *pcapsource_radiotap_registrant(string in_name, string in_device, char *in_err) { return new PcapSourceRadiotap(in_name, in_device); @@ -2997,7 +3000,7 @@ int chancontrol_openbsd_prism2(const cha } #endif -#if (defined(HAVE_RADIOTAP) && (defined(SYS_NETBSD) || defined(SYS_OPENBSD) || defined(SYS_FREEBSD))) +#if (defined(HAVE_RADIOTAP) && (defined(SYS_NETBSD) || defined(SYS_OPENBSD) || defined(SYS_FREEBSD) || defined(__DragonFly__))) RadiotapBSD::RadiotapBSD(const char *name) : ifname(name) { s = -1; } @@ -3148,7 +3151,7 @@ bool RadiotapBSD::set80211(int type, int return true; } -#elif defined(SYS_FREEBSD) /* FreeBSD has a generic 802.11 ioctl */ +#elif defined(SYS_FREEBSD) || defined(__DragonFly__) /* FreeBSD has a generic 802.11 ioctl */ bool RadiotapBSD::get80211(int type, int& val, int len, u_int8_t *data) { struct ieee80211req ireq; @@ -3198,7 +3201,7 @@ bool RadiotapBSD::getifflags(int& flags) } #if defined(SYS_FREEBSD) flags = (ifr.ifr_flags & 0xffff) | (ifr.ifr_flagshigh << 16); -#elif defined(SYS_OPENBSD) || defined(SYS_NETBSD) +#elif defined(SYS_OPENBSD) || defined(SYS_NETBSD) || defined(__DragonFly__) flags = ifr.ifr_flags; #endif return true; @@ -3215,7 +3218,7 @@ bool RadiotapBSD::setifflags(int flags) #if defined(SYS_FREEBSD) ifr.ifr_flags = flags & 0xffff; ifr.ifr_flagshigh = flags >> 16; -#elif defined(SYS_OPENBSD) || (SYS_NETBSD) +#elif defined(SYS_OPENBSD) || (SYS_NETBSD) || defined(__DragonFly__) ifr.ifr_flags = flags; #endif if (ioctl(s, SIOCSIFFLAGS, (caddr_t)&ifr) < 0) { @@ -3246,7 +3249,7 @@ bool RadiotapBSD::monitor_enable(int ini } #if defined(SYS_FREEBSD) if (!setifflags(prev_flags | IFF_PPROMISC | IFF_UP)) { -#elif defined(SYS_OPENBSD) || defined(SYS_NETBSD) +#elif defined(SYS_OPENBSD) || defined(SYS_NETBSD) || defined(__DragonFly__) if (!setifflags(prev_flags | IFF_PROMISC | IFF_UP)) { #endif (void) set80211(IEEE80211_IOC_CHANNEL, prev_chan, 0, NULL);