From 80a7fc3823f330d390f5f0c54f1b4859c9c07f15 Mon Sep 17 00:00:00 2001 From: Peter Hessler Date: Mon, 10 Sep 2018 08:26:40 +0000 Subject: give set_ess a len variable, so we can correctly match the essid we want to switch to. pointed out by stsp@ --- sys/net80211/ieee80211_node.c | 14 +++++--------- sys/net80211/ieee80211_var.h | 4 ++-- 2 files changed, 7 insertions(+), 11 deletions(-) (limited to 'sys/net80211') diff --git a/sys/net80211/ieee80211_node.c b/sys/net80211/ieee80211_node.c index 306b3616181..f692916c6b2 100644 --- a/sys/net80211/ieee80211_node.c +++ b/sys/net80211/ieee80211_node.c @@ -1,4 +1,4 @@ -/* $OpenBSD: ieee80211_node.c,v 1.145 2018/09/09 20:32:55 phessler Exp $ */ +/* $OpenBSD: ieee80211_node.c,v 1.146 2018/09/10 08:26:39 phessler Exp $ */ /* $NetBSD: ieee80211_node.c,v 1.14 2004/05/09 09:18:47 dyoung Exp $ */ /*- @@ -609,7 +609,7 @@ ieee80211_switch_ess(struct ieee80211com *ic) if (ic->ic_des_esslen == ess->esslen && memcmp(ic->ic_des_essid, ess->essid, ess->esslen) == 0) { - ieee80211_set_ess(ic, ess->essid); + ieee80211_set_ess(ic, ess->essid, ess->esslen); return; } continue; @@ -636,20 +636,16 @@ ieee80211_switch_ess(struct ieee80211com *ic) printf("\n"); } - ieee80211_set_ess(ic, seless->essid); + ieee80211_set_ess(ic, seless->essid, ess->esslen); } } void -ieee80211_set_ess(struct ieee80211com *ic, char *nwid) +ieee80211_set_ess(struct ieee80211com *ic, char *nwid, int len) { struct ieee80211_ess *ess; - TAILQ_FOREACH(ess, &ic->ic_ess, ess_next) { - if (memcmp(ess->essid, nwid, IEEE80211_NWID_LEN) == 0) - break; - } - + ess = ieee80211_get_ess(ic, nwid, len); if (ess == NULL) return; diff --git a/sys/net80211/ieee80211_var.h b/sys/net80211/ieee80211_var.h index 686e31510ef..9fc5c736e65 100644 --- a/sys/net80211/ieee80211_var.h +++ b/sys/net80211/ieee80211_var.h @@ -1,4 +1,4 @@ -/* $OpenBSD: ieee80211_var.h,v 1.89 2018/09/09 20:32:55 phessler Exp $ */ +/* $OpenBSD: ieee80211_var.h,v 1.90 2018/09/10 08:26:39 phessler Exp $ */ /* $NetBSD: ieee80211_var.h,v 1.7 2004/05/06 03:07:10 dyoung Exp $ */ /*- @@ -454,7 +454,7 @@ void ieee80211_disable_wep(struct ieee80211com *); void ieee80211_disable_rsn(struct ieee80211com *); int ieee80211_add_ess(struct ieee80211com *, struct ieee80211_join *); void ieee80211_del_ess(struct ieee80211com *, char *, int); -void ieee80211_set_ess(struct ieee80211com *, char *); +void ieee80211_set_ess(struct ieee80211com *, char *, int); struct ieee80211_ess *ieee80211_get_ess(struct ieee80211com *, const char *, int); extern int ieee80211_cache_size; -- cgit v1.2.3