]> git.ipfire.org Git - thirdparty/hostap.git/commitdiff
AOSP: ctrl_iface interface=
authorJouni Malinen <j@w1.fi>
Thu, 9 Aug 2012 19:40:57 +0000 (22:40 +0300)
committerJouni Malinen <j@w1.fi>
Thu, 9 Aug 2012 20:18:32 +0000 (23:18 +0300)
wpa_supplicant/ctrl_iface_unix.c

index 65136041a58b3420981958c144e37d7e8b68791b..b4af7934d2a11159fa8b766eea1400da53efbfab 100644 (file)
@@ -164,6 +164,35 @@ static void wpa_supplicant_ctrl_iface_receive(int sock, void *eloop_ctx,
                else
                        reply_len = 2;
        } else {
+#if defined(CONFIG_P2P) && defined(ANDROID_P2P)
+               char *ifname = NULL, *arg;
+               char cmd[256];
+               /* Skip the command name */
+               arg = os_strchr(buf, ' ');
+               if (arg) {
+                       *arg++ = '\0';
+                       os_strncpy(cmd, buf, sizeof(cmd));
+                       /* Now search for interface= */
+                       if (os_strncmp(arg, "interface=", 10) == 0) {
+                               ifname = arg + 10;
+                               arg = os_strchr(ifname, ' ');
+                               if (arg)
+                                       *arg++ = '\0';
+                               wpa_printf(MSG_DEBUG, "Found interface= in the arg %s ifname %s", arg, ifname);
+                               for (wpa_s = wpa_s->global->ifaces; wpa_s; wpa_s = wpa_s->next) {
+                                       if (os_strcmp(wpa_s->ifname, ifname) == 0)
+                                               break;
+                               }
+                               if (wpa_s == NULL) {
+                                       wpa_printf(MSG_ERROR, "P2P: interface=%s does not exist", ifname);
+                                       wpa_s = eloop_ctx;
+                               }
+                       }
+                       if (arg)
+                               os_snprintf(buf, sizeof(buf), "%s %s", cmd, arg);
+               }
+               wpa_printf(MSG_DEBUG, "wpa_s %p cmd %s", wpa_s, buf);
+#endif /* defined CONFIG_P2P && defined ANDROID_P2P */
                reply = wpa_supplicant_ctrl_iface_process(wpa_s, buf,
                                                          &reply_len);
        }