Real-time collaboration for Jupyter Notebooks, Linux Terminals, LaTeX, VS Code, R IDE, and more,
all in one place. Commercial Alternative to JupyterHub.
Real-time collaboration for Jupyter Notebooks, Linux Terminals, LaTeX, VS Code, R IDE, and more,
all in one place. Commercial Alternative to JupyterHub.
Path: blob/next/external/patch/misc/kali-wifi-injection-1.patch
Views: 3959
--- a/net/mac80211/cfg.c1+++ b/net/mac80211/cfg.c2@@ -784,7 +784,8 @@ static int ieee80211_set_monitor_channel3ret = ieee80211_vif_use_channel(sdata, chandef,4IEEE80211_CHANCTX_EXCLUSIVE);5}6- } else if (local->open_count == local->monitors) {7+ // Patch: Always allow channel change, even if a normal virtual interface is present8+ } else /*if (local->open_count == local->monitors)*/ {9local->_oper_chandef = *chandef;10ieee80211_hw_config(local, 0);11}12--- a/net/mac80211/tx.c13+++ b/net/mac80211/tx.c14@@ -803,11 +803,19 @@ ieee80211_tx_h_sequence(struct ieee802111516/*17* Packet injection may want to control the sequence18- * number, if we have no matching interface then we19- * neither assign one ourselves nor ask the driver to.20+ * number, so if an injected packet is found, skip21+ * renumbering it. Also make the packet NO_ACK to avoid22+ * excessive retries (ACKing and retrying should be23+ * handled by the injecting application).24+ * FIXME This may break hostapd and some other injectors.25+ * This should be done using a radiotap flag.26*/27- if (unlikely(info->control.vif->type == NL80211_IFTYPE_MONITOR))28+ if (unlikely((info->flags & IEEE80211_TX_CTL_INJECTED) &&29+ !(tx->sdata->u.mntr.flags & MONITOR_FLAG_COOK_FRAMES))) {30+ if (!ieee80211_has_morefrags(hdr->frame_control))31+ info->flags |= IEEE80211_TX_CTL_NO_ACK;32return TX_CONTINUE;33+ }3435if (unlikely(ieee80211_is_ctl(hdr->frame_control)))36return TX_CONTINUE;37@@ -2012,7 +2020,10 @@ void ieee80211_xmit(struct ieee80211_sub38}39}4041- ieee80211_set_qos_hdr(sdata, skb);42+ // Don't overwrite QoS header in monitor mode43+ if (likely(info->control.vif->type != NL80211_IFTYPE_MONITOR)) {44+ ieee80211_set_qos_hdr(sdata, skb);45+ }46ieee80211_tx(sdata, sta, skb, false, txdata_flags);47}4849--- a/net/wireless/chan.c50+++ b/net/wireless/chan.c51@@ -1148,8 +1148,10 @@ int cfg80211_set_monitor_channel(struct52{53if (!rdev->ops->set_monitor_channel)54return -EOPNOTSUPP;55- if (!cfg80211_has_monitors_only(rdev))56- return -EBUSY;57+ // Always allow user to change channel, even if there is another normal58+ // virtual interface using the device.59+ //if (!cfg80211_has_monitors_only(rdev))60+ // return -EBUSY;6162return rdev_set_monitor_channel(rdev, chandef);63}64--- a/drivers/net/wireless/zydas/zd1211rw/zd_mac.c65+++ b/drivers/net/wireless/zydas/zd1211rw/zd_mac.c66@@ -229,14 +229,19 @@ void zd_mac_clear(struct zd_mac *mac)67static int set_rx_filter(struct zd_mac *mac)68{69unsigned long flags;70- u32 filter = STA_RX_FILTER;71+ struct zd_ioreq32 ioreqs[] = {72+ {CR_RX_FILTER, STA_RX_FILTER},73+ { CR_SNIFFER_ON, 0U },74+ };7576spin_lock_irqsave(&mac->lock, flags);77- if (mac->pass_ctrl)78- filter |= RX_FILTER_CTRL;79+ if (mac->pass_ctrl) {80+ ioreqs[0].value |= 0xFFFFFFFF;81+ ioreqs[1].value = 0x1;82+ }83spin_unlock_irqrestore(&mac->lock, flags);8485- return zd_iowrite32(&mac->chip, CR_RX_FILTER, filter);86+ return zd_iowrite32a(&mac->chip, ioreqs, ARRAY_SIZE(ioreqs));87}8889static int set_mac_and_bssid(struct zd_mac *mac)90@@ -1043,7 +1048,8 @@ int zd_mac_rx(struct ieee80211_hw *hw, c91/* Caller has to ensure that length >= sizeof(struct rx_status). */92status = (struct rx_status *)93(buffer + (length - sizeof(struct rx_status)));94- if (status->frame_status & ZD_RX_ERROR) {95+ if ((status->frame_status & ZD_RX_ERROR) ||96+ (status->frame_status & ~0x21)) {97if (mac->pass_failed_fcs &&98(status->frame_status & ZD_RX_CRC32_ERROR)) {99stats.flag |= RX_FLAG_FAILED_FCS_CRC;100@@ -1386,7 +1392,7 @@ struct ieee80211_hw *zd_mac_alloc_hw(str101ieee80211_hw_set(hw, MFP_CAPABLE);102ieee80211_hw_set(hw, HOST_BROADCAST_PS_BUFFERING);103ieee80211_hw_set(hw, RX_INCLUDES_FCS);104- ieee80211_hw_set(hw, SIGNAL_UNSPEC);105+ ieee80211_hw_set(hw, SIGNAL_DBM);106107hw->wiphy->interface_modes =108BIT(NL80211_IFTYPE_MESH_POINT) |109--- a/drivers/net/wireless/realtek/rtl818x/rtl8187/dev.c110+++ b/drivers/net/wireless/realtek/rtl818x/rtl8187/dev.c111@@ -248,8 +248,17 @@ static void rtl8187_tx(struct ieee80211_112flags |= RTL818X_TX_DESC_FLAG_NO_ENC;113114flags |= ieee80211_get_tx_rate(dev, info)->hw_value << 24;115+116+ // When this flag is set the firmware waits untill ALL fragments have117+ // reached the USB device. Then it sends the first fragment and waits118+ // for ACKS's. Of course in monitor mode it won't detect these ACK's.119if (ieee80211_has_morefrags(tx_hdr->frame_control))120- flags |= RTL818X_TX_DESC_FLAG_MOREFRAG;121+ {122+ // If info->control.vif is NULL it's most likely in monitor mode123+ if (likely(info->control.vif != NULL && info->control.vif->type != NL80211_IFTYPE_MONITOR)) {124+ flags |= RTL818X_TX_DESC_FLAG_MOREFRAG;125+ }126+ }127128/* HW will perform RTS-CTS when only RTS flags is set.129* HW will perform CTS-to-self when both RTS and CTS flags are set.130131132