@@ -1068,6 +1068,47 @@ static int hwsim_unicast_netgroup(struct mac80211_hwsim_data *data,
10681068 return res ;
10691069}
10701070
1071+ static void mac80211_hwsim_config_mac_nl (struct ieee80211_hw * hw ,
1072+ const u8 * addr , bool add )
1073+ {
1074+ struct mac80211_hwsim_data * data = hw -> priv ;
1075+ u32 _portid = READ_ONCE (data -> wmediumd );
1076+ struct sk_buff * skb ;
1077+ void * msg_head ;
1078+
1079+ if (!_portid && !hwsim_virtio_enabled )
1080+ return ;
1081+
1082+ skb = genlmsg_new (GENLMSG_DEFAULT_SIZE , GFP_ATOMIC );
1083+ if (!skb )
1084+ return ;
1085+
1086+ msg_head = genlmsg_put (skb , 0 , 0 , & hwsim_genl_family , 0 ,
1087+ add ? HWSIM_CMD_ADD_MAC_ADDR :
1088+ HWSIM_CMD_DEL_MAC_ADDR );
1089+ if (!msg_head ) {
1090+ pr_debug ("mac80211_hwsim: problem with msg_head\n" );
1091+ goto nla_put_failure ;
1092+ }
1093+
1094+ if (nla_put (skb , HWSIM_ATTR_ADDR_TRANSMITTER ,
1095+ ETH_ALEN , data -> addresses [1 ].addr ))
1096+ goto nla_put_failure ;
1097+
1098+ if (nla_put (skb , HWSIM_ATTR_ADDR_RECEIVER , ETH_ALEN , addr ))
1099+ goto nla_put_failure ;
1100+
1101+ genlmsg_end (skb , msg_head );
1102+
1103+ if (hwsim_virtio_enabled )
1104+ hwsim_tx_virtio (data , skb );
1105+ else
1106+ hwsim_unicast_netgroup (data , skb , _portid );
1107+ return ;
1108+ nla_put_failure :
1109+ nlmsg_free (skb );
1110+ }
1111+
10711112static inline u16 trans_tx_rate_flags_ieee2hwsim (struct ieee80211_tx_rate * rate )
10721113{
10731114 u16 result = 0 ;
@@ -1545,6 +1586,9 @@ static int mac80211_hwsim_add_interface(struct ieee80211_hw *hw,
15451586 vif -> addr );
15461587 hwsim_set_magic (vif );
15471588
1589+ if (vif -> type != NL80211_IFTYPE_MONITOR )
1590+ mac80211_hwsim_config_mac_nl (hw , vif -> addr , true);
1591+
15481592 vif -> cab_queue = 0 ;
15491593 vif -> hw_queue [IEEE80211_AC_VO ] = 0 ;
15501594 vif -> hw_queue [IEEE80211_AC_VI ] = 1 ;
@@ -1584,6 +1628,8 @@ static void mac80211_hwsim_remove_interface(
15841628 vif -> addr );
15851629 hwsim_check_magic (vif );
15861630 hwsim_clear_magic (vif );
1631+ if (vif -> type != NL80211_IFTYPE_MONITOR )
1632+ mac80211_hwsim_config_mac_nl (hw , vif -> addr , false);
15871633}
15881634
15891635static void mac80211_hwsim_tx_frame (struct ieee80211_hw * hw ,
@@ -1781,6 +1827,8 @@ static void mac80211_hwsim_configure_filter(struct ieee80211_hw *hw,
17811827 data -> rx_filter = 0 ;
17821828 if (* total_flags & FIF_ALLMULTI )
17831829 data -> rx_filter |= FIF_ALLMULTI ;
1830+ if (* total_flags & FIF_MCAST_ACTION )
1831+ data -> rx_filter |= FIF_MCAST_ACTION ;
17841832
17851833 * total_flags = data -> rx_filter ;
17861834}
@@ -2104,6 +2152,8 @@ static void hw_scan_work(struct work_struct *work)
21042152 hwsim -> hw_scan_vif = NULL ;
21052153 hwsim -> tmp_chan = NULL ;
21062154 mutex_unlock (& hwsim -> mutex );
2155+ mac80211_hwsim_config_mac_nl (hwsim -> hw , hwsim -> scan_addr ,
2156+ false);
21072157 return ;
21082158 }
21092159
@@ -2177,6 +2227,7 @@ static int mac80211_hwsim_hw_scan(struct ieee80211_hw *hw,
21772227 memset (hwsim -> survey_data , 0 , sizeof (hwsim -> survey_data ));
21782228 mutex_unlock (& hwsim -> mutex );
21792229
2230+ mac80211_hwsim_config_mac_nl (hw , hwsim -> scan_addr , true);
21802231 wiphy_dbg (hw -> wiphy , "hwsim hw_scan request\n" );
21812232
21822233 ieee80211_queue_delayed_work (hwsim -> hw , & hwsim -> hw_scan , 0 );
@@ -2220,6 +2271,7 @@ static void mac80211_hwsim_sw_scan(struct ieee80211_hw *hw,
22202271 pr_debug ("hwsim sw_scan request, prepping stuff\n" );
22212272
22222273 memcpy (hwsim -> scan_addr , mac_addr , ETH_ALEN );
2274+ mac80211_hwsim_config_mac_nl (hw , hwsim -> scan_addr , true);
22232275 hwsim -> scanning = true;
22242276 memset (hwsim -> survey_data , 0 , sizeof (hwsim -> survey_data ));
22252277
@@ -2236,6 +2288,7 @@ static void mac80211_hwsim_sw_scan_complete(struct ieee80211_hw *hw,
22362288
22372289 pr_debug ("hwsim sw_scan_complete\n" );
22382290 hwsim -> scanning = false;
2291+ mac80211_hwsim_config_mac_nl (hw , hwsim -> scan_addr , false);
22392292 eth_zero_addr (hwsim -> scan_addr );
22402293
22412294 mutex_unlock (& hwsim -> mutex );
@@ -2413,6 +2466,11 @@ static void mac80211_hwsim_get_et_stats(struct ieee80211_hw *hw,
24132466 WARN_ON (i != MAC80211_HWSIM_SSTATS_LEN );
24142467}
24152468
2469+ static int mac80211_hwsim_tx_last_beacon (struct ieee80211_hw * hw )
2470+ {
2471+ return 1 ;
2472+ }
2473+
24162474#define HWSIM_COMMON_OPS \
24172475 .tx = mac80211_hwsim_tx, \
24182476 .start = mac80211_hwsim_start, \
@@ -2423,6 +2481,7 @@ static void mac80211_hwsim_get_et_stats(struct ieee80211_hw *hw,
24232481 .config = mac80211_hwsim_config, \
24242482 .configure_filter = mac80211_hwsim_configure_filter, \
24252483 .bss_info_changed = mac80211_hwsim_bss_info_changed, \
2484+ .tx_last_beacon = mac80211_hwsim_tx_last_beacon, \
24262485 .sta_add = mac80211_hwsim_sta_add, \
24272486 .sta_remove = mac80211_hwsim_sta_remove, \
24282487 .sta_notify = mac80211_hwsim_sta_notify, \
@@ -3003,6 +3062,10 @@ static int mac80211_hwsim_new_radio(struct genl_info *info,
30033062 NL80211_FEATURE_SCAN_RANDOM_MAC_ADDR ;
30043063 wiphy_ext_feature_set (hw -> wiphy , NL80211_EXT_FEATURE_VHT_IBSS );
30053064 wiphy_ext_feature_set (hw -> wiphy , NL80211_EXT_FEATURE_BEACON_PROTECTION );
3065+ wiphy_ext_feature_set (hw -> wiphy ,
3066+ NL80211_EXT_FEATURE_MULTICAST_REGISTRATIONS );
3067+ wiphy_ext_feature_set (hw -> wiphy ,
3068+ NL80211_EXT_FEATURE_BEACON_RATE_LEGACY );
30063069
30073070 hw -> wiphy -> interface_modes = param -> iftypes ;
30083071
0 commit comments