Skip to content

Commit 35ca058

Browse files
authored
Align with recent cfg80211 header (#63)
Starting from Linux v6.7, several significant changes have been made to the cfg80211 subsystem. 1. The scan_width field is no longer present in the cfg80211_inform_bss structure. There really is not any support for scanning at different channel widths than 20 MHz since there is no way to set it. 2. The parameters in the change_beacon function have been updated to cfg80211_ap_update. The change_beacon function now includes two additional parameters, fils_discovery and unsol_bcast_probe_resp. These two additional parameters are part of the cfg80211_ap_update structure.
1 parent 308459f commit 35ca058

File tree

1 file changed

+22
-5
lines changed

1 file changed

+22
-5
lines changed

vwifi.c

+22-5
Original file line numberDiff line numberDiff line change
@@ -454,7 +454,9 @@ static void inform_bss(struct vwifi_vif *vif)
454454
struct cfg80211_inform_bss data = {
455455
/* the only channel */
456456
.chan = &ap->wdev.wiphy->bands[NL80211_BAND_2GHZ]->channels[0],
457+
#if LINUX_VERSION_CODE < KERNEL_VERSION(6, 7, 0)
457458
.scan_width = NL80211_BSS_CHAN_WIDTH_20,
459+
#endif
458460
.signal = DBM_TO_MBM(rand_int_smooth(-100, -30, jiffies)),
459461
};
460462
int capability = WLAN_CAPABILITY_ESS;
@@ -529,7 +531,7 @@ static enum hrtimer_restart vwifi_beacon(struct hrtimer *timer)
529531
.boottime_ns = ktime_get_boottime_ns(),
530532
.chan = vif->channel,
531533
};
532-
534+
#if LINUX_VERSION_CODE < KERNEL_VERSION(6, 7, 0)
533535
switch (vif->bw) {
534536
case NL80211_CHAN_WIDTH_5:
535537
bss_meta.scan_width = NL80211_BSS_CHAN_WIDTH_5;
@@ -541,7 +543,7 @@ static enum hrtimer_restart vwifi_beacon(struct hrtimer *timer)
541543
bss_meta.scan_width = NL80211_BSS_CHAN_WIDTH_20;
542544
break;
543545
}
544-
546+
#endif
545547
int capability = WLAN_CAPABILITY_ESS;
546548

547549
if (vif->privacy)
@@ -1580,7 +1582,12 @@ static int vwifi_stop_ap(struct wiphy *wiphy, struct net_device *ndev)
15801582

15811583
static int vwifi_change_beacon(struct wiphy *wiphy,
15821584
struct net_device *ndev,
1583-
struct cfg80211_beacon_data *info)
1585+
#if LINUX_VERSION_CODE >= KERNEL_VERSION(6, 7, 0)
1586+
struct cfg80211_ap_update *info
1587+
#else
1588+
struct cfg80211_beacon_data *info
1589+
#endif
1590+
)
15841591
{
15851592
struct vwifi_vif *vif = ndev_get_vwifi_vif(ndev);
15861593
int ie_offset = DOT11_MGMT_HDR_LEN + DOT11_BCN_PRB_FIXED_LEN;
@@ -1591,15 +1598,23 @@ static int vwifi_change_beacon(struct wiphy *wiphy,
15911598
* 2. tail: beacon IEs after TIM IE
15921599
* We combine them and store them in vif->beacon_ie.
15931600
*/
1601+
#if LINUX_VERSION_CODE >= KERNEL_VERSION(6, 7, 0)
1602+
head_ie_len = info->beacon.head_len - ie_offset;
1603+
tail_ie_len = info->beacon.tail_len;
1604+
#else
15941605
head_ie_len = info->head_len - ie_offset;
15951606
tail_ie_len = info->tail_len;
1596-
1607+
#endif
15971608
if (likely(head_ie_len + tail_ie_len <= IE_MAX_LEN)) {
15981609
vif->beacon_ie_len = head_ie_len + tail_ie_len;
15991610
memset(vif->beacon_ie, 0, IE_MAX_LEN);
1611+
#if LINUX_VERSION_CODE >= KERNEL_VERSION(6, 7, 0)
1612+
memcpy(vif->beacon_ie, &info->beacon.head[ie_offset], head_ie_len);
1613+
memcpy(vif->beacon_ie + head_ie_len, info->beacon.tail, tail_ie_len);
1614+
#else
16001615
memcpy(vif->beacon_ie, &info->head[ie_offset], head_ie_len);
16011616
memcpy(vif->beacon_ie + head_ie_len, info->tail, tail_ie_len);
1602-
1617+
#endif
16031618
pr_info(
16041619
"%s: head_ie_len (before TIM IE) = %d, tail_ie_len = "
16051620
"%d",
@@ -2550,7 +2565,9 @@ static void vwifi_virtio_mgmt_rx_scan_response(
25502565
};
25512566
struct cfg80211_inform_bss data = {
25522567
.chan = &rx_channel,
2568+
#if LINUX_VERSION_CODE < KERNEL_VERSION(6, 7, 0)
25532569
.scan_width = NL80211_BSS_CHAN_WIDTH_20,
2570+
#endif
25542571
.signal = DBM_TO_MBM(rand_int_smooth(-100, -30, jiffies)),
25552572
};
25562573

0 commit comments

Comments
 (0)