nl80211: Use shared code for netlink initialization
[wpasupplicant] / src / eap_peer / tncc.c
index bf26917..662662d 100644 (file)
@@ -1218,12 +1218,11 @@ void tncc_deinit(struct tncc_data *tncc)
 }
 
 
-static struct wpabuf * tncc_build_soh(void)
+static struct wpabuf * tncc_build_soh(int ver)
 {
        struct wpabuf *buf;
        u8 *tlv_len, *tlv_len2, *outer_len, *inner_len, *ssoh_len, *end;
        u8 correlation_id[24];
-       int ver = 2;
        /* TODO: get correct name */
        char *machinename = "wpa_supplicant@w1.fi";
 
@@ -1274,10 +1273,11 @@ static struct wpabuf * tncc_build_soh(void)
 
        /* MS-Packet-Info */
        wpabuf_put_u8(buf, SSOH_MS_PACKET_INFO);
-       /* FIX: What is correct value here? IF-TNCCS-SOH v1.0 r8 claims this
-        * field to be: Reserved(4 bits) r(1 bit) Vers(3 bits), but Windows XP
+       /* Note: IF-TNCCS-SOH v1.0 r8 claims this field to be:
+        * Reserved(4 bits) r(1 bit) Vers(3 bits), but Windows XP
         * SP3 seems to be sending 0x11 for SSoH, i.e., r(request/response) bit
         * would not be in the specified location.
+        * [MS-SOH] 4.0.2: Reserved(3 bits) r(1 bit) Vers(4 bits)
         */
        wpabuf_put_u8(buf, 0x11); /* r=request, vers=1 */
 
@@ -1305,8 +1305,8 @@ static struct wpabuf * tncc_build_soh(void)
        wpabuf_put_be16(buf, 1); /* Flags: ExtState=0, f=0, qState=1 */
        wpabuf_put_be32(buf, 0xffffffff); /* ProbTime (hi) */
        wpabuf_put_be32(buf, 0xffffffff); /* ProbTime (lo) */
-       wpabuf_put_be16(buf, 0); /* urlLenInBytes */
-       /* followed by url */
+       wpabuf_put_be16(buf, 1); /* urlLenInBytes */
+       wpabuf_put_u8(buf, 0); /* null termination for the url */
 
        /* MS-Machine-Inventory-Ex */
        wpabuf_put_u8(buf, SSOH_MS_MACHINE_INVENTORY_EX);
@@ -1331,7 +1331,7 @@ static struct wpabuf * tncc_build_soh(void)
 }
 
 
-struct wpabuf * tncc_process_soh_request(const u8 *data, size_t len)
+struct wpabuf * tncc_process_soh_request(int ver, const u8 *data, size_t len)
 {
        const u8 *pos;
 
@@ -1364,5 +1364,5 @@ struct wpabuf * tncc_process_soh_request(const u8 *data, size_t len)
 
        wpa_printf(MSG_DEBUG, "TNC: SoH Request TLV received");
 
-       return tncc_build_soh();
+       return tncc_build_soh(2);
 }