Guest User

Untitled

a guest
Nov 14th, 2013
124
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. Dopo numerosi tentativi sono giunto ad una conclusione alla quale spero qualcuno possa porre rimedio. Sono finalmente riuscito a compilare con successo i driver backports(compat-drivers-3.8-1) ai quali dovevo applicare 2 patch:
  2.  
  3. -http://patches.aircrack-ng.org/mac80211.compat08082009.wl_frag+ack_v1.patch | FUNZIONA!!
  4.  
  5. -http://patches.aircrack-ng.org/channel-negative-one-maxim.patch | NON FUNZIONA!!(è sicuramente questo il problema del fixed channel mon0: -1)
  6.  
  7. Con i "compat-wireless-2010-11-07" tutte le patch di aircrack funzionano:
  8.  
  9. [code]patch -p1 < ../wireless-patches/404-ath_regd_optional.patch
  10. patch -p1 < ../wireless-patches/ar9170_regdomain_override.patch
  11. patch -p1 < ../wireless-patches/ath.patch
  12. patch -p1 < ../wireless-patches/ath5k_regdomain_override.patch
  13. patch -p0 < ../wireless-patches/ath9k_injection_fix.patch
  14. patch -p1 < ../wireless-patches/channel-negative-one-maxim.patch
  15. patch -p1 < ../wireless-patches/mac80211_2.6.32.2-wl_frag+ack_radiotap.patch
  16. patch -p1 < ../wireless-patches/rtl8187-mac80211-injection-speed-2.6.30-rc3.patch
  17. patch -p0 < ../wireless-patches/zd1211rw-inject+dbi-fix-2.6.26.patch
  18. patch -p0 < ../wireless-patches/zd1211rw.patch[/code]
  19.  
  20. putroppo la compilazione di questi driver patchati non funziona e da errore, quindi la soluzione è quella di applicare le modifiche al chan.c dei "compat-drivers-3.8-1" manualmente
  21.  
  22. Questo è il codice del file chan.c(compat-drivers-3.8-1/net/wireless):
  23. [code]/*
  24. * This file contains helper code to handle channel
  25. * settings and keeping track of what is possible at
  26. * any point in time.
  27. *
  28. * Copyright 2009 Johannes Berg <johannes@sipsolutions.net>
  29. */
  30.  
  31. #include <linux/export.h>
  32. #include <net/cfg80211.h>
  33. #include "core.h"
  34. #include "rdev-ops.h"
  35.  
  36. void cfg80211_chandef_create(struct cfg80211_chan_def *chandef,
  37. struct ieee80211_channel *chan,
  38. enum nl80211_channel_type chan_type)
  39. {
  40. if (WARN_ON(!chan))
  41. return;
  42.  
  43. chandef->chan = chan;
  44. chandef->center_freq2 = 0;
  45.  
  46. switch (chan_type) {
  47. case NL80211_CHAN_NO_HT:
  48. chandef->width = NL80211_CHAN_WIDTH_20_NOHT;
  49. chandef->center_freq1 = chan->center_freq;
  50. break;
  51. case NL80211_CHAN_HT20:
  52. chandef->width = NL80211_CHAN_WIDTH_20;
  53. chandef->center_freq1 = chan->center_freq;
  54. break;
  55. case NL80211_CHAN_HT40PLUS:
  56. chandef->width = NL80211_CHAN_WIDTH_40;
  57. chandef->center_freq1 = chan->center_freq + 10;
  58. break;
  59. case NL80211_CHAN_HT40MINUS:
  60. chandef->width = NL80211_CHAN_WIDTH_40;
  61. chandef->center_freq1 = chan->center_freq - 10;
  62. break;
  63. default:
  64. WARN_ON(1);
  65. }
  66. }
  67. EXPORT_SYMBOL(cfg80211_chandef_create);
  68.  
  69. bool cfg80211_chandef_valid(const struct cfg80211_chan_def *chandef)
  70. {
  71. u32 control_freq;
  72.  
  73. if (!chandef->chan)
  74. return false;
  75.  
  76. control_freq = chandef->chan->center_freq;
  77.  
  78. switch (chandef->width) {
  79. case NL80211_CHAN_WIDTH_20:
  80. case NL80211_CHAN_WIDTH_20_NOHT:
  81. if (chandef->center_freq1 != control_freq)
  82. return false;
  83. if (chandef->center_freq2)
  84. return false;
  85. break;
  86. case NL80211_CHAN_WIDTH_40:
  87. if (chandef->center_freq1 != control_freq + 10 &&
  88. chandef->center_freq1 != control_freq - 10)
  89. return false;
  90. if (chandef->center_freq2)
  91. return false;
  92. break;
  93. case NL80211_CHAN_WIDTH_80P80:
  94. if (chandef->center_freq1 != control_freq + 30 &&
  95. chandef->center_freq1 != control_freq + 10 &&
  96. chandef->center_freq1 != control_freq - 10 &&
  97. chandef->center_freq1 != control_freq - 30)
  98. return false;
  99. if (!chandef->center_freq2)
  100. return false;
  101. break;
  102. case NL80211_CHAN_WIDTH_80:
  103. if (chandef->center_freq1 != control_freq + 30 &&
  104. chandef->center_freq1 != control_freq + 10 &&
  105. chandef->center_freq1 != control_freq - 10 &&
  106. chandef->center_freq1 != control_freq - 30)
  107. return false;
  108. if (chandef->center_freq2)
  109. return false;
  110. break;
  111. case NL80211_CHAN_WIDTH_160:
  112. if (chandef->center_freq1 != control_freq + 70 &&
  113. chandef->center_freq1 != control_freq + 50 &&
  114. chandef->center_freq1 != control_freq + 30 &&
  115. chandef->center_freq1 != control_freq + 10 &&
  116. chandef->center_freq1 != control_freq - 10 &&
  117. chandef->center_freq1 != control_freq - 30 &&
  118. chandef->center_freq1 != control_freq - 50 &&
  119. chandef->center_freq1 != control_freq - 70)
  120. return false;
  121. if (chandef->center_freq2)
  122. return false;
  123. break;
  124. default:
  125. return false;
  126. }
  127.  
  128. return true;
  129. }
  130. EXPORT_SYMBOL(cfg80211_chandef_valid);
  131.  
  132. static void chandef_primary_freqs(const struct cfg80211_chan_def *c,
  133. int *pri40, int *pri80)
  134. {
  135. int tmp;
  136.  
  137. switch (c->width) {
  138. case NL80211_CHAN_WIDTH_40:
  139. *pri40 = c->center_freq1;
  140. *pri80 = 0;
  141. break;
  142. case NL80211_CHAN_WIDTH_80:
  143. case NL80211_CHAN_WIDTH_80P80:
  144. *pri80 = c->center_freq1;
  145. /* n_P20 */
  146. tmp = (30 + c->chan->center_freq - c->center_freq1)/20;
  147. /* n_P40 */
  148. tmp /= 2;
  149. /* freq_P40 */
  150. *pri40 = c->center_freq1 - 20 + 40 * tmp;
  151. break;
  152. case NL80211_CHAN_WIDTH_160:
  153. /* n_P20 */
  154. tmp = (70 + c->chan->center_freq - c->center_freq1)/20;
  155. /* n_P40 */
  156. tmp /= 2;
  157. /* freq_P40 */
  158. *pri40 = c->center_freq1 - 60 + 40 * tmp;
  159. /* n_P80 */
  160. tmp /= 2;
  161. *pri80 = c->center_freq1 - 40 + 80 * tmp;
  162. break;
  163. default:
  164. WARN_ON_ONCE(1);
  165. }
  166. }
  167.  
  168. const struct cfg80211_chan_def *
  169. cfg80211_chandef_compatible(const struct cfg80211_chan_def *c1,
  170. const struct cfg80211_chan_def *c2)
  171. {
  172. u32 c1_pri40, c1_pri80, c2_pri40, c2_pri80;
  173.  
  174. /* If they are identical, return */
  175. if (cfg80211_chandef_identical(c1, c2))
  176. return c1;
  177.  
  178. /* otherwise, must have same control channel */
  179. if (c1->chan != c2->chan)
  180. return NULL;
  181.  
  182. /*
  183. * If they have the same width, but aren't identical,
  184. * then they can't be compatible.
  185. */
  186. if (c1->width == c2->width)
  187. return NULL;
  188.  
  189. if (c1->width == NL80211_CHAN_WIDTH_20_NOHT ||
  190. c1->width == NL80211_CHAN_WIDTH_20)
  191. return c2;
  192.  
  193. if (c2->width == NL80211_CHAN_WIDTH_20_NOHT ||
  194. c2->width == NL80211_CHAN_WIDTH_20)
  195. return c1;
  196.  
  197. chandef_primary_freqs(c1, &c1_pri40, &c1_pri80);
  198. chandef_primary_freqs(c2, &c2_pri40, &c2_pri80);
  199.  
  200. if (c1_pri40 != c2_pri40)
  201. return NULL;
  202.  
  203. WARN_ON(!c1_pri80 && !c2_pri80);
  204. if (c1_pri80 && c2_pri80 && c1_pri80 != c2_pri80)
  205. return NULL;
  206.  
  207. if (c1->width > c2->width)
  208. return c1;
  209. return c2;
  210. }
  211. EXPORT_SYMBOL(cfg80211_chandef_compatible);
  212.  
  213. static bool cfg80211_secondary_chans_ok(struct wiphy *wiphy,
  214. u32 center_freq, u32 bandwidth,
  215. u32 prohibited_flags)
  216. {
  217. struct ieee80211_channel *c;
  218. u32 freq;
  219.  
  220. for (freq = center_freq - bandwidth/2 + 10;
  221. freq <= center_freq + bandwidth/2 - 10;
  222. freq += 20) {
  223. c = ieee80211_get_channel(wiphy, freq);
  224. if (!c || c->flags & prohibited_flags)
  225. return false;
  226. }
  227.  
  228. return true;
  229. }
  230.  
  231. bool cfg80211_chandef_usable(struct wiphy *wiphy,
  232. const struct cfg80211_chan_def *chandef,
  233. u32 prohibited_flags)
  234. {
  235. struct ieee80211_sta_ht_cap *ht_cap;
  236. struct ieee80211_sta_vht_cap *vht_cap;
  237. u32 width, control_freq;
  238.  
  239. if (WARN_ON(!cfg80211_chandef_valid(chandef)))
  240. return false;
  241.  
  242. ht_cap = &wiphy->bands[chandef->chan->band]->ht_cap;
  243. vht_cap = &wiphy->bands[chandef->chan->band]->vht_cap;
  244.  
  245. control_freq = chandef->chan->center_freq;
  246.  
  247. switch (chandef->width) {
  248. case NL80211_CHAN_WIDTH_20:
  249. if (!ht_cap->ht_supported)
  250. return false;
  251. case NL80211_CHAN_WIDTH_20_NOHT:
  252. width = 20;
  253. break;
  254. case NL80211_CHAN_WIDTH_40:
  255. width = 40;
  256. if (!ht_cap->ht_supported)
  257. return false;
  258. if (!(ht_cap->cap & IEEE80211_HT_CAP_SUP_WIDTH_20_40) ||
  259. ht_cap->cap & IEEE80211_HT_CAP_40MHZ_INTOLERANT)
  260. return false;
  261. if (chandef->center_freq1 < control_freq &&
  262. chandef->chan->flags & IEEE80211_CHAN_NO_HT40MINUS)
  263. return false;
  264. if (chandef->center_freq1 > control_freq &&
  265. chandef->chan->flags & IEEE80211_CHAN_NO_HT40PLUS)
  266. return false;
  267. break;
  268. case NL80211_CHAN_WIDTH_80P80:
  269. if (!(vht_cap->cap & IEEE80211_VHT_CAP_SUPP_CHAN_WIDTH_160_80PLUS80MHZ))
  270. return false;
  271. case NL80211_CHAN_WIDTH_80:
  272. if (!vht_cap->vht_supported)
  273. return false;
  274. width = 80;
  275. break;
  276. case NL80211_CHAN_WIDTH_160:
  277. if (!vht_cap->vht_supported)
  278. return false;
  279. if (!(vht_cap->cap & IEEE80211_VHT_CAP_SUPP_CHAN_WIDTH_160MHZ))
  280. return false;
  281. width = 160;
  282. break;
  283. default:
  284. WARN_ON_ONCE(1);
  285. return false;
  286. }
  287.  
  288. /* TODO: missing regulatory check on 80/160 bandwidth */
  289.  
  290. if (width > 20)
  291. prohibited_flags |= IEEE80211_CHAN_NO_OFDM;
  292.  
  293. if (!cfg80211_secondary_chans_ok(wiphy, chandef->center_freq1,
  294. width, prohibited_flags))
  295. return false;
  296.  
  297. if (!chandef->center_freq2)
  298. return true;
  299. return cfg80211_secondary_chans_ok(wiphy, chandef->center_freq2,
  300. width, prohibited_flags);
  301. }
  302. EXPORT_SYMBOL(cfg80211_chandef_usable);
  303.  
  304. bool cfg80211_reg_can_beacon(struct wiphy *wiphy,
  305. struct cfg80211_chan_def *chandef)
  306. {
  307. bool res;
  308.  
  309. trace_cfg80211_reg_can_beacon(wiphy, chandef);
  310.  
  311. res = cfg80211_chandef_usable(wiphy, chandef,
  312. IEEE80211_CHAN_DISABLED |
  313. IEEE80211_CHAN_PASSIVE_SCAN |
  314. IEEE80211_CHAN_NO_IBSS |
  315. IEEE80211_CHAN_RADAR);
  316.  
  317. trace_cfg80211_return_bool(res);
  318. return res;
  319. }
  320. EXPORT_SYMBOL(cfg80211_reg_can_beacon);
  321.  
  322. int cfg80211_set_monitor_channel(struct cfg80211_registered_device *rdev,
  323. struct cfg80211_chan_def *chandef)
  324. {
  325. if (!rdev->ops->set_monitor_channel)
  326. return -EOPNOTSUPP;
  327. if (!cfg80211_has_monitors_only(rdev))
  328. return -EBUSY;
  329.  
  330. return rdev_set_monitor_channel(rdev, chandef);
  331. }
  332.  
  333. void
  334. cfg80211_get_chan_state(struct wireless_dev *wdev,
  335. struct ieee80211_channel **chan,
  336. enum cfg80211_chan_mode *chanmode)
  337. {
  338. *chan = NULL;
  339. *chanmode = CHAN_MODE_UNDEFINED;
  340.  
  341. ASSERT_WDEV_LOCK(wdev);
  342.  
  343. if (wdev->netdev && !netif_running(wdev->netdev))
  344. return;
  345.  
  346. switch (wdev->iftype) {
  347. case NL80211_IFTYPE_ADHOC:
  348. if (wdev->current_bss) {
  349. *chan = wdev->current_bss->pub.channel;
  350. *chanmode = wdev->ibss_fixed
  351. ? CHAN_MODE_SHARED
  352. : CHAN_MODE_EXCLUSIVE;
  353. return;
  354. }
  355. case NL80211_IFTYPE_STATION:
  356. case NL80211_IFTYPE_P2P_CLIENT:
  357. if (wdev->current_bss) {
  358. *chan = wdev->current_bss->pub.channel;
  359. *chanmode = CHAN_MODE_SHARED;
  360. return;
  361. }
  362. break;
  363. case NL80211_IFTYPE_AP:
  364. case NL80211_IFTYPE_P2P_GO:
  365. if (wdev->beacon_interval) {
  366. *chan = wdev->channel;
  367. *chanmode = CHAN_MODE_SHARED;
  368. }
  369. return;
  370. case NL80211_IFTYPE_MESH_POINT:
  371. if (wdev->mesh_id_len) {
  372. *chan = wdev->channel;
  373. *chanmode = CHAN_MODE_SHARED;
  374. }
  375. return;
  376. case NL80211_IFTYPE_MONITOR:
  377. case NL80211_IFTYPE_AP_VLAN:
  378. case NL80211_IFTYPE_WDS:
  379. /* these interface types don't really have a channel */
  380. return;
  381. case NL80211_IFTYPE_P2P_DEVICE:
  382. if (wdev->wiphy->features &
  383. NL80211_FEATURE_P2P_DEVICE_NEEDS_CHANNEL)
  384. *chanmode = CHAN_MODE_EXCLUSIVE;
  385. return;
  386. case NL80211_IFTYPE_UNSPECIFIED:
  387. case NUM_NL80211_IFTYPES:
  388. WARN_ON(1);
  389. }
  390.  
  391. return;
  392. }
  393. [/code]
  394.  
  395.  
  396. mentre queste sono le differenze tra il chan.c(compat-wireless-2010-11-07/net/wireless) e il chan.c(compat-wireless-2010-11-07/net/wireless) una volta applicate le patch:
  397.  
  398. [code]diff originale/chan.c fixed/chan.c
  399. 52a53
  400. > struct wireless_dev *mon_dev = NULL;
  401. 54c55,56
  402. < if (wdev && wdev->iftype == NL80211_IFTYPE_MONITOR)
  403. ---
  404. > if (wdev && wdev->iftype == NL80211_IFTYPE_MONITOR) {
  405. > mon_dev = wdev;
  406. 55a58
  407. > }
  408. 78a82,84
  409. >
  410. > if (mon_dev)
  411. > mon_dev->channel = chan;
  412. [/code]
  413.  
  414. Qualcuno può aiutarmi a patchare correttamente il file chan.c dei "compat-drivers-3.8-1" conoscendo le modifiche da apportare???
RAW Paste Data