The branch main has been updated by bz:

URL: 
https://cgit.FreeBSD.org/src/commit/?id=ade774b19f9a7b35f01cbca68e51a768d1dd0773

commit ade774b19f9a7b35f01cbca68e51a768d1dd0773
Author:     Bjoern A. Zeeb <b...@freebsd.org>
AuthorDate: 2022-04-15 12:53:06 +0000
Commit:     Bjoern A. Zeeb <b...@freebsd.org>
CommitDate: 2022-04-15 15:54:03 +0000

    LinuxKPI: 802.11: implement ieee80211_probereq_get()
    
    Implement ieee80211_probereq_get() needed by Realtek drivers.
    
    Sponsored by:   The FreeBSD Foundation
    MFC after:      3 days
---
 sys/compat/linuxkpi/common/include/net/mac80211.h |  9 ++++--
 sys/compat/linuxkpi/common/src/linux_80211.c      | 34 +++++++++++++++++++++++
 2 files changed, 40 insertions(+), 3 deletions(-)

diff --git a/sys/compat/linuxkpi/common/include/net/mac80211.h 
b/sys/compat/linuxkpi/common/include/net/mac80211.h
index b5eb3131a7de..18e95eb33558 100644
--- a/sys/compat/linuxkpi/common/include/net/mac80211.h
+++ b/sys/compat/linuxkpi/common/include/net/mac80211.h
@@ -905,6 +905,8 @@ void linuxkpi_ieee80211_txq_get_depth(struct ieee80211_txq 
*, unsigned long *,
 struct wireless_dev *linuxkpi_ieee80211_vif_to_wdev(struct ieee80211_vif *);
 void linuxkpi_ieee80211_connection_loss(struct ieee80211_vif *);
 void linuxkpi_ieee80211_beacon_loss(struct ieee80211_vif *);
+struct sk_buff *linuxkpi_ieee80211_probereq_get(struct ieee80211_hw *,
+    uint8_t *, uint8_t *, size_t, size_t);
 
 /* -------------------------------------------------------------------------- 
*/
 
@@ -1868,10 +1870,11 @@ ieee80211_nullfunc_get(struct ieee80211_hw *hw, struct 
ieee80211_vif *vif,
 
 static __inline struct sk_buff *
 ieee80211_probereq_get(struct ieee80211_hw *hw, uint8_t *addr,
-    uint8_t *ssid, size_t ssid_len, int _x)
+    uint8_t *ssid, size_t ssid_len, size_t tailroom)
 {
-       TODO();
-       return (NULL);
+
+       return (linuxkpi_ieee80211_probereq_get(hw, addr, ssid, ssid_len,
+           tailroom));
 }
 
 static __inline void
diff --git a/sys/compat/linuxkpi/common/src/linux_80211.c 
b/sys/compat/linuxkpi/common/src/linux_80211.c
index 001040d025ed..f13c204b9ccc 100644
--- a/sys/compat/linuxkpi/common/src/linux_80211.c
+++ b/sys/compat/linuxkpi/common/src/linux_80211.c
@@ -4116,6 +4116,40 @@ linuxkpi_ieee80211_queue_work(struct ieee80211_hw *hw,
        queue_work(lhw->workq, w);
 }
 
+struct sk_buff *
+linuxkpi_ieee80211_probereq_get(struct ieee80211_hw *hw, uint8_t *addr,
+    uint8_t *ssid, size_t ssid_len, size_t tailroom)
+{
+       struct sk_buff *skb;
+       struct ieee80211_frame *wh;
+       uint8_t *p;
+       size_t len;
+
+       len = sizeof(*wh);
+       len += 2 + ssid_len;
+
+       skb = dev_alloc_skb(hw->extra_tx_headroom + len + tailroom);
+       if (skb == NULL)
+               return (NULL);
+
+       skb_reserve(skb, hw->extra_tx_headroom);
+
+       wh = skb_put_zero(skb, sizeof(*wh));
+       wh->i_fc[0] = IEEE80211_FC0_VERSION_0;
+       wh->i_fc[0] |= IEEE80211_FC0_SUBTYPE_PROBE_REQ | IEEE80211_FC0_TYPE_MGT;
+       IEEE80211_ADDR_COPY(wh->i_addr1, ieee80211broadcastaddr);
+       IEEE80211_ADDR_COPY(wh->i_addr2, addr);
+       IEEE80211_ADDR_COPY(wh->i_addr3, ieee80211broadcastaddr);
+
+       p = skb_put(skb, 2 + ssid_len);
+       *p++ = IEEE80211_ELEMID_SSID;
+       *p++ = ssid_len;
+       if (ssid_len > 0)
+               memcpy(p, ssid, ssid_len);
+
+       return (skb);
+}
+
 struct sk_buff *
 linuxkpi_ieee80211_pspoll_get(struct ieee80211_hw *hw,
     struct ieee80211_vif *vif)

Reply via email to