@@ -454,7 +454,9 @@ static void inform_bss(struct vwifi_vif *vif)
454
454
struct cfg80211_inform_bss data = {
455
455
/* the only channel */
456
456
.chan = & ap -> wdev .wiphy -> bands [NL80211_BAND_2GHZ ]-> channels [0 ],
457
+ #if LINUX_VERSION_CODE < KERNEL_VERSION (6 , 7 , 0 )
457
458
.scan_width = NL80211_BSS_CHAN_WIDTH_20 ,
459
+ #endif
458
460
.signal = DBM_TO_MBM (rand_int_smooth (-100 , -30 , jiffies )),
459
461
};
460
462
int capability = WLAN_CAPABILITY_ESS ;
@@ -529,7 +531,7 @@ static enum hrtimer_restart vwifi_beacon(struct hrtimer *timer)
529
531
.boottime_ns = ktime_get_boottime_ns (),
530
532
.chan = vif -> channel ,
531
533
};
532
-
534
+ #if LINUX_VERSION_CODE < KERNEL_VERSION ( 6 , 7 , 0 )
533
535
switch (vif -> bw ) {
534
536
case NL80211_CHAN_WIDTH_5 :
535
537
bss_meta .scan_width = NL80211_BSS_CHAN_WIDTH_5 ;
@@ -541,7 +543,7 @@ static enum hrtimer_restart vwifi_beacon(struct hrtimer *timer)
541
543
bss_meta .scan_width = NL80211_BSS_CHAN_WIDTH_20 ;
542
544
break ;
543
545
}
544
-
546
+ #endif
545
547
int capability = WLAN_CAPABILITY_ESS ;
546
548
547
549
if (vif -> privacy )
@@ -1577,7 +1579,7 @@ static int vwifi_stop_ap(struct wiphy *wiphy, struct net_device *ndev)
1577
1579
1578
1580
return 0 ;
1579
1581
}
1580
-
1582
+ #if LINUX_VERSION_CODE < KERNEL_VERSION ( 6 , 7 , 0 )
1581
1583
static int vwifi_change_beacon (struct wiphy * wiphy ,
1582
1584
struct net_device * ndev ,
1583
1585
struct cfg80211_beacon_data * info )
@@ -1611,7 +1613,41 @@ static int vwifi_change_beacon(struct wiphy *wiphy,
1611
1613
1612
1614
return 0 ;
1613
1615
}
1616
+ #else
1617
+ static int vwifi_change_beacon (struct wiphy * wiphy ,
1618
+ struct net_device * ndev ,
1619
+ struct cfg80211_ap_update * info )
1620
+ {
1621
+ struct vwifi_vif * vif = ndev_get_vwifi_vif (ndev );
1622
+ int ie_offset = DOT11_MGMT_HDR_LEN + DOT11_BCN_PRB_FIXED_LEN ;
1623
+ int head_ie_len , tail_ie_len ;
1624
+
1625
+ /* cfg80211 and some user-space programs treat IEs as two-part:
1626
+ * 1. head: 802.11 beacon frame header + beacon IEs before TIM IE
1627
+ * 2. tail: beacon IEs after TIM IE
1628
+ * We combine them and store them in vif->beacon_ie.
1629
+ */
1630
+ head_ie_len = info -> beacon .head_len - ie_offset ;
1631
+ tail_ie_len = info -> beacon .tail_len ;
1614
1632
1633
+ if (likely (head_ie_len + tail_ie_len <= IE_MAX_LEN )) {
1634
+ vif -> beacon_ie_len = head_ie_len + tail_ie_len ;
1635
+ memset (vif -> beacon_ie , 0 , IE_MAX_LEN );
1636
+ memcpy (vif -> beacon_ie , & info -> beacon .head [ie_offset ], head_ie_len );
1637
+ memcpy (vif -> beacon_ie + head_ie_len , info -> beacon .tail , tail_ie_len );
1638
+
1639
+ pr_info (
1640
+ "%s: head_ie_len (before TIM IE) = %d, tail_ie_len = "
1641
+ "%d" ,
1642
+ __func__ , head_ie_len , tail_ie_len );
1643
+ } else {
1644
+ pr_info ("%s: IE exceed %d bytes!\n" , __func__ , IE_MAX_LEN );
1645
+ return 1 ;
1646
+ }
1647
+
1648
+ return 0 ;
1649
+ }
1650
+ #endif
1615
1651
#if LINUX_VERSION_CODE >= KERNEL_VERSION (6 , 1 , 0 )
1616
1652
static int vwifi_add_key (struct wiphy * wiphy ,
1617
1653
struct net_device * ndev ,
@@ -2550,7 +2586,9 @@ static void vwifi_virtio_mgmt_rx_scan_response(
2550
2586
};
2551
2587
struct cfg80211_inform_bss data = {
2552
2588
.chan = & rx_channel ,
2589
+ #if LINUX_VERSION_CODE < KERNEL_VERSION (6 , 7 , 0 )
2553
2590
.scan_width = NL80211_BSS_CHAN_WIDTH_20 ,
2591
+ #endif
2554
2592
.signal = DBM_TO_MBM (rand_int_smooth (-100 , -30 , jiffies )),
2555
2593
};
2556
2594
0 commit comments