Skip site navigation (1)Skip section navigation (2)
Date:      Wed, 24 Mar 2021 22:27:21 GMT
From:      "Bjoern A. Zeeb" <bz@FreeBSD.org>
To:        src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org
Subject:   git: af7d9f8e31c4 - main - net80211: prefix get_random_bytes() with net80211_
Message-ID:  <202103242227.12OMRL1X066629@gitrepo.freebsd.org>

next in thread | raw e-mail | index | archive | help
The branch main has been updated by bz:

URL: https://cgit.FreeBSD.org/src/commit/?id=af7d9f8e31c4c185f277b27059e470ec8a5627a7

commit af7d9f8e31c4c185f277b27059e470ec8a5627a7
Author:     Bjoern A. Zeeb <bz@FreeBSD.org>
AuthorDate: 2021-03-18 22:15:00 +0000
Commit:     Bjoern A. Zeeb <bz@FreeBSD.org>
CommitDate: 2021-03-24 22:16:09 +0000

    net80211: prefix get_random_bytes() with net80211_
    
    Both linux/random.h and net80211 have a function named
    get_random_bytes().  With overlapping files included these collide.
    Arguably the function could be renamed in linuxkpi but the generic
    name should also not be used in net80211 so rename it there.
    
    Sponsored-by:   The FreeBSD Foundation
    MFC-after:      2 weeks
    Reviewed-by:    philip, adrian
    Differential Revision:  https://reviews.freebsd.org/D29335
---
 sys/net80211/ieee80211_crypto_wep.c | 2 +-
 sys/net80211/ieee80211_dfs.c        | 2 +-
 sys/net80211/ieee80211_freebsd.c    | 2 +-
 sys/net80211/ieee80211_freebsd.h    | 2 +-
 sys/net80211/ieee80211_hostap.c     | 2 +-
 sys/net80211/ieee80211_mesh.c       | 2 +-
 sys/net80211/ieee80211_node.c       | 3 ++-
 7 files changed, 8 insertions(+), 7 deletions(-)

diff --git a/sys/net80211/ieee80211_crypto_wep.c b/sys/net80211/ieee80211_crypto_wep.c
index bdaab1b29e14..797de006cdf2 100644
--- a/sys/net80211/ieee80211_crypto_wep.c
+++ b/sys/net80211/ieee80211_crypto_wep.c
@@ -100,7 +100,7 @@ wep_attach(struct ieee80211vap *vap, struct ieee80211_key *k)
 
 	ctx->wc_vap = vap;
 	ctx->wc_ic = vap->iv_ic;
-	get_random_bytes(&ctx->wc_iv, sizeof(ctx->wc_iv));
+	net80211_get_random_bytes(&ctx->wc_iv, sizeof(ctx->wc_iv));
 	nrefs++;			/* NB: we assume caller locking */
 	return ctx;
 }
diff --git a/sys/net80211/ieee80211_dfs.c b/sys/net80211/ieee80211_dfs.c
index abe67576d711..b3959220bfc9 100644
--- a/sys/net80211/ieee80211_dfs.c
+++ b/sys/net80211/ieee80211_dfs.c
@@ -421,7 +421,7 @@ ieee80211_dfs_pickchannel(struct ieee80211com *ic)
 	 * one at random (skipping channels where radar has
 	 * been detected).
 	 */
-	get_random_bytes(&v, sizeof(v));
+	net80211_get_random_bytes(&v, sizeof(v));
 	v %= ic->ic_nchans;
 	for (i = v; i < ic->ic_nchans; i++) {
 		c = &ic->ic_channels[i];
diff --git a/sys/net80211/ieee80211_freebsd.c b/sys/net80211/ieee80211_freebsd.c
index 850c93d1e5df..011ae7060a6c 100644
--- a/sys/net80211/ieee80211_freebsd.c
+++ b/sys/net80211/ieee80211_freebsd.c
@@ -749,7 +749,7 @@ ieee80211_vap_xmitpkt(struct ieee80211vap *vap, struct mbuf *m)
 #include <sys/libkern.h>
 
 void
-get_random_bytes(void *p, size_t n)
+net80211_get_random_bytes(void *p, size_t n)
 {
 	uint8_t *dp = p;
 
diff --git a/sys/net80211/ieee80211_freebsd.h b/sys/net80211/ieee80211_freebsd.h
index c3811cc32e84..9d7b9cbb7cce 100644
--- a/sys/net80211/ieee80211_freebsd.h
+++ b/sys/net80211/ieee80211_freebsd.h
@@ -359,7 +359,7 @@ struct ieee80211com;
 int	ieee80211_parent_xmitpkt(struct ieee80211com *, struct mbuf *);
 int	ieee80211_vap_xmitpkt(struct ieee80211vap *, struct mbuf *);
 
-void	get_random_bytes(void *, size_t);
+void	net80211_get_random_bytes(void *, size_t);
 
 void	ieee80211_sysctl_attach(struct ieee80211com *);
 void	ieee80211_sysctl_detach(struct ieee80211com *);
diff --git a/sys/net80211/ieee80211_hostap.c b/sys/net80211/ieee80211_hostap.c
index 8402ade857ff..16a3d97ae7f2 100644
--- a/sys/net80211/ieee80211_hostap.c
+++ b/sys/net80211/ieee80211_hostap.c
@@ -1093,7 +1093,7 @@ hostap_auth_shared(struct ieee80211_node *ni, struct ieee80211_frame *wh,
 			/* NB: don't return error so they rexmit */
 			return;
 		}
-		get_random_bytes(ni->ni_challenge,
+		net80211_get_random_bytes(ni->ni_challenge,
 			IEEE80211_CHALLENGE_LEN);
 		IEEE80211_NOTE(vap, IEEE80211_MSG_DEBUG | IEEE80211_MSG_AUTH,
 		    ni, "shared key %sauth request", allocbs ? "" : "re");
diff --git a/sys/net80211/ieee80211_mesh.c b/sys/net80211/ieee80211_mesh.c
index fdb84a2acb3d..48a3590d0cf3 100644
--- a/sys/net80211/ieee80211_mesh.c
+++ b/sys/net80211/ieee80211_mesh.c
@@ -962,7 +962,7 @@ mesh_generateid(struct ieee80211vap *vap)
 	uint16_t r;
 
 	do {
-		get_random_bytes(&r, 2);
+		net80211_get_random_bytes(&r, 2);
 		ieee80211_iterate_nodes(&vap->iv_ic->ic_sta, mesh_checkid, &r);
 		maxiter--;
 	} while (r == 0 && maxiter > 0);
diff --git a/sys/net80211/ieee80211_node.c b/sys/net80211/ieee80211_node.c
index 64a0164aeb81..5a9677836dbd 100644
--- a/sys/net80211/ieee80211_node.c
+++ b/sys/net80211/ieee80211_node.c
@@ -363,7 +363,8 @@ ieee80211_create_ibss(struct ieee80211vap* vap, struct ieee80211_channel *chan)
 		if (vap->iv_flags & IEEE80211_F_DESBSSID)
 			IEEE80211_ADDR_COPY(ni->ni_bssid, vap->iv_des_bssid);
 		else {
-			get_random_bytes(ni->ni_bssid, IEEE80211_ADDR_LEN);
+			net80211_get_random_bytes(ni->ni_bssid,
+			    IEEE80211_ADDR_LEN);
 			/* clear group bit, add local bit */
 			ni->ni_bssid[0] = (ni->ni_bssid[0] &~ 0x01) | 0x02;
 		}



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?202103242227.12OMRL1X066629>