]> git.ipfire.org Git - thirdparty/hostap.git/commitdiff
hostapd: Add a configuration to set an AP as stationary
authorDavid Spinadel <david.spinadel@intel.com>
Thu, 27 Oct 2016 12:18:25 +0000 (15:18 +0300)
committerJouni Malinen <j@w1.fi>
Sat, 29 Oct 2016 16:16:47 +0000 (19:16 +0300)
Add a configuration option in hostapd.conf and in neighbor report that
sets an AP as stationary. To enable this option on the current AP set
the config option stationary_ap to 1. To set a neighbor entry to be
marked as stationary add the word stat to the SET_NEIGHBOR command. This
option tells hostapd to send LCI data even if it is older than requested
by max age subelement in RRM request.

Signed-off-by: David Spinadel <david.spinadel@intel.com>
hostapd/config_file.c
hostapd/ctrl_iface.c
hostapd/hostapd.conf
hostapd/hostapd_cli.c
src/ap/ap_config.h
src/ap/hostapd.c
src/ap/hostapd.h
src/ap/neighbor_db.c
src/ap/neighbor_db.h
src/ap/rrm.c

index 4b4967241443c27e65a3a47b94dfb57d891aee21..77950150d84f7485e5e1cba57f40c43f87820beb 100644 (file)
@@ -3510,6 +3510,8 @@ static int hostapd_config_fill(struct hostapd_config *conf,
                                WLAN_RRM_CAPS_NEIGHBOR_REPORT;
        } else if (os_strcmp(buf, "gas_address3") == 0) {
                bss->gas_address3 = atoi(pos);
+       } else if (os_strcmp(buf, "stationary_ap") == 0) {
+               conf->stationary_ap = atoi(pos);
        } else if (os_strcmp(buf, "ftm_responder") == 0) {
                bss->ftm_responder = atoi(pos);
        } else if (os_strcmp(buf, "ftm_initiator") == 0) {
index 68751decf0e4fdb8f55e9a7632f9b86904092e91..0d86b4a4f01be48fc8318504c80f096daa318493 100644 (file)
@@ -2174,6 +2174,7 @@ static int hostapd_ctrl_iface_set_neighbor(struct hostapd_data *hapd, char *buf)
        struct wpa_ssid_value ssid;
        u8 bssid[ETH_ALEN];
        struct wpabuf *nr, *lci = NULL, *civic = NULL;
+       int stationary = 0;
        char *tmp;
        int ret;
 
@@ -2252,8 +2253,15 @@ static int hostapd_ctrl_iface_set_neighbor(struct hostapd_data *hapd, char *buf)
                }
        }
 
+       if (!buf)
+               goto set;
+
+       if (os_strstr(buf, "stat"))
+               stationary = 1;
+
 set:
-       ret = hostapd_neighbor_set(hapd, bssid, &ssid, nr, lci, civic);
+       ret = hostapd_neighbor_set(hapd, bssid, &ssid, nr, lci, civic,
+                                  stationary);
 
        wpabuf_free(nr);
        wpabuf_free(lci);
index 0574fa47471be2c86de3b7622d136deb1e620523..54c8b95e39cf1184461ecb734f499cc4d5db074b 100644 (file)
@@ -1940,6 +1940,12 @@ own_ip_addr=127.0.0.1
 # This parameter only controls publishing via Extended Capabilities element.
 # Actual functionality is managed outside hostapd.
 #ftm_initiator=0
+#
+# Stationary AP config indicates that the AP doesn't move hence location data
+# can be considered as always up to date. If configured, LCI data will be sent
+# as a radio measurement even if the request doesn't contain a max age element
+# that allows sending of such data. Default: 0.
+#stationary_ap=0
 
 ##### TESTING OPTIONS #########################################################
 #
