Lines 1-54
Link Here
|
1 |
--- src/osdep/freebsd.c.orig 2011-09-25 00:05:54.000000000 +0200 |
1 |
--- src/osdep/freebsd.c.orig 2011-09-24 22:05:54 UTC |
2 |
+++ src/osdep/freebsd.c 2013-12-20 17:15:28.184126473 +0100 |
2 |
+++ src/osdep/freebsd.c |
3 |
@@ -53,7 +53,9 @@ struct priv_fbsd { |
3 |
@@ -389,7 +389,7 @@ static int do_fbsd_open(struct wif *wi, |
4 |
unsigned char pf_buf[4096]; |
|
|
5 |
unsigned char *pf_next; |
6 |
int pf_totlen; |
7 |
+#if __FreeBSD_version > 700018 |
8 |
struct ieee80211_bpf_params pf_txparams; |
9 |
+#endif |
10 |
|
4 |
|
11 |
/* setchan */ |
|
|
12 |
int pf_s; |
13 |
@@ -280,13 +282,16 @@ static int fbsd_read(struct wif *wi, uns |
14 |
static int fbsd_write(struct wif *wi, unsigned char *h80211, int len, |
15 |
struct tx_info *ti) |
16 |
{ |
17 |
+#if __FreeBSD_version > 700018 |
18 |
struct iovec iov[2]; |
19 |
+#endif |
20 |
struct priv_fbsd *pf = wi_priv(wi); |
21 |
int rc; |
22 |
|
23 |
/* XXX make use of ti */ |
24 |
if (ti) {} |
25 |
|
26 |
+#if __FreeBSD_version > 700018 |
27 |
iov[0].iov_base = &pf->pf_txparams; |
28 |
iov[0].iov_len = pf->pf_txparams.ibp_len; |
29 |
|
30 |
@@ -294,12 +299,19 @@ static int fbsd_write(struct wif *wi, un |
31 |
iov[1].iov_len = len; |
32 |
|
33 |
rc = writev(pf->pf_fd, iov, 2); |
34 |
+#else |
35 |
+ rc = write(pf->pf_fd, h80211, len); |
36 |
+#endif |
37 |
if (rc == -1) |
38 |
return rc; |
39 |
+#if __FreeBSD_version > 700018 |
40 |
if (rc < (int) iov[0].iov_len) |
41 |
return 0; |
42 |
|
43 |
return rc - iov[0].iov_len; |
44 |
+#else |
45 |
+ return 0; |
46 |
+#endif |
47 |
} |
48 |
|
49 |
static int fbsd_set_channel(struct wif *wi, int chan) |
50 |
@@ -389,7 +401,7 @@ static int do_fbsd_open(struct wif *wi, |
51 |
|
52 |
memset(&ifr, 0, sizeof(ifr)); |
5 |
memset(&ifr, 0, sizeof(ifr)); |
53 |
strcpy(ifr.ifr_name, iface); |
6 |
strcpy(ifr.ifr_name, iface); |
54 |
- ifr.ifr_media = ifmr.ifm_current | IFM_IEEE80211_MONITOR; |
7 |
- ifr.ifr_media = ifmr.ifm_current | IFM_IEEE80211_MONITOR; |
Lines 56-62
Link Here
|
56 |
if (ioctl(s, SIOCSIFMEDIA, &ifr) == -1) |
9 |
if (ioctl(s, SIOCSIFMEDIA, &ifr) == -1) |
57 |
goto close_sock; |
10 |
goto close_sock; |
58 |
|
11 |
|
59 |
@@ -510,6 +522,39 @@ static int fbsd_set_mac(struct wif *wi, |
12 |
@@ -510,6 +510,39 @@ static int fbsd_set_mac(struct wif *wi, |
60 |
return ioctl(priv->pf_s, SIOCSIFLLADDR, ifr); |
13 |
return ioctl(priv->pf_s, SIOCSIFLLADDR, ifr); |
61 |
} |
14 |
} |
62 |
|
15 |
|
Lines 96-102
Link Here
|
96 |
static struct wif *fbsd_open(char *iface) |
49 |
static struct wif *fbsd_open(char *iface) |
97 |
{ |
50 |
{ |
98 |
struct wif *wi; |
51 |
struct wif *wi; |
99 |
@@ -530,7 +575,9 @@ static struct wif *fbsd_open(char *iface |
52 |
@@ -530,7 +563,9 @@ static struct wif *fbsd_open(char *iface |
100 |
wi->wi_set_mac = fbsd_set_mac; |
53 |
wi->wi_set_mac = fbsd_set_mac; |
101 |
wi->wi_get_rate = fbsd_get_rate; |
54 |
wi->wi_get_rate = fbsd_get_rate; |
102 |
wi->wi_set_rate = fbsd_set_rate; |
55 |
wi->wi_set_rate = fbsd_set_rate; |
Lines 107-117
Link Here
|
107 |
|
60 |
|
108 |
/* setup iface */ |
61 |
/* setup iface */ |
109 |
fd = do_fbsd_open(wi, iface); |
62 |
fd = do_fbsd_open(wi, iface); |
110 |
@@ -542,13 +589,17 @@ static struct wif *fbsd_open(char *iface |
63 |
@@ -544,6 +579,8 @@ static struct wif *fbsd_open(char *iface |
111 |
/* setup private state */ |
|
|
112 |
pf = wi_priv(wi); |
113 |
pf->pf_fd = fd; |
64 |
pf->pf_fd = fd; |
114 |
+#if __FreeBSD_version > 700018 |
|
|
115 |
pf->pf_txparams.ibp_vers = IEEE80211_BPF_VERSION; |
65 |
pf->pf_txparams.ibp_vers = IEEE80211_BPF_VERSION; |
116 |
pf->pf_txparams.ibp_len = sizeof(struct ieee80211_bpf_params) - 6; |
66 |
pf->pf_txparams.ibp_len = sizeof(struct ieee80211_bpf_params) - 6; |
117 |
+ pf->pf_txparams.ibp_rate0 = 2; /* 1 MB/s XXX */ |
67 |
+ pf->pf_txparams.ibp_rate0 = 2; /* 1 MB/s XXX */ |
Lines 119-127
Link Here
|
119 |
pf->pf_txparams.ibp_rate1 = 2; /* 1 MB/s XXX */ |
69 |
pf->pf_txparams.ibp_rate1 = 2; /* 1 MB/s XXX */ |
120 |
pf->pf_txparams.ibp_try1 = 1; /* no retransmits */ |
70 |
pf->pf_txparams.ibp_try1 = 1; /* no retransmits */ |
121 |
pf->pf_txparams.ibp_flags = IEEE80211_BPF_NOACK; |
71 |
pf->pf_txparams.ibp_flags = IEEE80211_BPF_NOACK; |
122 |
pf->pf_txparams.ibp_power = 100; /* nominal max */ |
|
|
123 |
pf->pf_txparams.ibp_pri = WME_AC_VO; /* high priority */ |
124 |
+#endif |
125 |
|
126 |
return wi; |
127 |
} |