]> git.ipfire.org Git - thirdparty/hostap.git/commitdiff
Do not use country_code default (was: US)
authorJouni Malinen <jouni.malinen@atheros.com>
Fri, 30 Jan 2009 10:43:19 +0000 (12:43 +0200)
committerJouni Malinen <j@w1.fi>
Fri, 30 Jan 2009 10:43:19 +0000 (12:43 +0200)
If country_code is not included in hostapd.conf, refuse to enable IEEE
802.11d and do not try to set the regulatory domain in kernel.

hostapd/config.c
hostapd/hostapd.c
hostapd/hostapd.conf

index 41cc75cdcdb096c893b325a3c0258772ae2b4430..c0381ea18666851489617bea041bdd5af7df2e68 100644 (file)
@@ -250,8 +250,6 @@ static struct hostapd_config * hostapd_config_defaults(void)
        conf->send_probe_response = 1;
        conf->bridge_packets = INTERNAL_BRIDGE_DO_NOT_CONTROL;
 
-       os_memcpy(conf->country, "US ", 3);
-
        for (i = 0; i < NUM_TX_QUEUES; i++)
                conf->tx_queue[i].aifs = -1; /* use hw default */
 
@@ -970,6 +968,12 @@ static int hostapd_config_check(struct hostapd_config *conf)
 {
        size_t i;
 
+       if (conf->ieee80211d && (!conf->country[0] || !conf->country[1])) {
+               wpa_printf(MSG_ERROR, "Cannot enable IEEE 802.11d without "
+                          "setting the country_code");
+               return -1;
+       }
+
        for (i = 0; i < conf->num_bss; i++) {
                if (hostapd_config_check_bss(&conf->bss[i], conf))
                        return -1;
index 51379dde14581618317a83afe2071e9e5cb8de27..caa7d8c38fa2d5fe53eb4788ef12e651d9cc7eb3 100644 (file)
@@ -1478,11 +1478,13 @@ static int setup_interface(struct hostapd_iface *iface)
                      OP_MODE_PURE);
 #endif /* CONFIG_IEEE80211N */
 
-       os_memcpy(country, hapd->iconf->country, 3);
-       country[3] = '\0';
-       if (hostapd_set_country(hapd, country) < 0) {
-               wpa_printf(MSG_ERROR, "Failed to set country code");
-               return -1;
+       if (hapd->iconf->country[0] && hapd->iconf->country[1]) {
+               os_memcpy(country, hapd->iconf->country, 3);
+               country[3] = '\0';
+               if (hostapd_set_country(hapd, country) < 0) {
+                       wpa_printf(MSG_ERROR, "Failed to set country code");
+                       return -1;
+               }
        }
 
        if (hapd->iconf->ieee80211d &&
index a4a033a986f18256c0bdcb6efa362bca96a5dfe6..0602cb04a50c511b29570f463c69dff88115acdc 100644 (file)
@@ -77,10 +77,9 @@ ctrl_interface_group=0
 # SSID to be used in IEEE 802.11 management frames
 ssid=test
 
-# Country code (ISO/IEC 3166-1).  Used to set regulatory domain.
-# Modify as needed to indicate country in which device is operating.
+# 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.
-# (default: US)
 #country_code=US
 
 # Enable IEEE 802.11d. This advertises the country_code and the set of allowed