HS 2.0: Include parsed WAN Metrics in RX-HS20-ANQP event
authorJouni Malinen <jouni@qca.qualcomm.com>
Wed, 3 Oct 2012 10:58:56 +0000 (13:58 +0300)
committerJouni Malinen <j@w1.fi>
Wed, 3 Oct 2012 10:58:56 +0000 (13:58 +0300)
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>:<DL Speed>:<UL Speed>:<DL Load>:<UL Load>:<LMD>
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 <jouni@qca.qualcomm.com>

wpa_supplicant/hs20_supplicant.c

index 0eb6119..a2577c9 100644 (file)
@@ -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);