wpa_supplicant: Add NEIGHBOR_REP_REQUEST command to the control interface
authorAssaf Krauss <assaf.krauss@intel.com>
Wed, 5 Nov 2014 08:42:51 +0000 (03:42 -0500)
committerJouni Malinen <j@w1.fi>
Sat, 22 Nov 2014 19:28:52 +0000 (21:28 +0200)
Add NEIGHBOR_REP_REQUEST command to the wpa_supplicant ctrl_iface.
This command triggers the sending of a Neighbor Report Request to the
associated AP.

Signed-off-by: Assaf Krauss <assaf.krauss@intel.com>
src/common/wpa_ctrl.h
wpa_supplicant/ctrl_iface.c

index e48bbed..1f747eb 100644 (file)
@@ -200,6 +200,9 @@ extern "C" {
 #define EXT_RADIO_WORK_START "EXT-RADIO-WORK-START "
 #define EXT_RADIO_WORK_TIMEOUT "EXT-RADIO-WORK-TIMEOUT "
 
+#define RRM_EVENT_NEIGHBOR_REP_RXED "RRM-NEIGHBOR-REP-RECEIVED "
+#define RRM_EVENT_NEIGHBOR_REP_FAILED "RRM-NEIGHBOR-REP-REQUEST-FAILED "
+
 /* hostapd control interface - fixed message prefixes */
 #define WPS_EVENT_PIN_NEEDED "WPS-PIN-NEEDED "
 #define WPS_EVENT_NEW_AP_SETTINGS "WPS-NEW-AP-SETTINGS "
index 4bd9986..bae632e 100644 (file)
@@ -6823,6 +6823,29 @@ static int wpas_ctrl_vendor_elem_remove(struct wpa_supplicant *wpa_s, char *cmd)
 }
 
 
+static void wpas_ctrl_neighbor_rep_cb(void *ctx, struct wpabuf *neighbor_rep)
+{
+       struct wpa_supplicant *wpa_s = ctx;
+
+       if (neighbor_rep) {
+               wpa_msg_ctrl(wpa_s, MSG_INFO, RRM_EVENT_NEIGHBOR_REP_RXED
+                            "length=%u",
+                            (unsigned int) wpabuf_len(neighbor_rep));
+               wpabuf_free(neighbor_rep);
+       } else {
+               wpa_msg_ctrl(wpa_s, MSG_INFO, RRM_EVENT_NEIGHBOR_REP_FAILED);
+       }
+}
+
+
+static int wpas_ctrl_iface_send_neigbor_rep(struct wpa_supplicant *wpa_s)
+{
+       return wpas_rrm_send_neighbor_rep_request(wpa_s,
+                                                 wpas_ctrl_neighbor_rep_cb,
+                                                 wpa_s);
+}
+
+
 char * wpa_supplicant_ctrl_iface_process(struct wpa_supplicant *wpa_s,
                                         char *buf, size_t *resp_len)
 {
@@ -7425,6 +7448,9 @@ char * wpa_supplicant_ctrl_iface_process(struct wpa_supplicant *wpa_s,
        } else if (os_strncmp(buf, "VENDOR_ELEM_REMOVE ", 19) == 0) {
                if (wpas_ctrl_vendor_elem_remove(wpa_s, buf + 19) < 0)
                        reply_len = -1;
+       } else if (os_strncmp(buf, "NEIGHBOR_REP_REQUEST", 20) == 0) {
+               if (wpas_ctrl_iface_send_neigbor_rep(wpa_s))
+                       reply_len = -1;
        } else {
                os_memcpy(reply, "UNKNOWN COMMAND\n", 16);
                reply_len = 16;