Source-Changes-HG archive
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]
[src/trunk]: src/sys Export some 802.11 IE manipulate functions.
details: https://anonhg.NetBSD.org/src/rev/657928b3f21c
branches: trunk
changeset: 350088:657928b3f21c
user: nonaka <nonaka%NetBSD.org@localhost>
date: Wed Jan 04 03:05:24 2017 +0000
description:
Export some 802.11 IE manipulate functions.
diffstat:
sys/dev/pci/if_iwm.c | 63 +---------------------------------------
sys/dev/pci/if_iwn.c | 63 +---------------------------------------
sys/net80211/ieee80211_output.c | 14 ++++----
sys/net80211/ieee80211_proto.h | 9 +++++-
4 files changed, 19 insertions(+), 130 deletions(-)
diffs (265 lines):
diff -r e6bc77dc689a -r 657928b3f21c sys/dev/pci/if_iwm.c
--- a/sys/dev/pci/if_iwm.c Wed Jan 04 02:05:23 2017 +0000
+++ b/sys/dev/pci/if_iwm.c Wed Jan 04 03:05:24 2017 +0000
@@ -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_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 @@
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;
-}
diff -r e6bc77dc689a -r 657928b3f21c sys/dev/pci/if_iwn.c
--- a/sys/dev/pci/if_iwn.c Wed Jan 04 02:05:23 2017 +0000
+++ b/sys/dev/pci/if_iwn.c Wed Jan 04 03:05:24 2017 +0000
@@ -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 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 @@
#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
diff -r e6bc77dc689a -r 657928b3f21c sys/net80211/ieee80211_output.c
--- a/sys/net80211/ieee80211_output.c Wed Jan 04 02:05:23 2017 +0000
+++ b/sys/net80211/ieee80211_output.c Wed Jan 04 03:05:24 2017 +0000
@@ -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 @@
/*
* 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 @@
/*
* 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 @@
/*
* 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 @@
/*
* 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 @@
/*
* 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 = {
diff -r e6bc77dc689a -r 657928b3f21c sys/net80211/ieee80211_proto.h
--- a/sys/net80211/ieee80211_proto.h Wed Jan 04 02:05:23 2017 +0000
+++ b/sys/net80211/ieee80211_proto.h Wed Jan 04 03:05:24 2017 +0000
@@ -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 @@
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 *,
Home |
Main Index |
Thread Index |
Old Index