]> git.ipfire.org Git - thirdparty/hostap.git/commitdiff
iface match: Unspecified matched interfaces should not log driver fails
authorRoy Marples <roy@marples.name>
Tue, 21 Jul 2020 13:25:26 +0000 (14:25 +0100)
committerJouni Malinen <j@w1.fi>
Fri, 9 Oct 2020 13:50:36 +0000 (16:50 +0300)
If there is no matching interface given, but interface matching is
enabled, all interfaces on the system will try to be initialized. Non
wireless interfaces will fail and the loopback device will be one of
these, so just log a diagnostic rather than an error.

Signed-off-by: Roy Marples <roy@marples.name>
wpa_supplicant/events.c
wpa_supplicant/wpa_supplicant.c
wpa_supplicant/wpa_supplicant_i.h

index 15c572f11bdf85b8b2dc05610372e406b40acdfb..7b7802c464977e934e22fba62b36679928ccb56e 100644 (file)
@@ -5472,8 +5472,6 @@ void wpa_supplicant_event_global(void *ctx, enum wpa_event_type event,
                        return;
                wpa_s = wpa_supplicant_add_iface(ctx, wpa_i, NULL);
                os_free(wpa_i);
-               if (wpa_s)
-                       wpa_s->matched = 1;
        }
 #endif /* CONFIG_MATCH_IFACE */
 
index cb243f2f88ddf92701e05a38c94aa7b56ff7c2be..a52b9a9e12ef2d3366349cff1797d576752cb6f6 100644 (file)
@@ -6154,6 +6154,8 @@ next_driver:
        wpa_s->drv_priv = wpa_drv_init(wpa_s, wpa_s->ifname);
        if (wpa_s->drv_priv == NULL) {
                const char *pos;
+               int level = MSG_ERROR;
+
                pos = driver ? os_strchr(driver, ',') : NULL;
                if (pos) {
                        wpa_dbg(wpa_s, MSG_DEBUG, "Failed to initialize "
@@ -6161,8 +6163,12 @@ next_driver:
                        driver = pos + 1;
                        goto next_driver;
                }
-               wpa_msg(wpa_s, MSG_ERROR, "Failed to initialize driver "
-                       "interface");
+
+#ifdef CONFIG_MATCH_IFACE
+               if (wpa_s->matched == WPA_IFACE_MATCHED_NULL)
+                       level = MSG_DEBUG;
+#endif /* CONFIG_MATCH_IFACE */
+               wpa_msg(wpa_s, level, "Failed to initialize driver interface");
                return -1;
        }
        if (wpa_drv_set_param(wpa_s, wpa_s->conf->driver_param) < 0) {
@@ -6307,6 +6313,9 @@ static int wpa_supplicant_init_iface(struct wpa_supplicant *wpa_s,
                return -1;
        }
        os_strlcpy(wpa_s->ifname, iface->ifname, sizeof(wpa_s->ifname));
+#ifdef CONFIG_MATCH_IFACE
+       wpa_s->matched = iface->matched;
+#endif /* CONFIG_MATCH_IFACE */
 
        if (iface->bridge_ifname) {
                if (os_strlen(iface->bridge_ifname) >=
@@ -6698,6 +6707,10 @@ struct wpa_interface * wpa_supplicant_match_iface(struct wpa_global *global,
                        if (!iface)
                                return NULL;
                        *iface = *miface;
+                       if (!miface->ifname)
+                               iface->matched = WPA_IFACE_MATCHED_NULL;
+                       else
+                               iface->matched = WPA_IFACE_MATCHED;
                        iface->ifname = ifname;
                        return iface;
                }
@@ -6732,8 +6745,6 @@ static int wpa_supplicant_match_existing(struct wpa_global *global)
                if (iface) {
                        wpa_s = wpa_supplicant_add_iface(global, iface, NULL);
                        os_free(iface);
-                       if (wpa_s)
-                               wpa_s->matched = 1;
                }
        }
 
index 5d99fcccd97057af8f3903c985dc9d571ae60dc2..e8778bbf99e6dbaf451a44cb8e1d3c625f4b72aa 100644 (file)
@@ -121,6 +121,18 @@ struct wpa_interface {
         * interface that is not a network interface.
         */
        int p2p_mgmt;
+
+#ifdef CONFIG_MATCH_IFACE
+       /**
+        * matched - Interface was matched rather than specified
+        *
+        */
+       enum {
+               WPA_IFACE_NOT_MATCHED,
+               WPA_IFACE_MATCHED_NULL,
+               WPA_IFACE_MATCHED
+       } matched;
+#endif /* CONFIG_MATCH_IFACE */
 };
 
 /**