summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorsam <sam@FreeBSD.org>2009-01-27 23:19:36 +0000
committersam <sam@FreeBSD.org>2009-01-27 23:19:36 +0000
commitb9b96b31bdf0b1f51b5f5c6a85490deee9187597 (patch)
tree48ffdc3bc41f006bee6d795caca1658a25967de0
parent5d3fffbba859a38a26b58d4557b58a3398a176f2 (diff)
downloadFreeBSD-src-b9b96b31bdf0b1f51b5f5c6a85490deee9187597.zip
FreeBSD-src-b9b96b31bdf0b1f51b5f5c6a85490deee9187597.tar.gz
change ic_getradiocaps driver callback to include the max # channels
so callers know the size of the array passed down
-rw-r--r--sys/dev/ath/if_ath.c4
-rw-r--r--sys/net80211/ieee80211_ioctl.c2
-rw-r--r--sys/net80211/ieee80211_regdomain.c10
-rw-r--r--sys/net80211/ieee80211_var.h2
4 files changed, 10 insertions, 8 deletions
diff --git a/sys/dev/ath/if_ath.c b/sys/dev/ath/if_ath.c
index c194ecd..e12cb8d 100644
--- a/sys/dev/ath/if_ath.c
+++ b/sys/dev/ath/if_ath.c
@@ -205,7 +205,7 @@ static void ath_newassoc(struct ieee80211_node *, int);
static int ath_setregdomain(struct ieee80211com *,
struct ieee80211_regdomain *, int,
struct ieee80211_channel []);
-static void ath_getradiocaps(struct ieee80211com *, int *,
+static void ath_getradiocaps(struct ieee80211com *, int, int *,
struct ieee80211_channel []);
static int ath_getchannels(struct ath_softc *);
static void ath_led_event(struct ath_softc *, int);
@@ -6332,7 +6332,7 @@ ath_setregdomain(struct ieee80211com *ic, struct ieee80211_regdomain *rd,
static void
ath_getradiocaps(struct ieee80211com *ic,
- int *nchans, struct ieee80211_channel chans[])
+ int maxchans, int *nchans, struct ieee80211_channel chans[])
{
struct ath_softc *sc = ic->ic_ifp->if_softc;
struct ath_hal *ah = sc->sc_ah;
diff --git a/sys/net80211/ieee80211_ioctl.c b/sys/net80211/ieee80211_ioctl.c
index d3b3683..f8bd234 100644
--- a/sys/net80211/ieee80211_ioctl.c
+++ b/sys/net80211/ieee80211_ioctl.c
@@ -708,7 +708,7 @@ ieee80211_ioctl_getdevcaps(struct ieee80211com *ic,
dc->dc_cryptocaps = ic->ic_cryptocaps;
dc->dc_htcaps = ic->ic_htcaps;
ci = &dc->dc_chaninfo;
- ic->ic_getradiocaps(ic, &ci->ic_nchans, ci->ic_chans);
+ ic->ic_getradiocaps(ic, IEEE80211_CHAN_MAX, &ci->ic_nchans, ci->ic_chans);
ieee80211_sort_channels(ci->ic_chans, ci->ic_nchans);
error = copyout(dc, ireq->i_data, sizeof(*dc));
free(dc, M_TEMP);
diff --git a/sys/net80211/ieee80211_regdomain.c b/sys/net80211/ieee80211_regdomain.c
index 042f9bb..c4000dd 100644
--- a/sys/net80211/ieee80211_regdomain.c
+++ b/sys/net80211/ieee80211_regdomain.c
@@ -44,12 +44,14 @@ __FBSDID("$FreeBSD$");
#include <net80211/ieee80211_regdomain.h>
static void
-null_getradiocaps(struct ieee80211com *ic, int *n, struct ieee80211_channel *c)
+null_getradiocaps(struct ieee80211com *ic, int maxchan,
+ int *n, struct ieee80211_channel *c)
{
/* just feed back the current channel list */
- *n = ic->ic_nchans;
- memcpy(c, ic->ic_channels,
- ic->ic_nchans*sizeof(struct ieee80211_channel));
+ *n = ic->ic_nchans; /* XXX return count copied? */
+ if (maxchan > ic->ic_nchans)
+ maxchan = ic->ic_nchans;
+ memcpy(c, ic->ic_channels, maxchan*sizeof(struct ieee80211_channel));
}
static int
diff --git a/sys/net80211/ieee80211_var.h b/sys/net80211/ieee80211_var.h
index fe27a12..0a0f19f 100644
--- a/sys/net80211/ieee80211_var.h
+++ b/sys/net80211/ieee80211_var.h
@@ -208,7 +208,7 @@ struct ieee80211com {
ieee80211vap_attach ic_vattach[IEEE80211_OPMODE_MAX];
/* return hardware/radio capabilities */
void (*ic_getradiocaps)(struct ieee80211com *,
- int *, struct ieee80211_channel []);
+ int, int *, struct ieee80211_channel []);
/* check and/or prepare regdomain state change */
int (*ic_setregdomain)(struct ieee80211com *,
struct ieee80211_regdomain *,
OpenPOWER on IntegriCloud