Module Name:    src
Committed By:   roy
Date:           Tue Jul 21 13:18:58 UTC 2020

Modified Files:
        src/external/bsd/wpa/dist/wpa_supplicant: events.c wpa_supplicant.c
            wpa_supplicant_i.h

Log Message:
wpa_supplicant: Matching unspecified interfaces should not log driver fails

If there is no matching interface given, but interface matching is enabled
then 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.


To generate a diff of this commit:
cvs rdiff -u -r1.7 -r1.8 src/external/bsd/wpa/dist/wpa_supplicant/events.c
cvs rdiff -u -r1.10 -r1.11 \
    src/external/bsd/wpa/dist/wpa_supplicant/wpa_supplicant.c
cvs rdiff -u -r1.4 -r1.5 \
    src/external/bsd/wpa/dist/wpa_supplicant/wpa_supplicant_i.h

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/external/bsd/wpa/dist/wpa_supplicant/events.c
diff -u src/external/bsd/wpa/dist/wpa_supplicant/events.c:1.7 src/external/bsd/wpa/dist/wpa_supplicant/events.c:1.8
--- src/external/bsd/wpa/dist/wpa_supplicant/events.c:1.7	Fri Jan  4 21:22:21 2019
+++ src/external/bsd/wpa/dist/wpa_supplicant/events.c	Tue Jul 21 13:18:58 2020
@@ -4825,8 +4825,6 @@ void wpa_supplicant_event_global(void *c
 			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: src/external/bsd/wpa/dist/wpa_supplicant/wpa_supplicant.c
diff -u src/external/bsd/wpa/dist/wpa_supplicant/wpa_supplicant.c:1.10 src/external/bsd/wpa/dist/wpa_supplicant/wpa_supplicant.c:1.11
--- src/external/bsd/wpa/dist/wpa_supplicant/wpa_supplicant.c:1.10	Fri Jan  4 21:22:21 2019
+++ src/external/bsd/wpa/dist/wpa_supplicant/wpa_supplicant.c	Tue Jul 21 13:18:58 2020
@@ -5298,6 +5298,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;
+
 		pos = driver ? os_strchr(driver, ',') : NULL;
 		if (pos) {
 			wpa_dbg(wpa_s, MSG_DEBUG, "Failed to initialize "
@@ -5305,7 +5307,14 @@ next_driver:
 			driver = pos + 1;
 			goto next_driver;
 		}
-		wpa_msg(wpa_s, MSG_ERROR, "Failed to initialize driver "
+
+#ifdef CONFIG_MATCH_IFACE
+		if (wpa_s->matched == WPA_IFACE_MATCHEDNULL)
+			level = MSG_DEBUG;
+		else
+#endif
+			level = MSG_ERROR;
+		wpa_msg(wpa_s, level, "Failed to initialize driver "
 			"interface");
 		return -1;
 	}
@@ -5451,6 +5460,9 @@ static int wpa_supplicant_init_iface(str
 		return -1;
 	}
 	os_strlcpy(wpa_s->ifname, iface->ifname, sizeof(wpa_s->ifname));
+#ifdef CONFIG_MATCH_IFACE
+	wpa_s->matched = iface->matched;
+#endif
 
 	if (iface->bridge_ifname) {
 		if (os_strlen(iface->bridge_ifname) >=
@@ -5829,6 +5841,10 @@ struct wpa_interface * wpa_supplicant_ma
 			if (!iface)
 				return NULL;
 			*iface = *miface;
+			if (!miface->ifname)
+				iface->matched = WPA_IFACE_MATCHEDNULL;
+			else
+				iface->matched = WPA_IFACE_MATCHED;
 			iface->ifname = ifname;
 			return iface;
 		}
@@ -5863,8 +5879,6 @@ static int wpa_supplicant_match_existing
 		if (iface) {
 			wpa_s = wpa_supplicant_add_iface(global, iface, NULL);
 			os_free(iface);
-			if (wpa_s)
-				wpa_s->matched = 1;
 		}
 	}
 

Index: src/external/bsd/wpa/dist/wpa_supplicant/wpa_supplicant_i.h
diff -u src/external/bsd/wpa/dist/wpa_supplicant/wpa_supplicant_i.h:1.4 src/external/bsd/wpa/dist/wpa_supplicant/wpa_supplicant_i.h:1.5
--- src/external/bsd/wpa/dist/wpa_supplicant/wpa_supplicant_i.h:1.4	Fri Jan  4 21:22:21 2019
+++ src/external/bsd/wpa/dist/wpa_supplicant/wpa_supplicant_i.h	Tue Jul 21 13:18:58 2020
@@ -118,6 +118,17 @@ struct wpa_interface {
 	 * interface that is not a network interface.
 	 */
 	int p2p_mgmt;
+
+#ifdef CONFIG_MATCH_IFACE
+	/**
+	 * matched - Interface was matched rather than specified
+	 *
+	 */
+	int matched;
+#define WPA_IFACE_NOTMATCHED	0
+#define WPA_IFACE_MATCHEDNULL	1
+#define WPA_IFACE_MATCHED	2
+#endif /* CONFIG_MATCH_IFACE */
 };
 
 /**

Reply via email to