]> git.ipfire.org Git - thirdparty/hostap.git/commitdiff
Add support for advertising UTF-8 SSID extended capability
authorJouni Malinen <j@w1.fi>
Sun, 16 Dec 2012 18:46:51 +0000 (20:46 +0200)
committerJouni Malinen <j@w1.fi>
Sun, 16 Dec 2012 18:46:51 +0000 (20:46 +0200)
This field can be used to indicate that UTF-8 encoding is used in the
SSID field.

Signed-hostap: Jouni Malinen <j@w1.fi>

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

index 70a114db6c7716d3fca03e1dae71e5092accc790..1b5c730aefa8cc75fc816fe8214a5c7382c74623 100644 (file)
@@ -1780,6 +1780,8 @@ static int hostapd_config_fill(struct hostapd_config *conf,
                                bss->ssid.ssid_set = 1;
                        }
                        os_free(str);
+               } else if (os_strcmp(buf, "utf8_ssid") == 0) {
+                       bss->ssid.utf8_ssid = atoi(pos) > 0;
                } else if (os_strcmp(buf, "macaddr_acl") == 0) {
                        bss->macaddr_acl = atoi(pos);
                        if (bss->macaddr_acl != ACCEPT_UNLESS_DENIED &&
index ad81f06e38601883c2b608c74c0067f00ea271be..58717acbacecfff93f1489e2d69622295c3ea099 100644 (file)
@@ -90,6 +90,9 @@ ssid=test
 #ssid2=74657374
 #ssid2=P"hello\nthere"
 
+# UTF-8 SSID: Whether the SSID is to be interpreted using UTF-8 encoding
+#utf8_ssid=1
+
 # Country code (ISO/IEC 3166-1). Used to set regulatory domain.
 # Set as needed to indicate country in which device is operating.
 # This can limit available channels and transmit power.
index ec6db3a6e8ff55a30bfdddb0a1241ec8450c2e04..bc04307ddd7b63465d37026edb2e544b8ff581fb 100644 (file)
@@ -51,7 +51,8 @@ typedef enum hostap_security_policy {
 struct hostapd_ssid {
        u8 ssid[HOSTAPD_MAX_SSID_LEN];
        size_t ssid_len;
-       int ssid_set;
+       unsigned int ssid_set:1;
+       unsigned int utf8_ssid:1;
 
        char vlan[IFNAMSIZ + 1];
        secpolicy security_policy;
index 9d07d651601032c6aeab8b9df29eb76fc5d1653c..72c127616af19895b7297bf81eaa58908a7bf3ee 100644 (file)
@@ -175,6 +175,8 @@ u8 * hostapd_eid_ext_capab(struct hostapd_data *hapd, u8 *eid)
                len = 4;
        if (len < 3 && hapd->conf->wnm_sleep_mode)
                len = 3;
+       if (len < 7 && hapd->conf->ssid.utf8_ssid)
+               len = 7;
        if (len == 0)
                return eid;
 
@@ -206,6 +208,18 @@ u8 * hostapd_eid_ext_capab(struct hostapd_data *hapd, u8 *eid)
                *pos |= 0x80; /* Bit 39 - TDLS Channel Switching Prohibited */
        pos++;
 
+       if (len < 6)
+               return pos;
+       *pos = 0x00;
+       pos++;
+
+       if (len < 7)
+               return pos;
+       *pos = 0x00;
+       if (hapd->conf->ssid.utf8_ssid)
+               *pos |= 0x01; /* Bit 48 - UTF-8 SSID */
+       pos++;
+
        return pos;
 }