diff --git a/sys-kernel/pentoo-sources/files/4005_kali-wifi-injection-without-4004.patch b/sys-kernel/pentoo-sources/files/4005_kali-wifi-injection-without-4004.patch new file mode 100644 index 000000000..e245183c4 --- /dev/null +++ b/sys-kernel/pentoo-sources/files/4005_kali-wifi-injection-without-4004.patch @@ -0,0 +1,72 @@ +--- a/net/mac80211/tx.c ++++ b/net/mac80211/tx.c +@@ -824,11 +824,19 @@ ieee80211_tx_h_sequence(struct ieee80211 + + /* + * Packet injection may want to control the sequence +- * number, if we have no matching interface then we +- * neither assign one ourselves nor ask the driver to. ++ * number, so if an injected packet is found, skip ++ * renumbering it. Also make the packet NO_ACK to avoid ++ * excessive retries (ACKing and retrying should be ++ * handled by the injecting application). ++ * FIXME This may break hostapd and some other injectors. ++ * This should be done using a radiotap flag. + */ +- if (unlikely(info->control.vif->type == NL80211_IFTYPE_MONITOR)) ++ if (unlikely((info->flags & IEEE80211_TX_CTL_INJECTED) && ++ !(tx->sdata->u.mntr.flags & MONITOR_FLAG_COOK_FRAMES))) { ++ if (!ieee80211_has_morefrags(hdr->frame_control)) ++ info->flags |= IEEE80211_TX_CTL_NO_ACK; + return TX_CONTINUE; ++ } + + if (unlikely(ieee80211_is_ctl(hdr->frame_control))) + return TX_CONTINUE; +@@ -2059,6 +2067,10 @@ void ieee80211_xmit(struct ieee80211_sub + } + + ieee80211_set_qos_hdr(sdata, skb); ++ // Don't overwrite QoS header in monitor mode ++ if (likely(info->control.vif->type != NL80211_IFTYPE_MONITOR)) { ++ ieee80211_set_qos_hdr(sdata, skb); ++ } + ieee80211_tx(sdata, sta, skb, false); + } + +--- a/net/wireless/chan.c ++++ b/net/wireless/chan.c +@@ -1582,8 +1582,10 @@ int cfg80211_set_monitor_channel(struct + { + if (!rdev->ops->set_monitor_channel) + return -EOPNOTSUPP; +- if (!cfg80211_has_monitors_only(rdev)) +- return -EBUSY; ++ // Always allow user to change channel, even if there is another normal ++ // virtual interface using the device. ++ //if (!cfg80211_has_monitors_only(rdev)) ++ // return -EBUSY; + + return rdev_set_monitor_channel(rdev, chandef); + } +--- a/drivers/net/wireless/realtek/rtl818x/rtl8187/dev.c ++++ b/drivers/net/wireless/realtek/rtl818x/rtl8187/dev.c +@@ -248,8 +248,17 @@ static void rtl8187_tx(struct ieee80211_ + flags |= RTL818X_TX_DESC_FLAG_NO_ENC; + + flags |= ieee80211_get_tx_rate(dev, info)->hw_value << 24; ++ ++ // When this flag is set the firmware waits untill ALL fragments have ++ // reached the USB device. Then it sends the first fragment and waits ++ // for ACKS's. Of course in monitor mode it won't detect these ACK's. + if (ieee80211_has_morefrags(tx_hdr->frame_control)) +- flags |= RTL818X_TX_DESC_FLAG_MOREFRAG; ++ { ++ // If info->control.vif is NULL it's most likely in monitor mode ++ if (likely(info->control.vif != NULL && info->control.vif->type != NL80211_IFTYPE_MONITOR)) { ++ flags |= RTL818X_TX_DESC_FLAG_MOREFRAG; ++ } ++ } + + /* HW will perform RTS-CTS when only RTS flags is set. + * HW will perform CTS-to-self when both RTS and CTS flags are set. diff --git a/sys-kernel/pentoo-sources/pentoo-sources-6.12.9.ebuild b/sys-kernel/pentoo-sources/pentoo-sources-6.12.9.ebuild index 524ea0693..8e639e175 100644 --- a/sys-kernel/pentoo-sources/pentoo-sources-6.12.9.ebuild +++ b/sys-kernel/pentoo-sources/pentoo-sources-6.12.9.ebuild @@ -22,6 +22,7 @@ src_unpack() { #penpatches eapply -s "${FILESDIR}/4004_zd1211rw-inject+dbi-fix-4.7ish.patch" eapply -s "${FILESDIR}/4400_logo_larry_the_cow.patch" + eapply -s "${FILESDIR}/4005_kali-wifi-injection-without-4004.patch" } src_install() {