From 07b34cbf92e71ba25af35357ea4fb79c0d08b311 Mon Sep 17 00:00:00 2001 From: WangYusen Date: Tue, 25 Mar 2025 21:07:17 +0800 Subject: [PATCH] test black list Signed-off-by: WangYusen --- wpa_supplicant-2.9_standard/hostapd/ap_config_file.c | 2 +- wpa_supplicant-2.9_standard/hostapd/ap_ctrl_iface.c | 4 +++- wpa_supplicant-2.9_standard/hostapd/ap_main.c | 2 +- wpa_supplicant-2.9_standard/src/ap/ap_config.c | 2 +- wpa_supplicant-2.9_standard/src/ap/drv_callbacks.c | 9 +++++++-- wpa_supplicant-2.9_standard/src/ap/ieee802_11_auth.c | 9 +++++++-- 6 files changed, 20 insertions(+), 8 deletions(-) diff --git a/wpa_supplicant-2.9_standard/hostapd/ap_config_file.c b/wpa_supplicant-2.9_standard/hostapd/ap_config_file.c index 9896c16..728b648 100755 --- a/wpa_supplicant-2.9_standard/hostapd/ap_config_file.c +++ b/wpa_supplicant-2.9_standard/hostapd/ap_config_file.c @@ -147,7 +147,7 @@ int hostapd_add_acl_maclist(struct mac_acl_entry **acl, int *num, (*acl)[*num].vlan_id.untagged = vlan_id; (*acl)[*num].vlan_id.notempty = !!vlan_id; (*num)++; - + wpa_printf(MSG_ERROR, "hostapd_add_acl_maclist"); return 0; } diff --git a/wpa_supplicant-2.9_standard/hostapd/ap_ctrl_iface.c b/wpa_supplicant-2.9_standard/hostapd/ap_ctrl_iface.c index 3fd77a9..e59dece 100755 --- a/wpa_supplicant-2.9_standard/hostapd/ap_ctrl_iface.c +++ b/wpa_supplicant-2.9_standard/hostapd/ap_ctrl_iface.c @@ -3438,7 +3438,7 @@ int hostapd_ctrl_iface_acl_add_mac(struct mac_acl_entry **acl, int *num, struct vlan_description vlan_id; int ret = 0, vlanid = 0; const char *pos; - + wpa_printf(MSG_ERROR, "hostapd_ctrl_iface_acl_add_mac"); if (hwaddr_aton(cmd, addr)) return -1; @@ -3447,6 +3447,7 @@ int hostapd_ctrl_iface_acl_add_mac(struct mac_acl_entry **acl, int *num, vlanid = atoi(pos + 8); if (!hostapd_maclist_found(*acl, *num, addr, &vlan_id)) { + wpa_printf(MSG_ERROR, "! hostapd_maclist_found"); ret = hostapd_add_acl_maclist(acl, num, vlanid, addr); if (ret != -1 && *acl) qsort(*acl, *num, sizeof(**acl), hostapd_acl_comp); @@ -3510,6 +3511,7 @@ static int hostapd_ctrl_iface_receive_process(struct hostapd_data *hapd, socklen_t fromlen) { int reply_len, res; + wpa_printf(MSG_ERROR, "hostapd_ctrl_iface_receive: %s", buf); os_memcpy(reply, "OK\n", 3); reply_len = 3; diff --git a/wpa_supplicant-2.9_standard/hostapd/ap_main.c b/wpa_supplicant-2.9_standard/hostapd/ap_main.c index 9ddaba1..352e235 100644 --- a/wpa_supplicant-2.9_standard/hostapd/ap_main.c +++ b/wpa_supplicant-2.9_standard/hostapd/ap_main.c @@ -237,7 +237,7 @@ static int hostapd_driver_init(struct hostapd_iface *iface) iface->extended_capa_mask = capa.extended_capa_mask; iface->extended_capa_len = capa.extended_capa_len; iface->drv_max_acl_mac_addrs = capa.max_acl_mac_addrs; - + wpa_printf(MSG_ERROR, "ACL check, iface->drv_max_acl_mac_addrs:%d", capa.max_acl_mac_addrs); /* * Override extended capa with per-interface type (AP), if * available from the driver. diff --git a/wpa_supplicant-2.9_standard/src/ap/ap_config.c b/wpa_supplicant-2.9_standard/src/ap/ap_config.c index b372c8c..f9e66fc 100644 --- a/wpa_supplicant-2.9_standard/src/ap/ap_config.c +++ b/wpa_supplicant-2.9_standard/src/ap/ap_config.c @@ -1021,7 +1021,7 @@ int hostapd_maclist_found(struct mac_acl_entry *list, int num_entries, start = 0; end = num_entries - 1; - + wpa_printf(MSG_ERROR, "hostapd_maclist_found"); while (start <= end) { middle = (start + end) / 2; res = os_memcmp(list[middle].addr, addr, ETH_ALEN); diff --git a/wpa_supplicant-2.9_standard/src/ap/drv_callbacks.c b/wpa_supplicant-2.9_standard/src/ap/drv_callbacks.c index 620e3ca..5bc25ca 100755 --- a/wpa_supplicant-2.9_standard/src/ap/drv_callbacks.c +++ b/wpa_supplicant-2.9_standard/src/ap/drv_callbacks.c @@ -147,6 +147,7 @@ static bool check_sa_query_need(struct hostapd_data *hapd, struct sta_info *sta) int hostapd_notif_assoc(struct hostapd_data *hapd, const u8 *addr, const u8 *req_ies, size_t req_ies_len, int reassoc) { + wpa_printf(MSG_ERROR, "hostapd_notif_assoc"); struct sta_info *sta; int new_assoc; enum wpa_validate_result res; @@ -242,9 +243,13 @@ int hostapd_notif_assoc(struct hostapd_data *hapd, const u8 *addr, * ACL if the driver supports ACL offload to avoid potentially * conflicting ACL rules. */ - if (hapd->iface->drv_max_acl_mac_addrs == 0 && + wpa_printf(MSG_ERROR, "ACL check, drv_max_acl_mac_addrs:%d", + hapd->iface->drv_max_acl_mac_addrs); + + // if (hapd->iface->drv_max_acl_mac_addrs == 0 && + if( hostapd_check_acl(hapd, addr, NULL) != HOSTAPD_ACL_ACCEPT) { - wpa_printf(MSG_INFO, "STA " MACSTR_SEC " not allowed to connect", + wpa_printf(MSG_ERROR, "STA " MACSTR_SEC " not allowed to connect", MAC2STR_SEC(addr)); reason = WLAN_REASON_UNSPECIFIED; goto fail; diff --git a/wpa_supplicant-2.9_standard/src/ap/ieee802_11_auth.c b/wpa_supplicant-2.9_standard/src/ap/ieee802_11_auth.c index 106496a..69d748c 100644 --- a/wpa_supplicant-2.9_standard/src/ap/ieee802_11_auth.c +++ b/wpa_supplicant-2.9_standard/src/ap/ieee802_11_auth.c @@ -174,14 +174,19 @@ static int hostapd_radius_acl_query(struct hostapd_data *hapd, const u8 *addr, int hostapd_check_acl(struct hostapd_data *hapd, const u8 *addr, struct vlan_description *vlan_id) { + wpa_printf(MSG_ERROR, "hostapd_check_acl"); if (hostapd_maclist_found(hapd->conf->accept_mac, hapd->conf->num_accept_mac, addr, vlan_id)) + { + wpa_printf(MSG_ERROR, "return HOSTAPD_ACL_ACCEPT"); return HOSTAPD_ACL_ACCEPT; - + } if (hostapd_maclist_found(hapd->conf->deny_mac, hapd->conf->num_deny_mac, addr, vlan_id)) + { + wpa_printf(MSG_ERROR, "return HOSTAPD_ACL_REJECT"); return HOSTAPD_ACL_REJECT; - + } if (hapd->conf->macaddr_acl == ACCEPT_UNLESS_DENIED) return HOSTAPD_ACL_ACCEPT; if (hapd->conf->macaddr_acl == DENY_UNLESS_ACCEPTED) -- Gitee