From owner-svn-src-head@FreeBSD.ORG Thu Jul 25 06:23:27 2013 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [8.8.178.115]) (using TLSv1 with cipher ADH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTP id C6EAAFB3; Thu, 25 Jul 2013 06:23:27 +0000 (UTC) (envelope-from rpaulo@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mx1.freebsd.org (Postfix) with ESMTPS id 9A2982F51; Thu, 25 Jul 2013 06:23:27 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.7/8.14.7) with ESMTP id r6P6NRFo099458; Thu, 25 Jul 2013 06:23:27 GMT (envelope-from rpaulo@svn.freebsd.org) Received: (from rpaulo@localhost) by svn.freebsd.org (8.14.7/8.14.5/Submit) id r6P6NQZJ099455; Thu, 25 Jul 2013 06:23:26 GMT (envelope-from rpaulo@svn.freebsd.org) Message-Id: <201307250623.r6P6NQZJ099455@svn.freebsd.org> From: Rui Paulo Date: Thu, 25 Jul 2013 06:23:26 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r253639 - head/sys/net80211 X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 25 Jul 2013 06:23:27 -0000 Author: rpaulo Date: Thu Jul 25 06:23:26 2013 New Revision: 253639 URL: http://svnweb.freebsd.org/changeset/base/253639 Log: Add ieee80211_add_{qos,wpa,rsn}() functions since they are needed by an OpenBSD driver that is being ported to FreeBSD. Reviewed by: adrian Modified: head/sys/net80211/ieee80211.h head/sys/net80211/ieee80211_output.c head/sys/net80211/ieee80211_proto.h Modified: head/sys/net80211/ieee80211.h ============================================================================== --- head/sys/net80211/ieee80211.h Thu Jul 25 03:55:50 2013 (r253638) +++ head/sys/net80211/ieee80211.h Thu Jul 25 06:23:26 2013 (r253639) @@ -711,6 +711,7 @@ enum { IEEE80211_ELEMID_IBSSDFS = 41, IEEE80211_ELEMID_ERP = 42, IEEE80211_ELEMID_HTCAP = 45, + IEEE80211_ELEMID_QOS = 46, IEEE80211_ELEMID_RSN = 48, IEEE80211_ELEMID_XRATES = 50, IEEE80211_ELEMID_HTINFO = 61, Modified: head/sys/net80211/ieee80211_output.c ============================================================================== --- head/sys/net80211/ieee80211_output.c Thu Jul 25 03:55:50 2013 (r253638) +++ head/sys/net80211/ieee80211_output.c Thu Jul 25 06:23:26 2013 (r253639) @@ -1883,6 +1883,40 @@ ieee80211_add_countryie(uint8_t *frm, st return add_appie(frm, ic->ic_countryie); } +uint8_t * +ieee80211_add_wpa(uint8_t *frm, const struct ieee80211vap *vap) +{ + if (vap->iv_flags & IEEE80211_F_WPA1 && vap->iv_wpa_ie != NULL) + return (add_ie(frm, vap->iv_wpa_ie)); + else { + /* XXX else complain? */ + return (frm); + } +} + +uint8_t * +ieee80211_add_rsn(uint8_t *frm, const struct ieee80211vap *vap) +{ + if (vap->iv_flags & IEEE80211_F_WPA2 && vap->iv_rsn_ie != NULL) + return (add_ie(frm, vap->iv_rsn_ie)); + else { + /* XXX else complain? */ + return (frm); + } +} + +uint8_t * +ieee80211_add_qos(uint8_t *frm, const struct ieee80211_node *ni) +{ + if (ni->ni_flags & IEEE80211_NODE_QOS) { + *frm++ = IEEE80211_ELEMID_QOS; + *frm++ = 1; + *frm++ = 0; + } + + return (frm); +} + /* * Send a probe request frame with the specified ssid * and any optional information element data. @@ -1951,17 +1985,9 @@ ieee80211_send_probereq(struct ieee80211 frm = ieee80211_add_ssid(frm, ssid, ssidlen); rs = ieee80211_get_suprates(ic, ic->ic_curchan); frm = ieee80211_add_rates(frm, rs); - if (vap->iv_flags & IEEE80211_F_WPA2) { - if (vap->iv_rsn_ie != NULL) - frm = add_ie(frm, vap->iv_rsn_ie); - /* XXX else complain? */ - } + frm = ieee80211_add_rsn(frm, vap); frm = ieee80211_add_xrates(frm, rs); - if (vap->iv_flags & IEEE80211_F_WPA1) { - if (vap->iv_wpa_ie != NULL) - frm = add_ie(frm, vap->iv_wpa_ie); - /* XXX else complain? */ - } + frm = ieee80211_add_wpa(frm, vap); if (vap->iv_appie_probereq != NULL) frm = add_appie(frm, vap->iv_appie_probereq); m->m_pkthdr.len = m->m_len = frm - mtod(m, uint8_t *); @@ -2227,11 +2253,7 @@ ieee80211_send_mgmt(struct ieee80211_nod frm = ieee80211_add_ssid(frm, ni->ni_essid, ni->ni_esslen); frm = ieee80211_add_rates(frm, &ni->ni_rates); - if (vap->iv_flags & IEEE80211_F_WPA2) { - if (vap->iv_rsn_ie != NULL) - frm = add_ie(frm, vap->iv_rsn_ie); - /* XXX else complain? */ - } + frm = ieee80211_add_rsn(frm, vap); frm = ieee80211_add_xrates(frm, &ni->ni_rates); if (capinfo & IEEE80211_CAPINFO_SPECTRUM_MGMT) { frm = ieee80211_add_powercapability(frm, @@ -2242,11 +2264,7 @@ ieee80211_send_mgmt(struct ieee80211_nod ni->ni_ies.htcap_ie != NULL && ni->ni_ies.htcap_ie[0] == IEEE80211_ELEMID_HTCAP) frm = ieee80211_add_htcap(frm, ni); - if (vap->iv_flags & IEEE80211_F_WPA1) { - if (vap->iv_wpa_ie != NULL) - frm = add_ie(frm, vap->iv_wpa_ie); - /* XXX else complain */ - } + frm = ieee80211_add_wpa(frm, vap); if ((ic->ic_flags & IEEE80211_F_WME) && ni->ni_ies.wme_ie != NULL) frm = ieee80211_add_wme_info(frm, &ic->ic_wme); @@ -2513,11 +2531,7 @@ ieee80211_alloc_proberesp(struct ieee802 if (IEEE80211_IS_CHAN_ANYG(bss->ni_chan)) frm = ieee80211_add_erp(frm, ic); frm = ieee80211_add_xrates(frm, rs); - if (vap->iv_flags & IEEE80211_F_WPA2) { - if (vap->iv_rsn_ie != NULL) - frm = add_ie(frm, vap->iv_rsn_ie); - /* XXX else complain? */ - } + frm = ieee80211_add_rsn(frm, vap); /* * NB: legacy 11b clients do not get certain ie's. * The caller identifies such clients by passing @@ -2529,11 +2543,7 @@ ieee80211_alloc_proberesp(struct ieee802 frm = ieee80211_add_htcap(frm, bss); frm = ieee80211_add_htinfo(frm, bss); } - if (vap->iv_flags & IEEE80211_F_WPA1) { - if (vap->iv_wpa_ie != NULL) - frm = add_ie(frm, vap->iv_wpa_ie); - /* XXX else complain? */ - } + frm = ieee80211_add_wpa(frm, vap); if (vap->iv_flags & IEEE80211_F_WME) frm = ieee80211_add_wme_param(frm, &ic->ic_wme); if (IEEE80211_IS_CHAN_HT(bss->ni_chan) && @@ -2831,21 +2841,13 @@ ieee80211_beacon_construct(struct mbuf * frm = ieee80211_add_erp(frm, ic); } frm = ieee80211_add_xrates(frm, rs); - if (vap->iv_flags & IEEE80211_F_WPA2) { - if (vap->iv_rsn_ie != NULL) - frm = add_ie(frm, vap->iv_rsn_ie); - /* XXX else complain */ - } + frm = ieee80211_add_rsn(frm, vap); if (IEEE80211_IS_CHAN_HT(ni->ni_chan)) { frm = ieee80211_add_htcap(frm, ni); bo->bo_htinfo = frm; frm = ieee80211_add_htinfo(frm, ni); } - if (vap->iv_flags & IEEE80211_F_WPA1) { - if (vap->iv_wpa_ie != NULL) - frm = add_ie(frm, vap->iv_wpa_ie); - /* XXX else complain */ - } + frm = ieee80211_add_wpa(frm, vap); if (vap->iv_flags & IEEE80211_F_WME) { bo->bo_wme = frm; frm = ieee80211_add_wme_param(frm, &ic->ic_wme); Modified: head/sys/net80211/ieee80211_proto.h ============================================================================== --- head/sys/net80211/ieee80211_proto.h Thu Jul 25 03:55:50 2013 (r253638) +++ head/sys/net80211/ieee80211_proto.h Thu Jul 25 06:23:26 2013 (r253639) @@ -136,6 +136,9 @@ struct mbuf *ieee80211_alloc_cts(struct uint8_t *ieee80211_add_rates(uint8_t *, const struct ieee80211_rateset *); uint8_t *ieee80211_add_xrates(uint8_t *, const struct ieee80211_rateset *); +uint8_t *ieee80211_add_wpa(uint8_t *, const struct ieee80211vap *); +uint8_t *ieee80211_add_rsn(uint8_t *, const struct ieee80211vap *); +uint8_t *ieee80211_add_qos(uint8_t *, const struct ieee80211_node *); uint16_t ieee80211_getcapinfo(struct ieee80211vap *, struct ieee80211_channel *);