From baf7081ccde91913aacd00e1f6ff034b9db5100d Mon Sep 17 00:00:00 2001 From: Jouni Malinen Date: Wed, 22 Sep 2010 10:07:20 -0700 Subject: [PATCH] WPS: Add MAC address to validation error message for Probe Request This makes it easier to figure out which device is sending invalid Probe Request frames. --- src/ap/wps_hostapd.c | 2 +- src/wps/wps.h | 5 +++-- src/wps/wps_validate.c | 4 ++-- 3 files changed, 6 insertions(+), 5 deletions(-) diff --git a/src/ap/wps_hostapd.c b/src/ap/wps_hostapd.c index 7968471..f1ad1df 100644 --- a/src/ap/wps_hostapd.c +++ b/src/ap/wps_hostapd.c @@ -881,7 +881,7 @@ static int hostapd_wps_probe_req_rx(void *ctx, const u8 *addr, wps_ie = ieee802_11_vendor_ie_concat(ie, ie_len, WPS_DEV_OUI_WFA); if (wps_ie == NULL) return 0; - if (wps_validate_probe_req(wps_ie) < 0) { + if (wps_validate_probe_req(wps_ie, addr) < 0) { wpabuf_free(wps_ie); return 0; } diff --git a/src/wps/wps.h b/src/wps/wps.h index 8bc7547..e415061 100644 --- a/src/wps/wps.h +++ b/src/wps/wps.h @@ -770,7 +770,7 @@ u16 wps_config_methods_str2bin(const char *str); int wps_validate_beacon(const struct wpabuf *wps_ie); int wps_validate_beacon_probe_resp(const struct wpabuf *wps_ie, int probe, const u8 *addr); -int wps_validate_probe_req(const struct wpabuf *wps_ie); +int wps_validate_probe_req(const struct wpabuf *wps_ie, const u8 *addr); int wps_validate_assoc_req(const struct wpabuf *wps_ie); int wps_validate_assoc_resp(const struct wpabuf *wps_ie); int wps_validate_m1(const struct wpabuf *tlvs); @@ -802,7 +802,8 @@ static inline int wps_validate_beacon_probe_resp(const struct wpabuf *wps_ie, return 0; } -static inline int wps_validate_probe_req(const struct wpabuf *wps_ie) +static inline int wps_validate_probe_req(const struct wpabuf *wps_ie, + const u8 *addr) { return 0; } diff --git a/src/wps/wps_validate.c b/src/wps/wps_validate.c index 7888c1b..dd1ccf2 100644 --- a/src/wps/wps_validate.c +++ b/src/wps/wps_validate.c @@ -1181,7 +1181,7 @@ int wps_validate_beacon_probe_resp(const struct wpabuf *wps_ie, int probe, } -int wps_validate_probe_req(const struct wpabuf *wps_ie) +int wps_validate_probe_req(const struct wpabuf *wps_ie, const u8 *addr) { struct wps_parse_attr attr; int wps2; @@ -1220,7 +1220,7 @@ int wps_validate_probe_req(const struct wpabuf *wps_ie) wps_validate_req_dev_type(attr.req_dev_type, attr.num_req_dev_type, 0)) { wpa_printf(MSG_INFO, "WPS-STRICT: Invalid Probe Request " - "frame"); + "frame from " MACSTR, MAC2STR(addr)); return -1; } -- 2.1.4