From 2edcd5046a8e090de69e162088925317393eb66b Mon Sep 17 00:00:00 2001 From: Jouni Malinen Date: Wed, 3 Oct 2012 13:58:56 +0300 Subject: [PATCH] HS 2.0: Include parsed WAN Metrics in RX-HS20-ANQP event This adds parsed version of WAN Metrics information to the control event message as follows: RX-HS20-ANQP 02:00:00:00:01:00 WAN Metrics 01:8000:1000:80:240:3000 format: :
:
    :
    :
      : WAN Info: B0-B1: Link Status, B2: Symmetric Link, B3: At Capabity (encoded as two hex digits) Downlink Speed: Estimate of WAN backhaul link current downlink speed in kbps; 1..4294967295; 0 = unknown Uplink Speed: Estimate of WAN backhaul link current uplink speed in kbps 1..4294967295; 0 = unknown Downlink Load: Current load of downlink WAN connection (scaled to 255 = 100%) Uplink Load: Current load of uplink WAN connection (scaled to 255 = 100%) Load Measurement Duration: Duration for measuring downlink/uplink load in tenths of a second (1..65535); 0 if load cannot be determined Signed-hostap: Jouni Malinen --- wpa_supplicant/hs20_supplicant.c | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) diff --git a/wpa_supplicant/hs20_supplicant.c b/wpa_supplicant/hs20_supplicant.c index 0eb61196e..a2577c938 100644 --- a/wpa_supplicant/hs20_supplicant.c +++ b/wpa_supplicant/hs20_supplicant.c @@ -141,9 +141,16 @@ void hs20_parse_rx_hs20_anqp_resp(struct wpa_supplicant *wpa_s, } break; case HS20_STYPE_WAN_METRICS: + wpa_hexdump(MSG_DEBUG, "WAN Metrics", pos, slen); + if (slen < 13) { + wpa_dbg(wpa_s, MSG_DEBUG, "HS 2.0: Too short WAN " + "Metrics value from " MACSTR, MAC2STR(sa)); + break; + } wpa_msg(wpa_s, MSG_INFO, "RX-HS20-ANQP " MACSTR - " WAN Metrics", MAC2STR(sa)); - wpa_hexdump_ascii(MSG_DEBUG, "WAN Metrics", pos, slen); + " WAN Metrics %02x:%u:%u:%u:%u:%u", MAC2STR(sa), + pos[0], WPA_GET_LE32(pos + 1), WPA_GET_LE32(pos + 5), + pos[9], pos[10], WPA_GET_LE16(pos + 11)); if (anqp) { wpabuf_free(anqp->hs20_wan_metrics); anqp->hs20_wan_metrics = wpabuf_alloc_copy(pos, slen);