Compare commits

...

61 Commits

Author SHA1 Message Date
Moritz Rosenthal 8e34c700a6 Added definition of GPSACP message element (#10) 2017-05-30 16:19:46 +02:00
Andreas Schultz cc55da831b
release v1.4.1 2016-11-15 15:15:45 +01:00
Tobias Hintze 848b01e53c Merge remote-tracking branch 'gh/split-wtp-patches' 2016-11-15 12:07:27 +01:00
Andreas Schultz 890a2af6bb split STA deletion into immediate and delayed action
When sending a DeAuthentication frame to a STA we have to wait
a bit to make sure the driver has actually delivered the frame.
Once we get the DeAuthetication frame from a STA, we can stop
waiting and delete the STA.
2016-11-11 13:32:44 +01:00
Andreas Schultz bf57c7a336
split kernel and OpenWRT/LEDE patches
The OpenWRT patches are for the mac80211 package. They are functional
indentical to the kernel patches but need two modifications.

1. CONFIG_ needs to be replaced with CPTCFG_
2. any new configuration option, need to be patched into .local-symbols

This change move the kernel patches to a seperate directory, add a helper
script to rebuild the OpenWRT/LEDE patches and updates those patches.
2016-11-09 11:15:13 +01:00
Andreas Schultz 2f2a287928
remove some left over SmaretCAPWAP messages and AC pieces 2016-11-08 15:01:08 +01:00
Andreas Schultz cd7024568f
update CAPWAP tunnel patches to new static_key API 2016-11-08 14:35:35 +01:00
Tobias Hintze b6417ff793 bump sha1 2016-10-27 11:02:26 +02:00
Tobias Hintze 17c39e441a [build] inject PKG_VERSION as VERSION
* for -V display
2016-10-05 00:06:12 +02:00
Moritz Rosenthal 7e8be72647 Fixed malformed printk statements and did some makeup (#2)
* Fixed malformed printk statements and did some makeup
2016-09-22 17:36:07 +02:00
Tobias Hintze 9d0fe1cc76 [wtp] fix argument parsing
* efd9eedd introduced a bug which made -c unusable
2016-09-22 16:18:28 +02:00
Andreas Schultz 247a65c7d5 correctly handle endianess when parseing RSNE
The length fields in the RSN elements are little endian. We
need to convert then to host order when reading.
2016-09-22 10:36:01 +02:00
Tobias Hintze cee735bf62 add Dockerfile for reproducable building 2016-09-21 21:58:13 +02:00
Tobias Hintze a4fed97eba use WOLFSSL_CFLAGS from pkgconfig 2016-09-09 22:45:35 +02:00
Tobias Hintze efd9eedd51 version information, usage 2016-09-09 21:28:26 +02:00
Tobias Hintze f869a22beb [config] update default configuration
* localbridging -> false
* ethframe -> true
* nativeframe -> true
2016-08-29 21:16:27 +02:00
Andreas Schultz 4068f7d308 forward action frames from STAs to AC 2016-08-28 18:18:53 +02:00
Holger Winkelmann 6dcf8fa350 fixed typo 2016-08-25 10:02:33 +02:00
Holger Winkelmann 6681f5800a Removed AC inn the libev statement
The freeWP project is just about the the CAPWAP WTP part. The Source for the AC component has been removed.
2016-08-25 09:04:45 +02:00
Daniel Golle cb6e5ce35b package: add luci-app-freewtp 2016-08-24 13:02:22 +02:00
Daniel Golle 543fc7298b package: explicitely configure DTLS mode 2016-08-24 12:39:20 +02:00
Daniel Golle ec332d3e41 package: add reload-trigger to init script 2016-08-24 10:59:34 +02:00
Daniel Golle cd7e97dfce package: create and keep /etc/wtp to store certificates 2016-08-24 10:32:59 +02:00
Daniel Golle 5ae709f1bc package: refresh mac80211 patch and add .localsymbols 2016-08-23 18:06:24 +02:00
Daniel Golle 653a785003 fix static_key use in mac80211 patches 2016-08-23 17:58:24 +02:00
Daniel Golle 9138408fa6 package: fix use of backport-config-symbol in mac80211 patch 2016-08-23 17:32:40 +02:00
Daniel Golle 6ce434bc9b package: improve init script 2016-08-23 17:10:44 +02:00
Daniel Golle 85b3088c55 package: add PACKAGE_MAC80211_CAPWAP_WTP 2016-08-23 15:11:45 +02:00
Daniel Golle 8d594903f5 package: build-depend on mac80211
headers are not in place if building in parallel. try to address that
by adding PKG_BUILD_DEPENDS:=mac80211
2016-08-23 14:14:50 +02:00
Daniel Golle ec1fea6930 package: fixes for uci config and init script 2016-08-23 12:52:19 +02:00
Daniel Golle f571f4b2f7 package: create directories properly 2016-08-23 12:07:47 +02:00
Daniel Golle fc2149e345 package: update source reference 2016-08-23 12:02:43 +02:00
Daniel Golle a631f89729 package: add procd initscript and default uci config 2016-08-23 10:37:23 +02:00
Daniel Golle 63b4dbe91d package: remove obsolete files 2016-08-23 10:35:13 +02:00
Daniel Golle a500f104e1 package: move package into directory 2016-08-23 10:34:32 +02:00
Andreas Schultz 3869271509 rename kernel modules to wtp.ko 2016-08-23 09:18:16 +02:00
Andreas Schultz f4a2bae666 move kmod to top level directory 2016-08-23 09:08:46 +02:00
Andreas Schultz 7bb46f9927 update packet tunnel support patches 2016-08-23 08:55:15 +02:00
Andreas Schultz a6d5b88a1b prepare v1.4.0 release 2016-08-23 08:55:15 +02:00
Andreas Schultz 0101ea6e56 fork SmartCAWPAP as FreeWTP 2016-08-23 08:55:15 +02:00
Andreas Schultz 8cc6559f08 report supported Split MAC profiles and validate it in AC requests 2016-08-17 16:01:53 +02:00
Andreas Schultz de0ffd5153 properly handle a DTLS handshake failure
early DTLS handshake failures would not terminate the read
loop and cause the remaining handshake bytes to be feed to
packet reader, causing an error assertion.

Rework the main read loop to terminate it when the read
event is not longer active and stop the read event on
handshake failure.

Also, make the DTLS handshake erorr message a bit more readable
by appending the WolfSSL error message to it.

Fixes issue #8.
2016-08-17 15:18:35 +02:00
Andreas Schultz 627ecd5a9e rework MAC type handling so that split, local and both MAC's are possible 2016-08-17 14:10:04 +02:00
Andreas Schultz 0df59ddaad fix missing element declaration from ff290d80b5 2016-08-17 14:10:04 +02:00
Tobias Hintze 9b7e282d52 finally fix that typo 2016-08-17 14:06:56 +02:00
Andreas Schultz ff290d80b5 add RFC 7494 CAPWAP elements 2016-08-17 11:55:56 +02:00
Tobias Hintze c57eaca805 [openwrt] use git instead of local copies 2016-08-17 09:43:46 +02:00
Andreas Schultz 76cd5d7484 release 1.3.2 2016-08-15 15:39:06 +02:00
Andreas Schultz a488af66cf add vendor VSA to set additional key and IGTK support
IGTK == Management Frame Protection
2016-08-15 15:30:29 +02:00
Andreas Schultz ac135e16c4 add VSA to report supported ciphers per radio 2016-08-12 12:08:06 +02:00
Andreas Schultz 6f7c26d0af release 1.3.1 2016-08-11 16:03:57 +02:00
Andreas Schultz fdf256553c [mac80211] remove obsolete debugging output 2016-08-11 16:00:41 +02:00
Andreas Schultz ecf7a24eac [wtp-kmod] replace some printk based tracing with ftrace events 2016-08-11 15:43:19 +02:00
Andreas Schultz 57bcb0e183 fix hw queue selection for 802.11 raw frame injection
Update mac80211 support patch:
 * remove obsolte monitor sdata handling (we don't use
   a monitor interface, so accessing that data is a bug)
 * initialize the skb queue mapping to match the tid,
   at least ath9k does not like it when the tid and
   queue mapping disagree
2016-08-11 12:35:11 +02:00
Andreas Schultz 9fbf441896 release 1.3.0 2016-08-08 09:28:18 +02:00
Andreas Schultz 01919fffd9 update support for group key updates with Update WLAN 2016-08-08 09:25:01 +02:00
Andreas Schultz 02e8d534b5 preserve QoS tid for injected QoS data frames
The TX path will overwrite the TID based on the SKB
priority. Load the QoS TID from 802.11 frames into
the skb priority to preserve it during TX handling.
2016-08-02 15:46:07 +02:00
Andreas Schultz 3626927722 reset timeout_action on assoc response frame
Assoziation is complete when we get a response frame. We need to
reset the timeout action here, otherwise the client gets detached
as soon as the timer fires.
2016-08-01 18:14:00 +02:00
Andreas Schultz 2ac3944e7a implement WPA2 Stations Key handling
Implement the required support for extrace the cipher
suite settings from the the RS Information Element and
set the station key based on the 802.11 Station Key
CAPWAP message element.

Group Key update handling is currently not implemented nor is
Station Key update handling.
2016-07-27 12:36:34 +02:00
Andreas Schultz a131e17a6e fix 802.11 Station Key IE handling
memsetting the data to zero right after assigning them
is obviously wrong
2016-07-27 12:17:00 +02:00
Andreas Schultz 0e19b53e28 forward PAE (IEEE 802.1X Authentication) frames as raw 802.11 frames to AC 2016-05-10 17:07:46 +02:00
366 changed files with 5830 additions and 18677 deletions

27
COPYING
View File

@ -1,35 +1,32 @@
SmartCAPWAP -- An Open Source CAPWAP WTP / AC
FreeWTP -- An Open Source CAPWAP WTP
Copyright (C) 2012-2014 Massimo Vellucci <vemax78@gmail.com>
Portions (C) 2016 Travelping GmbH <info@travelping.com>
This distribution contains multiple components, some
of which fall under different licenses. By using SmartCAPWAP
of which fall under different licenses. By using FreeWTP
or any of the bundled components enumerated below, you
agree to be bound by the conditions of the license for
each respective component.
SmartCAPWAP license:
FreeWTP license:
----------------
SmartCAPWAP is distributed under the GPL license version 2.
FreeWTP is distributed under the GPL license version 2.
Libconfig license:
------------
Libconfig is Copyright (C) Mark Lindner, and is licensed under the LGPL.
Libxml2 license:
------------
Libxml2 is Copyright (C) Daniel Veillard, and is licensed under the MIT.
Libjson-c license:
------------
Libjson-c is Copyright (C) Eric Haszlakiewicz, and is licensed under the MIT.
WolfSSL License:
----------------
WolfSSL is Copyright (C) wolfSSL Inc, and is licensed under the GPL license version 2.
WolfSSL is Copyright (C) wolfSSL Inc, and is licensed under the GPL license
version 2.
libev license:
--------------
libev is Copyright (c) 2007,2008,2009,2010,2011,2012,2013 Marc Alexander
Lehmann and is licensed under BSD 2-Clause license.

23
INSTALL
View File

@ -1,12 +1,12 @@
==================================================
HOW TO BUILD AND RUN SmartCAPWAP FOR LINUX SYSTEMS
==================================================
==============================================
HOW TO BUILD AND RUN FreeWTP FOR LINUX SYSTEMS
==============================================
NOTE: To run WTP you must have a wireless card that has Linux driver based on the
Generic IEEE 802.11 Networking Stack (mac80211).
NOTE: To run WTP you must have a wireless card that has Linux driver based
on the Generic IEEE 802.11 Networking Stack (mac80211).
HOW TO BUILD AC AND WTP
HOW TO BUILD THE WTP
=======================
Requirements
@ -15,22 +15,25 @@ Requirements
* automake 1.9 or newer
* autoconf
* libconfig-dev
* libjson0-dev
* libnl-dev
* libtool
* libxml2-dev
* libev 4.22 or newer
* wolfssl 3.8 or newer
Build
-----
Linux Kernel:
Apply the appropriate path from kernel-patches to your kernel, enable
CAPWAP WTP support and rebuild you kernel.
WolfSSL:
./configure --enable-dtls --enable-psk --prefix=/usr/
make
make install
SmartCAPWAP:
FreeWTP:
autoreconf -f -i
./configure
make

View File

@ -1,4 +1,4 @@
This is a GPLv2 only fork of SmartCAWAP. The original project
This is a GPLv2 only fork of SmartCAPWAP. The original project
can be found here: https://bitbucket.org/vemax78/smartcapwap
All changes and contribution to this fork are GPL licensed only.

View File

@ -1,6 +1,7 @@
# SmartCAPWAP -- An Open Source CAPWAP WTP / AC
# FreeWTP -- An Open Source CAPWAP WTP
#
# Copyright (C) 2012-2013 Massimo Vellucci <vemax78@gmail.com>
# Copyright SmartCAPWAP (C) 2012-2013 Massimo Vellucci <vemax78@gmail.com>
# Copyright FreeWTP (C) 2016 Travelping GmbH <info@travelping.com>
#
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
@ -23,20 +24,24 @@ ACLOCAL_AMFLAGS = -I m4
MAINTAINERCLEANFILES = $(srcdir)/config.log \
$(srcdir)/config.status \
$(srcdir)/Makefile.in \
$(srcdir)/config.h.in \
$(srcdir)/config.h.in~ \
$(srcdir)/lib/Makefile.in \
$(srcdir)/src/Makefile.in \
$(srcdir)/lib/config.h.in \
$(srcdir)/lib/config.h.in~ \
$(srcdir)/configure \
$(srcdir)/build/install-sh \
$(srcdir)/ltmain.sh \
$(srcdir)/build/missing \
$(srcdir)/config/install-sh \
$(srcdir)/config/ltmain.sh \
$(srcdir)/config/compile \
$(srcdir)/config/missing \
$(srcdir)/config/ar-lib \
$(srcdir)/config/depcomp \
$(srcdir)/config/config.guess \
$(srcdir)/config/config.sub \
$(srcdir)/m4/libtool.m4 \
$(srcdir)/m4/lt~obsolete.m4 \
$(srcdir)/m4/ltoptions.m4 \
$(srcdir)/m4/ltsugar.m4 \
$(srcdir)/m4/ltversion.m4 \
$(srcdir)/depcomp \
$(srcdir)/aclocal.m4 \
$(srcdir)/build/config.guess \
$(srcdir)/build/config.sub
$(srcdir)/m4/lt~obsolete.m4 \
$(srcdir)/aclocal.m4
SUBDIRS = build
SUBDIRS = lib src

39
NEWS.md
View File

@ -1,7 +1,40 @@
SmartCAPWAP
===========
FreeWTP
=======
CAPWAP WTP and AC implementation
Open Source CAPWAP WTP implementation
Version 1.4.1 - 15 Nov 2016
---------------------------
* fix endianness buf in RSNE processing
* command line fixes/enhances
* updated kernel patches for plain upstream and OpenWRT/LEDE
* remove some left over references to SmartCAPWAP
* fix STA removal (make sure the DeAuthentication frame is sent)
Version 1.4.0 - 22 Aug 2016
---------------------------
* renamed to FreeWTP
* RFC-7494 support
* fix DTLS handshake failure handling
Version 1.3.2 - 15 Aug 2016
---------------------------
* support management frame protection
Version 1.3.1 - 11 Aug 2016
---------------------------
* fix hw queue selection for 802.11 raw frame injection
* initial Linux ftrace support
Version 1.3.0 - 08 Aug 2016
---------------------------
* forward PAE (IEEE 802.1X Authentication) frames as raw 802.11 frames to AC
* implement encryption support for group and peer temporal keys (CCMP only)
Version 1.2.1 - 06 May 2016
---------------------------

View File

@ -1,13 +1,11 @@
# README
[RFC-5415](https://tools.ietf.org/html/rfc5415) and [RFC-5416](https://tools.ietf.org/html/rfc5416) compliant CAPWAP WTP (and AC) implementation.
[RFC-5415](https://tools.ietf.org/html/rfc5415) and [RFC-5416](https://tools.ietf.org/html/rfc5416) compliant CAPWAP WTP implementation.
This fork is currently focusing on the WTP side only.
This project started as a fork of SmartCAPWAP, but has since dropped the AC part on focuses on WTP functionality only (hence the new name).
## STATUS
NOTE: The WTP has been ported to libev, the AC has not been adjusted and is therefor broken for the moment.
### WTP tested and working features:
* 802.11b
@ -17,6 +15,8 @@ NOTE: The WTP has been ported to libev, the AC has not been adjusted and is ther
* Local MAC
* single radio, single WLAN mode
* 802.11n ([draft-ietf-opsawg-capwap-extension-06](https://tools.ietf.org/html/draft-ietf-opsawg-capwap-extension-06))
* WPA2-PSK
* WPA2 Enterprise
Only cards with cfg80211 netlink API are supported. The following devices
have been tested:
@ -26,7 +26,7 @@ have been tested:
### Planned WTP features:
* encryption (WPA2)
* 802.11r - BSS fast transition
* Hybrid-MAC ([RFC-7494](https://tools.ietf.org/html/rfc7494))
## INSTALLATION
@ -40,16 +40,18 @@ NOTE: To run WTP you must have a wireless card that has Linux driver based on th
* automake 1.9 or newer
* autoconf
* libconfig-dev
* libjson0-dev
* libnl-dev
* libev-dev
* libtool
* libxml2-dev
* wolfssl 3.8 or newer
### Build
Linux Kernel:
Apply the appropriate path from kernel-patches to your kernel, enable
CAPWAP WTP support and rebuild you kernel.
WolfSSL:
./configure --enable-dtls --enable-ipv6 --enable-aesgcm \
@ -60,9 +62,33 @@ WolfSSL:
make
make install
SmartCAPWAP:
FreeWTP:
autoreconf -f -i
./configure --disable-ac
make
make install
### Debugging / Tracing
The wtp capwap kernel module defines a number of static ftrace events. For a detailed
guide on how to use those, see: https://www.kernel.org/doc/Documentation/trace/ftrace.txt
A sample trace session might lock like this:
# echo 1 > /sys/kernel/debug/tracing/events/capwap/enable
# echo 1 > /sys/kernel/debug/tracing/tracing_on
# cat /sys/kernel/debug/tracing/trace_pipe
<...>-890 [000] ...1 12030.725012: sc_capwap_create: session:9e04b10c75b3c6537da18d38da5bc70d
<...>-890 [000] ...1 12030.725048: sc_capwap_sendkeepalive: session:9e04b10c75b3c6537da18d38da5bc70d
<...>-890 [000] ...1 12030.725052: sc_capwap_createkeepalive: session:9e04b10c75b3c6537da18d38da5bc70d
<...>-890 [000] ...1 12030.725053: sc_capwap_send: session:9e04b10c75b3c6537da18d38da5bc70d
ksoftirqd/0-3 [000] ..s1 12030.727270: sc_capwap_parsingpacket: session:9e04b10c75b3c6537da18d38da5bc70d skb:ffff8802306c8900
wtp-890 [001] ...1 12060.764008: sc_capwap_sendkeepalive: session:9e04b10c75b3c6537da18d38da5bc70d
wtp-890 [001] ...1 12060.764530: sc_capwap_createkeepalive: session:9e04b10c75b3c6537da18d38da5bc70d
wtp-890 [001] ...1 12060.764637: sc_capwap_send: session:9e04b10c75b3c6537da18d38da5bc70d
<idle>-0 [000] ..s2 12060.787527: sc_capwap_parsingpacket: session:9e04b10c75b3c6537da18d38da5bc70d skb:ffff8800b8a85900
wtp-890 [001] ...1 12082.953847: sc_capwap_resetsession: session:9e04b10c75b3c6537da18d38da5bc70d
wtp-890 [001] ...1 12082.954005: sc_capwap_close: session:9e04b10c75b3c6537da18d38da5bc70d
wtp-890 [001] ...1 12082.954130: sc_capwap_freesession: session:9e04b10c75b3c6537da18d38da5bc70d
# echo 0 > /sys/kernel/debug/tracing/tracing_on

View File

@ -1,30 +0,0 @@
# SmartCAPWAP -- An Open Source CAPWAP WTP / AC
#
# Copyright (C) 2012-2013 Massimo Vellucci <vemax78@gmail.com>
#
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation; either version 2 of the License, or
# (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program (see the file COPYING included with this
# distribution); if not, write to the Free Software Foundation, Inc.,
# 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
MAINTAINERCLEANFILES = $(srcdir)/Makefile.in
SUBDIRS =
if BUILD_AC
SUBDIRS += ac
endif
if BUILD_WTP
SUBDIRS += wtp
endif

View File

@ -1,110 +0,0 @@
# SmartCAPWAP -- An Open Source CAPWAP WTP / AC
#
# Copyright (C) 2012-2013 Massimo Vellucci <vemax78@gmail.com>
#
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation; either version 2 of the License, or
# (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program (see the file COPYING included with this
# distribution); if not, write to the Free Software Foundation, Inc.,
# 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
capwap_SOURCES = $(top_srcdir)/src/common/capwap.c \
$(top_srcdir)/src/common/capwap_timeout.c \
$(top_srcdir)/src/common/capwap_network.c \
$(top_srcdir)/src/common/capwap_protocol.c \
$(top_srcdir)/src/common/capwap_logging.c \
$(top_srcdir)/src/common/capwap_list.c \
$(top_srcdir)/src/common/capwap_array.c \
$(top_srcdir)/src/common/capwap_hash.c \
$(top_srcdir)/src/common/capwap_dtls.c \
$(top_srcdir)/src/common/capwap_dfa.c \
$(top_srcdir)/src/common/capwap_element.c \
$(top_srcdir)/src/common/capwap_element_acdescriptor.c \
$(top_srcdir)/src/common/capwap_element_actimestamp.c \
$(top_srcdir)/src/common/capwap_element_addmacacl.c \
$(top_srcdir)/src/common/capwap_element_deletemacacl.c \
$(top_srcdir)/src/common/capwap_element_addstation.c \
$(top_srcdir)/src/common/capwap_element_deletestation.c \
$(top_srcdir)/src/common/capwap_element_discoverytype.c \
$(top_srcdir)/src/common/capwap_element_duplicateipv4.c \
$(top_srcdir)/src/common/capwap_element_duplicateipv6.c \
$(top_srcdir)/src/common/capwap_element_datatransferdata.c \
$(top_srcdir)/src/common/capwap_element_datatransfermode.c \
$(top_srcdir)/src/common/capwap_element_decrypterrorreport.c \
$(top_srcdir)/src/common/capwap_element_imagedata.c \
$(top_srcdir)/src/common/capwap_element_imageinfo.c \
$(top_srcdir)/src/common/capwap_element_initdownload.c \
$(top_srcdir)/src/common/capwap_element_wtpboarddata.c \
$(top_srcdir)/src/common/capwap_element_wtpdescriptor.c \
$(top_srcdir)/src/common/capwap_element_wtpframetunnelmode.c \
$(top_srcdir)/src/common/capwap_element_wtpmactype.c \
$(top_srcdir)/src/common/capwap_element_acname.c \
$(top_srcdir)/src/common/capwap_element_controlipv4.c \
$(top_srcdir)/src/common/capwap_element_controlipv6.c \
$(top_srcdir)/src/common/capwap_element_location.c \
$(top_srcdir)/src/common/capwap_element_wtpname.c \
$(top_srcdir)/src/common/capwap_element_sessionid.c \
$(top_srcdir)/src/common/capwap_element_ecnsupport.c \
$(top_srcdir)/src/common/capwap_element_localipv4.c \
$(top_srcdir)/src/common/capwap_element_localipv6.c \
$(top_srcdir)/src/common/capwap_element_transport.c \
$(top_srcdir)/src/common/capwap_element_mtudiscovery.c \
$(top_srcdir)/src/common/capwap_element_vendorpayload.c \
$(top_srcdir)/src/common/capwap_element_maximumlength.c \
$(top_srcdir)/src/common/capwap_element_wtprebootstat.c \
$(top_srcdir)/src/common/capwap_element_wtpradiostat.c \
$(top_srcdir)/src/common/capwap_element_resultcode.c \
$(top_srcdir)/src/common/capwap_element_returnedmessage.c \
$(top_srcdir)/src/common/capwap_element_acipv4list.c \
$(top_srcdir)/src/common/capwap_element_acipv6list.c \
$(top_srcdir)/src/common/capwap_element_imageidentifier.c \
$(top_srcdir)/src/common/capwap_element_radioadmstate.c \
$(top_srcdir)/src/common/capwap_element_statisticstimer.c \
$(top_srcdir)/src/common/capwap_element_acnamepriority.c \
$(top_srcdir)/src/common/capwap_element_wtpstaticipaddress.c \
$(top_srcdir)/src/common/capwap_element_timers.c \
$(top_srcdir)/src/common/capwap_element_decrypterrorreportperiod.c \
$(top_srcdir)/src/common/capwap_element_idletimeout.c \
$(top_srcdir)/src/common/capwap_element_wtpfallback.c \
$(top_srcdir)/src/common/capwap_element_radiooprstate.c \
$(top_srcdir)/src/common/capwap_element_80211_addwlan.c \
$(top_srcdir)/src/common/capwap_element_80211_antenna.c \
$(top_srcdir)/src/common/capwap_element_80211_assignbssid.c \
$(top_srcdir)/src/common/capwap_element_80211_deletewlan.c \
$(top_srcdir)/src/common/capwap_element_80211_directsequencecontrol.c \
$(top_srcdir)/src/common/capwap_element_80211_ie.c \
$(top_srcdir)/src/common/capwap_element_80211_macoperation.c \
$(top_srcdir)/src/common/capwap_element_80211_miccountermeasures.c \
$(top_srcdir)/src/common/capwap_element_80211_multidomaincapability.c \
$(top_srcdir)/src/common/capwap_element_80211_ofdmcontrol.c \
$(top_srcdir)/src/common/capwap_element_80211_rateset.c \
$(top_srcdir)/src/common/capwap_element_80211_rsnaerrorreport.c \
$(top_srcdir)/src/common/capwap_element_80211_station.c \
$(top_srcdir)/src/common/capwap_element_80211_stationqos.c \
$(top_srcdir)/src/common/capwap_element_80211_stationkey.c \
$(top_srcdir)/src/common/capwap_element_80211_statistics.c \
$(top_srcdir)/src/common/capwap_element_80211_supportedrates.c \
$(top_srcdir)/src/common/capwap_element_80211_txpower.c \
$(top_srcdir)/src/common/capwap_element_80211_txpowerlevel.c \
$(top_srcdir)/src/common/capwap_element_80211_updatestationqos.c \
$(top_srcdir)/src/common/capwap_element_80211_updatewlan.c \
$(top_srcdir)/src/common/capwap_element_80211_wtpqos.c \
$(top_srcdir)/src/common/capwap_element_80211_wtpradioconf.c \
$(top_srcdir)/src/common/capwap_element_80211_wtpradiofailalarm.c \
$(top_srcdir)/src/common/capwap_element_80211_wtpradioinformation.c \
$(top_srcdir)/src/common/capwap_element_80211n_radioconf.c \
$(top_srcdir)/src/common/capwap_element_80211n_station_information.c \
$(top_srcdir)/src/common/capwap_element_vendor_travelping_wtp_timestamp.c
if DEBUG_BUILD
capwap_SOURCES += $(top_srcdir)/src/common/capwap_debug.c
endif

View File

@ -1,90 +0,0 @@
# SmartCAPWAP -- An Open Source CAPWAP WTP / AC
#
# Copyright (C) 2012-2013 Massimo Vellucci <vemax78@gmail.com>
#
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation; either version 2 of the License, or
# (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program (see the file COPYING included with this
# distribution); if not, write to the Free Software Foundation, Inc.,
# 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
MAINTAINERCLEANFILES = $(srcdir)/Makefile.in
bin_PROGRAMS = ac
AM_CFLAGS = -DCAPWAP_MULTITHREADING_ENABLE \
-D_REENTRANT \
-D_GNU_SOURCE \
${LIBNL_CFLAGS} \
$(LIBXML2_CFLAGS) \
$(WOLFSSL_CFLAGS)
AM_CFLAGS += -I$(top_srcdir)/build \
-I$(top_srcdir)/src/common \
-I$(top_srcdir)/src/ac \
-I$(top_srcdir)/src/ac/kmod \
-I$(top_srcdir)/src/common/binding/ieee80211
include $(top_srcdir)/build/Makefile_common.am
ac_SOURCES = $(capwap_SOURCES) \
$(top_srcdir)/src/common/capwap_event.c \
$(top_srcdir)/src/common/capwap_lock.c \
$(top_srcdir)/src/common/capwap_rwlock.c \
$(top_srcdir)/src/common/capwap_socket.c \
$(top_srcdir)/src/ac/ac.c \
$(top_srcdir)/src/ac/ac_backend.c \
$(top_srcdir)/src/ac/ac_execute.c \
$(top_srcdir)/src/ac/ac_session.c \
$(top_srcdir)/src/ac/ac_wlans.c \
$(top_srcdir)/src/ac/ac_kmod.c \
$(top_srcdir)/src/ac/ac_ieee80211_data.c \
$(top_srcdir)/src/ac/ac_discovery.c \
$(top_srcdir)/src/ac/ac_80211_json.c \
$(top_srcdir)/src/ac/ac_80211_json_addwlan.c \
$(top_srcdir)/src/ac/ac_80211_json_antenna.c \
$(top_srcdir)/src/ac/ac_80211_json_assignbssid.c \
$(top_srcdir)/src/ac/ac_80211_json_deletewlan.c \
$(top_srcdir)/src/ac/ac_80211_json_directsequencecontrol.c \
$(top_srcdir)/src/ac/ac_80211_json_ie.c \
$(top_srcdir)/src/ac/ac_80211_json_macoperation.c \
$(top_srcdir)/src/ac/ac_80211_json_miccountermeasures.c \
$(top_srcdir)/src/ac/ac_80211_json_multidomaincapability.c \
$(top_srcdir)/src/ac/ac_80211_json_ofdmcontrol.c \
$(top_srcdir)/src/ac/ac_80211_json_rateset.c \
$(top_srcdir)/src/ac/ac_80211_json_rsnaerrorreport.c \
$(top_srcdir)/src/ac/ac_80211_json_statistics.c \
$(top_srcdir)/src/ac/ac_80211_json_supportedrates.c \
$(top_srcdir)/src/ac/ac_80211_json_txpower.c \
$(top_srcdir)/src/ac/ac_80211_json_txpowerlevel.c \
$(top_srcdir)/src/ac/ac_80211_json_updatewlan.c \
$(top_srcdir)/src/ac/ac_80211_json_wtpqos.c \
$(top_srcdir)/src/ac/ac_80211_json_wtpradioconf.c \
$(top_srcdir)/src/ac/ac_80211_json_wtpradiofailalarm.c \
$(top_srcdir)/src/ac/ac_80211_json_wtpradioinformation.c \
$(top_srcdir)/src/ac/ac_dfa_join.c \
$(top_srcdir)/src/ac/ac_dfa_configure.c \
$(top_srcdir)/src/ac/ac_dfa_imagedata.c \
$(top_srcdir)/src/ac/ac_dfa_datacheck.c \
$(top_srcdir)/src/ac/ac_dfa_dtls.c \
$(top_srcdir)/src/ac/ac_dfa_run.c \
$(top_srcdir)/src/ac/ac_dfa_reset.c \
$(top_srcdir)/src/ac/ac_dfa_teardown.c \
$(top_srcdir)/src/ac/ac_soap.c \
$(top_srcdir)/src/common/binding/ieee80211/ieee80211.c
ac_LDADD = $(CONFIG_LIBS) \
$(PTHREAD_LIBS) \
$(LIBXML2_LIBS) \
$(LIBJSON_LIBS) \
$(WOLFSSL_LIBS) \
$(LIBNL_LIBS)

View File

@ -1,71 +0,0 @@
# SmartCAPWAP -- An Open Source CAPWAP WTP / AC
#
# Copyright (C) 2012-2013 Massimo Vellucci <vemax78@gmail.com>
#
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation; either version 2 of the License, or
# (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program (see the file COPYING included with this
# distribution); if not, write to the Free Software Foundation, Inc.,
# 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
MAINTAINERCLEANFILES = $(srcdir)/Makefile.in
bin_PROGRAMS = wtp
AM_CFLAGS = -D_REENTRANT \
-D_GNU_SOURCE \
-fno-strict-aliasing \
${LIBNL_CFLAGS}
if DTLS_ENABLED
AM_CFLAGS += $(WOLFSSL_CFLAGS)
endif
AM_CFLAGS += -I$(top_srcdir)/build \
-I$(top_srcdir)/src/common \
-I$(top_srcdir)/src/wtp \
-I$(top_srcdir)/src/wtp/kmod \
-I$(top_srcdir)/src/common/binding/ieee80211 \
-I$(top_srcdir)/src/wtp/binding/ieee80211
include $(top_srcdir)/build/Makefile_common.am
wtp_SOURCES = $(capwap_SOURCES) \
$(top_srcdir)/src/wtp/wtp.c \
$(top_srcdir)/src/wtp/wtp_kmod.c \
$(top_srcdir)/src/wtp/wtp_element_helper.c \
$(top_srcdir)/src/wtp/wtp_dfa.c \
$(top_srcdir)/src/wtp/wtp_dfa_idle.c \
$(top_srcdir)/src/wtp/wtp_dfa_discovery.c \
$(top_srcdir)/src/wtp/wtp_dfa_sulking.c \
$(top_srcdir)/src/wtp/wtp_dfa_dtls.c \
$(top_srcdir)/src/wtp/wtp_dfa_join.c \
$(top_srcdir)/src/wtp/wtp_dfa_configure.c \
$(top_srcdir)/src/wtp/wtp_dfa_datacheck.c \
$(top_srcdir)/src/wtp/wtp_dfa_run.c \
$(top_srcdir)/src/wtp/wtp_dfa_reset.c \
$(top_srcdir)/src/wtp/wtp_dfa_imagedata.c \
$(top_srcdir)/src/wtp/wtp_radio.c \
$(top_srcdir)/src/common/binding/ieee80211/ieee80211.c \
$(top_srcdir)/src/wtp/binding/ieee80211/netlink_link.c \
$(top_srcdir)/src/wtp/binding/ieee80211/wifi_drivers.c
wtp_LDADD = $(CONFIG_LIBS) \
$(LIBNL_LIBS)
if DTLS_ENABLED
wtp_LDADD += $(WOLFSSL_LIBS)
endif
if BUILD_WTP_WIFI_DRIVERS_NL80211
wtp_SOURCES += $(top_srcdir)/src/wtp/binding/ieee80211/wifi_nl80211.c
endif

View File

@ -1,90 +0,0 @@
# AC configuration file
version = "1.0";
application: {
standalone = true;
name = "ac 1";
binding = [
"802.11"
];
descriptor: {
maxstations = 20;
maxwtp = 10;
security: {
presharedkey = false;
x509 = false;
};
rmacfiled: {
supported = false;
};
dtlspolicy: {
cleardatachannel = true;
dtlsdatachannel = true;
};
info = (
{ idvendor = 12345; type = "hardware"; value = "1.0"; },
{ idvendor = 33457; type = "software"; value = "2.0"; }
);
};
ecn = "limited";
timer: {
discovery = 20;
echorequest = 30;
decrypterrorreport = 120;
idletimeout = 320;
};
wtpfallback = true;
dtls: {
enable = true;
type = "x509";
presharedkey: {
hint = "esempio";
identity = "prova";
pskkey = "123456";
};
x509: {
calist = "/etc/capwap/ca.crt";
certificate = "/etc/capwap/ac.crt";
privatekey = "/etc/capwap/ac.key";
};
};
network: {
#binding = "eth1";
#listen = "";
transport = "udp";
mtu = 1400;
};
};
backend: {
id = "1";
version = "1.0";
server: (
{ url = "http://127.0.0.1/csoap.php"; }
#{ url = "https://127.0.0.1/csoap.php"; x509: { calist = "/etc/capwap/casoap.crt"; certificate = "/etc/capwap/clientsoap.crt"; privatekey = "/etc/capwap/clientsoap.key"; }; }
);
};
logging: {
enable = true;
level = "debug";
output = (
{ mode = "stdout"; }
);
};

View File

@ -1,76 +0,0 @@
Certificate:
Data:
Version: 3 (0x2)
Serial Number: 1 (0x1)
Signature Algorithm: sha1WithRSAEncryption
Issuer: C=IT, ST=IT, L=Rome, O=SmartCAPWAP, OU=SmartCAPWAP, CN=SmartCAPWAP CA/name=SmartCAPWAP/emailAddress=vemax78@gmail.com
Validity
Not Before: May 15 18:02:09 2014 GMT
Not After : May 12 18:02:09 2024 GMT
Subject: C=IT, ST=IT, L=Rome, O=SmartCAPWAP, OU=SmartCAPWAP, CN=ac1/name=SmartCAPWAP/emailAddress=vemax78@gmail.com
Subject Public Key Info:
Public Key Algorithm: rsaEncryption
Public-Key: (1024 bit)
Modulus:
00:c3:98:2b:82:c3:1b:aa:13:8d:16:e4:d6:7f:c0:
88:d9:f8:2a:52:46:92:be:c2:3d:91:04:07:7a:fb:
c6:d1:3b:cc:8a:a0:c2:cd:25:b8:22:9c:11:c4:d5:
ca:be:23:43:af:76:80:fd:65:bc:38:4b:66:1c:ac:
05:b1:d2:a4:5b:57:ed:c9:62:e3:67:6e:83:37:c1:
cc:38:a7:9b:0b:87:52:da:b1:83:7b:19:4d:99:48:
96:c9:a3:6d:ad:93:8f:62:ee:f1:38:8a:81:99:0e:
27:f6:70:ac:0e:93:06:3b:a4:b9:5c:6c:ed:ab:be:
27:db:52:72:f5:7e:10:36:a5
Exponent: 65537 (0x10001)
X509v3 extensions:
X509v3 Basic Constraints:
CA:FALSE
Netscape Cert Type:
SSL Server
Netscape Comment:
Easy-RSA Generated Server Certificate
X509v3 Subject Key Identifier:
C6:FE:48:73:99:7A:9E:24:87:8B:43:F8:13:6F:27:FB:4A:71:4D:22
X509v3 Authority Key Identifier:
keyid:B8:BE:B2:CB:C6:68:BD:0A:BB:E5:BC:DE:AE:56:FE:25:E6:E4:B3:1C
DirName:/C=IT/ST=IT/L=Rome/O=SmartCAPWAP/OU=SmartCAPWAP/CN=SmartCAPWAP CA/name=SmartCAPWAP/emailAddress=vemax78@gmail.com
serial:9A:6A:C6:B2:AA:33:22:C5
X509v3 Extended Key Usage:
TLS Web Server Authentication
X509v3 Key Usage:
Digital Signature, Non Repudiation, Key Encipherment, Data Encipherment
Signature Algorithm: sha1WithRSAEncryption
78:50:cf:ba:f0:b7:98:92:ae:e9:88:ce:10:43:79:22:03:bf:
ad:9f:1b:87:26:00:37:c0:11:21:bd:9e:e9:40:92:1a:0b:50:
a1:de:a5:00:df:8c:4b:5d:6d:09:75:6e:4e:f3:c2:4b:9e:6b:
08:fe:d0:5c:27:98:fe:30:c9:96:a9:b5:2c:dc:ed:0b:c2:2d:
3e:aa:b7:fd:54:be:17:5e:2f:35:5a:f1:8f:ae:49:3b:87:d5:
99:8e:04:3a:e6:33:fd:30:4a:70:ac:34:c5:9c:0a:57:c6:ab:
26:e7:98:bf:5d:ac:13:4a:6b:8e:e3:af:5e:e6:9b:e2:80:80:
b9:ce
-----BEGIN CERTIFICATE-----
MIIEMjCCA5ugAwIBAgIBATANBgkqhkiG9w0BAQUFADCBpjELMAkGA1UEBhMCSVQx
CzAJBgNVBAgTAklUMQ0wCwYDVQQHEwRSb21lMRQwEgYDVQQKEwtTbWFydENBUFdB
UDEUMBIGA1UECxMLU21hcnRDQVBXQVAxFzAVBgNVBAMTDlNtYXJ0Q0FQV0FQIENB
MRQwEgYDVQQpEwtTbWFydENBUFdBUDEgMB4GCSqGSIb3DQEJARYRdmVtYXg3OEBn
bWFpbC5jb20wHhcNMTQwNTE1MTgwMjA5WhcNMjQwNTEyMTgwMjA5WjCBmzELMAkG
A1UEBhMCSVQxCzAJBgNVBAgTAklUMQ0wCwYDVQQHEwRSb21lMRQwEgYDVQQKEwtT
bWFydENBUFdBUDEUMBIGA1UECxMLU21hcnRDQVBXQVAxDDAKBgNVBAMTA2FjMTEU
MBIGA1UEKRMLU21hcnRDQVBXQVAxIDAeBgkqhkiG9w0BCQEWEXZlbWF4NzhAZ21h
aWwuY29tMIGfMA0GCSqGSIb3DQEBAQUAA4GNADCBiQKBgQDDmCuCwxuqE40W5NZ/
wIjZ+CpSRpK+wj2RBAd6+8bRO8yKoMLNJbginBHE1cq+I0OvdoD9Zbw4S2YcrAWx
0qRbV+3JYuNnboM3wcw4p5sLh1LasYN7GU2ZSJbJo22tk49i7vE4ioGZDif2cKwO
kwY7pLlcbO2rvifbUnL1fhA2pQIDAQABo4IBdzCCAXMwCQYDVR0TBAIwADARBglg
hkgBhvhCAQEEBAMCBkAwNAYJYIZIAYb4QgENBCcWJUVhc3ktUlNBIEdlbmVyYXRl
ZCBTZXJ2ZXIgQ2VydGlmaWNhdGUwHQYDVR0OBBYEFMb+SHOZep4kh4tD+BNvJ/tK
cU0iMIHbBgNVHSMEgdMwgdCAFLi+ssvGaL0Ku+W83q5W/iXm5LMcoYGspIGpMIGm
MQswCQYDVQQGEwJJVDELMAkGA1UECBMCSVQxDTALBgNVBAcTBFJvbWUxFDASBgNV
BAoTC1NtYXJ0Q0FQV0FQMRQwEgYDVQQLEwtTbWFydENBUFdBUDEXMBUGA1UEAxMO
U21hcnRDQVBXQVAgQ0ExFDASBgNVBCkTC1NtYXJ0Q0FQV0FQMSAwHgYJKoZIhvcN
AQkBFhF2ZW1heDc4QGdtYWlsLmNvbYIJAJpqxrKqMyLFMBMGA1UdJQQMMAoGCCsG
AQUFBwMBMAsGA1UdDwQEAwIE8DANBgkqhkiG9w0BAQUFAAOBgQB4UM+68LeYkq7p
iM4QQ3kiA7+tnxuHJgA3wBEhvZ7pQJIaC1Ch3qUA34xLXW0JdW5O88JLnmsI/tBc
J5j+MMmWqbUs3O0Lwi0+qrf9VL4XXi81WvGPrkk7h9WZjgQ65jP9MEpwrDTFnApX
xqsm55i/XawTSmuO469e5pvigIC5zg==
-----END CERTIFICATE-----

View File

@ -1,16 +0,0 @@
-----BEGIN PRIVATE KEY-----
MIICeAIBADANBgkqhkiG9w0BAQEFAASCAmIwggJeAgEAAoGBAMOYK4LDG6oTjRbk
1n/AiNn4KlJGkr7CPZEEB3r7xtE7zIqgws0luCKcEcTVyr4jQ692gP1lvDhLZhys
BbHSpFtX7cli42dugzfBzDinmwuHUtqxg3sZTZlIlsmjba2Tj2Lu8TiKgZkOJ/Zw
rA6TBjukuVxs7au+J9tScvV+EDalAgMBAAECgYBh1N8OjKBttVHAvb08MQVCYQpq
FLqZh3Zb7nP/Y6fSR+LLBBXrno43YXDRz02VRPY58UAbfqNiVPRCKxi+FOn3li5l
LN9ad1S510MNg652vpKFnCQjpHDrxOQPxQHGc0XNeF4Xo12IhFxh0DbktloC3/Og
PXL0UdvMhZ+X0ErQEQJBAOqLxRYeUSB9HeSFcgNejd0wkM7DKoNyFmJ0jwEb46vO
mKJuA4CFbinX6PZfei8nXbZIBN5p3IS0TA7MU/b+erMCQQDVfEsfmEPUYx7M1oec
rT4+AeSO7KzcC83zeVEmEljwP3zvbM8gn7PLsJAU3K0HEh6scocP6UosTI4o6Ohw
ppVHAkEAsjCp9RnnTKWBlmIDsqedY9RHz63amK6ObxJaqt8DYz28HHs0UeoNPeD4
7mSvMS/ZNGkWudr3XCKWPg/iIp5HnQJBAMALdtzuMZ5+qDdmiUn1QrevJjc4S2wL
pnJu4QQZny5IPpB3VoCniasjowlRVsm0kClbQYqbt2DQYVYF5wtnn4MCQQCz7Rcj
eEZN1STdLv6K03cWKW8nqk+yLgsDFOZpzhIq5ezk/oEX38+1k/KCqwy+9xlQ/oJJ
5lGEUmKCh2XYCBcq
-----END PRIVATE KEY-----

View File

@ -1,6 +1,7 @@
# SmartCAPWAP -- An Open Source CAPWAP WTP / AC
# FreeWTP -- An Open Source CAPWAP AC
#
# Copyright (C) 2012-2013 Massimo Vellucci <vemax78@gmail.com>
# Copyright (C) 2016 Travelping GmbH <info@travelping.com>
#
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
@ -19,20 +20,26 @@
AC_PREREQ(2.63)
AC_INIT([SmartCAPWAP], [1.2.1], [https://github.com/travelping/smartcapwap], [smartcapwap])
AC_CONFIG_AUX_DIR([build])
AC_INIT([freewtp], [1.3.0], [https://github.com/travelping/freewtp], [freewtp])
AC_CONFIG_AUX_DIR([config])
AC_CONFIG_MACRO_DIR([m4])
AM_INIT_AUTOMAKE([1.11 -Wall])
AM_INIT_AUTOMAKE([1.11 -Wall foreign subdir-objects silent-rules])
AC_USE_SYSTEM_EXTENSIONS
AM_SILENT_RULES([yes])
# cross-compile macros
AC_CANONICAL_BUILD
AC_CANONICAL_HOST
#
AC_COPYRIGHT("SmartCapwap by Massimo Vellucci <vemax78@gmail.com>")
AC_COPYRIGHT("FreeWTP by Travelping <info@travelping.com>")
AC_REVISION($Revision: 1.0 $)
#
AM_MAINTAINER_MODE
#
AC_PROG_INSTALL
AC_LANG(C)
@ -60,16 +67,6 @@ AC_ARG_ENABLE(
[enable_logging="yes"]
)
AC_ARG_ENABLE([ac],
[AS_HELP_STRING([--enable-ac], [enable ac support])])
AC_ARG_ENABLE(
[wtp],
[AS_HELP_STRING([--disable-wtp], [disable wtp support])],
,
[enable_wtp="yes"]
)
AC_ARG_WITH(
[mem-check],
[AS_HELP_STRING([--with-mem-check=TYPE], [build with debug memory checking, TYPE=no|internal|valgrind])],
@ -82,7 +79,7 @@ AC_ARG_WITH(
[with_mem_check="internal"]
)
# WTP drivers wifi binding
# WTP drivers wifi binding
AC_ARG_ENABLE(
[wifi-drivers-nl80211],
[AS_HELP_STRING([--disable-wifi-drivers-nl80211], [disable WTP support for nl80211 wifi binding])],
@ -91,15 +88,18 @@ AC_ARG_ENABLE(
)
# specify output header file
AM_CONFIG_HEADER(build/config.h)
AM_CONFIG_HEADER(lib/config.h)
#
old_CFLAGS="${CFLAGS}"
AC_PROG_CC([gcc])
CFLAGS="${old_CFLAGS}"
AC_PROG_CC_C99
AC_PROG_CPP
AM_PROG_CC_C_O
AM_PROG_AR
AM_PROG_LIBTOOL
#
AM_CONDITIONAL([DEBUG_BUILD], [test "$enable_debug" = yes])
AM_CONDITIONAL([DEBUG_BUILD], [test "$enable_debug" = yes])
if test "${enable_debug}" = "yes"; then
CFLAGS="${CFLAGS} -DDEBUG -Wall -Werror -g -O0"
@ -171,32 +171,11 @@ LDFLAGS="$saved_LDFLAGS"
AC_DEFINE_UNQUOTED([LIBCONFIG_LOOKUP_INT_ARG], [$LIBCONFIG_LOOKUP_INT_ARG], [config_lookup_int() argument type])
# Check PTHREAD library
AC_CHECK_HEADER([pthread.h], [], [AC_MSG_ERROR(You need the pthread headers)])
AC_CHECK_LIB([pthread], [pthread_create], [PTHREAD_LIBS="-lpthread"], [AC_MSG_ERROR(You need the pthread library)])
AC_CHECK_LIB([ev], [ev_run],, [AC_MSG_ERROR(Required library ev missing)])
# Check SSL library
PKG_CHECK_MODULES([WOLFSSL], [wolfssl >= 3.8.0], [have_wolfssl_ssl="yes"], [have_wolfssl_ssl="no"])
# Check JSON library
if test "${enable_ac}" = "yes"; then
test "x${have_wolfssl_ssl}" != "xyes" && AC_MSG_ERROR(You need the wolfssl library)
PKG_CHECK_MODULES(
[LIBJSON],
[json-c >= 0.11],
[],
[AC_MSG_ERROR(You need the libjson)]
)
# Check XML2 library
PKG_CHECK_MODULES(
[LIBXML2],
[libxml-2.0 >= 2.6]
)
fi
# Check Netlink library
PKG_CHECK_MODULES(
[LIBNL3],
@ -256,10 +235,6 @@ case "${with_mem_check}" in
;;
esac
#
AM_CONDITIONAL([BUILD_AC], [test "${enable_ac}" = "yes"])
AM_CONDITIONAL([BUILD_WTP], [test "${enable_wtp}" = "yes"])
#
test "${enable_logging}" = "yes" && AC_DEFINE([ENABLE_LOGGING], [1], [Enable logging])
@ -271,14 +246,12 @@ AM_CONDITIONAL([DTLS_ENABLED], [test "${enable_dtls}" = "yes"])
AC_SUBST([SSL_CFLAGS])
AC_SUBST([SSL_LIBS])
AC_SUBST([CONFIG_LIBS])
AC_SUBST([PTHREAD_LIBS])
#
AC_CONFIG_FILES([
Makefile
build/Makefile
build/ac/Makefile
build/wtp/Makefile
lib/Makefile
src/Makefile
])
AC_OUTPUT

35
docker-build/Dockerfile Normal file
View File

@ -0,0 +1,35 @@
FROM ubuntu:16.04
# we would love to use alpine as the build-image
# but unfortunately lede-build still fails with
# it when build some host-utils.
ARG LEDE_REVISION=e9c517772cee8af63b4ef173a28152645a4e1b05
ARG FREEWTP_REVISION=a4fed97ebafbfb07ded50e102be4a46fc9ac7cf3
RUN apt-get -y update && apt-get -y install \
build-essential \
python unzip gawk wget openssl git-core subversion \
libssl-dev ncurses-dev
RUN mkdir /build
WORKDIR /build
RUN cd /build ; \
git clone https://git.lede-project.org/source.git lede ; \
cd lede ; git checkout -b docker_build $LEDE_REVISION
RUN cd /build ; \
git clone https://github.com/travelping/freewtp ; \
cd freewtp ; git checkout -b docker_build $FREEWTP_REVISION
RUN cp /build/lede/feeds.conf.default /build/lede/feeds.conf ; echo "src-link freewtp /build/freewtp/openwrt" >> /build/lede/feeds.conf
RUN cd /build/lede ; ./scripts/feeds update -a && ./scripts/feeds install -a && ./scripts/feeds list -r freewtp
RUN cp -v /build/freewtp/openwrt/mac80211_patches/922-mac80211_packet_tunnel-linux-4.8.patch /build/lede/package/kernel/mac80211/patches/
RUN cd /build/lede ; patch -p1 -i /build/freewtp/openwrt/mac80211_patches/package-config-option.patch
ADD ./dot-lede-config /build/lede/.config
RUN cd /build/lede ; make defconfig
RUN cd /build/lede ; make -j10 BUILD_LOG=1 FORCE_UNSAFE_CONFIGURE=1 ; rm -rf staging_dir build_dir

View File

@ -0,0 +1,46 @@
CONFIG_IB=y
CONFIG_SDK=y
CONFIG_TARGET_ramips=y
CONFIG_TARGET_ramips_mt7621=y
CONFIG_TARGET_ramips_mt7621_DEVICE_zbt-wg2626=y
CONFIG_PACKAGE_comgt=y
CONFIG_PACKAGE_comgt-directip=y
CONFIG_PACKAGE_comgt-ncm=y
CONFIG_PACKAGE_freewtp=y
CONFIG_PACKAGE_kmod-usb-acm=y
CONFIG_PACKAGE_kmod-usb-net=y
CONFIG_PACKAGE_kmod-usb-net-cdc-eem=y
CONFIG_PACKAGE_kmod-usb-net-cdc-ether=y
CONFIG_PACKAGE_kmod-usb-net-cdc-mbim=y
CONFIG_PACKAGE_kmod-usb-net-cdc-ncm=y
CONFIG_PACKAGE_kmod-usb-net-hso=y
CONFIG_PACKAGE_kmod-usb-net-huawei-cdc-ncm=y
CONFIG_PACKAGE_kmod-usb-net-qmi-wwan=y
CONFIG_PACKAGE_kmod-usb-net-sierrawireless=y
CONFIG_PACKAGE_kmod-usb-serial=y
CONFIG_PACKAGE_kmod-usb-serial-ipw=y
CONFIG_PACKAGE_kmod-usb-serial-option=y
CONFIG_PACKAGE_kmod-usb-serial-qualcomm=y
CONFIG_PACKAGE_kmod-usb-serial-sierrawireless=y
CONFIG_PACKAGE_kmod-usb-serial-wwan=y
CONFIG_PACKAGE_kmod-usb-wdm=y
CONFIG_PACKAGE_libustream-cyassl=y
CONFIG_PACKAGE_luci-app-freewtp=y
CONFIG_PACKAGE_luci-app-firewall=y
CONFIG_PACKAGE_luci-mod-admin-full=y
CONFIG_PACKAGE_luci-proto-3g=y
CONFIG_PACKAGE_luci-proto-ppp=y
CONFIG_PACKAGE_luci-theme-bootstrap=y
CONFIG_PACKAGE_libiwinfo-lua=y
CONFIG_PACKAGE_px5g-standalone=y
CONFIG_PACKAGE_smstools3=y
CONFIG_PACKAGE_uhttpd=y
CONFIG_PACKAGE_uhttpd-mod-lua=y
CONFIG_PACKAGE_uhttpd-mod-tls=y
CONFIG_PACKAGE_uhttpd-mod-tls_cyassl=y
CONFIG_PACKAGE_umbim=y
CONFIG_PACKAGE_uqmi=y
CONFIG_PACKAGE_usb-modeswitch=y
CONFIG_PACKAGE_usbreset=y
CONFIG_PACKAGE_usbutils=y
CONFIG_PACKAGE_wwan=y

10
docker-build/update.sh Executable file
View File

@ -0,0 +1,10 @@
#!/bin/sh
lede=$(git ls-remote https://git.lede-project.org/source.git | grep 'refs/heads/master$' | cut -f1)
freewtp=$(git ls-remote https://github.com/travelping/freewtp | grep 'refs/heads/master$' | cut -f1)
echo "found upstream ref to lede master: $lede"
echo "found upstream ref to freewtp master: $freewtp"
sed -i "s/^ARG LEDE_REVISION=.*$/ARG LEDE_REVISION=$lede/" Dockerfile
sed -i "s/^ARG FREEWTP_REVISION=.*$/ARG FREEWTP_REVISION=$freewtp/" Dockerfile

66
docs/GPSACP.md Normal file
View File

@ -0,0 +1,66 @@
# GPSACP message
GPSACP messages are defined in [WTP - SCG Reference Points](https://www.hochbahn.de/hochbahn/wcm/connect/de/1d8945fd-174c-447a-85a5-4a8424406b5a/Lieferung%2Bvon%2BWLAN%2BRoutern%2BAB%2B17.12.2016.pdf?MOD=AJPERES&CACHEID=ROOTWORKSPACE.Z18_JH8I1JC0L05M10AEB6TSP430A1-1d8945fd-174c-447a-85a5-4a8424406b5a-lLovXv0) can be sent within WTP Event Requests.
## Definition GPS Last Acquired Position
The GPS Last Acquired Position contains the output of the AT$GPSACP command from an WWAN Modem.
### Format
```
0 1 2 3
0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
| Timestamp |
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
| WWAN Id | GPSACP ....
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
```
**Vendor Id** 18681 (Travelping GmbH)
**Type** 15
**Length** >= 5
**Timestamp** The WTPs time when the meassurment was recorded
**WWAN Id** WWAN Interface Id, used to differentiate between multiple WWAN interfaces, MUST be between
one (1) and 16.
**GPSACP** The full output (including the starting $GPSACP) of the AT$GPSACP command the WWAN Interface:
```
$GPSACP:<UTC>,<latitude>,<longitude>,<hdop>,<altitude>,<fix>,<cog>,<spkm>,<spkn>,<date>,<nsat>
<UTC>: HHMMSS
HH: Hour of day (00..23)
MM: Minute (00..59)
SS: Second (00..60)
<latitude>: ddmm.mmmmD
dd: Degree (00..90)
mm.mmmm: Minutes with decimal fraction (00.0000 .. 59.9999)
D: Direction (N|S)
<longitude>: dddmm.mmmmD
dd: Degree (00..180)
mm.mmmm: Minutes with decimal fraction (00.0000 .. 59.9999)
D: Direction (W|E)
<hdop>: xx.x
xx.x: Horizontal dilution of precision in m (00.0..99.9)
<altitude>: xxxx.x
xxxx.x: Altitude above sea level in m (0000.0..9999.9) - Empty value for negative values.
<fix>: x
x: Fix status (0: No fix, 1: 2D, 2: 3D)
<cog>: xxx.x
xxx.x: Course over ground (000.0 .. 359.9)
<spkm>: xxx.x
xxx.x: Horizontal speed in km/h (000.0 .. 999.9)
<spkn>: xxx.x
xxx.x: Horizontal speed in knots (000.0 .. 999.9)
<date>: ddmmyy
dd: Day (01 .. 31)
mm: Month (01 .. 12)
yy: Year (00 .. 99)
<nsat>: xx
xx: Number of satallites in view (00 .. 99)
```

View File

@ -12,9 +12,9 @@ application: {
binding = "802.11";
tunnelmode: {
nativeframe = false;
ethframe = false;
localbridging = true;
nativeframe = true;
ethframe = true;
localbridging = false;
};
mactype = "localmac";

View File

@ -1,25 +1,31 @@
From 03b6aa026d60cd49931934338d8ca82d05acc818 Mon Sep 17 00:00:00 2001
From 681af1c29f8276c2105ff4ce8d31ec56bd9e5b7a Mon Sep 17 00:00:00 2001
From: Andreas Schultz <aschultz@tpip.net>
Date: Thu, 4 Feb 2016 15:57:11 +0100
Subject: [PATCH] support patch for smartcapwap
Subject: [PATCH] support patch for FreeWTP
Allows for kernel side interception and injection of IEEE 802.11 frames.
---
include/net/mac80211.h | 25 ++++
net/mac80211/ieee80211_i.h | 6 +
net/mac80211/iface.c | 56 +++++++++
net/mac80211/rx.c | 81 ++++++++++--
net/mac80211/tx.c | 306 +++++++++++++++++++++++++++++++++++++++++++++
5 files changed, 462 insertions(+), 12 deletions(-)
include/net/mac80211.h | 31 +++++
net/mac80211/Kconfig | 7 ++
net/mac80211/ieee80211_i.h | 12 ++
net/mac80211/iface.c | 63 ++++++++++
net/mac80211/rx.c | 92 +++++++++++++--
net/mac80211/tx.c | 286 +++++++++++++++++++++++++++++++++++++++++++++
6 files changed, 479 insertions(+), 12 deletions(-)
diff --git a/include/net/mac80211.h b/include/net/mac80211.h
index 760bc4d..6722da6 100644
index 760bc4d..e80b1af 100644
--- a/include/net/mac80211.h
+++ b/include/net/mac80211.h
@@ -2200,6 +2200,31 @@ ieee80211_get_alt_retry_rate(const struct ieee80211_hw *hw,
@@ -2199,6 +2199,37 @@ ieee80211_get_alt_retry_rate(const struct ieee80211_hw *hw,
*/
void ieee80211_free_txskb(struct ieee80211_hw *hw, struct sk_buff *skb);
/**
+#ifdef CONFIG_MAC80211_CAPWAP_WTP
+
+extern struct static_key_false mac80211_capwap_wtp;
+
+/**
+ *
+ */
+struct ieee80211_pcktunnel {
@ -44,50 +50,76 @@ index 760bc4d..6722da6 100644
+ */
+netdev_tx_t ieee80211_inject_xmit(struct sk_buff* skb, struct net_device* dev);
+
+/**
+#endif
+
/**
* DOC: Hardware crypto acceleration
*
* mac80211 is capable of taking advantage of many hardware
diff --git a/net/mac80211/Kconfig b/net/mac80211/Kconfig
index 3891cbd..4ff4461 100644
--- a/net/mac80211/Kconfig
+++ b/net/mac80211/Kconfig
@@ -318,3 +318,10 @@ config MAC80211_STA_HASH_MAX_SIZE
connect more stations than the number selected here.)
If unsure, leave the default of 0.
+
+config MAC80211_CAPWAP_WTP
+ bool "Enable support functions for out-of-tree CAPWAP WTP module"
+ depends on MAC80211
+ ---help---
+ Select this to build support hooks for out-of-tree CAPWAP FreeWTP
+ module.
diff --git a/net/mac80211/ieee80211_i.h b/net/mac80211/ieee80211_i.h
index 5322b4c..667c9ff 100644
index 6837a46..e96cbff 100644
--- a/net/mac80211/ieee80211_i.h
+++ b/net/mac80211/ieee80211_i.h
@@ -180,6 +180,7 @@ typedef unsigned __bitwise__ ieee80211_rx_result;
@@ -180,6 +180,9 @@ typedef unsigned __bitwise__ ieee80211_rx_result;
#define RX_DROP_UNUSABLE ((__force ieee80211_rx_result) 1u)
#define RX_DROP_MONITOR ((__force ieee80211_rx_result) 2u)
#define RX_QUEUED ((__force ieee80211_rx_result) 3u)
+#ifdef CONFIG_MAC80211_CAPWAP_WTP
+#define RX_IGNORE_MONITOR ((__force ieee80211_rx_result) 4u)
+#endif
/**
* enum ieee80211_packet_rx_flags - packet RX flags
@@ -835,6 +836,9 @@ struct ieee80211_sub_if_data {
@@ -835,6 +838,11 @@ struct ieee80211_sub_if_data {
char name[IFNAMSIZ];
+#ifdef CONFIG_MAC80211_CAPWAP_WTP
+ /* Packet tunnel handlers */
+ struct ieee80211_pcktunnel __rcu *pcktunnel_handlers;
+#endif
+
/* Fragment table for host-based reassembly */
struct ieee80211_fragment_entry fragments[IEEE80211_FRAGMENT_MAX];
unsigned int fragment_next;
@@ -1632,6 +1636,8 @@ netdev_tx_t ieee80211_subif_start_xmit(struct sk_buff *skb,
@@ -1632,6 +1640,10 @@ netdev_tx_t ieee80211_subif_start_xmit(struct sk_buff *skb,
void __ieee80211_subif_start_xmit(struct sk_buff *skb,
struct net_device *dev,
u32 info_flags);
+#ifdef CONFIG_MAC80211_CAPWAP_WTP
+netdev_tx_t ieee80211_capwap_subif_start_xmit(struct sk_buff *skb,
+ struct net_device *dev);
+#endif
void ieee80211_purge_tx_queue(struct ieee80211_hw *hw,
struct sk_buff_head *skbs);
struct sk_buff *
diff --git a/net/mac80211/iface.c b/net/mac80211/iface.c
index c9e325d..15ce6e3 100644
index bcb0a1b..cb08ec2 100644
--- a/net/mac80211/iface.c
+++ b/net/mac80211/iface.c
@@ -1952,3 +1952,59 @@ void ieee80211_iface_exit(void)
@@ -1955,3 +1955,66 @@ void ieee80211_iface_exit(void)
{
unregister_netdevice_notifier(&mac80211_netdev_notifier);
}
+
+#ifdef CONFIG_MAC80211_CAPWAP_WTP
+
+DEFINE_STATIC_KEY_FALSE(mac80211_capwap_wtp);
+
+static const struct net_device_ops ieee80211_capwapif_ops = {
+ .ndo_open = ieee80211_open,
+ .ndo_stop = ieee80211_stop,
@ -113,6 +145,7 @@ index c9e325d..15ce6e3 100644
+ ret = -EBUSY;
+ } else {
+ rcu_assign_pointer(sdata->pcktunnel_handlers, handler);
+ static_branch_enable(&mac80211_capwap_wtp);
+ }
+
+ mutex_unlock(&sdata->local->iflist_mtx);
@ -133,6 +166,7 @@ index c9e325d..15ce6e3 100644
+ h = rcu_dereference_protected(sdata->pcktunnel_handlers, lockdep_is_held(&sdata->local->iflist_mtx));
+ if (h == handler) {
+ ret = 0;
+ static_branch_disable(&mac80211_capwap_wtp);
+ rcu_assign_pointer(sdata->pcktunnel_handlers, NULL);
+ }
+
@ -143,14 +177,17 @@ index c9e325d..15ce6e3 100644
+}
+EXPORT_SYMBOL(ieee80211_pcktunnel_deregister);
+
+#endif
diff --git a/net/mac80211/rx.c b/net/mac80211/rx.c
index 82af407..29cc59b 100644
index a3bb8f7..07b2ff6 100644
--- a/net/mac80211/rx.c
+++ b/net/mac80211/rx.c
@@ -3039,6 +3039,51 @@ ieee80211_rx_h_mgmt(struct ieee80211_rx_data *rx)
@@ -3058,6 +3058,56 @@ ieee80211_rx_h_mgmt(struct ieee80211_rx_data *rx)
return RX_QUEUED;
}
+#ifdef CONFIG_MAC80211_CAPWAP_WTP
+
+static ieee80211_rx_result debug_noinline
+ieee80211_rx_h_pcktunnel(struct ieee80211_rx_data *rx, struct ieee80211_rate *rate)
+{
@ -196,18 +233,23 @@ index 82af407..29cc59b 100644
+}
+
+/* TODO: use IEEE80211_RX_FRAGMENTED */
+
+#endif
+
static void ieee80211_rx_cooked_monitor(struct ieee80211_rx_data *rx,
struct ieee80211_rate *rate)
{
@@ -3118,6 +3163,7 @@ static void ieee80211_rx_handlers_result(struct ieee80211_rx_data *rx,
@@ -3137,6 +3187,9 @@ static void ieee80211_rx_handlers_result(struct ieee80211_rx_data *rx,
if (rx->sta)
rx->sta->rx_stats.dropped++;
/* fall through */
+#ifdef CONFIG_MAC80211_CAPWAP_WTP
+ case RX_IGNORE_MONITOR:
+#endif
case RX_CONTINUE: {
struct ieee80211_rate *rate = NULL;
struct ieee80211_supported_band *sband;
@@ -3146,7 +3192,9 @@ static void ieee80211_rx_handlers_result(struct ieee80211_rx_data *rx,
@@ -3165,7 +3218,9 @@ static void ieee80211_rx_handlers_result(struct ieee80211_rx_data *rx,
}
static void ieee80211_rx_handlers(struct ieee80211_rx_data *rx,
@ -218,19 +260,23 @@ index 82af407..29cc59b 100644
{
ieee80211_rx_result res = RX_DROP_MONITOR;
struct sk_buff *skb;
@@ -3185,6 +3233,11 @@ static void ieee80211_rx_handlers(struct ieee80211_rx_data *rx,
@@ -3204,6 +3259,15 @@ static void ieee80211_rx_handlers(struct ieee80211_rx_data *rx,
if (ieee80211_vif_is_mesh(&rx->sdata->vif))
CALL_RXH(ieee80211_rx_h_mesh_fwding);
#endif
+ /* special treatment */
+ res = ieee80211_rx_h_pcktunnel(rx, rate);
+ if (res != RX_CONTINUE)
+ goto rxh_next;
+#ifdef CONFIG_MAC80211_CAPWAP_WTP
+ if (static_branch_unlikely(&mac80211_capwap_wtp)) {
+ /* special treatment */
+ res = ieee80211_rx_h_pcktunnel(rx, rate);
+ if (res != RX_CONTINUE)
+ goto rxh_next;
+ }
+#endif
+
CALL_RXH(ieee80211_rx_h_amsdu)
CALL_RXH(ieee80211_rx_h_data)
@@ -3208,7 +3261,8 @@ static void ieee80211_rx_handlers(struct ieee80211_rx_data *rx,
@@ -3227,7 +3291,8 @@ static void ieee80211_rx_handlers(struct ieee80211_rx_data *rx,
spin_unlock_bh(&rx->local->rx_path_lock);
}
@ -240,7 +286,7 @@ index 82af407..29cc59b 100644
{
struct sk_buff_head reorder_release;
ieee80211_rx_result res = RX_DROP_MONITOR;
@@ -3227,7 +3281,7 @@ static void ieee80211_invoke_rx_handlers(struct ieee80211_rx_data *rx)
@@ -3246,7 +3311,7 @@ static void ieee80211_invoke_rx_handlers(struct ieee80211_rx_data *rx)
ieee80211_rx_reorder_ampdu(rx, &reorder_release);
@ -249,7 +295,7 @@ index 82af407..29cc59b 100644
return;
rxh_next:
@@ -3273,7 +3327,7 @@ void ieee80211_release_reorder_timeout(struct sta_info *sta, int tid)
@@ -3292,7 +3357,7 @@ void ieee80211_release_reorder_timeout(struct sta_info *sta, int tid)
drv_event_callback(rx.local, rx.sdata, &event);
}
@ -258,7 +304,7 @@ index 82af407..29cc59b 100644
}
/* main receive path */
@@ -3395,7 +3449,9 @@ static bool ieee80211_accept_frame(struct ieee80211_rx_data *rx)
@@ -3415,7 +3480,9 @@ static bool ieee80211_accept_frame(struct ieee80211_rx_data *rx)
* or not the skb was consumed.
*/
static bool ieee80211_prepare_and_rx_handle(struct ieee80211_rx_data *rx,
@ -269,7 +315,7 @@ index 82af407..29cc59b 100644
{
struct ieee80211_local *local = rx->local;
struct ieee80211_sub_if_data *sdata = rx->sdata;
@@ -3418,7 +3474,7 @@ static bool ieee80211_prepare_and_rx_handle(struct ieee80211_rx_data *rx,
@@ -3438,7 +3505,7 @@ static bool ieee80211_prepare_and_rx_handle(struct ieee80211_rx_data *rx,
rx->skb = skb;
}
@ -278,7 +324,7 @@ index 82af407..29cc59b 100644
return true;
}
@@ -3428,7 +3484,8 @@ static bool ieee80211_prepare_and_rx_handle(struct ieee80211_rx_data *rx,
@@ -3448,7 +3515,8 @@ static bool ieee80211_prepare_and_rx_handle(struct ieee80211_rx_data *rx,
*/
static void __ieee80211_rx_handle_packet(struct ieee80211_hw *hw,
struct sk_buff *skb,
@ -288,7 +334,7 @@ index 82af407..29cc59b 100644
{
struct ieee80211_local *local = hw_to_local(hw);
struct ieee80211_sub_if_data *sdata;
@@ -3487,7 +3544,7 @@ static void __ieee80211_rx_handle_packet(struct ieee80211_hw *hw,
@@ -3507,7 +3575,7 @@ static void __ieee80211_rx_handle_packet(struct ieee80211_hw *hw,
rx.sta = prev_sta;
rx.sdata = prev_sta->sdata;
@ -297,7 +343,7 @@ index 82af407..29cc59b 100644
prev_sta = sta;
}
@@ -3496,7 +3553,7 @@ static void __ieee80211_rx_handle_packet(struct ieee80211_hw *hw,
@@ -3516,7 +3584,7 @@ static void __ieee80211_rx_handle_packet(struct ieee80211_hw *hw,
rx.sta = prev_sta;
rx.sdata = prev_sta->sdata;
@ -306,7 +352,7 @@ index 82af407..29cc59b 100644
return;
goto out;
}
@@ -3525,7 +3582,7 @@ static void __ieee80211_rx_handle_packet(struct ieee80211_hw *hw,
@@ -3545,7 +3613,7 @@ static void __ieee80211_rx_handle_packet(struct ieee80211_hw *hw,
rx.sta = sta_info_get_bss(prev, hdr->addr2);
rx.sdata = prev;
@ -315,7 +361,7 @@ index 82af407..29cc59b 100644
prev = sdata;
}
@@ -3534,7 +3591,7 @@ static void __ieee80211_rx_handle_packet(struct ieee80211_hw *hw,
@@ -3554,7 +3622,7 @@ static void __ieee80211_rx_handle_packet(struct ieee80211_hw *hw,
rx.sta = sta_info_get_bss(prev, hdr->addr2);
rx.sdata = prev;
@ -324,7 +370,7 @@ index 82af407..29cc59b 100644
return;
}
@@ -3646,7 +3703,7 @@ void ieee80211_rx_napi(struct ieee80211_hw *hw, struct sk_buff *skb,
@@ -3666,7 +3734,7 @@ void ieee80211_rx_napi(struct ieee80211_hw *hw, struct sk_buff *skb,
ieee80211_tpt_led_trig_rx(local,
((struct ieee80211_hdr *)skb->data)->frame_control,
skb->len);
@ -334,13 +380,15 @@ index 82af407..29cc59b 100644
rcu_read_unlock();
diff --git a/net/mac80211/tx.c b/net/mac80211/tx.c
index bdc224d..3769c33 100644
index bdc224d..ee4e7c7 100644
--- a/net/mac80211/tx.c
+++ b/net/mac80211/tx.c
@@ -2939,6 +2939,138 @@ netdev_tx_t ieee80211_subif_start_xmit(struct sk_buff *skb,
@@ -2939,6 +2939,115 @@ netdev_tx_t ieee80211_subif_start_xmit(struct sk_buff *skb,
return NETDEV_TX_OK;
}
+#ifdef CONFIG_MAC80211_CAPWAP_WTP
+
+/*
+ * inject raw 802.11 frame, processing is mostly identical
+ * to ieee80211_monitor_start_xmit, except for the different
@ -353,8 +401,9 @@ index bdc224d..3769c33 100644
+ struct ieee80211_chanctx_conf *chanctx_conf;
+ struct ieee80211_tx_info *info = IEEE80211_SKB_CB(skb);
+ struct ieee80211_hdr *hdr = (struct ieee80211_hdr *)skb->data;
+ struct ieee80211_sub_if_data *tmp_sdata, *sdata;
+ struct ieee80211_sub_if_data *sdata;
+ struct cfg80211_chan_def *chandef;
+ int tid;
+ int hdrlen;
+
+ /* check for not even having the fixed 802.11 header */
@ -367,13 +416,13 @@ index bdc224d..3769c33 100644
+ if (unlikely(skb->len < hdrlen))
+ goto fail; /* skb too short for claimed header length */
+
+ skb_reset_mac_header(skb);
+ skb_set_mac_header(skb, 0);
+ /*
+ * these are just fixed to the end of the rt area since we
+ * don't have any better information and at this point, nobody cares
+ */
+ skb_reset_network_header(skb);
+ skb_reset_transport_header(skb);
+ skb_set_network_header(skb, hdrlen);
+ skb_set_transport_header(skb, hdrlen);
+
+ /*
+ * Initialize skb->protocol if the injected frame is a data frame
@ -388,12 +437,17 @@ index bdc224d..3769c33 100644
+ payload[7]);
+ }
+
+ memset(info, 0, sizeof(*info));
+ if (ieee80211_is_data_qos(hdr->frame_control)) {
+ u8 *p = ieee80211_get_qos_ctl(hdr);
+
+ skb->priority = *p & IEEE80211_QOS_CTL_TAG1D_MASK;
+ }
+ skb_set_queue_mapping(skb, ieee802_1d_to_ac[skb->priority]);
+
+ memset(info, 0, sizeof(*info));
+ info->flags = IEEE80211_TX_CTL_REQ_TX_STATUS |
+ IEEE80211_TX_CTL_INJECTED;
+
+
+ /*
+ * we might have set these flags later.....
+ * info->flags &= ~IEEE80211_TX_INTFL_DONT_ENCRYPT;
@ -405,46 +459,17 @@ index bdc224d..3769c33 100644
+ sdata = IEEE80211_DEV_TO_SUB_IF(dev);
+
+ chanctx_conf = rcu_dereference(sdata->vif.chanctx_conf);
+ if (!chanctx_conf) {
+ tmp_sdata = rcu_dereference(local->monitor_sdata);
+ if (tmp_sdata)
+ chanctx_conf =
+ rcu_dereference(tmp_sdata->vif.chanctx_conf);
+ }
+
+ if (chanctx_conf)
+ chandef = &chanctx_conf->def;
+ else if (!local->use_chanctx)
+ chandef = &local->_oper_chandef;
+ else
+ if (!chanctx_conf)
+ goto fail_rcu;
+
+ /*
+ * Frame injection is not allowed if beaconing is not allowed
+ * or if we need radar detection. Beaconing is usually not allowed when
+ * the mode or operation (Adhoc, AP, Mesh) does not support DFS.
+ * Passive scan is also used in world regulatory domains where
+ * your country is not known and as such it should be treated as
+ * NO TX unless the channel is explicitly allowed in which case
+ * your current regulatory domain would not have the passive scan
+ * flag.
+ *
+ * Since AP mode uses monitor interfaces to inject/TX management
+ * frames we can make AP mode the exception to this rule once it
+ * supports radar detection as its implementation can deal with
+ * radar detection by itself. We can do that later by adding a
+ * monitor flag interfaces used for AP support.
+ */
+ if (!cfg80211_reg_can_beacon(local->hw.wiphy, chandef,
+ sdata->vif.type))
+ goto fail_rcu;
+ info->band = chanctx_conf->def.chan->band;
+
+ ieee80211_tx_stats(dev, skb->len);
+
+ info->band = chandef->chan->band;
+ ieee80211_xmit(sdata, NULL, skb);
+ rcu_read_unlock();
+
+ return;
+
+fail_rcu:
+ rcu_read_unlock();
+fail:
@ -461,10 +486,6 @@ index bdc224d..3769c33 100644
+netdev_tx_t ieee80211_capwap_subif_start_xmit(struct sk_buff *skb,
+ struct net_device *dev)
+{
+ if (skb->protocol != htons(ETH_P_IP))
+ printk(KERN_DEBUG "capwap xmit %s: protocol: %04X, data: %p, MAC: %p\n",
+ dev->name, ntohs(skb->protocol), skb->data, skb_mac_header(skb));
+
+ if (skb->protocol == htons(ETH_P_CONTROL)) {
+ __ieee80211_capwap_inject_start_xmit(skb, dev);
+ } else
@ -472,15 +493,19 @@ index bdc224d..3769c33 100644
+
+ return NETDEV_TX_OK;
+}
+
+#endif
+
struct sk_buff *
ieee80211_build_data_template(struct ieee80211_sub_if_data *sdata,
struct sk_buff *skb, u32 info_flags)
@@ -3914,3 +4046,177 @@ void __ieee80211_tx_skb_tid_band(struct ieee80211_sub_if_data *sdata,
@@ -3914,3 +4023,180 @@ void __ieee80211_tx_skb_tid_band(struct ieee80211_sub_if_data *sdata,
ieee80211_xmit(sdata, NULL, skb);
local_bh_enable();
}
+
+#ifdef CONFIG_MAC80211_CAPWAP_WTP
+
+netdev_tx_t ieee80211_inject_xmit(struct sk_buff* skb, struct net_device* dev) {
+ int multicast;
+ struct ieee80211_local *local = wdev_priv(dev->ieee80211_ptr);
@ -507,7 +532,7 @@ index bdc224d..3769c33 100644
+ hdrlen = ieee80211_hdrlen(hdr->frame_control);
+
+ if (skb->len < hdrlen) {
+ printk(KERN_WARNING, "droping packet for TO SMALL");
+ printk(KERN_WARNING "dropping packet (too small)\n");
+ goto error;
+ }
+
@ -531,13 +556,13 @@ index bdc224d..3769c33 100644
+ sdata = IEEE80211_DEV_TO_SUB_IF(dev);
+
+ if (sdata->vif.type != NL80211_IFTYPE_AP) {
+ printk(KERN_WARNING, "droping packet for NOT AP");
+ printk(KERN_WARNING "dropping packet (not AP)\n");
+ goto error_rcu;
+ }
+
+ chanctx_conf = rcu_dereference(sdata->vif.chanctx_conf);
+ if (!chanctx_conf) {
+ printk(KERN_WARNING, "droping packet for NO CHANTX");
+ printk(KERN_WARNING "dropping packet (no chanCTX)\n");
+ goto error_rcu;
+ }
+
@ -568,7 +593,7 @@ index bdc224d..3769c33 100644
+ */
+ if (!cfg80211_reg_can_beacon(local->hw.wiphy, chandef,
+ sdata->vif.type)) {
+ printk(KERN_WARNING, "droping packet for CAN NOT BEACON");
+ printk(KERN_WARNING "dropping packet (cannot BEACON)\n");
+ goto error_rcu;
+ }
+ /* */
@ -578,7 +603,7 @@ index bdc224d..3769c33 100644
+ if (sta && test_sta_flag(sta, WLAN_STA_AUTHORIZED)) {
+ skb->pkt_type = PACKET_OTHERHOST;
+ } else {
+ printk(KERN_WARNING, "droping packet for STA not AUTHORIZED");
+ printk(KERN_WARNING "dropping packet (STA not authorized)\n");
+ goto error_rcu;
+ }
+ } else {
@ -654,6 +679,7 @@ index bdc224d..3769c33 100644
+}
+EXPORT_SYMBOL(ieee80211_inject_xmit);
+
+#endif
--
2.7.0
2.9.3

View File

@ -0,0 +1,703 @@
From c77fede6bca4d81c4db720a0ebcfa3ea6b933161 Mon Sep 17 00:00:00 2001
From: Andreas Schultz <aschultz@tpip.net>
Date: Thu, 4 Feb 2016 15:57:11 +0100
Subject: [PATCH] support patch for FreeWTP
Allows for kernel side interception and injection of IEEE 802.11 frames.
---
include/net/mac80211.h | 31 +++++
net/mac80211/Kconfig | 7 ++
net/mac80211/ieee80211_i.h | 12 ++
net/mac80211/iface.c | 63 ++++++++++
net/mac80211/rx.c | 96 ++++++++++++---
net/mac80211/tx.c | 286 +++++++++++++++++++++++++++++++++++++++++++++
6 files changed, 481 insertions(+), 14 deletions(-)
diff --git a/include/net/mac80211.h b/include/net/mac80211.h
index be30b05..cc1f0e8 100644
--- a/include/net/mac80211.h
+++ b/include/net/mac80211.h
@@ -2309,6 +2309,37 @@ ieee80211_get_alt_retry_rate(const struct ieee80211_hw *hw,
*/
void ieee80211_free_txskb(struct ieee80211_hw *hw, struct sk_buff *skb);
+#ifdef CONFIG_MAC80211_CAPWAP_WTP
+
+extern struct static_key_false mac80211_capwap_wtp;
+
+/**
+ *
+ */
+struct ieee80211_pcktunnel {
+ u16 subtype_mask[3]; /* 0: MGMT, 1: CTLR, 2: DATA */
+
+ int (*handler)(u32 ifindex, struct sk_buff *skb, int sig_dbm, unsigned char rate, void *data);
+ void *data;
+};
+
+/**
+ *
+ */
+int ieee80211_pcktunnel_register(struct net_device *dev, struct ieee80211_pcktunnel *handler);
+
+/**
+ *
+ */
+int ieee80211_pcktunnel_deregister(struct net_device *dev, struct ieee80211_pcktunnel *handler);
+
+/**
+ *
+ */
+netdev_tx_t ieee80211_inject_xmit(struct sk_buff* skb, struct net_device* dev);
+
+#endif
+
/**
* DOC: Hardware crypto acceleration
*
diff --git a/net/mac80211/Kconfig b/net/mac80211/Kconfig
index 3891cbd..4ff4461 100644
--- a/net/mac80211/Kconfig
+++ b/net/mac80211/Kconfig
@@ -318,3 +318,10 @@ config MAC80211_STA_HASH_MAX_SIZE
connect more stations than the number selected here.)
If unsure, leave the default of 0.
+
+config MAC80211_CAPWAP_WTP
+ bool "Enable support functions for out-of-tree CAPWAP WTP module"
+ depends on MAC80211
+ ---help---
+ Select this to build support hooks for out-of-tree CAPWAP FreeWTP
+ module.
diff --git a/net/mac80211/ieee80211_i.h b/net/mac80211/ieee80211_i.h
index 9438c94..3ec4613 100644
--- a/net/mac80211/ieee80211_i.h
+++ b/net/mac80211/ieee80211_i.h
@@ -180,6 +180,9 @@ typedef unsigned __bitwise__ ieee80211_rx_result;
#define RX_DROP_UNUSABLE ((__force ieee80211_rx_result) 1u)
#define RX_DROP_MONITOR ((__force ieee80211_rx_result) 2u)
#define RX_QUEUED ((__force ieee80211_rx_result) 3u)
+#ifdef CONFIG_MAC80211_CAPWAP_WTP
+#define RX_IGNORE_MONITOR ((__force ieee80211_rx_result) 4u)
+#endif
/**
* enum ieee80211_packet_rx_flags - packet RX flags
@@ -836,6 +839,11 @@ struct ieee80211_sub_if_data {
char name[IFNAMSIZ];
+#ifdef CONFIG_MAC80211_CAPWAP_WTP
+ /* Packet tunnel handlers */
+ struct ieee80211_pcktunnel __rcu *pcktunnel_handlers;
+#endif
+
/* Fragment table for host-based reassembly */
struct ieee80211_fragment_entry fragments[IEEE80211_FRAGMENT_MAX];
unsigned int fragment_next;
@@ -1655,6 +1663,10 @@ netdev_tx_t ieee80211_subif_start_xmit(struct sk_buff *skb,
void __ieee80211_subif_start_xmit(struct sk_buff *skb,
struct net_device *dev,
u32 info_flags);
+#ifdef CONFIG_MAC80211_CAPWAP_WTP
+netdev_tx_t ieee80211_capwap_subif_start_xmit(struct sk_buff *skb,
+ struct net_device *dev);
+#endif
void ieee80211_purge_tx_queue(struct ieee80211_hw *hw,
struct sk_buff_head *skbs);
struct sk_buff *
diff --git a/net/mac80211/iface.c b/net/mac80211/iface.c
index c59af3e..c05f4c6 100644
--- a/net/mac80211/iface.c
+++ b/net/mac80211/iface.c
@@ -1966,3 +1966,66 @@ void ieee80211_iface_exit(void)
{
unregister_netdevice_notifier(&mac80211_netdev_notifier);
}
+
+#ifdef CONFIG_MAC80211_CAPWAP_WTP
+
+DEFINE_STATIC_KEY_FALSE(mac80211_capwap_wtp);
+
+static const struct net_device_ops ieee80211_capwapif_ops = {
+ .ndo_open = ieee80211_open,
+ .ndo_stop = ieee80211_stop,
+ .ndo_uninit = ieee80211_uninit,
+ .ndo_start_xmit = ieee80211_capwap_subif_start_xmit,
+ .ndo_set_rx_mode = ieee80211_set_multicast_list,
+ .ndo_change_mtu = ieee80211_change_mtu,
+ .ndo_set_mac_address = ieee80211_change_mac,
+ .ndo_select_queue = ieee80211_netdev_select_queue,
+ .ndo_get_stats64 = ieee80211_get_stats64,
+};
+
+int ieee80211_pcktunnel_register(struct net_device *dev, struct ieee80211_pcktunnel *handler)
+{
+ int ret = 0;
+ struct ieee80211_sub_if_data *sdata = IEEE80211_DEV_TO_SUB_IF(dev);
+
+ dev->netdev_ops = &ieee80211_capwapif_ops;
+
+ mutex_lock(&sdata->local->iflist_mtx);
+
+ if (rcu_dereference_protected(sdata->pcktunnel_handlers, lockdep_is_held(&sdata->local->iflist_mtx))) {
+ ret = -EBUSY;
+ } else {
+ rcu_assign_pointer(sdata->pcktunnel_handlers, handler);
+ static_branch_enable(&mac80211_capwap_wtp);
+ }
+
+ mutex_unlock(&sdata->local->iflist_mtx);
+ synchronize_net();
+
+ return ret;
+}
+EXPORT_SYMBOL(ieee80211_pcktunnel_register);
+
+int ieee80211_pcktunnel_deregister(struct net_device *dev, struct ieee80211_pcktunnel *handler)
+{
+ int ret = -ENODEV;
+ struct ieee80211_sub_if_data *sdata = IEEE80211_DEV_TO_SUB_IF(dev);
+ struct ieee80211_pcktunnel *h;
+
+ mutex_lock(&sdata->local->iflist_mtx);
+
+ h = rcu_dereference_protected(sdata->pcktunnel_handlers, lockdep_is_held(&sdata->local->iflist_mtx));
+ if (h == handler) {
+ ret = 0;
+ static_branch_disable(&mac80211_capwap_wtp);
+ rcu_assign_pointer(sdata->pcktunnel_handlers, NULL);
+ }
+
+ mutex_unlock(&sdata->local->iflist_mtx);
+ synchronize_net();
+
+ return ret;
+}
+EXPORT_SYMBOL(ieee80211_pcktunnel_deregister);
+
+#endif
diff --git a/net/mac80211/rx.c b/net/mac80211/rx.c
index 5e65e83..4a6d2cd 100644
--- a/net/mac80211/rx.c
+++ b/net/mac80211/rx.c
@@ -3097,6 +3097,56 @@ ieee80211_rx_h_mgmt(struct ieee80211_rx_data *rx)
return RX_QUEUED;
}
+#ifdef CONFIG_MAC80211_CAPWAP_WTP
+
+static ieee80211_rx_result debug_noinline
+ieee80211_rx_h_pcktunnel(struct ieee80211_rx_data *rx, struct ieee80211_rate *rate)
+{
+ struct ieee80211_pcktunnel *handler;
+
+ handler = rcu_dereference(rx->sdata->pcktunnel_handlers);
+ if (handler) {
+ u16 fc;
+ u16 fc_type;
+ int sig_dbm = 0;
+ unsigned char pckrate = 0;
+ struct ieee80211_rx_status *status = IEEE80211_SKB_RXCB(rx->skb);
+ struct ieee80211_hdr *hdr = (struct ieee80211_hdr *)rx->skb->data;
+
+ if (ieee80211_hw_check(&rx->local->hw, SIGNAL_DBM))
+ sig_dbm = status->signal;
+
+ if (rate && !(status->flag & (RX_FLAG_HT | RX_FLAG_VHT))) {
+ int shift = 0;
+ if (status->flag & RX_FLAG_10MHZ)
+ shift = 1;
+ else if (status->flag & RX_FLAG_5MHZ)
+ shift = 2;
+ pckrate = DIV_ROUND_UP(rate->bitrate, 5 * (1 << shift));
+ }
+
+ /* Retrieve type and subtype packet */
+ fc = le16_to_cpu(hdr->frame_control);
+ fc_type = ((fc & IEEE80211_FCTL_FTYPE) >> 2);
+ if (fc_type < 3) {
+ u16 bitmask = 1 << ((fc & IEEE80211_FCTL_STYPE) >> 4);
+
+ /* Delegate packet to external handler */
+ if (handler->subtype_mask[fc_type] & bitmask) {
+ if (handler->handler(rx->sdata->dev->ifindex, rx->skb, sig_dbm, pckrate, handler->data)) {
+ return RX_IGNORE_MONITOR;
+ }
+ }
+ }
+ }
+
+ return RX_CONTINUE;
+}
+
+/* TODO: use IEEE80211_RX_FRAGMENTED */
+
+#endif
+
static void ieee80211_rx_cooked_monitor(struct ieee80211_rx_data *rx,
struct ieee80211_rate *rate)
{
@@ -3176,6 +3226,9 @@ static void ieee80211_rx_handlers_result(struct ieee80211_rx_data *rx,
if (rx->sta)
rx->sta->rx_stats.dropped++;
/* fall through */
+#ifdef CONFIG_MAC80211_CAPWAP_WTP
+ case RX_IGNORE_MONITOR:
+#endif
case RX_CONTINUE: {
struct ieee80211_rate *rate = NULL;
struct ieee80211_supported_band *sband;
@@ -3204,7 +3257,9 @@ static void ieee80211_rx_handlers_result(struct ieee80211_rx_data *rx,
}
static void ieee80211_rx_handlers(struct ieee80211_rx_data *rx,
- struct sk_buff_head *frames)
+ struct sk_buff_head *frames,
+ struct ieee80211_rate *rate)
+
{
ieee80211_rx_result res = RX_DROP_MONITOR;
struct sk_buff *skb;
@@ -3243,6 +3298,15 @@ static void ieee80211_rx_handlers(struct ieee80211_rx_data *rx,
if (ieee80211_vif_is_mesh(&rx->sdata->vif))
CALL_RXH(ieee80211_rx_h_mesh_fwding);
#endif
+#ifdef CONFIG_MAC80211_CAPWAP_WTP
+ if (static_branch_unlikely(&mac80211_capwap_wtp)) {
+ /* special treatment */
+ res = ieee80211_rx_h_pcktunnel(rx, rate);
+ if (res != RX_CONTINUE)
+ goto rxh_next;
+ }
+#endif
+
CALL_RXH(ieee80211_rx_h_amsdu);
CALL_RXH(ieee80211_rx_h_data);
@@ -3266,7 +3330,8 @@ static void ieee80211_rx_handlers(struct ieee80211_rx_data *rx,
spin_unlock_bh(&rx->local->rx_path_lock);
}
-static void ieee80211_invoke_rx_handlers(struct ieee80211_rx_data *rx)
+static void ieee80211_invoke_rx_handlers(struct ieee80211_rx_data *rx,
+ struct ieee80211_rate *rate)
{
struct sk_buff_head reorder_release;
ieee80211_rx_result res = RX_DROP_MONITOR;
@@ -3285,7 +3350,7 @@ static void ieee80211_invoke_rx_handlers(struct ieee80211_rx_data *rx)
ieee80211_rx_reorder_ampdu(rx, &reorder_release);
- ieee80211_rx_handlers(rx, &reorder_release);
+ ieee80211_rx_handlers(rx, &reorder_release, rate);
return;
rxh_next:
@@ -3331,7 +3396,7 @@ void ieee80211_release_reorder_timeout(struct sta_info *sta, int tid)
drv_event_callback(rx.local, rx.sdata, &event);
}
- ieee80211_rx_handlers(&rx, &frames);
+ ieee80211_rx_handlers(&rx, &frames, NULL);
}
void ieee80211_mark_rx_ba_filtered_frames(struct ieee80211_sta *pubsta, u8 tid,
@@ -3406,7 +3471,7 @@ void ieee80211_mark_rx_ba_filtered_frames(struct ieee80211_sta *pubsta, u8 tid,
release:
spin_unlock_bh(&tid_agg_rx->reorder_lock);
- ieee80211_rx_handlers(&rx, &frames);
+ ieee80211_rx_handlers(&rx, &frames, NULL);
out:
rcu_read_unlock();
@@ -3878,7 +3943,9 @@ static bool ieee80211_invoke_fast_rx(struct ieee80211_rx_data *rx,
* or not the skb was consumed.
*/
static bool ieee80211_prepare_and_rx_handle(struct ieee80211_rx_data *rx,
- struct sk_buff *skb, bool consume)
+ struct sk_buff *skb,
+ struct ieee80211_rate *rate,
+ bool consume)
{
struct ieee80211_local *local = rx->local;
struct ieee80211_sub_if_data *sdata = rx->sdata;
@@ -3916,7 +3983,7 @@ static bool ieee80211_prepare_and_rx_handle(struct ieee80211_rx_data *rx,
rx->skb = skb;
}
- ieee80211_invoke_rx_handlers(rx);
+ ieee80211_invoke_rx_handlers(rx, rate);
return true;
}
@@ -3927,7 +3994,8 @@ static bool ieee80211_prepare_and_rx_handle(struct ieee80211_rx_data *rx,
static void __ieee80211_rx_handle_packet(struct ieee80211_hw *hw,
struct ieee80211_sta *pubsta,
struct sk_buff *skb,
- struct napi_struct *napi)
+ struct napi_struct *napi,
+ struct ieee80211_rate *rate)
{
struct ieee80211_local *local = hw_to_local(hw);
struct ieee80211_sub_if_data *sdata;
@@ -3973,7 +4041,7 @@ static void __ieee80211_rx_handle_packet(struct ieee80211_hw *hw,
if (pubsta) {
rx.sta = container_of(pubsta, struct sta_info, sta);
rx.sdata = rx.sta->sdata;
- if (ieee80211_prepare_and_rx_handle(&rx, skb, true))
+ if (ieee80211_prepare_and_rx_handle(&rx, skb, rate, true))
return;
goto out;
} else if (ieee80211_is_data(fc)) {
@@ -3992,7 +4060,7 @@ static void __ieee80211_rx_handle_packet(struct ieee80211_hw *hw,
rx.sta = prev_sta;
rx.sdata = prev_sta->sdata;
- ieee80211_prepare_and_rx_handle(&rx, skb, false);
+ ieee80211_prepare_and_rx_handle(&rx, skb, rate, false);
prev_sta = sta;
}
@@ -4001,7 +4069,7 @@ static void __ieee80211_rx_handle_packet(struct ieee80211_hw *hw,
rx.sta = prev_sta;
rx.sdata = prev_sta->sdata;
- if (ieee80211_prepare_and_rx_handle(&rx, skb, true))
+ if (ieee80211_prepare_and_rx_handle(&rx, skb, rate, true))
return;
goto out;
}
@@ -4030,7 +4098,7 @@ static void __ieee80211_rx_handle_packet(struct ieee80211_hw *hw,
rx.sta = sta_info_get_bss(prev, hdr->addr2);
rx.sdata = prev;
- ieee80211_prepare_and_rx_handle(&rx, skb, false);
+ ieee80211_prepare_and_rx_handle(&rx, skb, rate, false);
prev = sdata;
}
@@ -4039,7 +4107,7 @@ static void __ieee80211_rx_handle_packet(struct ieee80211_hw *hw,
rx.sta = sta_info_get_bss(prev, hdr->addr2);
rx.sdata = prev;
- if (ieee80211_prepare_and_rx_handle(&rx, skb, true))
+ if (ieee80211_prepare_and_rx_handle(&rx, skb, rate, true))
return;
}
@@ -4152,7 +4220,7 @@ void ieee80211_rx_napi(struct ieee80211_hw *hw, struct ieee80211_sta *pubsta,
((struct ieee80211_hdr *)skb->data)->frame_control,
skb->len);
- __ieee80211_rx_handle_packet(hw, pubsta, skb, napi);
+ __ieee80211_rx_handle_packet(hw, pubsta, skb, napi, rate);
rcu_read_unlock();
diff --git a/net/mac80211/tx.c b/net/mac80211/tx.c
index 2030443..bca96a4 100644
--- a/net/mac80211/tx.c
+++ b/net/mac80211/tx.c
@@ -3213,6 +3213,115 @@ netdev_tx_t ieee80211_subif_start_xmit(struct sk_buff *skb,
return NETDEV_TX_OK;
}
+#ifdef CONFIG_MAC80211_CAPWAP_WTP
+
+/*
+ * inject raw 802.11 frame, processing is mostly identical
+ * to ieee80211_monitor_start_xmit, except for the different
+ * headers
+ */
+static void __ieee80211_capwap_inject_start_xmit(struct sk_buff *skb,
+ struct net_device *dev)
+{
+ struct ieee80211_local *local = wdev_priv(dev->ieee80211_ptr);
+ struct ieee80211_chanctx_conf *chanctx_conf;
+ struct ieee80211_tx_info *info = IEEE80211_SKB_CB(skb);
+ struct ieee80211_hdr *hdr = (struct ieee80211_hdr *)skb->data;
+ struct ieee80211_sub_if_data *sdata;
+ struct cfg80211_chan_def *chandef;
+ int tid;
+ int hdrlen;
+
+ /* check for not even having the fixed 802.11 header */
+ if (unlikely(skb->len < sizeof(struct ieee80211_hdr)))
+ goto fail; /* too short to be possibly valid */
+
+ hdrlen = ieee80211_hdrlen(hdr->frame_control);
+
+ /* does the skb contain enough to deliver on the alleged length? */
+ if (unlikely(skb->len < hdrlen))
+ goto fail; /* skb too short for claimed header length */
+
+ skb_set_mac_header(skb, 0);
+ /*
+ * these are just fixed to the end of the rt area since we
+ * don't have any better information and at this point, nobody cares
+ */
+ skb_set_network_header(skb, hdrlen);
+ skb_set_transport_header(skb, hdrlen);
+
+ /*
+ * Initialize skb->protocol if the injected frame is a data frame
+ * carrying a rfc1042 header
+ */
+ if (ieee80211_is_data(hdr->frame_control) &&
+ skb->len >= hdrlen + sizeof(rfc1042_header) + 2) {
+ u8 *payload = (u8 *)hdr + hdrlen;
+
+ if (ether_addr_equal(payload, rfc1042_header))
+ skb->protocol = cpu_to_be16((payload[6] << 8) |
+ payload[7]);
+ }
+
+ if (ieee80211_is_data_qos(hdr->frame_control)) {
+ u8 *p = ieee80211_get_qos_ctl(hdr);
+
+ skb->priority = *p & IEEE80211_QOS_CTL_TAG1D_MASK;
+ }
+ skb_set_queue_mapping(skb, ieee802_1d_to_ac[skb->priority]);
+
+ memset(info, 0, sizeof(*info));
+ info->flags = IEEE80211_TX_CTL_REQ_TX_STATUS |
+ IEEE80211_TX_CTL_INJECTED;
+
+ /*
+ * we might have set these flags later.....
+ * info->flags &= ~IEEE80211_TX_INTFL_DONT_ENCRYPT;
+ * info->flags &= ~IEEE80211_TX_CTL_DONTFRAG;
+ */
+
+ rcu_read_lock();
+
+ sdata = IEEE80211_DEV_TO_SUB_IF(dev);
+
+ chanctx_conf = rcu_dereference(sdata->vif.chanctx_conf);
+ if (!chanctx_conf)
+ goto fail_rcu;
+
+ info->band = chanctx_conf->def.chan->band;
+
+ ieee80211_tx_stats(dev, skb->len);
+
+ ieee80211_xmit(sdata, NULL, skb);
+ rcu_read_unlock();
+
+ return;
+fail_rcu:
+ rcu_read_unlock();
+fail:
+ dev_kfree_skb(skb);
+}
+
+/**
+ * ieee80211_capwap_subif_start_xmit - netif start_xmit function for 802.3 vifs
+ * @skb: packet to be sent
+ * @dev: incoming interface
+ *
+ * On failure skb will be freed.
+ */
+netdev_tx_t ieee80211_capwap_subif_start_xmit(struct sk_buff *skb,
+ struct net_device *dev)
+{
+ if (skb->protocol == htons(ETH_P_CONTROL)) {
+ __ieee80211_capwap_inject_start_xmit(skb, dev);
+ } else
+ __ieee80211_subif_start_xmit(skb, dev, 0);
+
+ return NETDEV_TX_OK;
+}
+
+#endif
+
struct sk_buff *
ieee80211_build_data_template(struct ieee80211_sub_if_data *sdata,
struct sk_buff *skb, u32 info_flags)
@@ -4188,3 +4297,180 @@ void __ieee80211_tx_skb_tid_band(struct ieee80211_sub_if_data *sdata,
ieee80211_xmit(sdata, NULL, skb);
local_bh_enable();
}
+
+#ifdef CONFIG_MAC80211_CAPWAP_WTP
+
+netdev_tx_t ieee80211_inject_xmit(struct sk_buff* skb, struct net_device* dev) {
+ int multicast;
+ struct ieee80211_local *local = wdev_priv(dev->ieee80211_ptr);
+ struct ieee80211_chanctx_conf *chanctx_conf;
+ struct ieee80211_tx_info *info = IEEE80211_SKB_CB(skb);
+ struct ieee80211_sub_if_data *sdata;
+ struct cfg80211_chan_def *chandef;
+ struct ieee80211_hdr *hdr;
+ int hdrlen;
+ int queue_index;
+
+ /* */
+ if (skb->len < hdrlen) {
+ goto error;
+ }
+
+ /* */
+ skb->dev = dev;
+ skb_reset_mac_header(skb);
+ skb_reset_network_header(skb);
+ skb_reset_transport_header(skb);
+
+ hdr = (struct ieee80211_hdr *)skb->data;
+ hdrlen = ieee80211_hdrlen(hdr->frame_control);
+
+ if (skb->len < hdrlen) {
+ printk(KERN_WARNING "dropping packet (too small)\n");
+ goto error;
+ }
+
+ /*
+ * Initialize skb->protocol if the injected frame is a data frame
+ * carrying a rfc1042 header
+ */
+ if (ieee80211_is_data(hdr->frame_control) &&
+ skb->len >= hdrlen + sizeof(rfc1042_header) + 2) {
+ u8 *payload = (u8 *)hdr + hdrlen;
+
+ if (ether_addr_equal(payload, rfc1042_header))
+ skb->protocol = cpu_to_be16((payload[6] << 8) |
+ payload[7]);
+ }
+
+ memset(info, 0, sizeof(struct ieee80211_tx_info));
+
+ rcu_read_lock();
+
+ sdata = IEEE80211_DEV_TO_SUB_IF(dev);
+
+ if (sdata->vif.type != NL80211_IFTYPE_AP) {
+ printk(KERN_WARNING "dropping packet (not AP)\n");
+ goto error_rcu;
+ }
+
+ chanctx_conf = rcu_dereference(sdata->vif.chanctx_conf);
+ if (!chanctx_conf) {
+ printk(KERN_WARNING "dropping packet (no chanCTX)\n");
+ goto error_rcu;
+ }
+
+ chandef = &chanctx_conf->def;
+
+ queue_index = ieee80211_select_queue_80211(sdata, skb, hdr);
+ skb_set_queue_mapping(skb, queue_index);
+
+ info->band = chandef->chan->band;
+ info->hw_queue =
+ sdata->vif.hw_queue[queue_index];
+
+ /*
+ * Frame injection is not allowed if beaconing is not allowed
+ * or if we need radar detection. Beaconing is usually not allowed when
+ * the mode or operation (Adhoc, AP, Mesh) does not support DFS.
+ * Passive scan is also used in world regulatory domains where
+ * your country is not known and as such it should be treated as
+ * NO TX unless the channel is explicitly allowed in which case
+ * your current regulatory domain would not have the passive scan
+ * flag.
+ *
+ * Since AP mode uses monitor interfaces to inject/TX management
+ * frames we can make AP mode the exception to this rule once it
+ * supports radar detection as its implementation can deal with
+ * radar detection by itself. We can do that later by adding a
+ * monitor flag interfaces used for AP support.
+ */
+ if (!cfg80211_reg_can_beacon(local->hw.wiphy, chandef,
+ sdata->vif.type)) {
+ printk(KERN_WARNING "dropping packet (cannot BEACON)\n");
+ goto error_rcu;
+ }
+ /* */
+ multicast = is_multicast_ether_addr(hdr->addr1);
+ if (!multicast) {
+ struct sta_info* sta = sta_info_get(sdata, hdr->addr1);
+ if (sta && test_sta_flag(sta, WLAN_STA_AUTHORIZED)) {
+ skb->pkt_type = PACKET_OTHERHOST;
+ } else {
+ printk(KERN_WARNING "dropping packet (STA not authorized)\n");
+ goto error_rcu;
+ }
+ } else {
+ if (ether_addr_equal_64bits(hdr->addr1, dev->broadcast)) {
+ skb->pkt_type = PACKET_BROADCAST;
+ } else {
+ skb->pkt_type = PACKET_MULTICAST;
+ }
+ }
+
+ /* */
+ if (unlikely(!multicast && skb->sk &&
+ skb_shinfo(skb)->tx_flags & SKBTX_WIFI_STATUS)) {
+ struct sk_buff *ack_skb = skb_clone_sk(skb);
+
+ if (ack_skb) {
+ unsigned long flags;
+ int id;
+ struct ieee80211_local* local = sdata->local;
+
+ spin_lock_irqsave(&local->ack_status_lock, flags);
+ id = idr_alloc(&local->ack_status_frames, ack_skb,
+ 1, 0x10000, GFP_ATOMIC);
+ spin_unlock_irqrestore(&local->ack_status_lock, flags);
+
+ if (id >= 0) {
+ info->ack_frame_id = id;
+ info->flags |= IEEE80211_TX_CTL_REQ_TX_STATUS;
+ } else {
+ kfree_skb(ack_skb);
+ }
+ }
+ }
+
+#if 0
+ /* If the skb is shared we need to obtain our own copy. */
+ if (skb_shared(skb)) {
+ struct sk_buff *tmp_skb = skb;
+
+ /* can't happen -- skb is a clone if info_id != 0 */
+ WARN_ON(info->ack_frame_id);
+
+ skb = skb_clone(skb, GFP_ATOMIC);
+ kfree_skb(tmp_skb);
+
+ if (!skb)
+ goto error_rcu;
+ }
+#endif
+
+ /* */
+ hdr->duration_id = 0;
+ hdr->seq_ctrl = 0;
+
+ /* */
+ ieee80211_tx_stats(dev, skb->len);
+
+ /* */
+/* dev->trans_start = jiffies; */
+
+ /* */
+ ieee80211_xmit(sdata, NULL, skb);
+ rcu_read_unlock();
+
+ return NETDEV_TX_OK;
+
+error_rcu:
+ rcu_read_unlock();
+
+error:
+ dev_kfree_skb(skb);
+ return NETDEV_TX_OK;
+}
+EXPORT_SYMBOL(ieee80211_inject_xmit);
+
+#endif
--
2.9.3

View File

@ -1,7 +1,9 @@
obj-m += smartcapwap.o
obj-m += wtp.o
smartcapwap-y := \
wtp-y := \
main.o \
netlinkapp.o \
capwap.o \
capwap_private.o
CFLAGS_capwap.o = -I$(src)

486
kmod/capwap-trace.h Normal file
View File

@ -0,0 +1,486 @@
#if !defined(__CAPWAP_DRIVER_TRACE_H) || defined(TRACE_HEADER_MULTI_READ)
#define __CAPWAP_DRIVER_TRACE_H
#include <linux/tracepoint.h>
#include <net/mac80211.h>
#include "capwap.h"
#undef TRACE_SYSTEM
#define TRACE_SYSTEM capwap
#define SESSION_ENTRY __array(char, sessionid, 16)
#define SESSION_ASSIGN ((session) ? memcpy(__entry->sessionid, &session->sessionid, 16) : memset(__entry->sessionid, 0, 16))
#define SESSION_PR_FMT " session:%16phN"
#define SESSION_PR_ARG __entry->sessionid
#define SESSIONID_ENTRY __array(char, sessionid, 16)
#define SESSIONID_ASSIGN ((sessionid) ? memcpy(__entry->sessionid, sessionid, 16) : memset(__entry->sessionid, 0, 16))
#define SESSIONID_PR_FMT " session:%16phN"
#define SESSIONID_PR_ARG __entry->sessionid
#define SKB_ENTRY __field(struct sk_buff *, skb)
#define SKB_ASSIGN __entry->skb = skb
#define SKB_PR_FMT " skb:%p"
#define SKB_PR_ARG __entry->skb
#define FRAGMENT_ENTRY __field(struct sc_capwap_fragment *, fragment)
#define FRAGMENT_ASSIGN __entry->fragment = fragment
#define FRAGMENT_PR_FMT " frag:%p"
#define FRAGMENT_PR_ARG __entry->fragment
#define BSSID_ENTRY __array(char, bssid, ETH_ALEN)
#define BSSID_ASSIGN (bssid ? memcpy(__entry->bssid, bssid, ETH_ALEN) : memset(__entry->bssid, 0, ETH_ALEN))
#define BSSID_PR_FMT " BSS:%pM"
#define BSSID_PR_ARG __entry->bssid
/* capwap.c */
TRACE_EVENT(sc_capwap_fragment_free,
TP_PROTO(struct sc_capwap_fragment *fragment),
TP_ARGS(fragment),
TP_STRUCT__entry(
FRAGMENT_ENTRY
),
TP_fast_assign(
FRAGMENT_ASSIGN;
),
TP_printk(FRAGMENT_PR_FMT, FRAGMENT_PR_ARG)
);
TRACE_EVENT(sc_capwap_freesession,
TP_PROTO(struct sc_capwap_session *session),
TP_ARGS(session),
TP_STRUCT__entry(
SESSION_ENTRY
),
TP_fast_assign(
SESSION_ASSIGN;
),
TP_printk(SESSION_PR_FMT, SESSION_PR_ARG)
);
TRACE_EVENT(sc_capwap_defrag_evictor,
TP_PROTO(struct sc_capwap_session *session),
TP_ARGS(session),
TP_STRUCT__entry(
SESSION_ENTRY
),
TP_fast_assign(
SESSION_ASSIGN;
),
TP_printk(SESSION_PR_FMT, SESSION_PR_ARG)
);
TRACE_EVENT(sc_capwap_defrag_evictor_fragment_expired,
TP_PROTO(struct sc_capwap_session *session,
struct sc_capwap_fragment *fragment,
ktime_t now),
TP_ARGS(session,
fragment,
now),
TP_STRUCT__entry(
SESSION_ENTRY
FRAGMENT_ENTRY
__field(u64, now)
__field(u64, tstamp)
),
TP_fast_assign(
SESSION_ASSIGN;
FRAGMENT_ASSIGN;
__entry->now = now.tv64;
__entry->tstamp = fragment->tstamp.tv64;
),
TP_printk(SESSION_PR_FMT FRAGMENT_PR_FMT " (%llu %llu)",
SESSION_PR_ARG, FRAGMENT_PR_ARG,
__entry->now,
__entry->tstamp
)
);
TRACE_EVENT(sc_capwap_reasm,
TP_PROTO(struct sc_capwap_fragment *fragment),
TP_ARGS(fragment),
TP_STRUCT__entry(
FRAGMENT_ENTRY
),
TP_fast_assign(
FRAGMENT_ASSIGN;
),
TP_printk(FRAGMENT_PR_FMT, FRAGMENT_PR_ARG)
);
TRACE_EVENT(sc_capwap_defrag,
TP_PROTO(struct sc_capwap_session *session,
uint16_t id,
uint16_t offset,
uint16_t length),
TP_ARGS(session, id, offset, length),
TP_STRUCT__entry(
SESSION_ENTRY
__field(u16, id)
__field(u16, offset)
__field(u16, length)
),
TP_fast_assign(
SESSION_ASSIGN;
__entry->id = id;
__entry->offset = offset;
__entry->length = length;
),
TP_printk(
SESSION_PR_FMT " fragment id:%hu offset:%hu length:%hu",
SESSION_PR_ARG, __entry->id, __entry->offset, __entry->length
)
);
// TRACEKMOD("** *Fragment info: id %hu offset %hu length %hu\n", frag_id, cb->frag_offset, cb->frag_length);
TRACE_EVENT(sc_capwap_8023_to_80211,
TP_PROTO(struct sk_buff *skb, const uint8_t *bssid),
TP_ARGS(skb, bssid),
TP_STRUCT__entry(
SKB_ENTRY
BSSID_ENTRY
),
TP_fast_assign(
SKB_ASSIGN;
BSSID_ASSIGN;
),
TP_printk(
SKB_PR_FMT BSSID_PR_FMT,
SKB_PR_ARG, BSSID_PR_ARG
)
);
TRACE_EVENT(sc_capwap_80211_to_8023,
TP_PROTO(struct sk_buff *skb),
TP_ARGS(skb),
TP_STRUCT__entry(
SKB_ENTRY
),
TP_fast_assign(
SKB_ASSIGN;
),
TP_printk(SKB_PR_FMT, SKB_PR_ARG)
);
TRACE_EVENT(sc_capwap_create,
TP_PROTO(struct sc_capwap_session *session),
TP_ARGS(session),
TP_STRUCT__entry(
SESSION_ENTRY
),
TP_fast_assign(
SESSION_ASSIGN;
),
TP_printk(SESSION_PR_FMT, SESSION_PR_ARG)
);
TRACE_EVENT(sc_capwap_close,
TP_PROTO(struct sc_capwap_session *session),
TP_ARGS(session),
TP_STRUCT__entry(
SESSION_ENTRY
),
TP_fast_assign(
SESSION_ASSIGN;
),
TP_printk(SESSION_PR_FMT, SESSION_PR_ARG)
);
TRACE_EVENT(sc_capwap_newfragmentid,
TP_PROTO(struct sc_capwap_session *session),
TP_ARGS(session),
TP_STRUCT__entry(
SESSION_ENTRY
),
TP_fast_assign(
SESSION_ASSIGN;
),
TP_printk(SESSION_PR_FMT, SESSION_PR_ARG)
);
TRACE_EVENT(sc_capwap_createkeepalive,
TP_PROTO(struct sc_capwap_sessionid_element *sessionid),
TP_ARGS(sessionid),
TP_STRUCT__entry(
SESSIONID_ENTRY
),
TP_fast_assign(
SESSIONID_ASSIGN;
),
TP_printk(SESSIONID_PR_FMT, SESSIONID_PR_ARG)
);
TRACE_EVENT(sc_capwap_parsingpacket,
TP_PROTO(struct sc_capwap_session *session,
struct sk_buff *skb),
TP_ARGS(session, skb),
TP_STRUCT__entry(
SESSION_ENTRY
SKB_ENTRY
),
TP_fast_assign(
SESSION_ASSIGN;
SKB_ASSIGN;
),
TP_printk(
SESSION_PR_FMT SKB_PR_FMT,
SESSION_PR_ARG, SKB_PR_ARG
)
);
TRACE_EVENT(sc_capwap_forwarddata,
TP_PROTO(struct sc_capwap_session *session,
uint8_t radioid,
uint8_t binding,
struct sk_buff *skb,
uint32_t flags,
struct sc_capwap_radio_addr *radioaddr,
int radioaddrlength,
struct sc_capwap_wireless_information *winfo),
TP_ARGS(session, radioid, binding, skb, flags, radioaddr, radioaddrlength, winfo),
TP_STRUCT__entry(
SESSION_ENTRY
__field(u8, radioid)
__field(u8, binding)
SKB_ENTRY
__field(u32, flags)
__field(int, radioaddrlength)
__array(char, radioaddr, 8)
__field(u8, rssi)
__field(u8, snr)
__field(u16, rate)
),
TP_fast_assign(
SESSION_ASSIGN;
__entry->radioid = radioid;
__entry->binding = binding;
SKB_ASSIGN;
__entry->binding = flags;
__entry->radioaddrlength = radioaddrlength;
((radioaddrlength != 0 && radioaddr) ? memcpy(__entry->radioaddr, radioaddr, min(radioaddrlength, 8)) : memset(__entry->radioaddr, 0, 8));
__entry->rssi = (winfo) ? ((struct sc_capwap_ieee80211_frame_info *)(winfo))->rssi : 0;
__entry->snr = (winfo) ? ((struct sc_capwap_ieee80211_frame_info *)(winfo))->snr : 0;
__entry->rate = (winfo) ? ((struct sc_capwap_ieee80211_frame_info *)(winfo))->rate : 0;
),
TP_printk(
SESSION_PR_FMT " radio:%d binding:%d" SKB_PR_FMT
"radioaddr:%*phC rssid:%d snr:%d rate:%d",
SESSION_PR_ARG, __entry->radioid, __entry->binding, SKB_PR_ARG,
min(__entry->radioaddrlength, 8), __entry->radioaddr,
__entry->rssi, __entry->snr, __entry->rate
)
);
TRACE_EVENT(sc_capwap_setradiomacaddress,
TP_PROTO(uint8_t *bssid),
TP_ARGS(bssid),
TP_STRUCT__entry(
BSSID_ENTRY
),
TP_fast_assign(
BSSID_ASSIGN;
),
TP_printk(BSSID_PR_FMT, BSSID_PR_ARG)
);
TRACE_EVENT(sc_capwap_setwinfo_frameinfo,
TP_PROTO(uint8_t rssi,
uint8_t snr,
uint16_t rate),
TP_ARGS(rssi, snr, rate),
TP_STRUCT__entry(
__field(u8, rssi)
__field(u8, snr)
__field(u16, rate)
),
TP_fast_assign(
__entry->rssi = rssi;
__entry->snr = snr;
__entry->rate = rate;
),
TP_printk(
" rssid:%d snr:%d rate:%d",
__entry->rssi, __entry->snr, __entry->rate
)
);
TRACE_EVENT(sc_capwap_setwinfo_destwlans,
TP_PROTO(uint16_t wlanidbitmap),
TP_ARGS(wlanidbitmap),
TP_STRUCT__entry(
__field(u16, wlanidbitmap)
),
TP_fast_assign(
__entry->wlanidbitmap = wlanidbitmap;
),
TP_printk(" id:%04x", __entry->wlanidbitmap)
);
/* capwap_private.c */
TRACE_EVENT(sc_capwap_resetsession,
TP_PROTO(struct sc_capwap_session *session),
TP_ARGS(session),
TP_STRUCT__entry(
SESSION_ENTRY
),
TP_fast_assign(
SESSION_ASSIGN;
),
TP_printk(SESSION_PR_FMT, SESSION_PR_ARG)
);
TRACE_EVENT(sc_capwap_sendkeepalive,
TP_PROTO(struct sc_capwap_session *session),
TP_ARGS(session),
TP_STRUCT__entry(
SESSION_ENTRY
),
TP_fast_assign(
SESSION_ASSIGN;
),
TP_printk(SESSION_PR_FMT, SESSION_PR_ARG)
);
TRACE_EVENT(sc_capwap_send,
TP_PROTO(struct sc_capwap_session *session),
TP_ARGS(session),
TP_STRUCT__entry(
SESSION_ENTRY
),
TP_fast_assign(
SESSION_ASSIGN;
),
TP_printk(SESSION_PR_FMT, SESSION_PR_ARG)
);
TRACE_EVENT(sc_send_80211,
TP_PROTO(struct sk_buff *skb, struct net_device *dev),
TP_ARGS(skb, dev),
TP_STRUCT__entry(
SKB_ENTRY
__array(char, dev_name, 32)
),
TP_fast_assign(
SKB_ASSIGN;
strlcpy(__entry->dev_name, dev->name, 32);
),
TP_printk(" %s" SKB_PR_FMT, __entry->dev_name, SKB_PR_ARG)
);
TRACE_EVENT(sc_capwap_parsingdatapacket,
TP_PROTO(struct sc_capwap_session *session,
struct sk_buff *skb),
TP_ARGS(session, skb),
TP_STRUCT__entry(
SESSION_ENTRY
SKB_ENTRY
),
TP_fast_assign(
SESSION_ASSIGN;
SKB_ASSIGN;
),
TP_printk(
SESSION_PR_FMT SKB_PR_FMT,
SESSION_PR_ARG, SKB_PR_ARG
)
);
#endif /* !__CAPWAP_DRIVER_TRACE_H || TRACE_HEADER_MULTI_READ */
#undef TRACE_INCLUDE_PATH
#define TRACE_INCLUDE_PATH .
#undef TRACE_INCLUDE_FILE
#define TRACE_INCLUDE_FILE capwap-trace
#include <trace/define_trace.h>

View File

@ -10,6 +10,9 @@
#include "nlsmartcapwap.h"
#include "netlinkapp.h"
#define CREATE_TRACE_POINTS
#include "capwap-trace.h"
/* Ethernet-II snap header (RFC1042 for most EtherTypes) */
static const unsigned char sc_rfc1042_header[] = { 0xaa, 0xaa, 0x03, 0x00, 0x00, 0x00 };
@ -19,7 +22,7 @@ static const unsigned char sc_bridge_tunnel_header[] = { 0xaa, 0xaa, 0x03, 0x00,
/* */
static void sc_capwap_fragment_free(struct sc_capwap_fragment* fragment)
{
TRACEKMOD("### sc_capwap_fragment_free\n");
trace_sc_capwap_fragment_free(fragment);
/* */
list_del(&fragment->lru_list);
@ -42,7 +45,7 @@ static void sc_capwap_freesession(struct sc_capwap_session* session)
struct sc_capwap_fragment* fragment;
struct sc_station *sta;
TRACEKMOD("### sc_capwap_freesession\n");
trace_sc_capwap_freesession(session);
/* Free socket buffers */
list_for_each_entry_safe(fragment, temp, &session->fragments.lru_list, lru_list) {
@ -63,7 +66,7 @@ static void sc_capwap_defrag_evictor(struct sc_capwap_session* session, ktime_t
struct sc_capwap_fragment* fragment;
struct list_head* list = &session->fragments.lru_list;
TRACEKMOD("### sc_capwap_defrag_evictor\n");
trace_sc_capwap_defrag_evictor(session);
/* Light check without lock */
if (!list_empty(list)) {
@ -74,7 +77,7 @@ static void sc_capwap_defrag_evictor(struct sc_capwap_session* session, ktime_t
fragment = list_first_entry(list, struct sc_capwap_fragment, lru_list);
delta = ktime_sub(now, fragment->tstamp);
if ((delta.tv64 < -NSEC_PER_SEC) || (delta.tv64 > NSEC_PER_SEC)) {
TRACEKMOD("*** Expired fragment %hu (%llu %llu)\n", fragment->fragmentid, now.tv64, fragment->tstamp.tv64);
trace_sc_capwap_defrag_evictor_fragment_expired(session, fragment, now);
sc_capwap_fragment_free(fragment);
}
}
@ -91,7 +94,7 @@ static struct sk_buff* sc_capwap_reasm(struct sc_capwap_fragment* fragment) {
struct sk_buff* skbfrag;
struct sc_capwap_header* header;
TRACEKMOD("### sc_capwap_reasm\n");
trace_sc_capwap_reasm(fragment);
/* */
skbfrag = fragment->fragments;
@ -140,8 +143,6 @@ static struct sk_buff* sc_capwap_defrag(struct sc_capwap_session* session, struc
struct sk_buff* skb_defrag = NULL;
struct sc_capwap_header* header = (struct sc_capwap_header*)skb->data;
TRACEKMOD("### sc_capwap_defrag\n");
/* */
headersize = GET_HLEN_HEADER(header) * 4;
if (skb->len < headersize) {
@ -157,9 +158,10 @@ static struct sk_buff* sc_capwap_defrag(struct sc_capwap_session* session, struc
cb->frag_offset = be16_to_cpu(header->frag_off);
cb->frag_length = skb->len - headersize;
trace_sc_capwap_defrag(session, frag_id, cb->frag_offset, cb->frag_length);
/* */
spin_lock(&session->fragments.lock);
TRACEKMOD("*** Fragment info: id %hu offset %hu length %hu\n", frag_id, cb->frag_offset, cb->frag_length);
/* Get fragment */
fragment = &session->fragments.queues[frag_id % CAPWAP_FRAGMENT_QUEUE];
@ -266,8 +268,6 @@ error:
static unsigned int sc_capwap_80211_hdrlen(__le16 fc) {
unsigned int hdrlen = 24;
TRACEKMOD("### sc_capwap_80211_hdrlen\n");
if (ieee80211_is_data(fc)) {
if (ieee80211_has_a4(fc)) {
hdrlen = 30;
@ -301,7 +301,7 @@ int sc_capwap_8023_to_80211(struct sk_buff* skb, const uint8_t* bssid) {
struct ethhdr* eh = (struct ethhdr*)skb->data;
uint16_t ethertype = ntohs(eh->h_proto);
TRACEKMOD("### sc_capwap_8023_to_80211\n");
trace_sc_capwap_8023_to_80211(skb, bssid);
/* IEEE 802.11 header */
hdrlen = 24;
@ -367,7 +367,7 @@ int sc_capwap_80211_to_8023(struct sk_buff* skb) {
uint8_t dst[ETH_ALEN];
uint8_t src[ETH_ALEN] __aligned(2);
TRACEKMOD("### sc_capwap_80211_to_8023\n");
trace_sc_capwap_80211_to_8023(skb);
/* */
hdrlen = sc_capwap_80211_hdrlen(hdr->frame_control);
@ -411,7 +411,7 @@ int sc_capwap_create(struct sc_capwap_session *session)
.encap_rcv = sc_capwap_recvpacket
};
TRACEKMOD("### sc_capwap_bind\n");
trace_sc_capwap_create(session);
if (session->socket)
return -EBUSY;
@ -441,7 +441,7 @@ error:
void sc_capwap_close(struct sc_capwap_session *session)
{
TRACEKMOD("### sc_capwap_close\n");
trace_sc_capwap_close(session);
if (session->socket)
udp_tunnel_sock_release(session->socket);
@ -453,7 +453,7 @@ void sc_capwap_close(struct sc_capwap_session *session)
/* */
static uint16_t sc_capwap_newfragmentid(struct sc_capwap_session* session)
{
TRACEKMOD("### sc_capwap_newfragmentid\n");
trace_sc_capwap_newfragmentid(session);
return atomic_inc_return(&session->fragmentid) & 0xFFFF;
}
@ -465,7 +465,7 @@ int sc_capwap_createkeepalive(struct sc_capwap_sessionid_element* sessionid, uin
struct sc_capwap_data_message* dataheader;
struct sc_capwap_message_element* msgelement;
TRACEKMOD("### sc_capwap_createkeepalive\n");
trace_sc_capwap_createkeepalive(sessionid);
/* */
if (size < CAPWAP_KEEP_ALIVE_MAX_SIZE) {
@ -515,7 +515,7 @@ int sc_capwap_parsingpacket(struct sc_capwap_session* session,
struct sc_capwap_message_element* message;
struct sc_capwap_header* header = (struct sc_capwap_header*)skb->data;
TRACEKMOD("### sc_capwap_parsingpacket\n");
trace_sc_capwap_parsingpacket(session, skb);
/* Linearize socket buffer */
if (skb_linearize(skb)) {
@ -637,7 +637,16 @@ int sc_capwap_parsingpacket(struct sc_capwap_session* session,
}
/* */
int sc_capwap_forwarddata(struct sc_capwap_session* session, uint8_t radioid, uint8_t binding, struct sk_buff* skb, uint32_t flags, struct sc_capwap_radio_addr* radioaddr, int radioaddrlength, struct sc_capwap_wireless_information* winfo, int winfolength) {
int sc_capwap_forwarddata(struct sc_capwap_session* session,
uint8_t radioid,
uint8_t binding,
struct sk_buff* skb,
uint32_t flags,
struct sc_capwap_radio_addr* radioaddr,
int radioaddrlength,
struct sc_capwap_wireless_information* winfo,
int winfolength)
{
int err;
int size;
int length;
@ -650,7 +659,7 @@ int sc_capwap_forwarddata(struct sc_capwap_session* session, uint8_t radioid, ui
struct sk_buff* clone = NULL;
int packetlength = skb->len;
TRACEKMOD("### sc_capwap_forwarddata\n");
trace_sc_capwap_forwarddata(session, radioid, binding, skb, flags, radioaddr, radioaddrlength, winfo);
/* Check headroom */
headroom = skb_headroom(skb);
@ -745,25 +754,12 @@ int sc_capwap_forwarddata(struct sc_capwap_session* session, uint8_t radioid, ui
return (!packetlength ? 0 : -EIO);
}
/* */
void sc_capwap_sessionid_printf(const struct sc_capwap_sessionid_element* sessionid, char* string) {
int i;
char* pos = string;
for (i = 0; i < 16; i++) {
snprintf(pos, 3, "%02x", sessionid->id[i]);
pos += 2;
}
*pos = 0;
}
/* */
struct sc_capwap_radio_addr* sc_capwap_setradiomacaddress(uint8_t* buffer, int size, uint8_t* bssid) {
struct sc_capwap_radio_addr* radioaddr;
struct sc_capwap_macaddress_eui48* addr;
TRACEKMOD("### sc_capwap_setwirelessinformation\n");
trace_sc_capwap_setradiomacaddress(bssid);
memset(buffer, 0, size);
@ -781,7 +777,7 @@ struct sc_capwap_wireless_information* sc_capwap_setwinfo_frameinfo(uint8_t* buf
struct sc_capwap_wireless_information* winfo;
struct sc_capwap_ieee80211_frame_info* frameinfo;
TRACEKMOD("### sc_capwap_setwinfo_frameinfo\n");
trace_sc_capwap_setwinfo_frameinfo(rssi, snr, rate);
memset(buffer, 0, size);
@ -801,7 +797,7 @@ struct sc_capwap_wireless_information* sc_capwap_setwinfo_destwlans(uint8_t* buf
struct sc_capwap_wireless_information* winfo;
struct sc_capwap_destination_wlans* destwlans;
TRACEKMOD("### sc_capwap_setwinfo_destwlans\n");
trace_sc_capwap_setwinfo_destwlans(wlanidbitmap);
memset(buffer, 0, size);

View File

@ -50,12 +50,15 @@ union capwap_addr {
struct sockaddr_storage ss;
};
#define STA_FLAG_AKM_ONLY 0x0001
struct sc_station {
struct hlist_node station_list;
uint8_t radioid;
uint8_t mac[ETH_ALEN];
uint8_t wlanid;
uint32_t flags;
struct rcu_head rcu_head;
};
@ -136,8 +139,6 @@ void sc_capwap_close(struct sc_capwap_session *session);
int sc_capwap_8023_to_80211(struct sk_buff* skb, const uint8_t* bssid);
int sc_capwap_80211_to_8023(struct sk_buff* skb);
void sc_capwap_sessionid_printf(const struct sc_capwap_sessionid_element* sessionid, char* string);
int sc_capwap_createkeepalive(struct sc_capwap_sessionid_element* sessionid, uint8_t* buffer, int size);
int sc_capwap_parsingpacket(struct sc_capwap_session* session, struct sk_buff* skb);

View File

@ -13,6 +13,7 @@
#include "capwap.h"
#include "nlsmartcapwap.h"
#include "netlinkapp.h"
#include "capwap-trace.h"
/* */
int sc_capwap_init(struct sc_capwap_session *session, struct net *net)
@ -42,7 +43,7 @@ int sc_capwap_init(struct sc_capwap_session *session, struct net *net)
/* */
void sc_capwap_resetsession(struct sc_capwap_session *session)
{
TRACEKMOD("### sc_capwap_resetsession\n");
trace_sc_capwap_resetsession(session);
sc_capwap_close(session);
sc_capwap_init(session, session->net);
@ -55,7 +56,7 @@ int sc_capwap_sendkeepalive(struct sc_capwap_session *session)
int length;
uint8_t buffer[CAPWAP_KEEP_ALIVE_MAX_SIZE];
TRACEKMOD("### sc_capwap_sendkeepalive\n");
trace_sc_capwap_sendkeepalive(session);
/* Build keepalive */
length = sc_capwap_createkeepalive(&session->sessionid, buffer, CAPWAP_KEEP_ALIVE_MAX_SIZE);
@ -80,7 +81,7 @@ int sc_capwap_send(struct sc_capwap_session *session, uint8_t* buffer, int lengt
.msg_flags = MSG_DONTWAIT | MSG_NOSIGNAL,
};
TRACEKMOD("### sc_capwap_send\n");
trace_sc_capwap_send(session);
return kernel_sendmsg(session->socket, &msg, &vec, 1, vec.iov_len);
}
@ -169,11 +170,8 @@ static void sc_send_8023(struct sk_buff *skb, struct net_device *dev)
static void sc_send_80211(struct sk_buff *skb, struct net_device *dev)
{
struct ieee80211_tx_info *info = IEEE80211_SKB_CB(skb);
struct ieee80211_hdr *hdr;
int hdrlen;
printk(KERN_DEBUG "capwap inject: %s: hdr: %p\n",
dev->name, skb->data);
trace_sc_send_80211(skb, dev);
/* detach skb from CAPWAP */
skb_orphan(skb);
@ -185,17 +183,15 @@ static void sc_send_80211(struct sk_buff *skb, struct net_device *dev)
/* drop conntrack reference */
nf_reset(skb);
hdr = (struct ieee80211_hdr *)skb->data;
hdrlen = ieee80211_hdrlen(hdr->frame_control);
skb_reset_mac_header(skb);
skb_reset_network_header(skb);
skb_reset_transport_header(skb);
skb->dev = dev;
skb_set_mac_header(skb, hdrlen);
skb_set_network_header(skb, hdrlen);
skb_set_transport_header(skb, hdrlen);
skb->protocol = htons(ETH_P_CONTROL);
info->flags |= IEEE80211_TX_CTL_INJECTED;
memset(info, 0, sizeof(*info));
info->flags = IEEE80211_TX_CTL_INJECTED;
/* Force the device to verify it. */
skb->ip_summed = CHECKSUM_NONE;
@ -217,7 +213,7 @@ void sc_capwap_parsingdatapacket(struct sc_capwap_session* session, struct sk_bu
struct sc_capwap_destination_wlans* destwlan = NULL;
int winfosize = 0;
TRACEKMOD("### sc_capwap_parsingdatapacket\n");
trace_sc_capwap_parsingdatapacket(session, skb);
/* Retrieve optional attribute */
pos = skb->data + sizeof(struct sc_capwap_header);

View File

@ -29,4 +29,4 @@ module_exit(smartcapwap_wtp_exit);
MODULE_LICENSE("GPL");
MODULE_AUTHOR("Massimo Vellucci <vemax78@gmail.com>");
MODULE_DESCRIPTION("SmartCAPWAP WTP Data Channel Module");
MODULE_DESCRIPTION("FreeWTP CAPWAP Data Channel Module");

View File

@ -85,32 +85,58 @@ static int sc_netlink_handler(uint32_t ifindex, struct sk_buff* skb,
int err;
uint8_t radioaddrbuffer[CAPWAP_RADIO_EUI48_LENGTH_PADDED];
uint8_t winfobuffer[CAPWAP_WINFO_FRAMEINFO_LENGTH_PADDED];
uint16_t hdrlen, ethertype;
uint8_t *payload;
struct sc_capwap_radio_addr* radioaddr = NULL;
struct sc_capwap_wireless_information* winfo = NULL;
uint32_t flags = nldev->flags;
/* Drop packet */
ret = -1;
/* IEEE 802.11 into IEEE 802.3 */
if (nldev->flags & NLSMARTCAPWAP_FLAGS_TUNNEL_8023) {
if (ieee80211_data_to_8023(skb, nldev->dev->dev_addr, NL80211_IFTYPE_AP)) {
goto error;
}
hdrlen = ieee80211_hdrlen(hdr->frame_control);
if (!pskb_may_pull(skb, hdrlen + 8))
goto error;
/* Create Radio Mac Address */
radioaddr = sc_capwap_setradiomacaddress(radioaddrbuffer, CAPWAP_RADIO_EUI48_LENGTH_PADDED, nldev->dev->dev_addr);
payload = skb->data + hdrlen;
ethertype = (payload[6] << 8) | payload[7];
TRACEKMOD("### sc_netlink_handler, ethertype %04x\n", ethertype);
switch (ethertype) {
case ETH_P_PAE:
/* forward EAPOL as raw 802.11 frame, clear 802.3 tunnel flag */
flags &= ~NLSMARTCAPWAP_FLAGS_TUNNEL_8023;
break;
default:
/* IEEE 802.11 into IEEE 802.3 */
if (nldev->flags & NLSMARTCAPWAP_FLAGS_TUNNEL_8023) {
if (ieee80211_data_to_8023(skb, nldev->dev->dev_addr, NL80211_IFTYPE_AP))
goto error;
/* Create Radio Mac Address */
radioaddr =
sc_capwap_setradiomacaddress(radioaddrbuffer,
CAPWAP_RADIO_EUI48_LENGTH_PADDED,
nldev->dev->dev_addr);
}
break;
}
/* Create Wireless Information */
if (sig_dbm || rate) {
winfo = sc_capwap_setwinfo_frameinfo(winfobuffer, CAPWAP_WINFO_FRAMEINFO_LENGTH_PADDED, (uint8_t)sig_dbm, 0, ((uint16_t)rate) * 5);
}
if (sig_dbm || rate)
winfo = sc_capwap_setwinfo_frameinfo(winfobuffer,
CAPWAP_WINFO_FRAMEINFO_LENGTH_PADDED,
(uint8_t)sig_dbm, 0, ((uint16_t)rate) * 5);
/* */
CAPWAP_SKB_CB(skb)->flags = SKB_CAPWAP_FLAG_FROM_IEEE80211;
/* Forward to AC */
err = sc_capwap_forwarddata(&sn->sc_acsession, nldev->radioid, nldev->binding, skb, nldev->flags, radioaddr, (radioaddr ? CAPWAP_RADIO_EUI48_LENGTH_PADDED : 0), winfo, (winfo ? CAPWAP_WINFO_FRAMEINFO_LENGTH_PADDED : 0));
err = sc_capwap_forwarddata(&sn->sc_acsession, nldev->radioid, nldev->binding, skb, flags,
radioaddr, (radioaddr ? CAPWAP_RADIO_EUI48_LENGTH_PADDED : 0),
winfo, (winfo ? CAPWAP_WINFO_FRAMEINFO_LENGTH_PADDED : 0));
}
error:
@ -152,7 +178,7 @@ static struct sc_netlink_device* sc_netlink_new_device(struct net *net, uint32_t
}
/* disable IPv6 on this iface */
printk("SmartCAPWAP: disabling IPv6 on %s\n", dev->name);
printk("CAPWAP: disabling IPv6 on %s\n", dev->name);
idev->cnf.disable_ipv6 = 1;
/* Create device */
@ -642,7 +668,8 @@ static int sc_netlink_add_station(struct sk_buff* skb, struct genl_info* info)
if (!info->attrs[NLSMARTCAPWAP_ATTR_RADIOID] ||
!info->attrs[NLSMARTCAPWAP_ATTR_MAC] ||
!info->attrs[NLSMARTCAPWAP_ATTR_WLANID])
!info->attrs[NLSMARTCAPWAP_ATTR_WLANID] ||
!info->attrs[NLSMARTCAPWAP_ATTR_FLAGS])
return -EINVAL;
radioid = nla_get_u8(info->attrs[NLSMARTCAPWAP_ATTR_RADIOID]);
@ -650,11 +677,17 @@ static int sc_netlink_add_station(struct sk_buff* skb, struct genl_info* info)
hash = jhash(mac, ETH_ALEN, radioid) % STA_HASH_SIZE;
sta_head = &session->station_list[hash];
if (sc_find_station(sta_head, radioid, mac) != NULL)
return -EEXIST;
sta = sc_find_station(sta_head, radioid, mac);
if (sta) {
if (!(info->nlhdr->nlmsg_flags & NLM_F_REPLACE))
return -EEXIST;
if (info->nlhdr->nlmsg_flags & NLM_F_REPLACE)
return -ENXIO;
if (sta->wlanid != nla_get_u8(info->attrs[NLSMARTCAPWAP_ATTR_WLANID]))
return -ENXIO;
sta->flags = nla_get_u32(info->attrs[NLSMARTCAPWAP_ATTR_FLAGS]);
return 0;
}
sta = kmalloc(sizeof(struct sc_station), GFP_KERNEL);
if (sta == NULL)
@ -663,6 +696,7 @@ static int sc_netlink_add_station(struct sk_buff* skb, struct genl_info* info)
sta->radioid = radioid;
memcpy(&sta->mac, mac, ETH_ALEN);
sta->wlanid = nla_get_u8(info->attrs[NLSMARTCAPWAP_ATTR_WLANID]);
sta->flags = nla_get_u32(info->attrs[NLSMARTCAPWAP_ATTR_FLAGS]);
hlist_add_head_rcu(&sta->station_list, sta_head);
@ -962,7 +996,7 @@ int __init sc_netlink_init(void) {
if (ret)
goto unreg_genl_family;
pr_info("smartCAPWAP module loaded\n");
pr_info("CAPWAP WTP module loaded\n");
return 0;
unreg_genl_family:
@ -972,7 +1006,7 @@ unreg_netdev_notifier:
unreg_pernet:
unregister_pernet_subsys(&sc_net_ops);
error_out:
pr_err("error loading smartCAPWAP module\n");
pr_err("error loading CAPWAP WTP module\n");
return ret;
}

222
lib/Makefile.am Executable file
View File

@ -0,0 +1,222 @@
# FreeWTP -- An Open Source CAPWAP WTP
#
# Copyright SmartCAPWAP (C) 2012-2013 Massimo Vellucci <vemax78@gmail.com>
# Copyright FreeCAPWAP (C) 2016 Travelping GmbH <info@travelping.com>
#
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation; either version 2 of the License, or
# (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program (see the file COPYING included with this
# distribution); if not, write to the Free Software Foundation, Inc.,
# 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
AM_CFLAGS = -std=gnu99 -D_GNU_SOURCE
if DTLS_ENABLED
AM_CFLAGS += $(WOLFSSL_CFLAGS)
endif
noinst_LTLIBRARIES = libcapwap.la
libcapwap_la_LIBADD = $(WOLFSSL_LDFLAGS)
libcapwap_la_SOURCES = \
capwap.c \
network.c \
protocol.c \
logging.c \
list.c \
array.c \
hash.c \
dtls.c \
dfa.c \
binding/ieee80211/ieee80211.c \
element.c \
element_acdescriptor.c \
element_acipv4list.c \
element_acipv6list.c \
element_acname.c \
element_acnamepriority.c \
element_actimestamp.c \
element_addmacacl.c \
element_addstation.c \
element_controlipv4.c \
element_controlipv6.c \
element_datatransferdata.c \
element_datatransfermode.c \
element_decrypterrorreport.c \
element_decrypterrorreportperiod.c \
element_deletemacacl.c \
element_deletestation.c \
element_discoverytype.c \
element_duplicateipv4.c \
element_duplicateipv6.c \
element_ecnsupport.c \
element_idletimeout.c \
element_imagedata.c \
element_imageidentifier.c \
element_imageinfo.c \
element_initdownload.c \
element_localipv4.c \
element_localipv6.c \
element_location.c \
element_maximumlength.c \
element_mtudiscovery.c \
element_radioadmstate.c \
element_radiooprstate.c \
element_resultcode.c \
element_returnedmessage.c \
element_sessionid.c \
element_statisticstimer.c \
element_timers.c \
element_transport.c \
element_vendorpayload.c \
element_wtpboarddata.c \
element_wtpdescriptor.c \
element_wtpfallback.c \
element_wtpframetunnelmode.c \
element_wtpmactype.c \
element_wtpname.c \
element_wtpradiostat.c \
element_wtprebootstat.c \
element_wtpstaticipaddress.c \
element_80211_addwlan.c \
element_80211_antenna.c \
element_80211_assignbssid.c \
element_80211_deletewlan.c \
element_80211_directsequencecontrol.c \
element_80211_ie.c \
element_80211_mac_profile.c \
element_80211_macoperation.c \
element_80211_miccountermeasures.c \
element_80211_multidomaincapability.c \
element_80211_ofdmcontrol.c \
element_80211_rateset.c \
element_80211_rsnaerrorreport.c \
element_80211_station.c \
element_80211_stationkey.c \
element_80211_stationqos.c \
element_80211_statistics.c \
element_80211_supported_mac_profiles.c \
element_80211_supportedrates.c \
element_80211_txpower.c \
element_80211_txpowerlevel.c \
element_80211_updatestationqos.c \
element_80211_updatewlan.c \
element_80211_wtpqos.c \
element_80211_wtpradioconf.c \
element_80211_wtpradiofailalarm.c \
element_80211_wtpradioinformation.c \
element_80211n_radioconf.c \
element_80211n_station_information.c \
element_vendor_travelping_wtp_timestamp.c \
element_vendor_travelping_80211_encryption_capability.c \
element_vendor_travelping_80211_update_key.c
noinst_HEADERS = \
error.h \
rfc.h \
capwap.h \
network.h \
protocol.h \
logging.h \
list.h \
array.h \
hash.h \
dtls.h \
capwap_dfa.h \
binding/ieee80211/ieee80211.c \
element.h \
element_acdescriptor.h \
element_acipv4list.h \
element_acipv6list.h \
element_acname.h \
element_acnamepriority.h \
element_actimestamp.h \
element_addmacacl.h \
element_addstation.h \
element_controlipv4.h \
element_controlipv6.h \
element_datatransferdata.h \
element_datatransfermode.h \
element_decrypterrorreport.h \
element_decrypterrorreportperiod.h \
element_deletemacacl.h \
element_deletestation.h \
element_discoverytype.h \
element_duplicateipv4.h \
element_duplicateipv6.h \
element_ecnsupport.h \
element_idletimeout.h \
element_imagedata.h \
element_imageidentifier.h \
element_imageinfo.h \
element_initdownload.h \
element_localipv4.h \
element_localipv6.h \
element_location.h \
element_maximumlength.h \
element_mtudiscovery.h \
element_radioadmstate.h \
element_radiooprstate.h \
element_resultcode.h \
element_returnedmessage.h \
element_sessionid.h \
element_statisticstimer.h \
element_timers.h \
element_transport.h \
element_vendorpayload.h \
element_wtpboarddata.h \
element_wtpdescriptor.h \
element_wtpfallback.h \
element_wtpframetunnelmode.h \
element_wtpmactype.h \
element_wtpname.h \
element_wtpradiostat.h \
element_wtprebootstat.h \
element_wtpstaticipaddress.h \
element_80211_addwlan.h \
element_80211_antenna.h \
element_80211_assignbssid.h \
element_80211_deletewlan.h \
element_80211_directsequencecontrol.h \
element_80211_ie.h \
element_80211_macoperation.h \
element_80211_mac_profile.h \
element_80211_miccountermeasures.h \
element_80211_multidomaincapability.h \
element_80211_ofdmcontrol.h \
element_80211_rateset.h \
element_80211_rsnaerrorreport.h \
element_80211_station.h \
element_80211_stationkey.h \
element_80211_stationqos.h \
element_80211_statistics.h \
element_80211_supported_mac_profiles.h \
element_80211_supportedrates.h \
element_80211_txpower.h \
element_80211_txpowerlevel.h \
element_80211_updatestationqos.h \
element_80211_updatewlan.h \
element_80211_wtpqos.h \
element_80211_wtpradioconf.h \
element_80211_wtpradiofailalarm.h \
element_80211_wtpradioinformation.h \
element_80211n_radioconf.h \
element_80211n_station_information.h \
element_vendor_travelping_wtp_timestamp.h \
element_vendor_travelping_80211_encryption_capability.h \
element_vendor_travelping_80211_update_key.h \
vendor_travelping.h
if DEBUG_BUILD
libcapwap_la_SOURCES += debug.c
noinst_HEADERS += debug.h
endif

View File

@ -1,5 +1,5 @@
#include "capwap.h"
#include "capwap_array.h"
#include "array.h"
/* */
struct capwap_array* capwap_array_create(unsigned short itemsize, unsigned long initcount, int zeroed) {

View File

@ -420,6 +420,26 @@ struct ieee80211_ie_erp {
uint8_t params;
} STRUCT_PACKED;
/* 802.11 RSN information element */
#define IEEE80211_IE_RSN_INFORMATION 48
/* cipher suite selectors */
#define IEEE80211_CIPHER_SUITE_USE_GROUP 0x000FAC00
#define IEEE80211_CIPHER_SUITE_WEP40 0x000FAC01
#define IEEE80211_CIPHER_SUITE_TKIP 0x000FAC02
/* reserved: 0x000FAC03 */
#define IEEE80211_CIPHER_SUITE_CCMP 0x000FAC04
#define IEEE80211_CIPHER_SUITE_WEP104 0x000FAC05
#define IEEE80211_CIPHER_SUITE_AES_CMAC 0x000FAC06
#define IEEE80211_CIPHER_SUITE_NO_GROUP_ADDR 0x000FAC07
#define IEEE80211_CIPHER_SUITE_GCMP 0x000FAC08
#define IEEE80211_CIPHER_SUITE_GCMP_256 0x000FAC09
#define IEEE80211_CIPHER_SUITE_CCMP_256 0x000FAC0A
#define IEEE80211_CIPHER_SUITE_BIP_GMAC_128 0x000FAC0B
#define IEEE80211_CIPHER_SUITE_BIP_GMAC_256 0x000FAC0C
#define IEEE80211_CIPHER_SUITE_BIP_CMAC_256 0x000FAC0D
/* 802.11 Extended Supported Rates information element */
#define IEEE80211_IE_EXTENDED_SUPPORTED_RATES 50
#define IEEE80211_IE_EXTENDED_SUPPORTED_MIN_LENGTH 1

View File

@ -58,11 +58,10 @@
#endif
/* standard include */
#include "capwap_rfc.h"
#include "capwap_logging.h"
#include "capwap_debug.h"
#include "capwap_error.h"
#include "capwap_timeout.h"
#include "rfc.h"
#include "logging.h"
#include "debug.h"
#include "error.h"
/* Helper exit */
void capwap_exit(int errorcode);

View File

@ -10,8 +10,8 @@
#include <execinfo.h>
#endif
#include "capwap_logging.h"
#include "capwap_error.h"
#include "logging.h"
#include "error.h"
#define BACKTRACE_BUFFER 256

View File

@ -1,6 +1,6 @@
#include "capwap.h"
#include "capwap_dtls.h"
#include "capwap_protocol.h"
#include "dtls.h"
#include "protocol.h"
#include <wolfssl/options.h>
#include <wolfssl/ssl.h>
#include <wolfssl/wolfcrypt/sha.h>
@ -420,6 +420,8 @@ static int capwap_crypt_handshake(struct capwap_dtls* dtls) {
/* */
if (result != SSL_SUCCESS) {
char buffer[WOLFSSL_MAX_ERROR_SZ];
result = wolfSSL_get_error((WOLFSSL*)dtls->sslsession, 0);
if ((result == SSL_ERROR_WANT_READ) || (result == SSL_ERROR_WANT_WRITE)) {
/* Incomplete handshake */
@ -427,6 +429,9 @@ static int capwap_crypt_handshake(struct capwap_dtls* dtls) {
return CAPWAP_HANDSHAKE_CONTINUE;
}
log_printf(LOG_DEBUG, "Error in DTLS handshake: %s",
wolfSSL_ERR_error_string(result, buffer));
/* Handshake error */
dtls->action = CAPWAP_DTLS_ACTION_ERROR;
return CAPWAP_HANDSHAKE_ERROR;
@ -572,7 +577,6 @@ int capwap_decrypt_packet(struct capwap_dtls* dtls, void* encrybuffer, int size,
/* */
if (dtls->action == CAPWAP_DTLS_ACTION_HANDSHAKE) {
if (capwap_crypt_handshake(dtls) == CAPWAP_HANDSHAKE_ERROR) {
log_printf(LOG_DEBUG, "Error in DTLS handshake");
result = CAPWAP_ERROR_CLOSE; /* Error handshake */
} else {
result = CAPWAP_ERROR_AGAIN; /* Don't parsing DTLS packet */

View File

@ -1,8 +1,8 @@
#ifndef __CAPWAP_DTLS_HEADER__
#define __CAPWAP_DTLS_HEADER__
#include "capwap_list.h"
#include "capwap_network.h"
#include "list.h"
#include "network.h"
#define CAPWAP_DTLS_CLIENT 0
#define CAPWAP_DTLS_SERVER 1

View File

@ -1,7 +1,7 @@
#include "capwap.h"
#include "capwap_element.h"
#include "capwap_protocol.h"
#include "capwap_array.h"
#include "element.h"
#include "protocol.h"
#include "array.h"
/* */
#define element_ops(Id, Ops) [(Id) - CAPWAP_MESSAGE_ELEMENTS_START] = &(Ops)
@ -66,6 +66,7 @@ static const struct capwap_message_elements_ops * capwap_80211_message_elements[
element_ops(CAPWAP_ELEMENT_80211_DELETE_WLAN_TYPE, capwap_element_80211_deletewlan_ops),
element_ops(CAPWAP_ELEMENT_80211_DIRECTSEQUENCECONTROL_TYPE, capwap_element_80211_directsequencecontrol_ops),
element_ops(CAPWAP_ELEMENT_80211_IE_TYPE, capwap_element_80211_ie_ops),
element_ops(CAPWAP_ELEMENT_80211_MAC_PROFILE_TYPE, capwap_element_80211_mac_profile_ops),
element_ops(CAPWAP_ELEMENT_80211_MACOPERATION_TYPE, capwap_element_80211_macoperation_ops),
element_ops(CAPWAP_ELEMENT_80211_MIC_COUNTERMEASURES_TYPE, capwap_element_80211_miccountermeasures_ops),
element_ops(CAPWAP_ELEMENT_80211_MULTIDOMAINCAPABILITY_TYPE, capwap_element_80211_multidomaincapability_ops),
@ -76,6 +77,7 @@ static const struct capwap_message_elements_ops * capwap_80211_message_elements[
element_ops(CAPWAP_ELEMENT_80211_STATION_QOS_PROFILE_TYPE, capwap_element_80211_stationqos_ops),
element_ops(CAPWAP_ELEMENT_80211_STATION_SESSION_KEY_PROFILE_TYPE, capwap_element_80211_stationkey_ops),
element_ops(CAPWAP_ELEMENT_80211_STATISTICS_TYPE, capwap_element_80211_statistics_ops),
element_ops(CAPWAP_ELEMENT_80211_SUPPORTED_MAC_PROFILES_TYPE, capwap_element_80211_supported_mac_profiles_ops),
element_ops(CAPWAP_ELEMENT_80211_SUPPORTEDRATES_TYPE, capwap_element_80211_supportedrates_ops),
element_ops(CAPWAP_ELEMENT_80211_TXPOWER_TYPE, capwap_element_80211_txpower_ops),
element_ops(CAPWAP_ELEMENT_80211_TXPOWERLEVEL_TYPE, capwap_element_80211_txpowerlevel_ops),
@ -93,7 +95,9 @@ static const struct capwap_message_elements_ops * capwap_80211_message_elements[
static const struct capwap_message_elements_ops * capwap_vendor_travelping_message_elements[] = {
element_ops(CAPWAP_ELEMENT_VENDOR_TRAVELPING_WTP_TIMESTAMP_TYPE, capwap_element_vendor_travelping_wtp_timestamp_ops),
element_ops(CAPWAP_ELEMENT_80211N_RADIO_CONF_TYPE, capwap_element_80211n_radioconf_ops),
element_ops(CAPWAP_ELEMENT_80211N_STATION_INFO_TYPE, capwap_element_80211n_station_info_ops)
element_ops(CAPWAP_ELEMENT_80211N_STATION_INFO_TYPE, capwap_element_80211n_station_info_ops),
element_ops(CAPWAP_ELEMENT_VENDOR_TRAVELPING_80211_ENCRYPTION_CAPABILITY_TYPE, capwap_element_vendor_travelping_80211_encryption_capability_ops),
element_ops(CAPWAP_ELEMENT_VENDOR_TRAVELPING_80211_UPDATE_KEY_TYPE, capwap_element_vendor_travelping_80211_update_key_ops)
};
#undef element_ops

169
lib/element.h Normal file
View File

@ -0,0 +1,169 @@
#ifndef __CAPWAP_ELEMENT_HEADER__
#define __CAPWAP_ELEMENT_HEADER__
#include "array.h"
#include "list.h"
struct capwap_message_element_id
{
uint32_t vendor;
uint16_t type;
};
#define message_element_id_eq(a, b) \
(((a).vendor == (b).vendor) && ((a).type == (b).type))
/* */
typedef void* capwap_message_elements_handle;
struct capwap_write_message_elements_ops {
int (*write_u8)(capwap_message_elements_handle handle, uint8_t data);
int (*write_u16)(capwap_message_elements_handle handle, uint16_t data);
int (*write_u32)(capwap_message_elements_handle handle, uint32_t data);
int (*write_block)(capwap_message_elements_handle handle, const uint8_t* data, unsigned short length);
};
struct capwap_read_message_elements_ops {
unsigned short (*read_ready)(capwap_message_elements_handle handle);
int (*read_u8)(capwap_message_elements_handle handle, uint8_t* data);
int (*read_u16)(capwap_message_elements_handle handle, uint16_t* data);
int (*read_u32)(capwap_message_elements_handle handle, uint32_t* data);
int (*read_block)(capwap_message_elements_handle handle, uint8_t* data, unsigned short length);
};
struct capwap_message_elements_ops
{
int category;
/* Build message element */
void (*create)(void* data, capwap_message_elements_handle handle, struct capwap_write_message_elements_ops* func);
/* Parsing message element */
void* (*parse)(capwap_message_elements_handle handle, struct capwap_read_message_elements_ops* func);
/* Memory management */
void* (*clone)(void*);
void (*free)(void*);
};
const struct capwap_message_elements_ops *capwap_get_message_element_ops(const struct capwap_message_element_id id);
/*********************************************************************************************************************/
/* Standard message elements */
#include "element_acdescriptor.h" /* 00001 */
#include "element_acipv4list.h" /* 00002 */
#include "element_acipv6list.h" /* 00003 */
#include "element_acname.h" /* 00004 */
#include "element_acnamepriority.h" /* 00005 */
#include "element_actimestamp.h" /* 00006 */
#include "element_addmacacl.h" /* 00007 */
#include "element_addstation.h" /* 00008 */
/* Reserved */ /* 00009 */
#include "element_controlipv4.h" /* 00010 */
#include "element_controlipv6.h" /* 00011 */
#include "element_timers.h" /* 00012 */
#include "element_datatransferdata.h" /* 00013 */
#include "element_datatransfermode.h" /* 00014 */
#include "element_decrypterrorreport.h" /* 00015 */
#include "element_decrypterrorreportperiod.h" /* 00016 */
#include "element_deletemacacl.h" /* 00017 */
#include "element_deletestation.h" /* 00018 */
/* Reserved */ /* 00019 */
#include "element_discoverytype.h" /* 00020 */
#include "element_duplicateipv4.h" /* 00021 */
#include "element_duplicateipv6.h" /* 00022 */
#include "element_idletimeout.h" /* 00023 */
#include "element_imagedata.h" /* 00024 */
#include "element_imageidentifier.h" /* 00025 */
#include "element_imageinfo.h" /* 00026 */
#include "element_initdownload.h" /* 00027 */
#include "element_location.h" /* 00028 */
#include "element_maximumlength.h" /* 00029 */
#include "element_localipv4.h" /* 00030 */
#include "element_radioadmstate.h" /* 00031 */
#include "element_radiooprstate.h" /* 00032 */
#include "element_resultcode.h" /* 00033 */
#include "element_returnedmessage.h" /* 00034 */
#include "element_sessionid.h" /* 00035 */
#include "element_statisticstimer.h" /* 00036 */
#include "element_vendorpayload.h" /* 00037 */
#include "element_wtpboarddata.h" /* 00038 */
#include "element_wtpdescriptor.h" /* 00039 */
#include "element_wtpfallback.h" /* 00040 */
#include "element_wtpframetunnelmode.h" /* 00041 */
/* Reserved */ /* 00042 */
/* Reserved */ /* 00043 */
#include "element_wtpmactype.h" /* 00044 */
#include "element_wtpname.h" /* 00045 */
/* Reserved */ /* 00046 */
#include "element_wtpradiostat.h" /* 00047 */
#include "element_wtprebootstat.h" /* 00048 */
#include "element_wtpstaticipaddress.h" /* 00049 */
#include "element_localipv6.h" /* 00050 */
#include "element_transport.h" /* 00051 */
#include "element_mtudiscovery.h" /* 00052 */
#include "element_ecnsupport.h" /* 00053 */
/* IEEE 802.11 message elements */
#include "element_80211_addwlan.h" /* 01024 */
#include "element_80211_antenna.h" /* 01025 */
#include "element_80211_assignbssid.h" /* 01026 */
#include "element_80211_deletewlan.h" /* 01027 */
#include "element_80211_directsequencecontrol.h" /* 01028 */
#include "element_80211_ie.h" /* 01029 */
#include "element_80211_macoperation.h" /* 01030 */
#include "element_80211_miccountermeasures.h" /* 01031 */
#include "element_80211_multidomaincapability.h" /* 01032 */
#include "element_80211_ofdmcontrol.h" /* 01033 */
#include "element_80211_rateset.h" /* 01034 */
#include "element_80211_rsnaerrorreport.h" /* 01035 */
#include "element_80211_station.h" /* 01036 */
#include "element_80211_stationqos.h" /* 01037 */
#include "element_80211_stationkey.h" /* 01038 */
#include "element_80211_statistics.h" /* 01039 */
#include "element_80211_supportedrates.h" /* 01040 */
#include "element_80211_txpower.h" /* 01041 */
#include "element_80211_txpowerlevel.h" /* 01042 */
#include "element_80211_updatestationqos.h" /* 01043 */
#include "element_80211_updatewlan.h" /* 01044 */
#include "element_80211_wtpqos.h" /* 01045 */
#include "element_80211_wtpradioconf.h" /* 01046 */
#include "element_80211_wtpradiofailalarm.h" /* 01047 */
#include "element_80211_wtpradioinformation.h" /* 01048 */
#include "element_80211_supported_mac_profiles.h" /* 01060 */
#include "element_80211_mac_profile.h" /* 01061 */
#include "vendor_travelping.h"
/*********************************************************************************************************************/
#define CAPWAP_MESSAGE_ELEMENT_SINGLE 0
#define CAPWAP_MESSAGE_ELEMENT_ARRAY 1
int capwap_get_message_element_category(uint16_t type);
struct capwap_message_element_itemlist
{
struct capwap_message_element_id id;
int category;
void* data;
};
struct capwap_parsed_packet {
struct capwap_packet_rxmng* rxmngpacket;
struct capwap_list* messages;
};
/* */
#define PARSING_COMPLETE 0
#define UNRECOGNIZED_MESSAGE_ELEMENT 1
#define INVALID_MESSAGE_ELEMENT 2
int capwap_parsing_packet(struct capwap_packet_rxmng* rxmngpacket, struct capwap_parsed_packet* packet);
int capwap_validate_parsed_packet(struct capwap_parsed_packet* packet, struct capwap_array* returnedmessage);
void capwap_free_parsed_packet(struct capwap_parsed_packet* packet);
struct capwap_list_item *capwap_get_message_element(struct capwap_parsed_packet *packet,
const struct capwap_message_element_id id);
void *capwap_get_message_element_data(struct capwap_parsed_packet *packet,
const struct capwap_message_element_id id);
#endif /* __CAPWAP_ELEMENT_HEADER__ */

View File

@ -1,5 +1,5 @@
#include "capwap.h"
#include "capwap_element.h"
#include "element.h"
/********************************************************************

View File

@ -1,5 +1,5 @@
#include "capwap.h"
#include "capwap_element.h"
#include "element.h"
/********************************************************************

View File

@ -1,5 +1,5 @@
#include "capwap.h"
#include "capwap_element.h"
#include "element.h"
/********************************************************************

View File

@ -1,5 +1,5 @@
#include "capwap.h"
#include "capwap_element.h"
#include "element.h"
/********************************************************************

View File

@ -1,5 +1,5 @@
#include "capwap.h"
#include "capwap_element.h"
#include "element.h"
/********************************************************************

View File

@ -1,5 +1,5 @@
#include "capwap.h"
#include "capwap_element.h"
#include "element.h"
/********************************************************************

View File

@ -0,0 +1,89 @@
#include "capwap.h"
#include "element.h"
/*
* The IEEE 802.11 MAC Profile message element allows the AC to select a
* profile. This message element may be provided along with the IEEE
* 802.11 ADD WLAN message element while configuring a WLAN on the WTP.
*
* 0 1 2 3 4 5 6 7
* +=+-+-+-+-+-+-+-+
* | Profile |
* +-+-+-+-+-+-+-+-+
*
* o Type: 1061 for IEEE 802.11 MAC Profile
*
* o Profile: The profile is identified by a value as given below
*
* * 0: This refers to the IEEE 802.11 Split MAC Profile with WTP
* encryption
*
* * 1: This refers to the IEEE 802.11 Split MAC Profile with AC
* encryption
*/
/* */
static void
capwap_80211_mac_profile_element_create(void *data, capwap_message_elements_handle handle,
struct capwap_write_message_elements_ops *func)
{
struct capwap_80211_mac_profile_element *element =
(struct capwap_80211_mac_profile_element*)data;
ASSERT(data != NULL);
func->write_u8(handle, element->mac_profile);
}
/* */
static void *
capwap_80211_mac_profile_element_parsing(capwap_message_elements_handle handle,
struct capwap_read_message_elements_ops *func)
{
unsigned short length;
struct capwap_80211_mac_profile_element *data;
ASSERT(handle != NULL);
ASSERT(func != NULL);
length = func->read_ready(handle);
if (length != 1) {
log_printf(LOG_DEBUG, "Invalid IEEE 802.11 Supported MAC Profiles element");
return NULL;
}
/* */
data = (struct capwap_80211_mac_profile_element *)
capwap_alloc(sizeof(struct capwap_80211_mac_profile_element));
memset(data, 0, sizeof(struct capwap_80211_mac_profile_element));
/* Retrieve data */
func->read_u8(handle, &data->mac_profile);
return data;
}
/* */
static void *capwap_80211_mac_profile_element_clone(void *data)
{
ASSERT(data != NULL);
return capwap_clone(data, sizeof(struct capwap_80211_mac_profile_element));
}
/* */
static void capwap_80211_mac_profile_element_free(void *data)
{
ASSERT(data != NULL);
capwap_free(data);
}
/* */
const struct capwap_message_elements_ops capwap_element_80211_mac_profile_ops = {
.category = CAPWAP_MESSAGE_ELEMENT_SINGLE,
.create = capwap_80211_mac_profile_element_create,
.parse = capwap_80211_mac_profile_element_parsing,
.clone = capwap_80211_mac_profile_element_clone,
.free = capwap_80211_mac_profile_element_free
};

View File

@ -0,0 +1,18 @@
#ifndef __CAPWAP_ELEMENT_80211_MAC_PROFILE_HEADER__
#define __CAPWAP_ELEMENT_80211_MAC_PROFILE_HEADER__
#define CAPWAP_ELEMENT_80211_MAC_PROFILE_VENDOR 0
#define CAPWAP_ELEMENT_80211_MAC_PROFILE_TYPE 1061
#define CAPWAP_ELEMENT_80211_MAC_PROFILE \
(struct capwap_message_element_id) { \
.vendor = CAPWAP_ELEMENT_80211_MAC_PROFILE_VENDOR, \
.type = CAPWAP_ELEMENT_80211_MAC_PROFILE_TYPE \
}
struct capwap_80211_mac_profile_element {
uint8_t mac_profile;
};
extern const struct capwap_message_elements_ops capwap_element_80211_mac_profile_ops;
#endif /* __CAPWAP_ELEMENT_80211_MAC_PROFILE_HEADER__ */

View File

@ -1,5 +1,5 @@
#include "capwap.h"
#include "capwap_element.h"
#include "element.h"
/********************************************************************

View File

@ -1,5 +1,5 @@
#include "capwap.h"
#include "capwap_element.h"
#include "element.h"
/********************************************************************

View File

@ -1,5 +1,5 @@
#include "capwap.h"
#include "capwap_element.h"
#include "element.h"
/********************************************************************

View File

@ -1,5 +1,5 @@
#include "capwap.h"
#include "capwap_element.h"
#include "element.h"
/********************************************************************

View File

@ -1,5 +1,5 @@
#include "capwap.h"
#include "capwap_element.h"
#include "element.h"
/********************************************************************

View File

@ -1,5 +1,5 @@
#include "capwap.h"
#include "capwap_element.h"
#include "element.h"
/********************************************************************

View File

@ -1,5 +1,5 @@
#include "capwap.h"
#include "capwap_element.h"
#include "element.h"
/********************************************************************

View File

@ -1,5 +1,5 @@
#include "capwap.h"
#include "capwap_element.h"
#include "element.h"
/********************************************************************
@ -39,7 +39,9 @@ static void capwap_80211_stationkey_element_create(void* data, capwap_message_el
}
/* */
static void* capwap_80211_stationkey_element_parsing(capwap_message_elements_handle handle, struct capwap_read_message_elements_ops* func) {
static void* capwap_80211_stationkey_element_parsing(capwap_message_elements_handle handle,
struct capwap_read_message_elements_ops* func)
{
unsigned short length;
struct capwap_80211_stationkey_element* data;
@ -53,10 +55,11 @@ static void* capwap_80211_stationkey_element_parsing(capwap_message_elements_han
}
/* */
data = (struct capwap_80211_stationkey_element*)capwap_alloc(sizeof(struct capwap_80211_stationkey_element));
data = (struct capwap_80211_stationkey_element *)
capwap_alloc(sizeof(struct capwap_80211_stationkey_element));
memset(data, 0, sizeof(struct capwap_80211_stationkey_element));
data->keylength = length - 20;
data->key = (uint8_t*)capwap_alloc(data->keylength);
memset(data, 0, sizeof(struct capwap_80211_stationkey_element));
/* Retrieve data */
func->read_block(handle, data->address, MACADDRESS_EUI48_LENGTH);

View File

@ -1,5 +1,5 @@
#include "capwap.h"
#include "capwap_element.h"
#include "element.h"
/********************************************************************

View File

@ -1,5 +1,5 @@
#include "capwap.h"
#include "capwap_element.h"
#include "element.h"
/********************************************************************

View File

@ -0,0 +1,102 @@
#include "capwap.h"
#include "element.h"
/*
* The IEEE 802.11 Supported MAC Profile message element allows the WTP
* to communicate the profiles it supports. The Discovery Request
* message, Primary Discovery Request message, and Join Request message
* may include one such message element.
*
* 0 1 2 3
* 0 1 2 3 4 5 6 7 0 1 2 3 4 5 6 7 0 1 2 3 4 5 6 7 0
* +=+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-
* | Num_Profiles | Profile_1 | Profile_[2..N]..
* +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-
*
* o Type: 1060 for IEEE 802.11 Supported MAC Profiles
*
* o Num_Profiles >=1: This refers to the number of profiles present in
* this message element. There must be at least one profile.
*
* o Profile: Each profile is identified by a value specified in
* Section 3.2.
*/
/* */
static void
capwap_80211_supported_mac_profiles_element_create(void *data, capwap_message_elements_handle handle,
struct capwap_write_message_elements_ops *func)
{
struct capwap_80211_supported_mac_profiles_element *element =
(struct capwap_80211_supported_mac_profiles_element*)data;
ASSERT(data != NULL);
func->write_u8(handle, element->supported_mac_profilescount);
func->write_block(handle, element->supported_mac_profiles, element->supported_mac_profilescount);
}
/* */
static void *
capwap_80211_supported_mac_profiles_element_parsing(capwap_message_elements_handle handle,
struct capwap_read_message_elements_ops *func)
{
unsigned short length;
struct capwap_80211_supported_mac_profiles_element *data;
ASSERT(handle != NULL);
ASSERT(func != NULL);
length = func->read_ready(handle);
if (length < 1 || length > 255) {
log_printf(LOG_DEBUG, "Invalid IEEE 802.11 Supported MAC Profiles element");
return NULL;
}
length -= 1;
/* */
data = (struct capwap_80211_supported_mac_profiles_element *)
capwap_alloc(sizeof(struct capwap_80211_supported_mac_profiles_element) + length);
memset(data, 0, sizeof(struct capwap_80211_supported_mac_profiles_element) + length);
/* Retrieve data */
func->read_u8(handle, &data->supported_mac_profilescount);
if (data->supported_mac_profilescount != length) {
log_printf(LOG_DEBUG, "Invalid IEEE 802.11 Supported MAC Profiles element");
capwap_free(data);
return NULL;
}
func->read_block(handle, data->supported_mac_profiles, length);
return data;
}
/* */
static void *capwap_80211_supported_mac_profiles_element_clone(void *data)
{
struct capwap_80211_supported_mac_profiles_element *element =
(struct capwap_80211_supported_mac_profiles_element*)data;
ASSERT(data != NULL);
return capwap_clone(data, sizeof(struct capwap_80211_supported_mac_profiles_element)
+ element->supported_mac_profilescount);
}
/* */
static void capwap_80211_supported_mac_profiles_element_free(void *data)
{
ASSERT(data != NULL);
capwap_free(data);
}
/* */
const struct capwap_message_elements_ops capwap_element_80211_supported_mac_profiles_ops = {
.category = CAPWAP_MESSAGE_ELEMENT_SINGLE,
.create = capwap_80211_supported_mac_profiles_element_create,
.parse = capwap_80211_supported_mac_profiles_element_parsing,
.clone = capwap_80211_supported_mac_profiles_element_clone,
.free = capwap_80211_supported_mac_profiles_element_free
};

View File

@ -0,0 +1,20 @@
#ifndef __CAPWAP_ELEMENT_80211_SUPPORTED_MAC_PROFILES_HEADER__
#define __CAPWAP_ELEMENT_80211_SUPPORTED_MAC_PROFILES_HEADER__
#define CAPWAP_ELEMENT_80211_SUPPORTED_MAC_PROFILES_VENDOR 0
#define CAPWAP_ELEMENT_80211_SUPPORTED_MAC_PROFILES_TYPE 1060
#define CAPWAP_ELEMENT_80211_SUPPORTED_MAC_PROFILES \
(struct capwap_message_element_id) { \
.vendor = CAPWAP_ELEMENT_80211_SUPPORTED_MAC_PROFILES_VENDOR, \
.type = CAPWAP_ELEMENT_80211_SUPPORTED_MAC_PROFILES_TYPE \
}
struct capwap_80211_supported_mac_profiles_element {
uint8_t supported_mac_profilescount;
uint8_t supported_mac_profiles[];
};
extern const struct capwap_message_elements_ops capwap_element_80211_supported_mac_profiles_ops;
#endif /* __CAPWAP_ELEMENT_80211_SUPPORTED_MAC_PROFILES_HEADER__ */

View File

@ -1,5 +1,5 @@
#include "capwap.h"
#include "capwap_element.h"
#include "element.h"
/********************************************************************

View File

@ -1,5 +1,5 @@
#include "capwap.h"
#include "capwap_element.h"
#include "element.h"
/********************************************************************

View File

@ -1,5 +1,5 @@
#include "capwap.h"
#include "capwap_element.h"
#include "element.h"
/********************************************************************

View File

@ -1,5 +1,5 @@
#include "capwap.h"
#include "capwap_element.h"
#include "element.h"
/********************************************************************

View File

@ -1,5 +1,5 @@
#include "capwap.h"
#include "capwap_element.h"
#include "element.h"
/********************************************************************

View File

@ -1,5 +1,5 @@
#include "capwap.h"
#include "capwap_element.h"
#include "element.h"
/********************************************************************

View File

@ -1,5 +1,5 @@
#include "capwap.h"
#include "capwap_element.h"
#include "element.h"
/********************************************************************

Some files were not shown because too many files have changed in this diff Show More