Module Name: src
Committed By: nonaka
Date: Wed Jan 4 03:05:24 UTC 2017
Modified Files:
src/sys/dev/pci: if_iwm.c if_iwn.c
src/sys/net80211: ieee80211_output.c ieee80211_proto.h
Log Message:
Export some 802.11 IE manipulate functions.
To generate a diff of this commit:
cvs rdiff -u -r1.45 -r1.46 src/sys/dev/pci/if_iwm.c
cvs rdiff -u -r1.81 -r1.82 src/sys/dev/pci/if_iwn.c
cvs rdiff -u -r1.57 -r1.58 src/sys/net80211/ieee80211_output.c
cvs rdiff -u -r1.22 -r1.23 src/sys/net80211/ieee80211_proto.h
Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.
Modified files:
Index: src/sys/dev/pci/if_iwm.c
diff -u src/sys/dev/pci/if_iwm.c:1.45 src/sys/dev/pci/if_iwm.c:1.46
--- src/sys/dev/pci/if_iwm.c:1.45 Sun Dec 18 02:18:29 2016
+++ src/sys/dev/pci/if_iwm.c Wed Jan 4 03:05:24 2017
@@ -1,4 +1,4 @@
-/* $NetBSD: if_iwm.c,v 1.45 2016/12/18 02:18:29 nonaka Exp $ */
+/* $NetBSD: if_iwm.c,v 1.46 2017/01/04 03:05:24 nonaka Exp $ */
/* OpenBSD: if_iwm.c,v 1.147 2016/11/17 14:12:33 stsp Exp */
#define IEEE80211_NO_HT
/*
@@ -107,7 +107,7 @@
*/
#include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: if_iwm.c,v 1.45 2016/12/18 02:18:29 nonaka Exp $");
+__KERNEL_RCSID(0, "$NetBSD: if_iwm.c,v 1.46 2017/01/04 03:05:24 nonaka Exp $");
#include <sys/param.h>
#include <sys/conf.h>
@@ -486,13 +486,6 @@ static void iwm_wakeup(struct iwm_softc
static void iwm_radiotap_attach(struct iwm_softc *);
static int iwm_sysctl_fw_loaded_handler(SYSCTLFN_PROTO);
-/* XXX needed by iwn_scan */
-static uint8_t *ieee80211_add_ssid(uint8_t *, const uint8_t *, u_int);
-static uint8_t *ieee80211_add_rates(uint8_t *,
- const struct ieee80211_rateset *);
-static uint8_t *ieee80211_add_xrates(uint8_t *,
- const struct ieee80211_rateset *);
-
static int iwm_sysctl_root_num;
static int
@@ -7760,55 +7753,3 @@ SYSCTL_SETUP(sysctl_iwm, "sysctl iwm(4)
err:
aprint_error("%s: sysctl_createv failed (rc = %d)\n", __func__, rc);
}
-
-/*
- * XXX code from OpenBSD src/sys/net80211/ieee80211_output.c
- * Copyright (c) 2001 Atsushi Onoe
- * Copyright (c) 2002, 2003 Sam Leffler, Errno Consulting
- * Copyright (c) 2007-2009 Damien Bergamini
- * All rights reserved.
- */
-
-/*
- * Add an SSID element to a frame (see 7.3.2.1).
- */
-static uint8_t *
-ieee80211_add_ssid(uint8_t *frm, const uint8_t *ssid, u_int len)
-{
- *frm++ = IEEE80211_ELEMID_SSID;
- *frm++ = len;
- memcpy(frm, ssid, len);
- return frm + len;
-}
-
-/*
- * Add a supported rates element to a frame (see 7.3.2.2).
- */
-static uint8_t *
-ieee80211_add_rates(uint8_t *frm, const struct ieee80211_rateset *rs)
-{
- int nrates;
-
- *frm++ = IEEE80211_ELEMID_RATES;
- nrates = min(rs->rs_nrates, IEEE80211_RATE_SIZE);
- *frm++ = nrates;
- memcpy(frm, rs->rs_rates, nrates);
- return frm + nrates;
-}
-
-/*
- * Add an extended supported rates element to a frame (see 7.3.2.14).
- */
-static uint8_t *
-ieee80211_add_xrates(uint8_t *frm, const struct ieee80211_rateset *rs)
-{
- int nrates;
-
- KASSERT(rs->rs_nrates > IEEE80211_RATE_SIZE);
-
- *frm++ = IEEE80211_ELEMID_XRATES;
- nrates = rs->rs_nrates - IEEE80211_RATE_SIZE;
- *frm++ = nrates;
- memcpy(frm, rs->rs_rates + IEEE80211_RATE_SIZE, nrates);
- return frm + nrates;
-}
Index: src/sys/dev/pci/if_iwn.c
diff -u src/sys/dev/pci/if_iwn.c:1.81 src/sys/dev/pci/if_iwn.c:1.82
--- src/sys/dev/pci/if_iwn.c:1.81 Thu Dec 8 01:12:01 2016
+++ src/sys/dev/pci/if_iwn.c Wed Jan 4 03:05:24 2017
@@ -1,4 +1,4 @@
-/* $NetBSD: if_iwn.c,v 1.81 2016/12/08 01:12:01 ozaki-r Exp $ */
+/* $NetBSD: if_iwn.c,v 1.82 2017/01/04 03:05:24 nonaka Exp $ */
/* $OpenBSD: if_iwn.c,v 1.135 2014/09/10 07:22:09 dcoppa Exp $ */
/*-
@@ -22,7 +22,7 @@
* adapters.
*/
#include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: if_iwn.c,v 1.81 2016/12/08 01:12:01 ozaki-r Exp $");
+__KERNEL_RCSID(0, "$NetBSD: if_iwn.c,v 1.82 2017/01/04 03:05:24 nonaka Exp $");
#define IWN_USE_RBUF /* Use local storage for RX */
#undef IWN_HWCRYPTO /* XXX does not even compile yet */
@@ -323,13 +323,6 @@ static int iwn_alloc_rpool(struct iwn_so
static void iwn_free_rpool(struct iwn_softc *);
#endif
-/* XXX needed by iwn_scan */
-static u_int8_t *ieee80211_add_ssid(u_int8_t *, const u_int8_t *, u_int);
-static u_int8_t *ieee80211_add_rates(u_int8_t *,
- const struct ieee80211_rateset *);
-static u_int8_t *ieee80211_add_xrates(u_int8_t *,
- const struct ieee80211_rateset *);
-
static void iwn_fix_channel(struct ieee80211com *, struct mbuf *,
struct iwn_rx_stat *);
@@ -6457,58 +6450,6 @@ iwn_free_rpool(struct iwn_softc *sc)
#endif
/*
- * XXX code from OpenBSD src/sys/net80211/ieee80211_output.c
- * Copyright (c) 2001 Atsushi Onoe
- * Copyright (c) 2002, 2003 Sam Leffler, Errno Consulting
- * Copyright (c) 2007-2009 Damien Bergamini
- * All rights reserved.
- */
-
-/*
- * Add an SSID element to a frame (see 7.3.2.1).
- */
-static u_int8_t *
-ieee80211_add_ssid(u_int8_t *frm, const u_int8_t *ssid, u_int len)
-{
- *frm++ = IEEE80211_ELEMID_SSID;
- *frm++ = len;
- memcpy(frm, ssid, len);
- return frm + len;
-}
-
-/*
- * Add a supported rates element to a frame (see 7.3.2.2).
- */
-static u_int8_t *
-ieee80211_add_rates(u_int8_t *frm, const struct ieee80211_rateset *rs)
-{
- int nrates;
-
- *frm++ = IEEE80211_ELEMID_RATES;
- nrates = min(rs->rs_nrates, IEEE80211_RATE_SIZE);
- *frm++ = nrates;
- memcpy(frm, rs->rs_rates, nrates);
- return frm + nrates;
-}
-
-/*
- * Add an extended supported rates element to a frame (see 7.3.2.14).
- */
-static u_int8_t *
-ieee80211_add_xrates(u_int8_t *frm, const struct ieee80211_rateset *rs)
-{
- int nrates;
-
- KASSERT(rs->rs_nrates > IEEE80211_RATE_SIZE);
-
- *frm++ = IEEE80211_ELEMID_XRATES;
- nrates = rs->rs_nrates - IEEE80211_RATE_SIZE;
- *frm++ = nrates;
- memcpy(frm, rs->rs_rates + IEEE80211_RATE_SIZE, nrates);
- return frm + nrates;
-}
-
-/*
* XXX: Hack to set the current channel to the value advertised in beacons or
* probe responses. Only used during AP detection.
* XXX: Duplicated from if_iwi.c
Index: src/sys/net80211/ieee80211_output.c
diff -u src/sys/net80211/ieee80211_output.c:1.57 src/sys/net80211/ieee80211_output.c:1.58
--- src/sys/net80211/ieee80211_output.c:1.57 Thu Jul 7 06:55:43 2016
+++ src/sys/net80211/ieee80211_output.c Wed Jan 4 03:05:24 2017
@@ -1,4 +1,4 @@
-/* $NetBSD: ieee80211_output.c,v 1.57 2016/07/07 06:55:43 msaitoh Exp $ */
+/* $NetBSD: ieee80211_output.c,v 1.58 2017/01/04 03:05:24 nonaka Exp $ */
/*-
* Copyright (c) 2001 Atsushi Onoe
* Copyright (c) 2002-2005 Sam Leffler, Errno Consulting
@@ -36,7 +36,7 @@
__FBSDID("$FreeBSD: src/sys/net80211/ieee80211_output.c,v 1.34 2005/08/10 16:22:29 sam Exp $");
#endif
#ifdef __NetBSD__
-__KERNEL_RCSID(0, "$NetBSD: ieee80211_output.c,v 1.57 2016/07/07 06:55:43 msaitoh Exp $");
+__KERNEL_RCSID(0, "$NetBSD: ieee80211_output.c,v 1.58 2017/01/04 03:05:24 nonaka Exp $");
#endif
#ifdef _KERNEL_OPT
@@ -963,7 +963,7 @@ bad:
/*
* Add a supported rates element id to a frame.
*/
-static u_int8_t *
+u_int8_t *
ieee80211_add_rates(u_int8_t *frm, const struct ieee80211_rateset *rs)
{
int nrates;
@@ -980,7 +980,7 @@ ieee80211_add_rates(u_int8_t *frm, const
/*
* Add an extended supported rates element id to a frame.
*/
-static u_int8_t *
+u_int8_t *
ieee80211_add_xrates(u_int8_t *frm, const struct ieee80211_rateset *rs)
{
/*
@@ -999,7 +999,7 @@ ieee80211_add_xrates(u_int8_t *frm, cons
/*
* Add an ssid elemet to a frame.
*/
-static u_int8_t *
+u_int8_t *
ieee80211_add_ssid(u_int8_t *frm, const u_int8_t *ssid, u_int len)
{
*frm++ = IEEE80211_ELEMID_SSID;
@@ -1201,7 +1201,7 @@ ieee80211_setup_rsn_ie(struct ieee80211c
/*
* Add a WPA/RSN element to a frame.
*/
-static u_int8_t *
+u_int8_t *
ieee80211_add_wpa(u_int8_t *frm, struct ieee80211com *ic)
{
@@ -1217,7 +1217,7 @@ ieee80211_add_wpa(u_int8_t *frm, struct
/*
* Add a WME information element to a frame.
*/
-static u_int8_t *
+u_int8_t *
ieee80211_add_wme_info(u_int8_t *frm, struct ieee80211_wme_state *wme)
{
static const struct ieee80211_wme_info info = {
Index: src/sys/net80211/ieee80211_proto.h
diff -u src/sys/net80211/ieee80211_proto.h:1.22 src/sys/net80211/ieee80211_proto.h:1.23
--- src/sys/net80211/ieee80211_proto.h:1.22 Sat Mar 30 15:12:28 2013
+++ src/sys/net80211/ieee80211_proto.h Wed Jan 4 03:05:24 2017
@@ -1,4 +1,4 @@
-/* $NetBSD: ieee80211_proto.h,v 1.22 2013/03/30 15:12:28 christos Exp $ */
+/* $NetBSD: ieee80211_proto.h,v 1.23 2017/01/04 03:05:24 nonaka Exp $ */
/*-
* Copyright (c) 2001 Atsushi Onoe
* Copyright (c) 2002-2005 Sam Leffler, Errno Consulting
@@ -85,6 +85,13 @@ struct mbuf *ieee80211_get_cts_to_self(s
void ieee80211_pwrsave(struct ieee80211com *, struct ieee80211_node *,
struct mbuf *);
+u_int8_t *ieee80211_add_rates(u_int8_t *, const struct ieee80211_rateset *);
+u_int8_t *ieee80211_add_xrates(u_int8_t *, const struct ieee80211_rateset *);
+u_int8_t *ieee80211_add_ssid(u_int8_t *, const u_int8_t *, u_int);
+u_int8_t *ieee80211_add_wpa(u_int8_t *, struct ieee80211com *);
+struct ieee80211_wme_state;
+u_int8_t *ieee80211_add_wme_info(u_int8_t *, struct ieee80211_wme_state *);
+
void ieee80211_reset_erp(struct ieee80211com *);
void ieee80211_set_shortslottime(struct ieee80211com *, int onoff);
int ieee80211_iserp_rateset(struct ieee80211com *,