From 8f1a123de2345394e2eabeb9c24f58c403bc2801 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Daniel=20Ekl=C3=B6f?= Date: Sun, 16 Oct 2022 16:17:08 +0200 Subject: [PATCH] module/network: only log SSID when different from current one This prevents log spamming with poll-interval set Closes #232 --- modules/network.c | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/modules/network.c b/modules/network.c index 710148e..1cb7a2e 100644 --- a/modules/network.c +++ b/modules/network.c @@ -837,7 +837,9 @@ handle_nl80211_new_interface(struct module *mod, uint16_t type, bool nested, case NL80211_ATTR_SSID: { const char *ssid = payload; - LOG_INFO("%s: SSID: %.*s", m->iface, (int)len, ssid); + + if (m->ssid == NULL || strncmp(m->ssid, ssid, len) != 0) + LOG_INFO("%s: SSID: %.*s", m->iface, (int)len, ssid); mtx_lock(&mod->lock); free(m->ssid); @@ -991,7 +993,8 @@ handle_ies(struct module *mod, const void *_ies, size_t len) const char *ssid = (const char *)&ies[2]; const size_t ssid_len = ies[1]; - LOG_INFO("%s: SSID: %.*s", m->iface, (int)ssid_len, ssid); + if (m->ssid == NULL || strncmp(m->ssid, ssid, ssid_len) != 0) + LOG_INFO("%s: SSID: %.*s", m->iface, (int)ssid_len, ssid); mtx_lock(&mod->lock); free(m->ssid);