Skip site navigation (1)Skip section navigation (2)
Date:      Sun, 4 May 2008 18:44:51 GMT
From:      Sam Leffler <sam@FreeBSD.org>
To:        Perforce Change Reviews <perforce@freebsd.org>
Subject:   PERFORCE change 141150 for review
Message-ID:  <200805041844.m44IipbB065817@repoman.freebsd.org>

next in thread | raw e-mail | index | archive | help
http://perforce.freebsd.org/chv.cgi?CH=141150

Change 141150 by sam@sam_ebb on 2008/05/04 18:44:47

	o validate opmode parameter at top level of clone work so every driver
	  doesn't need to do it
	o disambiguate error returns
	
	Note: printf's left in place for now; will move to something like
	      DIAGNOSTIC eventually

Affected files ...

.. //depot/projects/vap/sys/net80211/ieee80211_freebsd.c#29 edit

Differences ...

==== //depot/projects/vap/sys/net80211/ieee80211_freebsd.c#29 (text+ko) ====

@@ -108,11 +108,22 @@
 	ifp = ifunit(cp.icp_parent);
 	if (ifp == NULL)
 		return ENXIO;
+	/* XXX move printfs to DIAGNOSTIC before release */
 	if (ifp->if_type != IFT_IEEE80211) {
 		if_printf(ifp, "%s: reject, not an 802.11 device\n", __func__);
+		return ENXIO;
+	}
+	if (cp.icp_opmode >= IEEE80211_OPMODE_MAX) {
+		if_printf(ifp, "%s: invalid opmode %d\n",
+		    __func__, cp.icp_opmode);
 		return EINVAL;
 	}
 	ic = ifp->if_l2com;
+	if ((ic->ic_caps & ieee80211_opcap[cp.icp_opmode]) == 0) {
+		if_printf(ifp, "%s mode not supported\n",
+		    ieee80211_opmode_name[cp.icp_opmode]);
+		return EOPNOTSUPP;
+	}
 	vap = ic->ic_vap_create(ic, ifc->ifc_name, unit,
 			cp.icp_opmode, cp.icp_flags, cp.icp_bssid,
 			cp.icp_flags & IEEE80211_CLONE_MACADDR ?



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