3
0
mirror of https://git.kernel.org/pub/scm/network/wireless/iwd.git synced 2024-11-22 06:19:34 +01:00

frame-xchg: add multicast RX flag argument

DPP optionally uses the multicast RX flag for frame registrations but
since frame-xchg did not support that, it used its own registration
internally. To avoid code duplication within DPP add a flag to
frame_watch_add in order to allow DPP to utilize frame-xchg.
This commit is contained in:
James Prestwood 2024-10-21 05:42:26 -07:00 committed by Denis Kenzior
parent a6edf6f31e
commit ff4edacb42
8 changed files with 27 additions and 20 deletions

View File

@ -3914,34 +3914,34 @@ struct ap_state *ap_start(struct netdev *netdev, struct l_settings *config,
if (!frame_watch_add(wdev_id, 0, 0x0000 | if (!frame_watch_add(wdev_id, 0, 0x0000 |
(MPDU_MANAGEMENT_SUBTYPE_ASSOCIATION_REQUEST << 4), (MPDU_MANAGEMENT_SUBTYPE_ASSOCIATION_REQUEST << 4),
NULL, 0, ap_assoc_req_cb, ap, NULL)) NULL, 0, false, ap_assoc_req_cb, ap, NULL))
goto error; goto error;
if (!frame_watch_add(wdev_id, 0, 0x0000 | if (!frame_watch_add(wdev_id, 0, 0x0000 |
(MPDU_MANAGEMENT_SUBTYPE_REASSOCIATION_REQUEST << 4), (MPDU_MANAGEMENT_SUBTYPE_REASSOCIATION_REQUEST << 4),
NULL, 0, ap_reassoc_req_cb, ap, NULL)) NULL, 0, false, ap_reassoc_req_cb, ap, NULL))
goto error; goto error;
if (!wiphy_supports_probe_resp_offload(wiphy)) { if (!wiphy_supports_probe_resp_offload(wiphy)) {
if (!frame_watch_add(wdev_id, 0, 0x0000 | if (!frame_watch_add(wdev_id, 0, 0x0000 |
(MPDU_MANAGEMENT_SUBTYPE_PROBE_REQUEST << 4), (MPDU_MANAGEMENT_SUBTYPE_PROBE_REQUEST << 4),
NULL, 0, ap_probe_req_cb, ap, NULL)) NULL, 0, false, ap_probe_req_cb, ap, NULL))
goto error; goto error;
} }
if (!frame_watch_add(wdev_id, 0, 0x0000 | if (!frame_watch_add(wdev_id, 0, 0x0000 |
(MPDU_MANAGEMENT_SUBTYPE_DISASSOCIATION << 4), (MPDU_MANAGEMENT_SUBTYPE_DISASSOCIATION << 4),
NULL, 0, ap_disassoc_cb, ap, NULL)) NULL, 0, false, ap_disassoc_cb, ap, NULL))
goto error; goto error;
if (!frame_watch_add(wdev_id, 0, 0x0000 | if (!frame_watch_add(wdev_id, 0, 0x0000 |
(MPDU_MANAGEMENT_SUBTYPE_AUTHENTICATION << 4), (MPDU_MANAGEMENT_SUBTYPE_AUTHENTICATION << 4),
NULL, 0, ap_auth_cb, ap, NULL)) NULL, 0, false, ap_auth_cb, ap, NULL))
goto error; goto error;
if (!frame_watch_add(wdev_id, 0, 0x0000 | if (!frame_watch_add(wdev_id, 0, 0x0000 |
(MPDU_MANAGEMENT_SUBTYPE_DEAUTHENTICATION << 4), (MPDU_MANAGEMENT_SUBTYPE_DEAUTHENTICATION << 4),
NULL, 0, ap_deauth_cb, ap, NULL)) NULL, 0, false, ap_deauth_cb, ap, NULL))
goto error; goto error;
ap->mlme_watch = l_genl_family_register(ap->nl80211, "mlme", ap->mlme_watch = l_genl_family_register(ap->nl80211, "mlme",

View File

@ -3861,11 +3861,11 @@ static void dpp_create(struct netdev *netdev)
frame_watch_add(netdev_get_wdev_id(netdev), 0, 0x00d0, frame_watch_add(netdev_get_wdev_id(netdev), 0, 0x00d0,
dpp_conf_response_prefix, dpp_conf_response_prefix,
sizeof(dpp_conf_response_prefix), sizeof(dpp_conf_response_prefix), false,
dpp_handle_config_response_frame, dpp, NULL); dpp_handle_config_response_frame, dpp, NULL);
frame_watch_add(netdev_get_wdev_id(netdev), 0, 0x00d0, frame_watch_add(netdev_get_wdev_id(netdev), 0, 0x00d0,
dpp_conf_request_prefix, dpp_conf_request_prefix,
sizeof(dpp_conf_request_prefix), sizeof(dpp_conf_request_prefix), false,
dpp_handle_config_request_frame, dpp, NULL); dpp_handle_config_request_frame, dpp, NULL);
dpp->known_network_watch = known_networks_watch_add( dpp->known_network_watch = known_networks_watch_add(

View File

@ -574,6 +574,7 @@ drop:
bool frame_watch_add(uint64_t wdev_id, uint32_t group_id, uint16_t frame_type, bool frame_watch_add(uint64_t wdev_id, uint32_t group_id, uint16_t frame_type,
const uint8_t *prefix, size_t prefix_len, const uint8_t *prefix, size_t prefix_len,
bool multicast_rx,
frame_watch_cb_t handler, void *user_data, frame_watch_cb_t handler, void *user_data,
frame_xchg_destroy_func_t destroy) frame_xchg_destroy_func_t destroy)
{ {
@ -613,6 +614,10 @@ bool frame_watch_add(uint64_t wdev_id, uint32_t group_id, uint16_t frame_type,
l_genl_msg_append_attr(msg, NL80211_ATTR_FRAME_MATCH, l_genl_msg_append_attr(msg, NL80211_ATTR_FRAME_MATCH,
prefix_len, prefix); prefix_len, prefix);
if (multicast_rx)
l_genl_msg_append_attr(msg, NL80211_ATTR_RECEIVE_MULTICAST,
0, NULL);
if (group->id == 0) if (group->id == 0)
l_genl_family_send(nl80211, msg, frame_watch_register_cb, l_genl_family_send(nl80211, msg, frame_watch_register_cb,
L_UINT_TO_PTR(frame_type), NULL); L_UINT_TO_PTR(frame_type), NULL);
@ -1193,7 +1198,7 @@ uint32_t frame_xchg_startv(uint64_t wdev_id, struct iovec *frame, uint32_t freq,
watch->prefix = prefix; watch->prefix = prefix;
watch->cb = va_arg(resp_args, void *); watch->cb = va_arg(resp_args, void *);
frame_watch_add(wdev_id, group_id, prefix->frame_type, frame_watch_add(wdev_id, group_id, prefix->frame_type,
prefix->data, prefix->len, prefix->data, prefix->len, false,
frame_xchg_resp_cb, fx, NULL); frame_xchg_resp_cb, fx, NULL);
if (!fx->rx_watches) if (!fx->rx_watches)

View File

@ -45,6 +45,7 @@ enum frame_xchg_group {
bool frame_watch_add(uint64_t wdev_id, uint32_t group, uint16_t frame_type, bool frame_watch_add(uint64_t wdev_id, uint32_t group, uint16_t frame_type,
const uint8_t *prefix, size_t prefix_len, const uint8_t *prefix, size_t prefix_len,
bool multicast_rx,
frame_watch_cb_t handler, void *user_data, frame_watch_cb_t handler, void *user_data,
frame_xchg_destroy_func_t destroy); frame_xchg_destroy_func_t destroy);
bool frame_watch_group_remove(uint64_t wdev_id, uint32_t group); bool frame_watch_group_remove(uint64_t wdev_id, uint32_t group);

View File

@ -5720,35 +5720,35 @@ static void netdev_add_station_frame_watches(struct netdev *netdev)
/* Subscribe to Management -> Action -> RM -> Neighbor Report frames */ /* Subscribe to Management -> Action -> RM -> Neighbor Report frames */
frame_watch_add(wdev, 0, 0x00d0, action_neighbor_report_prefix, frame_watch_add(wdev, 0, 0x00d0, action_neighbor_report_prefix,
sizeof(action_neighbor_report_prefix), sizeof(action_neighbor_report_prefix), false,
netdev_neighbor_report_frame_event, netdev, NULL); netdev_neighbor_report_frame_event, netdev, NULL);
frame_watch_add(wdev, 0, 0x00d0, action_sa_query_resp_prefix, frame_watch_add(wdev, 0, 0x00d0, action_sa_query_resp_prefix,
sizeof(action_sa_query_resp_prefix), sizeof(action_sa_query_resp_prefix), false,
netdev_sa_query_resp_frame_event, netdev, NULL); netdev_sa_query_resp_frame_event, netdev, NULL);
frame_watch_add(wdev, 0, 0x00d0, action_sa_query_req_prefix, frame_watch_add(wdev, 0, 0x00d0, action_sa_query_req_prefix,
sizeof(action_sa_query_req_prefix), sizeof(action_sa_query_req_prefix), false,
netdev_sa_query_req_frame_event, netdev, NULL); netdev_sa_query_req_frame_event, netdev, NULL);
frame_watch_add(wdev, 0, 0x00d0, action_ft_response_prefix, frame_watch_add(wdev, 0, 0x00d0, action_ft_response_prefix,
sizeof(action_ft_response_prefix), sizeof(action_ft_response_prefix), false,
netdev_ft_response_frame_event, netdev, NULL); netdev_ft_response_frame_event, netdev, NULL);
frame_watch_add(wdev, 0, 0x00b0, auth_ft_response_prefix, frame_watch_add(wdev, 0, 0x00b0, auth_ft_response_prefix,
sizeof(auth_ft_response_prefix), sizeof(auth_ft_response_prefix), false,
netdev_ft_auth_response_frame_event, netdev, NULL); netdev_ft_auth_response_frame_event, netdev, NULL);
if (wiphy_supports_qos_set_map(netdev->wiphy)) if (wiphy_supports_qos_set_map(netdev->wiphy))
frame_watch_add(wdev, 0, 0x00d0, action_qos_map_prefix, frame_watch_add(wdev, 0, 0x00d0, action_qos_map_prefix,
sizeof(action_qos_map_prefix), sizeof(action_qos_map_prefix), false,
netdev_qos_map_frame_event, netdev, NULL); netdev_qos_map_frame_event, netdev, NULL);
if (!wiphy_supports_cmds_auth_assoc(netdev->wiphy) && if (!wiphy_supports_cmds_auth_assoc(netdev->wiphy) &&
wiphy_has_feature(netdev->wiphy, NL80211_FEATURE_SAE)) wiphy_has_feature(netdev->wiphy, NL80211_FEATURE_SAE))
frame_watch_add(wdev, 0, 0x00b0, frame_watch_add(wdev, 0, 0x00b0,
auth_sae_prefix, sizeof(auth_sae_prefix), auth_sae_prefix, sizeof(auth_sae_prefix),
netdev_sae_external_auth_frame_event, false, netdev_sae_external_auth_frame_event,
netdev, NULL); netdev, NULL);
} }

View File

@ -4163,10 +4163,11 @@ static void p2p_device_discovery_start(struct p2p_device *dev)
L_ARRAY_SIZE(channels_social)]; L_ARRAY_SIZE(channels_social)];
frame_watch_add(dev->wdev_id, FRAME_GROUP_P2P_LISTEN, 0x0040, frame_watch_add(dev->wdev_id, FRAME_GROUP_P2P_LISTEN, 0x0040,
(uint8_t *) "", 0, p2p_device_probe_cb, dev, NULL); (uint8_t *) "", 0, false,
p2p_device_probe_cb, dev, NULL);
frame_watch_add(dev->wdev_id, FRAME_GROUP_P2P_LISTEN, 0x00d0, frame_watch_add(dev->wdev_id, FRAME_GROUP_P2P_LISTEN, 0x00d0,
p2p_frame_go_neg_req.data, p2p_frame_go_neg_req.len, p2p_frame_go_neg_req.data, p2p_frame_go_neg_req.len,
p2p_device_go_negotiation_req_cb, dev, NULL); false, p2p_device_go_negotiation_req_cb, dev, NULL);
p2p_device_scan_start(dev); p2p_device_scan_start(dev);
} }

View File

@ -798,7 +798,7 @@ static void rrm_add_frame_watches(struct rrm_state *rrm)
l_debug(""); l_debug("");
frame_watch_add(rrm->wdev_id, 0, frame_type, prefix, sizeof(prefix), frame_watch_add(rrm->wdev_id, 0, frame_type, prefix, sizeof(prefix),
rrm_frame_watch_cb, rrm, NULL); false, rrm_frame_watch_cb, rrm, NULL);
} }
static struct rrm_state *rrm_new_state(struct netdev *netdev) static struct rrm_state *rrm_new_state(struct netdev *netdev)

View File

@ -5683,7 +5683,7 @@ static void add_frame_watches(struct netdev *netdev)
*/ */
frame_watch_add(netdev_get_wdev_id(netdev), 0, 0x00d0, frame_watch_add(netdev_get_wdev_id(netdev), 0, 0x00d0,
action_ap_roam_prefix, sizeof(action_ap_roam_prefix), action_ap_roam_prefix, sizeof(action_ap_roam_prefix),
ap_roam_frame_event, false, ap_roam_frame_event,
L_UINT_TO_PTR(netdev_get_ifindex(netdev)), NULL); L_UINT_TO_PTR(netdev_get_ifindex(netdev)), NULL);
} }