WPS: Determine the OpCode based on message type attribute (UPnP)
authorJouni Malinen <j@w1.fi>
Sun, 15 Nov 2009 20:23:49 +0000 (22:23 +0200)
committerJouni Malinen <j@w1.fi>
Sun, 15 Nov 2009 20:23:49 +0000 (22:23 +0200)
This allows WSC_ACK and WSC_NACK to be processed correctly in the AP
when operating as an Enrollee with an ER over UPnP transport.

src/wps/wps_enrollee.c

index 9b479a6..df2c086 100644 (file)
@@ -1190,6 +1190,17 @@ enum wps_process_res wps_enrollee_process_msg(struct wps_data *wps,
                   "op_code=%d)",
                   (unsigned long) wpabuf_len(msg), op_code);
 
+       if (op_code == WSC_UPnP) {
+               /* Determine the OpCode based on message type attribute */
+               struct wps_parse_attr attr;
+               if (wps_parse_msg(msg, &attr) == 0 && attr.msg_type) {
+                       if (*attr.msg_type == WPS_WSC_ACK)
+                               op_code = WSC_ACK;
+                       else if (*attr.msg_type == WPS_WSC_NACK)
+                               op_code = WSC_NACK;
+               }
+       }
+
        switch (op_code) {
        case WSC_MSG:
        case WSC_UPnP: