diff --git a/src/agent.c b/src/agent.c index 1058fc98f7e96a5499ed42fcc81e6d73d8674a36..ff6655375aa710818a65436a4f254bd8154d077c 100644 --- a/src/agent.c +++ b/src/agent.c @@ -2400,16 +2400,40 @@ static void check_protocol(const char *framestr, uint8_t *protocol) memcpy(&category, frame + offset, 1); memcpy(&action, frame + offset + 1, 1); - if (category == 0x0a) { - if (action == 0x06) + /* = category = + * Public action = 4 + * Radio measurement = 5 + * WNM = 10, + * + * = action = + * Public action: + * Extended CSA = 4, + * GAS Initial Request = 10, + * GAS Initial Response = 11, + * GAS Comeback Request = 12, + * GAS_Comeback Response = 13, + * + * WNM actions: + * BTM Query = 6 + * BTM Request = 7 + * BTM Response = 8 + * WNM Notification request = 26 + * + */ + if (category == WIFI_ACTION_WNM) { + if (action == 6) *protocol = 0x02; - else if (action == 0x1a) + else if (action == 26) *protocol = 0x03; - } + } else if (category == WIFI_ACTION_PUBLIC) { + uint8_t *ad = frame + offset + 1 + 1; - /* TODO:check the action frame category & - * type for ANQP. - */ + if (action == 10 && ad[0] == 108 && ad[1] == 2 && ad[3] == 0) { + /* ANQP protocol */ + *protocol = 0x04; + //TODO: check ANQP-Info-ID == 272 + } + } out: free(frame);