Feelingfree

compatdrivers_chan_qos_frag

Jun 8th, 2014
1,659
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. *original patch by Mathy Vanhoef
  2. *http://www.mathyvanhoef.com/2012/09/compat-wireless-injection-patch-for.html
  3. *fixed in offset by Devil_D
  4. *fixed new driver backports-3.12-1 @feelingfree
  5. diff -r 6b71629b673d drivers/net/wireless/rtl818x/rtl8187/dev.c
  6. --- a/drivers/net/wireless/rtl818x/rtl8187/dev.c Tue May 28 16:57:23 2013 -0400
  7. +++ b/drivers/net/wireless/rtl818x/rtl8187/dev.c Tue May 28 17:16:15 2013 -0400
  8. @@ -252,8 +252,18 @@ static void rtl8187_tx(struct ieee80211_
  9. flags |= RTL818X_TX_DESC_FLAG_NO_ENC;
  10.  
  11. flags |= ieee80211_get_tx_rate(dev, info)->hw_value << 24;
  12. +
  13. + // When this flag is set the firmware waits untill ALL fragments have
  14. + // reached the USB device. Then it sends the first fragment and waits
  15. + // for ACKS's. Of course in monitor mode it won't detect these ACK's.
  16. if (ieee80211_has_morefrags(tx_hdr->frame_control))
  17. - flags |= RTL818X_TX_DESC_FLAG_MOREFRAG;
  18. + {
  19. + // If info->control.vif is NULL it's most likely in monitor mode
  20. + if (likely(info->control.vif != NULL && info->control.vif->type != NL80211_IFTYPE_MONITOR)) {
  21. + flags |= RTL818X_TX_DESC_FLAG_MOREFRAG;
  22. + }
  23. + }
  24. +
  25. if (info->control.rates[0].flags & IEEE80211_TX_RC_USE_RTS_CTS) {
  26. flags |= RTL818X_TX_DESC_FLAG_RTS;
  27. flags |= ieee80211_get_rts_cts_rate(dev, info)->hw_value << 19;
  28. diff -r 6b71629b673d net/mac80211/cfg.c
  29. --- a/net/mac80211/cfg.c 2014-06-09 08:55:25.073219859 +0700
  30. +++ b/net/mac80211/cfg.c 2014-06-09 08:53:15.929594845 +0700
  31. @@ -826,7 +826,8 @@
  32. ret = ieee80211_vif_use_channel(sdata, chandef,
  33. IEEE80211_CHANCTX_EXCLUSIVE);
  34. }
  35. - } else if (local->open_count == local->monitors) {
  36. + // Patch: Always allow channel change, even if a normal virtual interface is present
  37. + } else /*if (local->open_count == local->monitors)*/ {
  38. local->_oper_chandef = *chandef;
  39. ieee80211_hw_config(local, 0);
  40. }
  41. diff -r 6b71629b673d net/mac80211/tx.c
  42. --- a/net/mac80211/tx.c Tue May 28 16:57:23 2013 -0400
  43. +++ b/net/mac80211/tx.c Tue May 28 17:16:15 2013 -0400
  44. @@ -1482,7 +1582,10 @@ void ieee80211_xmit(struct ieee80211_sub
  45. /* Older kernels do not have the select_queue callback */
  46. skb_set_queue_mapping(skb, ieee80211_select_queue(sdata, skb));
  47. #endif
  48. - ieee80211_set_qos_hdr(sdata, skb);
  49. + // Don't overwrite QoS header in monitor mode
  50. + if (likely(info->control.vif->type != NL80211_IFTYPE_MONITOR)) {
  51. + ieee80211_set_qos_hdr(sdata, skb);
  52. + }
  53. ieee80211_tx(sdata, skb, false, band);
  54. }
  55.  
  56. diff -r 6b71629b673d net/wireless/chan.c
  57. --- a/net/wireless/chan.c Tue May 28 16:57:23 2013 -0400
  58. +++ b/net/wireless/chan.c Tue May 28 17:16:15 2013 -0400
  59. @@ -480,8 +480,10 @@ int cfg80211_set_monitor_channel(struct
  60. {
  61. if (!rdev->ops->set_monitor_channel)
  62. return -EOPNOTSUPP;
  63. - if (!cfg80211_has_monitors_only(rdev))
  64. - return -EBUSY;
  65. + // Always allow user to change channel, even if there is another normal
  66. + // virtual interface using the device.
  67. + //if (!cfg80211_has_monitors_only(rdev))
  68. + // return -EBUSY;
  69.  
  70. return rdev_set_monitor_channel(rdev, chandef);
  71. }
RAW Paste Data