index 9a6e3cb774892344bb65bb7411828109b72e9c26..8b8d7f92f00d8a8f367722d3c644e5dc9fb86f84 100644 (file)
@@ -1255,14 +1255,14 @@ static int hostapd_cli_cmd_set_neighbor(struct wpa_ctrl *ctrl, int argc,
        char cmd[2048];
        int res;
 
-       if (argc < 3 || argc > 5) {
-               printf("Invalid set_neighbor command: needs 3-5 arguments\n");
+       if (argc < 3 || argc > 6) {
+               printf("Invalid set_neighbor command: needs 3-6 arguments\n");
                return -1;
        }
 
-       res = os_snprintf(cmd, sizeof(cmd), "SET_NEIGHBOR %s %s %s %s %s",
+       res = os_snprintf(cmd, sizeof(cmd), "SET_NEIGHBOR %s %s %s %s %s %s",
                          argv[0], argv[1], argv[2], argc >= 4 ? argv[3] : "",
-                         argc == 5 ? argv[4] : "");
+                         argc >= 5 ? argv[4] : "", argc == 6 ? argv[5] : "");
        if (os_snprintf_error(sizeof(cmd), res)) {
                printf("Too long SET_NEIGHBOR command.\n");
                return -1;
index 04b90b84a7b944b19a6856483f8d0101c9e5efc2..ec476070fcc34284360ef622c9765c856854880b 100644 (file)
@@ -713,6 +713,7 @@ struct hostapd_config {
 
        struct wpabuf *lci;
        struct wpabuf *civic;
+       int stationary_ap;
 };
 
 
index 9fafc7f457bb0c8d2a0b4fea8666da6195fbebb1..f03db292ec4b19a106599326479e318dd31c5a15 100644 (file)
@@ -1645,7 +1645,7 @@ static void hostapd_set_own_neighbor_report(struct hostapd_data *hapd)
        wpabuf_put_u8(nr, center_freq2);
 
        hostapd_neighbor_set(hapd, hapd->own_addr, &ssid, nr, hapd->iconf->lci,
-                            hapd->iconf->civic);
+                            hapd->iconf->civic, hapd->iconf->stationary_ap);
 
        wpabuf_free(nr);
 #endif /* NEED_AP_MLME */
index 919b1853487e51325227af6ccbde24381eedcfc5..fd5aaedcc5f510f0d11d4a7116ed22a3484cc1a2 100644 (file)
@@ -109,6 +109,7 @@ struct hostapd_neighbor_entry {
        struct wpabuf *civic;
        /* LCI update time */
        struct os_time lci_date;
+       int stationary;
 };
 
 /**
index c6cdbfce28fbc65f6499493c064bae3bf43b4f20..b8fd5924b88935ed3f57003b2aee86e6d650bb58 100644 (file)
@@ -43,6 +43,7 @@ static void hostapd_neighbor_clear_entry(struct hostapd_neighbor_entry *nr)
        nr->civic = NULL;
        os_memset(nr->bssid, 0, sizeof(nr->bssid));
        os_memset(&nr->ssid, 0, sizeof(nr->ssid));
+       nr->stationary = 0;
 }
 
 
@@ -64,7 +65,7 @@ hostapd_neighbor_add(struct hostapd_data *hapd)
 int hostapd_neighbor_set(struct hostapd_data *hapd, const u8 *bssid,
                         const struct wpa_ssid_value *ssid,
                         const struct wpabuf *nr, const struct wpabuf *lci,
-                        const struct wpabuf *civic)
+                        const struct wpabuf *civic, int stationary)
 {
        struct hostapd_neighbor_entry *entry;
 
@@ -95,6 +96,8 @@ int hostapd_neighbor_set(struct hostapd_data *hapd, const u8 *bssid,
                        goto fail;
        }
 
+       entry->stationary = stationary;
+
        return 0;
 
 fail:
index c22e043c120ef0bb1b3816ad124760d85f7758e4..ba46d88435e56a7280e3417c469030ae496020dd 100644 (file)
@@ -16,7 +16,7 @@ hostapd_neighbor_get(struct hostapd_data *hapd, const u8 *bssid,
 int hostapd_neighbor_set(struct hostapd_data *hapd, const u8 *bssid,
                         const struct wpa_ssid_value *ssid,
                         const struct wpabuf *nr, const struct wpabuf *lci,
-                        const struct wpabuf *civic);
+                        const struct wpabuf *civic, int stationary);
 int hostapd_neighbor_remove(struct hostapd_data *hapd, const u8 *bssid,
                            const struct wpa_ssid_value *ssid);
 void hostpad_free_neighbor_db(struct hostapd_data *hapd);
index 3569f955bcd27351ccd8cb488d71b406c2c83180..5ca87c0be942ddc7cab54bfd989f149b9d72fbf4 100644 (file)
@@ -129,12 +129,12 @@ static int hostapd_check_lci_age(struct hostapd_neighbor_entry *nr, u16 max_age)
        struct os_time curr, diff;
        unsigned long diff_l;
 
+       if (nr->stationary || max_age == 0xffff)
+               return 1;
+
        if (!max_age)
                return 0;
 
-       if (max_age == 0xffff)
-               return 1;
-
        if (os_get_time(&curr))
                return 0;