]> git.ipfire.org Git - thirdparty/hostap.git/commitdiff
Interworking: Add ctrl_iface events on cred block modifications
authorJouni Malinen <jouni@qca.qualcomm.com>
Fri, 4 Apr 2014 16:10:47 +0000 (19:10 +0300)
committerJouni Malinen <j@w1.fi>
Fri, 4 Apr 2014 16:10:47 +0000 (19:10 +0300)
Following events are now sent to ctrl_iface monitors to indicate if
credential blocks have been added, modified, or removed:

CRED-ADDED <id>
CRED-MODIFIED <id> <field>
CRED-REMOVE <id>

Signed-off-by: Jouni Malinen <jouni@qca.qualcomm.com>
src/common/wpa_ctrl.h
wpa_supplicant/ctrl_iface.c

index 6d172283d392bf3b93ea68c1bcebe6c2db0adcdd..7f39ccdc325acece9201e5773a6550687d80f2d9 100644 (file)
@@ -164,6 +164,13 @@ extern "C" {
 #define INTERWORKING_ALREADY_CONNECTED "INTERWORKING-ALREADY-CONNECTED "
 #define INTERWORKING_SELECTED "INTERWORKING-SELECTED "
 
+/* Credential block added; parameters: <id> */
+#define CRED_ADDED "CRED-ADDED "
+/* Credential block modified; parameters: <id> <field> */
+#define CRED_MODIFIED "CRED-MODIFIED "
+/* Credential block removed; parameters: <id> */
+#define CRED_REMOVED "CRED-REMOVED "
+
 #define GAS_RESPONSE_INFO "GAS-RESPONSE-INFO "
 /* parameters: <addr> <dialog_token> <freq> */
 #define GAS_QUERY_START "GAS-QUERY-START "
index 925ece1289fca668134c7a44219004c753fc6f67..4a63f4a8c9d8ee426e3b1ca560f5771bd5d43bf9 100644 (file)
@@ -2660,6 +2660,8 @@ static int wpa_supplicant_ctrl_iface_add_cred(struct wpa_supplicant *wpa_s,
        if (cred == NULL)
                return -1;
 
+       wpa_msg(wpa_s, MSG_INFO, CRED_ADDED "%d", cred->id);
+
        ret = os_snprintf(buf, buflen, "%d\n", cred->id);
        if (ret < 0 || (size_t) ret >= buflen)
                return -1;
@@ -2672,12 +2674,21 @@ static int wpas_ctrl_remove_cred(struct wpa_supplicant *wpa_s,
 {
        struct wpa_ssid *ssid;
        char str[20];
+       int id;
 
-       if (cred == NULL || wpa_config_remove_cred(wpa_s->conf, cred->id) < 0) {
+       if (cred == NULL) {
                wpa_printf(MSG_DEBUG, "CTRL_IFACE: Could not find cred");
                return -1;
        }
 
+       id = cred->id;
+       if (wpa_config_remove_cred(wpa_s->conf, id) < 0) {
+               wpa_printf(MSG_DEBUG, "CTRL_IFACE: Could not find cred");
+               return -1;
+       }
+
+       wpa_msg(wpa_s, MSG_INFO, CRED_REMOVED "%d", id);
+
        /* Remove any network entry created based on the removed credential */
        ssid = wpa_s->conf->ssid;
        while (ssid) {
@@ -2794,6 +2805,8 @@ static int wpa_supplicant_ctrl_iface_set_cred(struct wpa_supplicant *wpa_s,
                return -1;
        }
 
+       wpa_msg(wpa_s, MSG_INFO, CRED_MODIFIED "%d %s", cred->id, name);
+
        return 0;
 }