diff mbox series

op_classes: Don't report an error when there are none to add

Message ID c6d53015-64fd-299b-c9a7-31b3c0bd2de8@marples.name
State New
Headers show
Series op_classes: Don't report an error when there are none to add | expand

Commit Message

Roy Marples July 21, 2020, 12:17 p.m. UTC
Instead, log a diagnostic so that noise to the user is reduced.

Signed-off-by: Roy Marples <roy@marples.name>
---
  wpa_supplicant/op_classes.c | 8 ++++++--
  1 file changed, 6 insertions(+), 2 deletions(-)
diff mbox series

Patch

diff --git a/wpa_supplicant/op_classes.c b/wpa_supplicant/op_classes.c
index bd97fee54..2494bffb6 100644
--- a/wpa_supplicant/op_classes.c
+++ b/wpa_supplicant/op_classes.c
@@ -412,9 +412,13 @@  size_t wpas_supp_op_class_ie(struct wpa_supplicant *wpa_s,
  	}

  	*ie_len = wpabuf_len(buf) - 2;
-	if (*ie_len < 2 || wpabuf_len(buf) > len) {
+	if (*ie_len < 2) {
+		wpa_printf(MSG_DEBUG,
+			   "No supported operating classes IE to add");
+		res = 0;
+	} else if (wpabuf_len(buf) > len) {
  		wpa_printf(MSG_ERROR,
-			   "Failed to add supported operating classes IE");
+			   "Supported operating classes IE exceed length");
  		res = 0;
  	} else {
  		os_memcpy(pos, wpabuf_head(buf), wpabuf_len(buf));