]> git.ipfire.org Git - thirdparty/hostap.git/commitdiff
Interworking: Add IP Address Type Availability element (AP)
authorJay Katabathuni <jkatabat@qca.qualcomm.com>
Mon, 30 Jul 2012 18:51:19 +0000 (21:51 +0300)
committerJouni Malinen <j@w1.fi>
Mon, 30 Jul 2012 19:25:16 +0000 (22:25 +0300)
Signed-hostap: Jouni Malinen <jouni@qca.qualcomm.com>

hostapd/config_file.c
hostapd/hostapd.conf
src/ap/ap_config.h
src/ap/gas_serv.c
src/ap/gas_serv.h

index f67535ea14ddc0283939c9d404cd59ea31e801d8..d4c7d2b033f2355455958e7b8ab8e3ece6d33f97 100644 (file)
@@ -2457,6 +2457,17 @@ static int hostapd_config_fill(struct hostapd_config *conf,
                                os_memcpy(bss->network_auth_type + 3,
                                          pos + 2, redirect_url_len);
                        bss->network_auth_type_len = 3 + redirect_url_len;
+               } else if (os_strcmp(buf, "ipaddr_type_availability") == 0) {
+                       if (hexstr2bin(pos, &bss->ipaddr_type_availability, 1))
+                       {
+                               wpa_printf(MSG_ERROR, "Line %d: Invalid "
+                                          "ipaddr_type_availability '%s'",
+                                          line, pos);
+                               bss->ipaddr_type_configured = 0;
+                               errors++;
+                               return errors;
+                       }
+                       bss->ipaddr_type_configured = 1;
                } else if (os_strcmp(buf, "gas_frag_limit") == 0) {
                        bss->gas_frag_limit = atoi(pos);
                } else if (os_strcmp(buf, "gas_comeback_delay") == 0) {
index 78287bb0057dc214add0cf8a1d998451e9059e72..5ed655c503ae5dbc64dbb45e02519ed2b16077da 100644 (file)
@@ -1337,6 +1337,24 @@ own_ip_addr=127.0.0.1
 #network_auth_type=00
 #network_auth_type=02http://www.example.com/redirect/me/here/
 
+# IP Address Type Availability
+# format: <1-octet encoded value as hex str>
+# (ipv4_type & 0x3f) << 2 | (ipv6_type & 0x3)
+# ipv4_type:
+# 0 = Address type not available
+# 1 = Public IPv4 address available
+# 2 = Port-restricted IPv4 address available
+# 3 = Single NATed private IPv4 address available
+# 4 = Double NATed private IPv4 address available
+# 5 = Port-restricted IPv4 address and single NATed IPv4 address available
+# 6 = Port-restricted IPv4 address and double NATed IPv4 address available
+# 7 = Availability of the address type is not known
+# ipv6_type:
+# 0 = Address type not available
+# 1 = Address type available
+# 2 = Availability of the address type not known
+#ipaddr_type_availability=14
+
 ##### Hotspot 2.0 #############################################################
 
 # Enable Hotspot 2.0 support
index c23fb77cf34df18e36afb86b61491f145edbc410..b02313adeaebea6bbf0bd1012ef31b56438670f2 100644 (file)
@@ -395,6 +395,10 @@ struct hostapd_bss_config {
        u8 *network_auth_type;
        size_t network_auth_type_len;
 
+       /* IEEE 802.11u - IP Address Type Availability */
+       u8 ipaddr_type_availability;
+       u8 ipaddr_type_configured;
+
        u16 gas_comeback_delay;
        int gas_frag_limit;
 
index 7bfe8188fae060e16d2a674690dd4839903d833c..e304b5240b16b2e1fab7600b7fd5ee1d46451b94 100644 (file)
@@ -141,6 +141,8 @@ static void anqp_add_capab_list(struct hostapd_data *hapd,
                wpabuf_put_le16(buf, ANQP_NETWORK_AUTH_TYPE);
        if (hapd->conf->roaming_consortium)
                wpabuf_put_le16(buf, ANQP_ROAMING_CONSORTIUM);
+       if (hapd->conf->ipaddr_type_configured)
+               wpabuf_put_le16(buf, ANQP_IP_ADDR_TYPE_AVAILABILITY);
        gas_anqp_set_element_len(buf, len);
 }
 
@@ -194,6 +196,17 @@ static void anqp_add_roaming_consortium(struct hostapd_data *hapd,
 }
 
 
+static void anqp_add_ip_addr_type_availability(struct hostapd_data *hapd,
+                                              struct wpabuf *buf)
+{
+       if (hapd->conf->ipaddr_type_configured) {
+               wpabuf_put_le16(buf, ANQP_IP_ADDR_TYPE_AVAILABILITY);
+               wpabuf_put_le16(buf, 1);
+               wpabuf_put_u8(buf, hapd->conf->ipaddr_type_availability);
+       }
+}
+
+
 static struct wpabuf *
 gas_serv_build_gas_resp_payload(struct hostapd_data *hapd,
                                unsigned int request,
@@ -213,6 +226,8 @@ gas_serv_build_gas_resp_payload(struct hostapd_data *hapd,
                anqp_add_network_auth_type(hapd, buf);
        if (request & ANQP_REQ_ROAMING_CONSORTIUM)
                anqp_add_roaming_consortium(hapd, buf);
+       if (request & ANQP_REQ_IP_ADDR_TYPE_AVAILABILITY)
+               anqp_add_ip_addr_type_availability(hapd, buf);
 
        return buf;
 }
@@ -277,6 +292,11 @@ static void rx_anqp_query_list_id(struct hostapd_data *hapd, u16 info_id,
                set_anqp_req(ANQP_REQ_ROAMING_CONSORTIUM, "Roaming Consortium",
                             hapd->conf->roaming_consortium != NULL, 0, 0, qi);
                break;
+       case ANQP_IP_ADDR_TYPE_AVAILABILITY:
+               set_anqp_req(ANQP_REQ_IP_ADDR_TYPE_AVAILABILITY,
+                            "IP Addr Type Availability",
+                            hapd->conf->ipaddr_type_configured,
+                            0, 0, qi);
        default:
                wpa_printf(MSG_DEBUG, "ANQP: Unsupported Info Id %u",
                           info_id);
index d445b53a8db173b46917c17ba9aba503803f1698..e12b432dc430de5a13b5273d62a01dad9277137a 100644 (file)
@@ -17,6 +17,8 @@
        (1 << (ANQP_NETWORK_AUTH_TYPE - ANQP_QUERY_LIST))
 #define ANQP_REQ_ROAMING_CONSORTIUM \
        (1 << (ANQP_ROAMING_CONSORTIUM - ANQP_QUERY_LIST))
+#define ANQP_REQ_IP_ADDR_TYPE_AVAILABILITY \
+       (1 << (ANQP_IP_ADDR_TYPE_AVAILABILITY - ANQP_QUERY_LIST))
 
 /* To account for latencies between hostapd and external ANQP processor */
 #define GAS_SERV_COMEBACK_DELAY_FUDGE 10