mirror of
https://github.com/coolsnowwolf/lede.git
synced 2025-04-16 04:13:31 +00:00
ramips: add mt7615_dbdc driver 80211k 80211v 80211r 80211w and wps support
* 增加mt7615_dbdc闭源驱动对80211k 80211v 80211r 80211w的支持 * 增加对mtkiappd的支持
This commit is contained in:
parent
1512bd83a2
commit
1c4829d56a
@ -5,8 +5,9 @@
|
|||||||
# Copyright (c) 2013, Hoowa <hoowa.sun@gmail.com>
|
# Copyright (c) 2013, Hoowa <hoowa.sun@gmail.com>
|
||||||
# Copyright (c) 2015-2017, GuoGuo <gch981213@gmail.com>
|
# Copyright (c) 2015-2017, GuoGuo <gch981213@gmail.com>
|
||||||
# Copyright (c) 2020, jjm2473 <jjm2473@gmail.com>
|
# Copyright (c) 2020, jjm2473 <jjm2473@gmail.com>
|
||||||
|
# Copyright (c) 2022, nanchuci <nanchuci023@gmail.com>
|
||||||
#
|
#
|
||||||
# netifd config script for MT7615 DBDC mode.
|
# netifd config script for MT7615/MT7915 DBDC mode.
|
||||||
#
|
#
|
||||||
# 嘿,对着屏幕的哥们,为了表示对原作者辛苦工作的尊重,任何引用跟借用都不允许你抹去所有作者的信息,请保留这段话。
|
# 嘿,对着屏幕的哥们,为了表示对原作者辛苦工作的尊重,任何引用跟借用都不允许你抹去所有作者的信息,请保留这段话。
|
||||||
#
|
#
|
||||||
@ -68,7 +69,10 @@ drv_mt_dbdc_init_device_config() {
|
|||||||
drv_mt_dbdc_init_iface_config() {
|
drv_mt_dbdc_init_iface_config() {
|
||||||
config_add_boolean disabled
|
config_add_boolean disabled
|
||||||
config_add_string mode bssid ssid encryption
|
config_add_string mode bssid ssid encryption
|
||||||
|
config_add_boolean hidden isolate doth ieee80211k
|
||||||
|
config_add_boolean hidden isolate doth ieee80211v
|
||||||
config_add_boolean hidden isolate doth ieee80211r
|
config_add_boolean hidden isolate doth ieee80211r
|
||||||
|
config_add_boolean hidden isolate doth ieee80211w
|
||||||
config_add_string key key1 key2 key3 key4
|
config_add_string key key1 key2 key3 key4
|
||||||
config_add_string wps
|
config_add_string wps
|
||||||
config_add_string pin
|
config_add_string pin
|
||||||
@ -97,7 +101,7 @@ mt_dbdc_ap_vif_pre_config() {
|
|||||||
local name="$1"
|
local name="$1"
|
||||||
|
|
||||||
json_select config
|
json_select config
|
||||||
json_get_vars disabled encryption key key1 key2 key3 key4 ssid mode wps pin isolate doth hidden disassoc_low_ack rssiassoc ieee80211r macfilter
|
json_get_vars disabled encryption key key1 key2 key3 key4 ssid mode wps pin isolate doth hidden disassoc_low_ack rssiassoc ieee80211k ieee80211v ieee80211r ieee80211w macfilter
|
||||||
json_get_values maclist maclist
|
json_get_values maclist maclist
|
||||||
json_select ..
|
json_select ..
|
||||||
[ "$disabled" == "1" ] && return
|
[ "$disabled" == "1" ] && return
|
||||||
@ -192,7 +196,7 @@ mt_dbdc_ap_vif_pre_config() {
|
|||||||
mt_cmd echo "Interface $ifname now up."
|
mt_cmd echo "Interface $ifname now up."
|
||||||
mt_cmd iwpriv $ifname set NoForwarding=${isolate:-0}
|
mt_cmd iwpriv $ifname set NoForwarding=${isolate:-0}
|
||||||
mt_cmd iwpriv $ifname set IEEE80211H=${doth:-0}
|
mt_cmd iwpriv $ifname set IEEE80211H=${doth:-0}
|
||||||
if [ "$wps" == "pbc" ] && [ "$encryption" != "none" ]; then
|
if [ "$wps" == "pbc" ] || [ "$wps" == "pin" ] && [ "$encryption" != "none" ]; then
|
||||||
echo "Enable WPS for ${ifname}."
|
echo "Enable WPS for ${ifname}."
|
||||||
mt_cmd iwpriv $ifname set WscConfMode=4
|
mt_cmd iwpriv $ifname set WscConfMode=4
|
||||||
mt_cmd iwpriv $ifname set WscConfStatus=2
|
mt_cmd iwpriv $ifname set WscConfStatus=2
|
||||||
@ -203,7 +207,10 @@ mt_dbdc_ap_vif_pre_config() {
|
|||||||
fi
|
fi
|
||||||
[ -n "$disassoc_low_ack" ] && [ "$disassoc_low_ack" != "0" ] && mt_cmd iwpriv $ifname set KickStaRssiLow=$disassoc_low_ack
|
[ -n "$disassoc_low_ack" ] && [ "$disassoc_low_ack" != "0" ] && mt_cmd iwpriv $ifname set KickStaRssiLow=$disassoc_low_ack
|
||||||
[ -n "$rssiassoc" ] && [ "$rssiassoc" != "0" ] && mt_cmd iwpriv $ifname set AssocReqRssiThres=$rssiassoc
|
[ -n "$rssiassoc" ] && [ "$rssiassoc" != "0" ] && mt_cmd iwpriv $ifname set AssocReqRssiThres=$rssiassoc
|
||||||
|
[ -n "$ieee80211k" ] && [ "$ieee80211k" != "0" ] && mt_cmd iwpriv $ifname set rrmenable=1
|
||||||
|
[ -n "$ieee80211v" ] && [ "$ieee80211v" != "0" ] && mt_cmd iwpriv $ifname set wnmenable=1
|
||||||
[ -n "$ieee80211r" ] && [ "$ieee80211r" != "0" ] && mt_cmd iwpriv $ifname set ftenable=1
|
[ -n "$ieee80211r" ] && [ "$ieee80211r" != "0" ] && mt_cmd iwpriv $ifname set ftenable=1
|
||||||
|
[ -n "$ieee80211w" ] && [ "$ieee80211w" != "0" ] && mt_cmd iwpriv $ifname set pmfenable=1
|
||||||
}
|
}
|
||||||
|
|
||||||
mt_dbdc_wds_vif_pre_config() {
|
mt_dbdc_wds_vif_pre_config() {
|
||||||
@ -272,7 +279,7 @@ mt_dbdc_ap_vif_post_config() {
|
|||||||
local name="$1"
|
local name="$1"
|
||||||
|
|
||||||
json_select config
|
json_select config
|
||||||
json_get_vars disabled encryption key key1 key2 key3 key4 ssid mode wps pin isolate doth hidden disassoc_low_ack rssiassoc ieee80211r
|
json_get_vars disabled encryption key key1 key2 key3 key4 ssid mode wps pin isolate doth hidden disassoc_low_ack rssiassoc ieee80211k ieee80211v ieee80211r ieee80211w
|
||||||
json_select ..
|
json_select ..
|
||||||
|
|
||||||
[ "$disabled" == "1" ] && return
|
[ "$disabled" == "1" ] && return
|
||||||
@ -532,6 +539,10 @@ MacAddress=${macaddr}
|
|||||||
CountryRegion=${countryregion:-5}
|
CountryRegion=${countryregion:-5}
|
||||||
CountryRegionABand=${countryregion_a:-7}
|
CountryRegionABand=${countryregion_a:-7}
|
||||||
CountryCode=${country:-CN}
|
CountryCode=${country:-CN}
|
||||||
|
RRMEnable=${RRMEnable:-0};${RRMEnable:-0};${RRMEnable:-0};${RRMEnable:-0}
|
||||||
|
WNMEnable=${WNMEnable:-0};${WNMEnable:-0};${WNMEnable:-0};${WNMEnable:-0}
|
||||||
|
FTEnable=${FTEnable:-0};${FTEnable:-0};${FTEnable:-0};${FTEnable:-0}
|
||||||
|
PMFenable=${PMFenable:-0};${PMFenable:-0};${PMFenable:-0};${PMFenable:-0}
|
||||||
WirelessMode=${WirelessMode}
|
WirelessMode=${WirelessMode}
|
||||||
G_BAND_256QAM=1
|
G_BAND_256QAM=1
|
||||||
FixedTxMode=
|
FixedTxMode=
|
||||||
@ -547,8 +558,8 @@ BFBACKOFFenable=0
|
|||||||
CalCacheApply=0
|
CalCacheApply=0
|
||||||
DisableOLBC=0
|
DisableOLBC=0
|
||||||
BGProtection=0
|
BGProtection=0
|
||||||
TxAntenna=
|
TxAntenna=${TxAntenna:-2};${TxAntenna:-2};${TxAntenna:-4};${TxAntenna:-4}
|
||||||
RxAntenna=
|
RxAntenna=${RxAntenna:-2};${RxAntenna:-2};${RxAntenna:-4};${RxAntenna:-4}
|
||||||
TxPreamble=1
|
TxPreamble=1
|
||||||
RTSThreshold=${rts:-2347}
|
RTSThreshold=${rts:-2347}
|
||||||
FragThreshold=${frag:-2346}
|
FragThreshold=${frag:-2346}
|
||||||
@ -677,8 +688,8 @@ VHT_STBC=${tx_stbc:-1}
|
|||||||
VHT_BW_SIGNAL=0
|
VHT_BW_SIGNAL=0
|
||||||
VHT_DisallowNonVHT=${VHT_DisallowNonVHT:-0}
|
VHT_DisallowNonVHT=${VHT_DisallowNonVHT:-0}
|
||||||
VHT_LDPC=${ldpc:-1}
|
VHT_LDPC=${ldpc:-1}
|
||||||
#HT_TxStream=2
|
HT_TxStream=2;2;2;2
|
||||||
#HT_RxStream=2
|
HT_RxStream=2;2;2;2
|
||||||
HT_PROTECT=0
|
HT_PROTECT=0
|
||||||
HT_DisallowTKIP=${HT_DisallowTKIP:-0}
|
HT_DisallowTKIP=${HT_DisallowTKIP:-0}
|
||||||
HT_BSSCoexistence=${HT_CE:-1}
|
HT_BSSCoexistence=${HT_CE:-1}
|
||||||
|
56
package/lean/mt/mtkiappd/Makefile
Normal file
56
package/lean/mt/mtkiappd/Makefile
Normal file
@ -0,0 +1,56 @@
|
|||||||
|
#
|
||||||
|
# This is free software, licensed under the GNU General Public License v2.
|
||||||
|
# See /LICENSE for more information.
|
||||||
|
#
|
||||||
|
|
||||||
|
include $(TOPDIR)/rules.mk
|
||||||
|
|
||||||
|
PKG_NAME:=mtkiappd
|
||||||
|
PKG_VERSION:=1
|
||||||
|
PKG_RELEASE:=1
|
||||||
|
|
||||||
|
PKG_CONFIG_DEPENDS := \
|
||||||
|
CONFIG_MTK_CHIP_MT7615E_DBDC \
|
||||||
|
CONFIG_PACKAGE_mtkiappd_DUAL_BAND
|
||||||
|
|
||||||
|
include $(INCLUDE_DIR)/package.mk
|
||||||
|
|
||||||
|
define Package/mtkiappd
|
||||||
|
SECTION:=net
|
||||||
|
CATEGORY:=Network
|
||||||
|
TITLE:=MTK 802.11f supporting daemon
|
||||||
|
DEPENDS:=@TARGET_ramips
|
||||||
|
SUBMENU:=Wireless
|
||||||
|
endef
|
||||||
|
|
||||||
|
define Package/mtkiappd/description
|
||||||
|
Mtkiappd is an optional user space component for MT76xx SoftAP driver.
|
||||||
|
endef
|
||||||
|
|
||||||
|
define Package/mtkiappd/config
|
||||||
|
config PACKAGE_mtkiappd_DUAL_BAND
|
||||||
|
bool "dual band"
|
||||||
|
depends on MTK_CHIP_MT7615E
|
||||||
|
default y if TARGET_ramips_mt7621_DEVICE_phicomm_k2p
|
||||||
|
default y if TARGET_ramips_mt7621_DEVICE_raisecom_msg1500-x-00
|
||||||
|
default n
|
||||||
|
endef
|
||||||
|
|
||||||
|
ifeq ($(CONFIG_PACKAGE_mtkiappd_DUAL_BAND),y)
|
||||||
|
WIRELESS_IOCTL_PARAM:=-wi ra0 -wi rax0
|
||||||
|
else
|
||||||
|
WIRELESS_IOCTL_PARAM:=-wi ra0
|
||||||
|
endif
|
||||||
|
|
||||||
|
define Package/mtkiappd/install
|
||||||
|
$(INSTALL_DIR) $(1)/usr/sbin
|
||||||
|
$(INSTALL_DIR) $(1)/etc/init.d
|
||||||
|
$(INSTALL_DIR) $(1)/usr/share/mtkiappd
|
||||||
|
|
||||||
|
$(INSTALL_BIN) $(PKG_BUILD_DIR)/mtkiappd $(1)/usr/sbin/
|
||||||
|
$(INSTALL_BIN) ./files/mtkiappd.sh $(1)/etc/init.d/mtkiappd
|
||||||
|
sed -i 's/WIRELESS_IOCTL_PARAM/$(WIRELESS_IOCTL_PARAM)/' $(1)/etc/init.d/mtkiappd
|
||||||
|
$(INSTALL_DATA) ./files/firewall.include $(1)/usr/share/mtkiappd/
|
||||||
|
endef
|
||||||
|
|
||||||
|
$(eval $(call BuildPackage,mtkiappd))
|
49
package/lean/mt/mtkiappd/files/README
Normal file
49
package/lean/mt/mtkiappd/files/README
Normal file
@ -0,0 +1,49 @@
|
|||||||
|
mtkiappd - user space daemon supported 802.11f protocol
|
||||||
|
for RTxxxx a/b/g/n SoftAP driver, Ralink Technology, Corp.
|
||||||
|
=================================================================
|
||||||
|
|
||||||
|
This is the README file for the 802.11f/802.11r/802.11k daemon - mtkiappd,
|
||||||
|
which comes with RTxxxx SoftAP driver.
|
||||||
|
|
||||||
|
|
||||||
|
I. Introduction
|
||||||
|
=================================================================
|
||||||
|
mtkiappd is an optional user space component for RTxxxx SoftAP driver.
|
||||||
|
|
||||||
|
|
||||||
|
II. 802.11f features in mtkiappd
|
||||||
|
=================================================================
|
||||||
|
IEEE Std 802.11F-2003 is a standard for inter-access point protocol(IAPP).
|
||||||
|
It can handle issues on multi-verder access point interoperability.
|
||||||
|
|
||||||
|
There are three major topics which 802.11f supported,
|
||||||
|
1. ADD-notify
|
||||||
|
2. MOVE-notify
|
||||||
|
3. CACHE-notify
|
||||||
|
|
||||||
|
mtkiappd only supports ADD-notify in current phase due to lack of support from radius server
|
||||||
|
|
||||||
|
There are three major topics which 802.11r supported,
|
||||||
|
1. Key Distribution Protocol
|
||||||
|
|
||||||
|
There are three major topics which 802.11k supported,
|
||||||
|
1. Neighbor Report
|
||||||
|
|
||||||
|
Some ethernet card needs special configuration to support multicasting.
|
||||||
|
Make sure your ethernet card support multicasting
|
||||||
|
|
||||||
|
|
||||||
|
III. How to start mtkiappd
|
||||||
|
=================================================================
|
||||||
|
Note: the broadcast/netmask address of all AP must be the same.
|
||||||
|
1. If you want to debug mtkiappd, add CFLAGS with DBG.
|
||||||
|
2. If you want to extend wifi control interface,
|
||||||
|
modify "MAX_WIFI_COUNT" in rtmpiapp.h. (default setting is 2)
|
||||||
|
3. First we need to compile the source code using 'make' command
|
||||||
|
4. Load RTxxxx SoftAP driver - ex: rt2860ap.ko
|
||||||
|
5. Manually start mtkiappd, type $mtkiappd
|
||||||
|
6. For wifi multi-interface, type $mtkiappd -wi ra0 -wi rai0
|
||||||
|
|
||||||
|
|
||||||
|
IV. Reference
|
||||||
|
IEEE Std 802.11F-2003, IEEE802.11r, IEEE802.11k
|
2
package/lean/mt/mtkiappd/files/firewall.include
Normal file
2
package/lean/mt/mtkiappd/files/firewall.include
Normal file
@ -0,0 +1,2 @@
|
|||||||
|
-A INPUT -i br-lan -p tcp --dport 3517 -j ACCEPT
|
||||||
|
-A INPUT -i br-lan -p udp --dport 3517 -j ACCEPT
|
12
package/lean/mt/mtkiappd/files/mtkiappd.defaults
Normal file
12
package/lean/mt/mtkiappd/files/mtkiappd.defaults
Normal file
@ -0,0 +1,12 @@
|
|||||||
|
#!/bin/sh
|
||||||
|
|
||||||
|
uci -q batch <<-EOT
|
||||||
|
delete firewall.mtkiappd
|
||||||
|
set firewall.mtkiappd=include
|
||||||
|
set firewall.mtkiappd.type=restore
|
||||||
|
set firewall.mtkiappd.path=/usr/share/mtkiappd/firewall.include
|
||||||
|
set firewall.mtkiappd.reload=1
|
||||||
|
commit firewall
|
||||||
|
EOT
|
||||||
|
|
||||||
|
exit 0
|
20
package/lean/mt/mtkiappd/files/mtkiappd.sh
Normal file
20
package/lean/mt/mtkiappd/files/mtkiappd.sh
Normal file
@ -0,0 +1,20 @@
|
|||||||
|
#!/bin/sh /etc/rc.common
|
||||||
|
|
||||||
|
START=99
|
||||||
|
STOP=01
|
||||||
|
|
||||||
|
USE_PROCD=1
|
||||||
|
|
||||||
|
start_service() {
|
||||||
|
procd_open_instance mtkiappd
|
||||||
|
procd_set_param command /usr/sbin/mtkiappd -e br-lan WIRELESS_IOCTL_PARAM
|
||||||
|
procd_set_param respawn
|
||||||
|
procd_set_param netdev br-lan
|
||||||
|
procd_set_param netdev ra0
|
||||||
|
procd_close_instance
|
||||||
|
}
|
||||||
|
|
||||||
|
reload_service() {
|
||||||
|
stop
|
||||||
|
start
|
||||||
|
}
|
10
package/lean/mt/mtkiappd/src/Makefile
Normal file
10
package/lean/mt/mtkiappd/src/Makefile
Normal file
@ -0,0 +1,10 @@
|
|||||||
|
OBJS = rtmpiapp.o mt_iapp_util.o
|
||||||
|
|
||||||
|
# If you want to debug daemon, uncomment following line
|
||||||
|
# CFLAGS += -ggdb3 -DDBG
|
||||||
|
|
||||||
|
mtkiappd: $(OBJS)
|
||||||
|
$(CC) $(LDFLAGS) -o $@ $(OBJS) $(LDLIBS)
|
||||||
|
|
||||||
|
clean:
|
||||||
|
rm -f core *.o mtkiappd
|
128
package/lean/mt/mtkiappd/src/iappdefs.h
Normal file
128
package/lean/mt/mtkiappd/src/iappdefs.h
Normal file
@ -0,0 +1,128 @@
|
|||||||
|
/****************************************************************************
|
||||||
|
* Ralink Tech Inc.
|
||||||
|
* Taiwan, R.O.C.
|
||||||
|
*
|
||||||
|
* (c) Copyright 2002, Ralink Technology, Inc.
|
||||||
|
*
|
||||||
|
* All rights reserved. Ralink's source code is an unpublished work and the
|
||||||
|
* use of a copyright notice does not imply otherwise. This source code
|
||||||
|
* contains confidential trade secret material of Ralink Tech. Any attemp
|
||||||
|
* or participation in deciphering, decoding, reverse engineering or in any
|
||||||
|
* way altering the source code is stricitly prohibited, unless the prior
|
||||||
|
* written consent of Ralink Technology, Inc. is obtained.
|
||||||
|
***************************************************************************/
|
||||||
|
|
||||||
|
/****************************************************************************
|
||||||
|
|
||||||
|
Abstract:
|
||||||
|
|
||||||
|
All related IEEE802.11f IAPP + IEEE802.11r IAPP extension.
|
||||||
|
|
||||||
|
***************************************************************************/
|
||||||
|
|
||||||
|
#ifndef __IAPP_DEF_H__
|
||||||
|
#define __IAPP_DEF_H__
|
||||||
|
|
||||||
|
/* Some Notes */
|
||||||
|
|
||||||
|
#define IAPP_DS_LINK_LOST
|
||||||
|
/*
|
||||||
|
When an AP continues to accept associations without a link to the DS,
|
||||||
|
it is a black hole in the WLAN, where STAs associate and cannot
|
||||||
|
communicate with anything beyond the AP’s BSS. When an AP loses its link
|
||||||
|
to the DS, it should cease transmitting Beacons, disassociate all
|
||||||
|
associated stations, and cease responding to Probe Request,
|
||||||
|
Authentication, and Association Request frames.
|
||||||
|
*/
|
||||||
|
|
||||||
|
/* Local use file */
|
||||||
|
#define PROC_NET_ARP_PATH "/proc/net/arp"
|
||||||
|
#define IAPP_PID_BACKUP_FILE "/var/run/mtkiappd.pid"
|
||||||
|
|
||||||
|
/* Definition of IAPP */
|
||||||
|
#define IAPP_DAEMON_VERSION "v1.1.0"
|
||||||
|
#define IAPP_VERSION 0
|
||||||
|
//#define IAPP_MULTICAST_ADDR "224.0.1.178" /* used in
|
||||||
|
// ADD-req frame*/ #define IAPP_MULTICAST_ADDR
|
||||||
|
//"192.168.15.255" /* used in ADD-req frame*/
|
||||||
|
|
||||||
|
/*
|
||||||
|
The UDP Port parameter is the UDP port number to be opened for the IAPP
|
||||||
|
for transmission and reception of IAPP packets.
|
||||||
|
*/
|
||||||
|
#define IAPP_UDP_PORT 3517 /* used in UDP connection */
|
||||||
|
|
||||||
|
/*
|
||||||
|
The TCP Port parameter is the TCP port number that the IAPP entity opens
|
||||||
|
to listen for new IAPP TCP connections from the IAPP entities of other
|
||||||
|
APs.
|
||||||
|
*/
|
||||||
|
#define IAPP_TCP_PORT 3517 /* used in TCP connection */
|
||||||
|
|
||||||
|
/* Message type */
|
||||||
|
#define IAPP_ETH_PRO 0xEEEE
|
||||||
|
#define IAPPMSGQUEID 1
|
||||||
|
#define RADIUSMSGQUEID 2
|
||||||
|
#define RRB_ETH_PRO 0x890D
|
||||||
|
|
||||||
|
/* Message subtype */
|
||||||
|
#define IAPP_OPEN_SERVICE_REQ 0
|
||||||
|
#define IAPP_OPEN_SERVICE_RSP 1
|
||||||
|
#define IAPP_CLOSE_SERVICE_REQ 2
|
||||||
|
#define IAPP_SIGNAL_REQ 3
|
||||||
|
#define IAPP_SET_OID_REQ 4
|
||||||
|
#define IAPP_QUERY_OID_REQ 5
|
||||||
|
#define IAPP_QUERY_OID_RSP 6
|
||||||
|
|
||||||
|
/* Definition of signal */
|
||||||
|
#define IAPP_SIG_NONE 0
|
||||||
|
#define IAPP_SIG_ASSOCIATION 1
|
||||||
|
#define IAPP_SIG_REASSOCIATION 2
|
||||||
|
#define IAPP_SIG_TERMINATE 3
|
||||||
|
|
||||||
|
/* Definition of IAPP command */ /* reference to IEEE802.11f page 50 */
|
||||||
|
#define IAPP_CMD_ADD_NOTIFY 0 /* ADD-notify */
|
||||||
|
#define IAPP_CMD_MOVE_NOTIFY 1 /* MOVE-notify */
|
||||||
|
#define IAPP_CMD_MOVE_RESPONSE 2 /* MOVE-response */
|
||||||
|
#define IAPP_CMD_SEND_SECURITY_BLOCK 3 /* Send-Security-Block */
|
||||||
|
#define IAPP_CMD_ACK_SECURITY_BLOCK 4 /* ACK-Security-Block */
|
||||||
|
#define IAPP_CMD_CACHE_NOTIFY 5 /* CACHE-notify */
|
||||||
|
#define IAPP_CMD_CACHE_RESPONSE 6 /* CACHE-response */
|
||||||
|
|
||||||
|
#define IAPP_CMD_FT_SEND_SECURITY_BLOCK \
|
||||||
|
50 /* proprietary FT Send-Security-Block */
|
||||||
|
#define IAPP_CMD_FT_ACK_SECURITY_BLOCK \
|
||||||
|
51 /* proprietary FT ACK-Security-Block */
|
||||||
|
|
||||||
|
#define IAPP_CMD_INFO_BROADCAST 60 /* proprietary INFO broadcast */
|
||||||
|
#define IAPP_CMD_INFO_REQUEST 61 /* proprietary INFO request */
|
||||||
|
#define IAPP_CMD_INFO_RESPONSE 62 /* proprietary INFO response */
|
||||||
|
|
||||||
|
#define IAPP_CMD_SECURITY_MONITOR 128 /* proprietary, for SM broadcast */
|
||||||
|
|
||||||
|
/* Definition of event log */
|
||||||
|
#define IAPP_MAX_SIZE_OF_EVENT_LOG 1024
|
||||||
|
|
||||||
|
/* Definition of general */
|
||||||
|
#define IAPP_SELECT_TIMEOUT 5 /* unit: second */
|
||||||
|
|
||||||
|
#define IAPP_MAX_RCV_PKT_SIZE 1600
|
||||||
|
#define IAPP_MAX_RCV_PKT_SIZE_SAFE 100
|
||||||
|
|
||||||
|
#define IAPP_IP_HEADER_OFFSET 14 /* skip MAC header */
|
||||||
|
#define IAPP_IP_PROTO_OFFSET 9
|
||||||
|
#define IAPP_IP_PROTO_UDP 17
|
||||||
|
#define IAPP_UDP_DST_PORT_OFFSET (20 + 2)
|
||||||
|
|
||||||
|
#define IAPP_MAC_IP_UDP_LEN (14 + 20 + 8)
|
||||||
|
|
||||||
|
/* 16 for extra 8B encryption & 8B-align, other 16B for safe */
|
||||||
|
#define IAPP_SECURITY_EXTEND_LEN 32
|
||||||
|
|
||||||
|
#define IAPP_IN
|
||||||
|
#define IAPP_OUT
|
||||||
|
#define IAPP_INOUT
|
||||||
|
|
||||||
|
#endif /* __IAPP_DEF_H__ */
|
||||||
|
|
||||||
|
/* End of iapp_def.h */
|
234
package/lean/mt/mtkiappd/src/mt_iapp_util.c
Normal file
234
package/lean/mt/mtkiappd/src/mt_iapp_util.c
Normal file
@ -0,0 +1,234 @@
|
|||||||
|
/****************************************************************************
|
||||||
|
* Ralink Tech Inc.
|
||||||
|
* Taiwan, R.O.C.
|
||||||
|
*
|
||||||
|
* (c) Copyright 2002, Ralink Technology, Inc.
|
||||||
|
*
|
||||||
|
* All rights reserved. Ralink's source code is an unpublished work and the
|
||||||
|
* use of a copyright notice does not imply otherwise. This source code
|
||||||
|
* contains confidential trade secret material of Ralink Tech. Any attemp
|
||||||
|
* or participation in deciphering, decoding, reverse engineering or in any
|
||||||
|
* way altering the source code is stricitly prohibited, unless the prior
|
||||||
|
* written consent of Ralink Technology, Inc. is obtained.
|
||||||
|
***************************************************************************/
|
||||||
|
|
||||||
|
/****************************************************************************
|
||||||
|
|
||||||
|
Abstract:
|
||||||
|
|
||||||
|
All related IEEE802.11f IAPP + IEEE802.11r/11k IAPP extension.
|
||||||
|
|
||||||
|
***************************************************************************/
|
||||||
|
|
||||||
|
/* Include */
|
||||||
|
|
||||||
|
#include "iappdefs.h"
|
||||||
|
#include "rt_config.h"
|
||||||
|
#include "rt_typedef.h"
|
||||||
|
#include "rtmpiapp.h"
|
||||||
|
|
||||||
|
VOID os_alloc_mem(UCHAR *pAd, UCHAR **ppMem, UINT32 Size) {
|
||||||
|
*ppMem = (UCHAR *)malloc(Size);
|
||||||
|
}
|
||||||
|
|
||||||
|
VOID os_free_mem(UCHAR *pAd, VOID *pMem) { free(pMem); }
|
||||||
|
|
||||||
|
BOOLEAN mt_iapp_get_wifi_iface_mac(RTMP_IAPP *pCtrlBK) {
|
||||||
|
#ifdef IAPP_OS_LINUX
|
||||||
|
INT idx;
|
||||||
|
for (idx = 0; idx < pCtrlBK->IfNameWlanCount; idx++) {
|
||||||
|
struct ifreq ReqIf;
|
||||||
|
|
||||||
|
NdisZeroMemory(pCtrlBK->IfNameWlanMAC[idx], ETH_ALEN);
|
||||||
|
NdisCopyMemory(ReqIf.ifr_name, pCtrlBK->IfNameWlanIoctl[idx], IFNAMSIZ);
|
||||||
|
/* get mac address of the interface */
|
||||||
|
if (ioctl(pCtrlBK->SocketIoctl, SIOCGIFHWADDR, &ReqIf) < 0) {
|
||||||
|
DBGPRINT(RT_DEBUG_ERROR,
|
||||||
|
("iapp> %s - Fail to get MAC of IfName[%d]: %s\n", __FUNCTION__,
|
||||||
|
idx, pCtrlBK->IfNameWlanIoctl[idx]));
|
||||||
|
return FALSE;
|
||||||
|
} else {
|
||||||
|
NdisCopyMemory(pCtrlBK->IfNameWlanMAC[idx],
|
||||||
|
&ReqIf.ifr_ifru.ifru_hwaddr.sa_data[0], ETH_ALEN);
|
||||||
|
DBGPRINT(RT_DEBUG_OFF, ("iapp> %s - IfName[%d]: %s\n", __FUNCTION__, idx,
|
||||||
|
pCtrlBK->IfNameWlanIoctl[idx]));
|
||||||
|
IAPP_HEX_DUMP("MAC", pCtrlBK->IfNameWlanMAC[idx], ETH_ALEN);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return TRUE;
|
||||||
|
#else
|
||||||
|
return FALSE;
|
||||||
|
#endif
|
||||||
|
}
|
||||||
|
|
||||||
|
INT32 mt_iapp_find_ifidx_by_mac(RTMP_IAPP *pCtrlBK, UCHAR *WifiMAC) {
|
||||||
|
INT32 idx = 0;
|
||||||
|
|
||||||
|
if (WifiMAC == NULL) {
|
||||||
|
DBGPRINT(RT_DEBUG_OFF, ("iapp> %s - WifiMAC is null.\n", __FUNCTION__));
|
||||||
|
return -1;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (pCtrlBK->IfNameWlanCount < MAX_WIFI_COUNT) {
|
||||||
|
DBGPRINT(RT_DEBUG_OFF,
|
||||||
|
("iapp> %s - pCtrlBK->IfNameWlanCount (%d) is less than %d.\n",
|
||||||
|
__FUNCTION__, pCtrlBK->IfNameWlanCount, MAX_WIFI_COUNT));
|
||||||
|
}
|
||||||
|
|
||||||
|
for (idx = 0; idx < MAX_WIFI_COUNT; idx++) {
|
||||||
|
if (NdisCompareMemory(WifiMAC, pCtrlBK->IfNameWlanMAC[idx], ETH_ALEN) ==
|
||||||
|
0) {
|
||||||
|
return idx;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return -1;
|
||||||
|
}
|
||||||
|
|
||||||
|
VOID mt_iapp_set_daemon_information(RTMP_IAPP *pCtrlBK, pid_t *pPidAuth) {
|
||||||
|
INT32 ComLen = 0;
|
||||||
|
INT32 idx = 0;
|
||||||
|
|
||||||
|
for (idx = 0; idx < pCtrlBK->IfNameWlanCount; idx++) {
|
||||||
|
ComLen = sizeof(INT32);
|
||||||
|
IAPP_IOCTL_TO_WLAN(pCtrlBK, RT_IOCTL_IAPP, pPidAuth, &ComLen, idx,
|
||||||
|
RT_SET_IAPP_PID | OID_GET_SET_TOGGLE);
|
||||||
|
#ifdef FT_KDP_KEY_FROM_DAEMON
|
||||||
|
ComLen = strlen(pCtrlBK->CommonKey);
|
||||||
|
IAPP_IOCTL_TO_WLAN(pCtrlBK, RT_IOCTL_IAPP, pCtrlBK->CommonKey, &ComLen, idx,
|
||||||
|
RT_FT_KEY_SET | OID_GET_SET_TOGGLE);
|
||||||
|
#endif /* FT_KDP_KEY_FROM_DAEMON */
|
||||||
|
}
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
VOID mt_iapp_ft_client_table_init(RTMP_IAPP *pCtrlBK) {
|
||||||
|
INT i;
|
||||||
|
NdisZeroMemory(&pCtrlBK->SelfFtStaTable, sizeof(pCtrlBK->SelfFtStaTable));
|
||||||
|
for (i = 0; i < HASH_TABLE_SIZE; i++)
|
||||||
|
pCtrlBK->SelfFtStaTable.hash[i] = NULL;
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
FT_CLIENT_INFO *mt_iapp_ft_client_look_up(FT_CLIENT_TABLE *pFtTable,
|
||||||
|
UCHAR *pAddr) {
|
||||||
|
ULONG HashIdx;
|
||||||
|
FT_CLIENT_INFO *ft_entry = NULL;
|
||||||
|
|
||||||
|
HashIdx = MAC_ADDR_HASH_INDEX(pAddr);
|
||||||
|
ft_entry = pFtTable->hash[HashIdx];
|
||||||
|
|
||||||
|
while (ft_entry) {
|
||||||
|
if (NdisCompareMemory(ft_entry->sta_mac, pAddr, ETH_ALEN) == 0)
|
||||||
|
break;
|
||||||
|
else
|
||||||
|
ft_entry = ft_entry->next;
|
||||||
|
}
|
||||||
|
|
||||||
|
return ft_entry;
|
||||||
|
}
|
||||||
|
|
||||||
|
FT_CLIENT_INFO *mt_iapp_ft_client_insert(FT_CLIENT_TABLE *pFtTable,
|
||||||
|
UCHAR *pStaAddr, UCHAR *pApAddr,
|
||||||
|
INT32 ApIfIdx) {
|
||||||
|
UCHAR HashIdx;
|
||||||
|
INT idx = 0;
|
||||||
|
FT_CLIENT_INFO *ft_entry = NULL;
|
||||||
|
FT_CLIENT_INFO *current_ft_entry = NULL;
|
||||||
|
|
||||||
|
ft_entry = mt_iapp_ft_client_look_up(pFtTable, pStaAddr);
|
||||||
|
if (ft_entry) {
|
||||||
|
/* Update information */
|
||||||
|
if (pApAddr)
|
||||||
|
NdisCopyMemory(ft_entry->ap_mac, pApAddr, ETH_ALEN);
|
||||||
|
ft_entry->if_idx = ApIfIdx;
|
||||||
|
ft_entry->used = 1;
|
||||||
|
return ft_entry;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (pFtTable->ft_sta_table_size >= MAX_NUM_OF_CLIENT) {
|
||||||
|
DBGPRINT(RT_DEBUG_ERROR,
|
||||||
|
("iapp> %s - FT client table is full. (FtStaTableSize=%d)\n",
|
||||||
|
__FUNCTION__, pFtTable->ft_sta_table_size));
|
||||||
|
return NULL;
|
||||||
|
}
|
||||||
|
|
||||||
|
for (idx = 0; idx < MAX_NUM_OF_CLIENT; idx++) {
|
||||||
|
ft_entry = &pFtTable->ft_sta_info[idx];
|
||||||
|
if (ft_entry->used)
|
||||||
|
continue;
|
||||||
|
if (pStaAddr)
|
||||||
|
NdisCopyMemory(ft_entry->sta_mac, pStaAddr, ETH_ALEN);
|
||||||
|
if (pApAddr)
|
||||||
|
NdisCopyMemory(ft_entry->ap_mac, pApAddr, ETH_ALEN);
|
||||||
|
ft_entry->if_idx = ApIfIdx;
|
||||||
|
ft_entry->used = 1;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
pFtTable->ft_sta_table_size++;
|
||||||
|
|
||||||
|
HashIdx = MAC_ADDR_HASH_INDEX(pStaAddr);
|
||||||
|
ft_entry->hash_idx = HashIdx;
|
||||||
|
if (pFtTable->hash[HashIdx] == NULL)
|
||||||
|
pFtTable->hash[HashIdx] = ft_entry;
|
||||||
|
else {
|
||||||
|
current_ft_entry = pFtTable->hash[HashIdx];
|
||||||
|
while (current_ft_entry->next != NULL)
|
||||||
|
current_ft_entry = current_ft_entry->next;
|
||||||
|
current_ft_entry->next = ft_entry;
|
||||||
|
}
|
||||||
|
return ft_entry;
|
||||||
|
}
|
||||||
|
|
||||||
|
VOID mt_iapp_ft_client_delete(FT_CLIENT_TABLE *pFtTable, UCHAR *pStaAddr) {
|
||||||
|
UCHAR HashIdx = 0xFF;
|
||||||
|
FT_CLIENT_INFO *ft_entry = NULL;
|
||||||
|
FT_CLIENT_INFO *hash_ft_entry = NULL;
|
||||||
|
FT_CLIENT_INFO *pre_hash_ft_entry = NULL;
|
||||||
|
|
||||||
|
ft_entry = mt_iapp_ft_client_look_up(pFtTable, pStaAddr);
|
||||||
|
|
||||||
|
if (ft_entry == NULL) {
|
||||||
|
DBGPRINT(
|
||||||
|
RT_DEBUG_TRACE,
|
||||||
|
("iapp> %s - cannot find this entry (%02x:%02x:%02x:%02x:%02x:%02x)\n",
|
||||||
|
__FUNCTION__, pStaAddr[0], pStaAddr[1], pStaAddr[2], pStaAddr[3],
|
||||||
|
pStaAddr[4], pStaAddr[5]));
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
ft_entry->used = 0;
|
||||||
|
NdisZeroMemory(ft_entry->ap_mac, ETH_ALEN);
|
||||||
|
NdisZeroMemory(ft_entry->sta_mac, ETH_ALEN);
|
||||||
|
ft_entry->if_idx = -1;
|
||||||
|
|
||||||
|
HashIdx = ft_entry->hash_idx;
|
||||||
|
hash_ft_entry = pFtTable->hash[HashIdx];
|
||||||
|
pre_hash_ft_entry = NULL;
|
||||||
|
if (hash_ft_entry != NULL) {
|
||||||
|
/* update Hash list*/
|
||||||
|
do {
|
||||||
|
if (hash_ft_entry == ft_entry) {
|
||||||
|
if (pre_hash_ft_entry == NULL)
|
||||||
|
pFtTable->hash[HashIdx] = ft_entry->next;
|
||||||
|
else
|
||||||
|
pre_hash_ft_entry->next = ft_entry->next;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
|
pre_hash_ft_entry = hash_ft_entry;
|
||||||
|
hash_ft_entry = hash_ft_entry->next;
|
||||||
|
} while (hash_ft_entry);
|
||||||
|
}
|
||||||
|
pFtTable->ft_sta_table_size--;
|
||||||
|
}
|
||||||
|
|
||||||
|
INT32 mt_iapp_find_ifidx_by_sta_mac(FT_CLIENT_TABLE *pFtTable, UCHAR *pStaMAC) {
|
||||||
|
FT_CLIENT_INFO *ft_entry = NULL;
|
||||||
|
ft_entry = mt_iapp_ft_client_look_up(pFtTable, pStaMAC);
|
||||||
|
if (ft_entry)
|
||||||
|
return ft_entry->if_idx;
|
||||||
|
else
|
||||||
|
return -1;
|
||||||
|
}
|
||||||
|
/* End of mt_iapp_util.c */
|
187
package/lean/mt/mtkiappd/src/rt_config.h
Normal file
187
package/lean/mt/mtkiappd/src/rt_config.h
Normal file
@ -0,0 +1,187 @@
|
|||||||
|
/****************************************************************************
|
||||||
|
* Ralink Tech Inc.
|
||||||
|
* Taiwan, R.O.C.
|
||||||
|
*
|
||||||
|
* (c) Copyright 2002, Ralink Technology, Inc.
|
||||||
|
*
|
||||||
|
* All rights reserved. Ralink's source code is an unpublished work and the
|
||||||
|
* use of a copyright notice does not imply otherwise. This source code
|
||||||
|
* contains confidential trade secret material of Ralink Tech. Any attemp
|
||||||
|
* or participation in deciphering, decoding, reverse engineering or in any
|
||||||
|
* way altering the source code is stricitly prohibited, unless the prior
|
||||||
|
* written consent of Ralink Technology, Inc. is obtained.
|
||||||
|
***************************************************************************/
|
||||||
|
|
||||||
|
/****************************************************************************
|
||||||
|
|
||||||
|
Abstract:
|
||||||
|
|
||||||
|
All related IEEE802.11f IAPP + IEEE802.11r IAPP extension.
|
||||||
|
|
||||||
|
***************************************************************************/
|
||||||
|
|
||||||
|
#ifndef __RT_CONFIG_H__
|
||||||
|
#define __RT_CONFIG_H__
|
||||||
|
|
||||||
|
/* Include Kernel file */
|
||||||
|
#include <arpa/inet.h>
|
||||||
|
#include <fcntl.h>
|
||||||
|
#include <linux/if.h>
|
||||||
|
#include <linux/if_packet.h>
|
||||||
|
#include <linux/wireless.h>
|
||||||
|
#include <net/if_arp.h>
|
||||||
|
#include <netdb.h>
|
||||||
|
#include <netinet/if_ether.h>
|
||||||
|
#include <netinet/in.h>
|
||||||
|
#include <signal.h>
|
||||||
|
#include <stdio.h>
|
||||||
|
#include <stdlib.h>
|
||||||
|
#include <string.h>
|
||||||
|
#include <unistd.h>
|
||||||
|
|
||||||
|
#include <sys/ioctl.h>
|
||||||
|
#include <sys/ipc.h>
|
||||||
|
#include <sys/msg.h>
|
||||||
|
#include <sys/socket.h>
|
||||||
|
#include <sys/time.h>
|
||||||
|
#include <sys/types.h>
|
||||||
|
|
||||||
|
#include "rt_typedef.h"
|
||||||
|
|
||||||
|
/* Definition of OID to RALINK AP driver */
|
||||||
|
#define OID_GET_SET_TOGGLE 0x8000
|
||||||
|
#define RT_QUERY_SIGNAL_CONTEXT 0x0402
|
||||||
|
#define RT_SET_IAPP_PID 0x0404
|
||||||
|
#define RT_SET_APD_PID 0x0405
|
||||||
|
#define RT_SET_DEL_MAC_ENTRY 0x0406
|
||||||
|
#define RT_QUERY_EVENT_TABLE 0x0407
|
||||||
|
|
||||||
|
#define RT_SET_FT_STATION_NOTIFY 0x0408
|
||||||
|
#define RT_SET_FT_KEY_REQ 0x0409
|
||||||
|
#define RT_SET_FT_KEY_RSP 0x040a
|
||||||
|
|
||||||
|
#define RT_FT_KEY_SET 0x040b
|
||||||
|
#define RT_FT_DATA_ENCRYPT 0x040c
|
||||||
|
#define RT_FT_DATA_DECRYPT 0x040d
|
||||||
|
#define RT_FT_NEIGHBOR_REPORT 0x040e
|
||||||
|
#define RT_FT_NEIGHBOR_REQUEST 0x040f
|
||||||
|
#define RT_FT_NEIGHBOR_RESPONSE 0x0410
|
||||||
|
#define RT_FT_ACTION_FORWARD 0x0411
|
||||||
|
|
||||||
|
/* File path */
|
||||||
|
// #define MSG_FILE "/etc/wireless/mt7615/mtkiappd.dat"
|
||||||
|
#define EVENT_LOG_FILE "/var/log/mtkiappd.log"
|
||||||
|
|
||||||
|
/* ReDefinition */
|
||||||
|
#define NdisZeroMemory(__Dst, __Len) memset(__Dst, 0, __Len)
|
||||||
|
#define NdisFillMemory(__Dst, __Len, __Val) memset(__Dst, __Val, __Len)
|
||||||
|
#define NdisMoveMemory(__Dst, __Src, __Len) memmove(__Dst, __Src, __Len)
|
||||||
|
#define NdisCopyMemory(__Dst, __Src, __Len) memcpy(__Dst, __Src, __Len)
|
||||||
|
#define NdisCompareMemory(__Dst, __Src, __Len) memcmp(__Dst, __Src, __Len)
|
||||||
|
|
||||||
|
VOID os_alloc_mem(UCHAR *pAd, UCHAR **ppMem, UINT32 Size);
|
||||||
|
VOID os_free_mem(UCHAR *pAd, VOID *pMem);
|
||||||
|
|
||||||
|
/* Debug flag */
|
||||||
|
#define RT_DEBUG_OFF 0
|
||||||
|
#define RT_DEBUG_ERROR 1
|
||||||
|
#define RT_DEBUG_WARN 2
|
||||||
|
#define RT_DEBUG_TRACE 3
|
||||||
|
#define RT_DEBUG_INFO 4
|
||||||
|
|
||||||
|
#define NIC_DBG_STRING (" ")
|
||||||
|
|
||||||
|
#ifdef DBG
|
||||||
|
#define DBGPRINT(Level, Fmt) \
|
||||||
|
{ \
|
||||||
|
if (Level <= RTDebugLevel) { \
|
||||||
|
printf Fmt; \
|
||||||
|
} \
|
||||||
|
}
|
||||||
|
#else
|
||||||
|
|
||||||
|
/* no debug information */
|
||||||
|
#define DBGPRINT(Level, Fmt)
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#define MAX_NUM_OF_EVENT 30 /* entry # in EVENT table */
|
||||||
|
|
||||||
|
typedef struct _RT_802_11_EVENT_LOG {
|
||||||
|
|
||||||
|
ULONG SystemTime; /* timestammp (jiffies) */
|
||||||
|
UCHAR TriggerAddr[ETH_ALEN];
|
||||||
|
UCHAR DetectorAddr[ETH_ALEN];
|
||||||
|
UINT16 Event; /* EVENT_xxx */
|
||||||
|
} RT_802_11_EVENT_LOG, *PRT_802_11_EVENT_LOG;
|
||||||
|
|
||||||
|
typedef struct _RT_802_11_EVENT_TABLE {
|
||||||
|
|
||||||
|
ULONG Num;
|
||||||
|
RT_802_11_EVENT_LOG Log[MAX_NUM_OF_EVENT];
|
||||||
|
} RT_802_11_EVENT_TABLE, *PRT_802_11_EVENT_TABLE;
|
||||||
|
|
||||||
|
#define PACKED __attribute__((packed))
|
||||||
|
|
||||||
|
typedef struct PACKED _FT_KDP_EVT_HEADER {
|
||||||
|
|
||||||
|
UINT32 EventLen;
|
||||||
|
UINT32 PeerIpAddr;
|
||||||
|
|
||||||
|
} FT_KDP_EVT_HEADER;
|
||||||
|
|
||||||
|
typedef struct PACKED _RT_SIGNAL_STRUC {
|
||||||
|
|
||||||
|
VOID *pNext; /* point to next signal */
|
||||||
|
|
||||||
|
UINT16 Sequence;
|
||||||
|
UCHAR MacAddr[ETH_ALEN];
|
||||||
|
UCHAR CurrAPAddr[ETH_ALEN];
|
||||||
|
|
||||||
|
#define FT_KDP_SIG_NOTHING 0x00 /* no signal */
|
||||||
|
#define FT_KDP_SIG_IAPP_ASSOCIATION 0x01 /* A station has associated */
|
||||||
|
#define FT_KDP_SIG_IAPP_REASSOCIATION 0x02 /* A station has re-associated */
|
||||||
|
#define FT_KDP_SIG_TERMINATE 0x03 /* terminate the daemon */
|
||||||
|
|
||||||
|
#define FT_KDP_SIG_FT_ASSOCIATION 0x50 /* A FT station has associated */
|
||||||
|
#define FT_KDP_SIG_FT_REASSOCIATION 0x51 /* A FT station has re-associated */
|
||||||
|
#define FT_KDP_SIG_KEY_TIMEOUT 0x52 /* PMK-R1 KEY Timeout */
|
||||||
|
#define FT_KDP_SIG_KEY_REQ 0x53 /* Request PMK-R1 KEY from R0KH */
|
||||||
|
#define FT_KDP_SIG_ACTION 0x54 /* Forward FT Action frame to DS */
|
||||||
|
|
||||||
|
#define FT_KDP_SIG_AP_INFO_REQ 0x70 /* request neighbor AP info. */
|
||||||
|
#define FT_KDP_SIG_AP_INFO_RSP 0x71 /* response my AP info. */
|
||||||
|
|
||||||
|
/* FT KDP internal use */
|
||||||
|
#define FT_KDP_SIG_KEY_REQ_AUTO 0xA0 /* Request PMK-R1 KEY from R0KH */
|
||||||
|
#define FT_KDP_SIG_KEY_RSP_AUTO 0xA1 /* Response PMK-R1 KEY to R1KH */
|
||||||
|
#define FT_KDP_SIG_INFO_BROADCAST 0xB0 /* broadcast our AP information */
|
||||||
|
|
||||||
|
#define FT_KSP_SIG_DEBUG_TRACE 0xC0 /* enable debug flag to TRACE */
|
||||||
|
UCHAR Sig;
|
||||||
|
|
||||||
|
UCHAR MacAddrSa[ETH_ALEN];
|
||||||
|
|
||||||
|
/* IEEE80211R_SUPPORT */
|
||||||
|
/* the first 6B are FT_KDP_EVT_HEADER */
|
||||||
|
/*
|
||||||
|
For FT_KDP_SIG_NOTHING: nothing
|
||||||
|
For FT_KDP_SIG_IAPP_ASSOCIATION:nothing
|
||||||
|
For FT_KDP_SIG_REASSOCIATION: nothing
|
||||||
|
For FT_KDP_SIG_TERMINATE: nothing
|
||||||
|
For FT_KDP_SIG_FT_ASSOCIATION: nothing
|
||||||
|
FT_KDP_SIG_FT_REASSOCIATION: nothing
|
||||||
|
For FT_KDP_SIG_KEY_TIMEOUT: it is
|
||||||
|
For FT_KDP_SIG_KEY_REQ_AUTO: it is FT_KDP_EVT_KEY_REQ
|
||||||
|
For FT_KDP_SIG_KEY_RSP_AUTO: it is FT_KDP_SIG_KEY_RSP
|
||||||
|
*/
|
||||||
|
UCHAR Reserved[3]; /* let Content address four-byte align */
|
||||||
|
UCHAR Content[1024]; /* signal content */
|
||||||
|
|
||||||
|
#define RT_SIGNAL_STRUC_HDR_SIZE (sizeof(RT_SIGNAL_STRUC) - 1024)
|
||||||
|
} RT_SIGNAL_STRUC, *PRT_SIGNAL_STRUC;
|
||||||
|
|
||||||
|
static INT32 RTDebugLevel = RT_DEBUG_ERROR;
|
||||||
|
|
||||||
|
#endif /* __RT_CONFIG_H__ */
|
||||||
|
|
||||||
|
/* End of rt_config.h */
|
22
package/lean/mt/mtkiappd/src/rt_typedef.h
Normal file
22
package/lean/mt/mtkiappd/src/rt_typedef.h
Normal file
@ -0,0 +1,22 @@
|
|||||||
|
#ifndef __RT_TYPEDEF_H__
|
||||||
|
#define __RT_TYPEDEF_H__
|
||||||
|
|
||||||
|
#include <stdint.h>
|
||||||
|
|
||||||
|
typedef enum _BOOLEAN { FALSE = 0, TRUE = 1 } BOOLEAN;
|
||||||
|
|
||||||
|
typedef char CHAR;
|
||||||
|
typedef int INT;
|
||||||
|
|
||||||
|
typedef int INT32;
|
||||||
|
typedef int16_t INT16;
|
||||||
|
typedef uint8_t UCHAR;
|
||||||
|
typedef uint16_t UINT16;
|
||||||
|
typedef uint32_t UINT;
|
||||||
|
typedef uint32_t ULONG;
|
||||||
|
typedef uint32_t UINT32;
|
||||||
|
|
||||||
|
typedef void VOID;
|
||||||
|
typedef void *PVOID;
|
||||||
|
|
||||||
|
#endif
|
3946
package/lean/mt/mtkiappd/src/rtmpiapp.c
Normal file
3946
package/lean/mt/mtkiappd/src/rtmpiapp.c
Normal file
File diff suppressed because it is too large
Load Diff
580
package/lean/mt/mtkiappd/src/rtmpiapp.h
Normal file
580
package/lean/mt/mtkiappd/src/rtmpiapp.h
Normal file
@ -0,0 +1,580 @@
|
|||||||
|
/****************************************************************************
|
||||||
|
* Ralink Tech Inc.
|
||||||
|
* Taiwan, R.O.C.
|
||||||
|
*
|
||||||
|
* (c) Copyright 2002, Ralink Technology, Inc.
|
||||||
|
*
|
||||||
|
* All rights reserved. Ralink's source code is an unpublished work and the
|
||||||
|
* use of a copyright notice does not imply otherwise. This source code
|
||||||
|
* contains confidential trade secret material of Ralink Tech. Any attemp
|
||||||
|
* or participation in deciphering, decoding, reverse engineering or in any
|
||||||
|
* way altering the source code is stricitly prohibited, unless the prior
|
||||||
|
* written consent of Ralink Technology, Inc. is obtained.
|
||||||
|
***************************************************************************/
|
||||||
|
|
||||||
|
/****************************************************************************
|
||||||
|
|
||||||
|
Abstract:
|
||||||
|
|
||||||
|
All related IEEE802.11f IAPP + IEEE802.11r IAPP extension.
|
||||||
|
|
||||||
|
***************************************************************************/
|
||||||
|
|
||||||
|
#ifndef __RTMP_IAPP_H__
|
||||||
|
#define __RTMP_IAPP_H__
|
||||||
|
|
||||||
|
#include "rt_config.h"
|
||||||
|
#include "rt_typedef.h"
|
||||||
|
|
||||||
|
#define IAPP_OS_LINUX
|
||||||
|
//#define IAPP_OS_VXWORKS
|
||||||
|
|
||||||
|
/*
|
||||||
|
IAPP issues:
|
||||||
|
|
||||||
|
1. Lack of fast roaming support, particularly required for voice;
|
||||||
|
2. Only supports use of RADIUS (in a non-standard way);
|
||||||
|
*/
|
||||||
|
|
||||||
|
/*
|
||||||
|
Three levels of support for ESS formation are possible with the IAPP
|
||||||
|
capabilities described here:
|
||||||
|
|
||||||
|
Level 1: no administrative or security support;
|
||||||
|
Level 2: support for dynamic mapping of BSSID to IP addresses; and
|
||||||
|
Level 3: support for encryption and authentication of IAPP messages.
|
||||||
|
|
||||||
|
Level 1 support can be achieved by configuring each AP in the ESS with
|
||||||
|
the BSSID to IP address mapping for all other APs in the ESS. This may
|
||||||
|
be acceptable for a small ESS.
|
||||||
|
|
||||||
|
Many ESS providers will need levels 2 or 3, which require RADIUS
|
||||||
|
support.
|
||||||
|
*/
|
||||||
|
|
||||||
|
/*
|
||||||
|
Note with RALINK driver:
|
||||||
|
|
||||||
|
1. OID to RALINK AP driver;
|
||||||
|
2. RT_SIGNAL_STRUC
|
||||||
|
3. IAPP daemon must be run after br-lan & ra0 built up.
|
||||||
|
*/
|
||||||
|
|
||||||
|
/* ---------------------------- User Definition ------------------------ */
|
||||||
|
|
||||||
|
#define FT_KDP_FUNC_SOCK_COMM /* use socket to communicate with driver */
|
||||||
|
#define FT_KDP_FUNC_PKT_ENCRYPT /* do encryption for each IAPP packet */
|
||||||
|
#define FT_KDP_SELECT_TIMEOUT /* use timeout to wait for any packet */
|
||||||
|
#define FT_KDP_KEY_FROM_DAEMON /* key is set in daemon */
|
||||||
|
#define FT_KDP_DEFAULT_IF_ETH "br-lan"
|
||||||
|
#define FT_KDP_DEFAULT_IF_WLAN \
|
||||||
|
"br-lan" /* used to receive command from WLAN \
|
||||||
|
*/
|
||||||
|
#define FT_KDP_DEFAULT_IF_WLAN_IOCTL "ra0" /* ioctl command to WLAN */
|
||||||
|
|
||||||
|
/*
|
||||||
|
Inter-AP communications present opportunities to an attacker.
|
||||||
|
The attacker can use IAPP or forged 802.11 MAC management frames as a
|
||||||
|
Denial-of-Service (DoS) attack against a STA state in its AP.
|
||||||
|
It can capture MOVE packets to gather information on the STA that is
|
||||||
|
roaming. It can act as a rogue AP in the ESS.
|
||||||
|
|
||||||
|
If use RADIUS server, the IAPP entity sends the RADIUS Initiate-Request
|
||||||
|
and receives the RADIUS Initiate-Accept or Initiate-Reject.
|
||||||
|
If the Initiate-Accept is received, then the IAPP entity initializes
|
||||||
|
its data structures, functions, and protocols. If an Initiate-Reject
|
||||||
|
is received, the IAPP does not start.
|
||||||
|
|
||||||
|
The RADIUS servers provide two functions, mapping the BSSID of an AP to
|
||||||
|
its IP address on the DSM and distribution of keys to the APs to allow
|
||||||
|
the encryption of the communications between the APs.
|
||||||
|
|
||||||
|
The function of mapping the BSSID of an AP to its IP address on the DSM
|
||||||
|
can also be accomplished by local configuration information or the IETF
|
||||||
|
Inverse Address Resolution Protocol (RFC 2390:1998).
|
||||||
|
|
||||||
|
We don't support RADIUS server so we use a fixed PSK key to encrypt.
|
||||||
|
*/
|
||||||
|
#define FT_KDP_DEFAULT_PTK "zpxrjs9uo2kvbuqo"
|
||||||
|
|
||||||
|
#ifdef IAPP_OS_LINUX
|
||||||
|
#define RT_IOCTL_IAPP (SIOCIWFIRSTPRIV + 0x01)
|
||||||
|
#endif // IAPP_OS_LINUX //
|
||||||
|
|
||||||
|
#ifdef IAPP_OS_VXWORKS
|
||||||
|
#define PF_PACKET AF_INET
|
||||||
|
#define RT_IOCTL_IAPP VX_RT_PRIV_IOCTL
|
||||||
|
#define FT_KDP_WLAN_NAME "ra"
|
||||||
|
#define FT_KDP_WLAN_UNIT 0
|
||||||
|
#define FT_KDP_ETH_NAME "eth" /* must not use mirror */
|
||||||
|
#define FT_KDP_BR_ETH_IF_NUM 2 /* eth0 and eth1 */
|
||||||
|
#define FT_KDP_BR_NAME "mirror"
|
||||||
|
#define FT_KDP_BR_UNIT 0
|
||||||
|
#endif // IAPP_OS_VXWORKS //
|
||||||
|
|
||||||
|
#define HASH_TABLE_SIZE 128
|
||||||
|
#define MAX_NUM_OF_CLIENT 64
|
||||||
|
|
||||||
|
#define MAC_ADDR_HASH(Addr) \
|
||||||
|
(Addr[0] ^ Addr[1] ^ Addr[2] ^ Addr[3] ^ Addr[4] ^ Addr[5])
|
||||||
|
#define MAC_ADDR_HASH_INDEX(Addr) (MAC_ADDR_HASH(Addr) & (HASH_TABLE_SIZE - 1))
|
||||||
|
|
||||||
|
/* ---------------------------- MACRO Definition ---------------------------- */
|
||||||
|
#define IAPP_LITTLE_ENDIAN /* __BIG_ENDIAN */
|
||||||
|
|
||||||
|
#ifdef IAPP_LITTLE_ENDIAN
|
||||||
|
#define SWAP_16(x) \
|
||||||
|
((UINT16)((((UINT16)(x) & (UINT16)0x00ffU) << 8) | \
|
||||||
|
(((UINT16)(x) & (UINT16)0xff00U) >> 8)))
|
||||||
|
#else
|
||||||
|
|
||||||
|
#define SWAP_16(x) x
|
||||||
|
#endif
|
||||||
|
|
||||||
|
/* 16 for extra 8B encryption & 8B-align */
|
||||||
|
#define IAPP_PKT_ALLOCATE(__pPkt, __Len) \
|
||||||
|
IAPP_MEM_ALLOC(__pPkt, __Len + IAPP_SECURITY_EXTEND_LEN)
|
||||||
|
#define IAPP_PKT_ZERO(__pPkt, __Len) \
|
||||||
|
IAPP_MEM_ZERO(__pPkt, __Len + IAPP_SECURITY_EXTEND_LEN)
|
||||||
|
|
||||||
|
#define IAPP_MEM_ALLOC(__pMem, __Size) \
|
||||||
|
{ \
|
||||||
|
os_alloc_mem(NULL, (UCHAR **)(&__pMem), __Size); \
|
||||||
|
IAPP_MemAllocNum++; \
|
||||||
|
}
|
||||||
|
#define IAPP_MEM_FREE(__Mem) \
|
||||||
|
{ \
|
||||||
|
os_free_mem(NULL, __Mem); \
|
||||||
|
IAPP_MemFreeNum++; \
|
||||||
|
}
|
||||||
|
|
||||||
|
/* calculate the size to the multiple of 8 */
|
||||||
|
#define IAPP_ENCRYPTED_DATA_SIZE_CAL(__LenOfAction) \
|
||||||
|
if ((__LenOfAction)&0x07) \
|
||||||
|
(__LenOfAction) += 8 - ((__LenOfAction)&0x07); \
|
||||||
|
__LenOfAction += 8;
|
||||||
|
|
||||||
|
#define IAPP_MEM_ZERO(__Dst, __Len) NdisZeroMemory(__Dst, __Len)
|
||||||
|
#define IAPP_MEM_FILL(__Dst, __Val, __Len) NdisFillMemory(__Dst, __Len, __Val)
|
||||||
|
#define IAPP_MEM_MOVE(__Dst, __Src, __Len) NdisMoveMemory(__Dst, __Src, __Len)
|
||||||
|
|
||||||
|
#define IAPP_HEX_DUMP(__pPrompt, __pBuf, __Len) \
|
||||||
|
IAPP_HexDump((CHAR *)__pPrompt, (CHAR *)__pBuf, __Len)
|
||||||
|
|
||||||
|
#define IAPP_IOCTL_TO_WLAN(__pCtrlBK, __Param, __pData, __pLen, __ApIdx, \
|
||||||
|
__Flags) \
|
||||||
|
{ \
|
||||||
|
IAPP_IoctlToWLAN(__pCtrlBK, __Param, (CHAR *)(__pData), (INT32 *)(__pLen), \
|
||||||
|
__ApIdx, __Flags); \
|
||||||
|
}
|
||||||
|
|
||||||
|
/* ---------------------------- Structure Definition ------------------------ */
|
||||||
|
|
||||||
|
/*
|
||||||
|
IAPP supports three protocol sequences.
|
||||||
|
|
||||||
|
One is initiated by invoking the IAPP-ADD.request after the APME
|
||||||
|
receives an MLME-ASSOCIATE.indication.
|
||||||
|
|
||||||
|
The second is initiated by invoking the IAPPMOVE.request after the APME
|
||||||
|
receives an MLME-REASSOCIATE.indication.
|
||||||
|
|
||||||
|
The third is initiated by invoking the IAPP-CACHE.request to cache
|
||||||
|
context in neighboring APs to facilitate fast roaming.
|
||||||
|
*/
|
||||||
|
|
||||||
|
/* event log */
|
||||||
|
#define FT_IP_ADDRESS_SIZE 4
|
||||||
|
|
||||||
|
/* IAPP header in the frame body, 6B */
|
||||||
|
typedef struct PACKED _RT_IAPP_HEADER {
|
||||||
|
|
||||||
|
UCHAR Version; /* indicates the protocol version of the IAPP */
|
||||||
|
UCHAR Command; /* ADD-notify, MOVE-notify, etc. */
|
||||||
|
UINT16 Identifier; /* aids in matching requests and responses */
|
||||||
|
UINT16 Length; /* indicates the length of the entire packet */
|
||||||
|
} RT_IAPP_HEADER;
|
||||||
|
|
||||||
|
/* IAPP Action Frame */
|
||||||
|
/* ADD notify frame */
|
||||||
|
typedef struct PACKED _RT_IAPP_ADD_NOTIFY {
|
||||||
|
|
||||||
|
RT_IAPP_HEADER IappHeader;
|
||||||
|
|
||||||
|
/* the number of octets in the MAC Address */
|
||||||
|
UCHAR AddressLen;
|
||||||
|
|
||||||
|
/* should be sent with a value of zero */
|
||||||
|
#define FT_KDP_ADD_NOTIFY_RSVD_11R_SUPPORT 0x01
|
||||||
|
UCHAR Rsvd;
|
||||||
|
|
||||||
|
/* the MAC address of the STA that has associated */
|
||||||
|
UCHAR MacAddr[ETH_ALEN];
|
||||||
|
|
||||||
|
/* the integer value of the sequence number of the association request frame
|
||||||
|
*/
|
||||||
|
/*
|
||||||
|
The 802.11 sequence number may be an ambiguous indication of the most
|
||||||
|
recent association. But, this information may be useful to an
|
||||||
|
algorithm making a determination of the location of the most recent
|
||||||
|
association of a STA.
|
||||||
|
*/
|
||||||
|
UINT16 Sequence;
|
||||||
|
|
||||||
|
} RT_IAPP_ADD_NOTIFY;
|
||||||
|
|
||||||
|
/* MOVE requset frame */
|
||||||
|
typedef struct PACKED _RT_IAPP_MOVE_NOTIFY {
|
||||||
|
|
||||||
|
RT_IAPP_HEADER IappHeader;
|
||||||
|
|
||||||
|
/* the number of octets in the MAC Address */
|
||||||
|
UCHAR AddressLen;
|
||||||
|
|
||||||
|
/* should be sent with a value of zero */
|
||||||
|
UCHAR Rsvd;
|
||||||
|
|
||||||
|
/* the MAC address of the STA that has associated */
|
||||||
|
UCHAR MacAddr[ETH_ALEN];
|
||||||
|
|
||||||
|
/* the integer value of the sequence number of the association request frame
|
||||||
|
*/
|
||||||
|
UINT16 Sequence;
|
||||||
|
|
||||||
|
/* indicates the number of octets in the Context Block field, always 0 */
|
||||||
|
UINT16 LenOfContextBlock;
|
||||||
|
|
||||||
|
} RT_IAPP_MOVE_NOTIFY;
|
||||||
|
|
||||||
|
/* MOVE response frame */
|
||||||
|
typedef struct PACKED _RT_IAPP_MOVE_RSP {
|
||||||
|
|
||||||
|
RT_IAPP_HEADER IappHeader;
|
||||||
|
|
||||||
|
/* the number of octets in the MAC Address */
|
||||||
|
UCHAR AddressLen;
|
||||||
|
|
||||||
|
#define IAPP_MOVE_RSP_STATUS_SUCCESS 0
|
||||||
|
#define IAPP_MOVE_RSP_STATUS_DENY 1
|
||||||
|
#define IAPP_MOVE_RSP_STATUS_STALE 2
|
||||||
|
/* 0 Successful, 1 Move denied, 2 Stale move */
|
||||||
|
/*
|
||||||
|
FAIL indicates that a RADIUS Access-Reject was received in response
|
||||||
|
to the RADIUS Access-Request sent to the RADUS server to look up the
|
||||||
|
IP address of the Old AP. (not use the IP in the MOVE-notify frame)
|
||||||
|
*/
|
||||||
|
UCHAR Status;
|
||||||
|
|
||||||
|
/* the MAC address of the STA that has associated */
|
||||||
|
UCHAR MacAddr[ETH_ALEN];
|
||||||
|
|
||||||
|
/* the integer value of the sequence number of the association request frame
|
||||||
|
*/
|
||||||
|
UINT16 Sequence;
|
||||||
|
|
||||||
|
/* indicates the number of octets in the Context Block field, always 0 */
|
||||||
|
UINT16 LenOfContextBlock;
|
||||||
|
|
||||||
|
} RT_IAPP_MOVE_RSP;
|
||||||
|
|
||||||
|
/* SEND-SECURITY-BLOCK frame */
|
||||||
|
typedef struct PACKED _RT_IAPP_SEND_SECURITY_BLOCK {
|
||||||
|
|
||||||
|
RT_IAPP_HEADER IappHeader;
|
||||||
|
|
||||||
|
/* first 8 bytes of the ACK nonce */
|
||||||
|
#define IAPP_SB_INIT_VEC_SIZE 8
|
||||||
|
UCHAR InitVec[8];
|
||||||
|
|
||||||
|
/* indicates the number of octets in the Security Block field */
|
||||||
|
UINT16 Length;
|
||||||
|
|
||||||
|
/*
|
||||||
|
Contains the security information being forwarded from the
|
||||||
|
RADIUS Server through the new AP to the old AP.
|
||||||
|
*/
|
||||||
|
UCHAR SB[0];
|
||||||
|
|
||||||
|
} RT_IAPP_SEND_SECURITY_BLOCK;
|
||||||
|
|
||||||
|
/* no use */
|
||||||
|
typedef struct PACKED _RT_IAPP_ACK_SECURITY_BLOCK {
|
||||||
|
|
||||||
|
RT_IAPP_HEADER IappHeader;
|
||||||
|
|
||||||
|
/* copied from the Date/Time stamp */
|
||||||
|
UCHAR InitVec[8];
|
||||||
|
|
||||||
|
/*
|
||||||
|
Content of the New-AP-ACK-Authenticator information element that
|
||||||
|
the old AP received in the Security Block.
|
||||||
|
*/
|
||||||
|
UCHAR NewApAckAuth[48];
|
||||||
|
|
||||||
|
} RT_IAPP_ACK_SECURITY_BLOCK;
|
||||||
|
|
||||||
|
/* private frame */
|
||||||
|
typedef struct PACKED _RT_IAPP_INFORMATION {
|
||||||
|
|
||||||
|
#define IAPP_INFO_TYPE_BC 0
|
||||||
|
#define IAPP_INFO_TYPE_REQ 1
|
||||||
|
#define IAPP_INFO_TYPE_RSP 2
|
||||||
|
#define IAPP_INFO_TYPE_MAX_NUM 3
|
||||||
|
|
||||||
|
RT_IAPP_HEADER IappHeader;
|
||||||
|
|
||||||
|
/* indicates the number of octets in the Information Block field */
|
||||||
|
UINT16 Length;
|
||||||
|
|
||||||
|
/* contains the AP information being forwarded */
|
||||||
|
UCHAR IB[0];
|
||||||
|
|
||||||
|
} RT_IAPP_INFORMATION;
|
||||||
|
|
||||||
|
typedef struct PACKED _RT_IAPP_SECURITY_MONITOR {
|
||||||
|
|
||||||
|
RT_IAPP_HEADER IappHeader;
|
||||||
|
RT_802_11_EVENT_TABLE EvtTab;
|
||||||
|
} RT_IAPP_SECURITY_MONITOR, *PRT_IAPP_SECURITY_MONITOR;
|
||||||
|
|
||||||
|
/* Event structure between daemon and driver */
|
||||||
|
#define FT_KDP_EVT_HEADER_SIZE sizeof(FT_KDP_EVT_HEADER)
|
||||||
|
|
||||||
|
typedef struct _OID_REQ {
|
||||||
|
|
||||||
|
INT32 OID;
|
||||||
|
INT32 Len;
|
||||||
|
CHAR Buf[0];
|
||||||
|
} OID_REQ, *POID_REQ;
|
||||||
|
|
||||||
|
typedef struct _MSG_BUF {
|
||||||
|
|
||||||
|
INT32 MsgType;
|
||||||
|
INT32 MsgSubType;
|
||||||
|
CHAR Buf[1024];
|
||||||
|
} MSG_BUF, *PMSG_BUF;
|
||||||
|
|
||||||
|
/* Layer 2 Update frame to switch/bridge */
|
||||||
|
typedef struct PACKED _FT_ETH_HEADER {
|
||||||
|
|
||||||
|
UCHAR DA[ETH_ALEN];
|
||||||
|
UCHAR SA[ETH_ALEN];
|
||||||
|
UINT16 Len;
|
||||||
|
|
||||||
|
} FT_ETH_HEADER;
|
||||||
|
|
||||||
|
/* For any Layer2 devices, e.g., bridges, switches and other APs, the frame
|
||||||
|
can update their forwarding tables with the correct port to reach the new
|
||||||
|
location of the STA */
|
||||||
|
typedef struct PACKED _RT_IAPP_L2_UPDATE_FRAME {
|
||||||
|
|
||||||
|
FT_ETH_HEADER ETH;
|
||||||
|
UCHAR DSAP; /* must be NULL */
|
||||||
|
UCHAR SSAP; /* must be NULL */
|
||||||
|
UCHAR Control; /* reference to IEEE Std 802.2 */
|
||||||
|
UCHAR XIDInfo[3]; /* reference to IEEE Std 802.2 */
|
||||||
|
} RT_IAPP_L2_UPDATE_FRAME, *PRT_IAPP_L2_UPDATE_FRAME;
|
||||||
|
|
||||||
|
/* RRB protocol */
|
||||||
|
typedef struct PACKED _FT_RRB_FRAME {
|
||||||
|
/* ethernet header */
|
||||||
|
FT_ETH_HEADER ETH;
|
||||||
|
|
||||||
|
/* shall be set to 1 */
|
||||||
|
#define FT_RRB_FRAME_TYPE 1
|
||||||
|
UCHAR RemoteFrameType;
|
||||||
|
|
||||||
|
/* 0 for Remote Request, and to 1 for Remote Response */
|
||||||
|
UCHAR FTPacketType;
|
||||||
|
|
||||||
|
/* the length in octets of the FT Action Frame field */
|
||||||
|
UINT16 FTActionLength;
|
||||||
|
|
||||||
|
/* the BSSID of the current AP */
|
||||||
|
UCHAR ApAddress[ETH_ALEN];
|
||||||
|
|
||||||
|
/*
|
||||||
|
The contents of the FT Action frame, from the Category field to the
|
||||||
|
end of the Action Frame body.
|
||||||
|
*/
|
||||||
|
#define FT_RRB_HEADER_SIZE (sizeof(FT_RRB_FRAME))
|
||||||
|
UCHAR FTActionFrame[0];
|
||||||
|
} FT_RRB_FRAME;
|
||||||
|
|
||||||
|
typedef struct _FT_CLIENT_INFO {
|
||||||
|
struct _FT_CLIENT_INFO *next;
|
||||||
|
INT if_idx;
|
||||||
|
UCHAR sta_mac[ETH_ALEN];
|
||||||
|
UCHAR ap_mac[ETH_ALEN];
|
||||||
|
UCHAR used;
|
||||||
|
UCHAR hash_idx;
|
||||||
|
} FT_CLIENT_INFO;
|
||||||
|
|
||||||
|
typedef struct _FT_CLIENT_TABLE {
|
||||||
|
FT_CLIENT_INFO *hash[HASH_TABLE_SIZE];
|
||||||
|
FT_CLIENT_INFO ft_sta_info[MAX_NUM_OF_CLIENT];
|
||||||
|
INT32 ft_sta_table_size;
|
||||||
|
} FT_CLIENT_TABLE;
|
||||||
|
|
||||||
|
/* IAPP control block */
|
||||||
|
#define IAPP_ENCRYPT_KEY_MAX_SIZE 64
|
||||||
|
#define MAX_WIFI_COUNT 2
|
||||||
|
typedef struct _RTMP_IAPP {
|
||||||
|
|
||||||
|
CHAR IfNameEth[IFNAMSIZ]; /* ethernet interface name */
|
||||||
|
CHAR IfNameWlan[IFNAMSIZ]; /* wireless interface name */
|
||||||
|
CHAR IfNameWlanIoctl[MAX_WIFI_COUNT][IFNAMSIZ]; /* wireless interface name */
|
||||||
|
UCHAR IfNameWlanMAC[MAX_WIFI_COUNT][ETH_ALEN]; /* wireless interface name */
|
||||||
|
INT32 IfNameWlanCount;
|
||||||
|
|
||||||
|
BOOLEAN FlgIsTerminated; /* if terminate IAPP daemon */
|
||||||
|
|
||||||
|
struct in_addr AddrOwn; /* IP address of ethernet interface */
|
||||||
|
struct in_addr AddrNetmask; /* netmask of ethernet interface */
|
||||||
|
struct in_addr AddrBroadcast; /* broadcast address of ethernet interface */
|
||||||
|
|
||||||
|
BOOLEAN FlgIsRcvRunning; /* if rcv handler is running */
|
||||||
|
|
||||||
|
INT32 SocketUdpSend; /* used to send/rcv IAPP multicast frame */
|
||||||
|
INT32 SocketTcpRcv; /* used to rcv unicast frame from a peer */
|
||||||
|
INT32 SocketRawBr; /* used to send bridge L2 frame */
|
||||||
|
INT32 SocketIoctl; /* used to ioctl() to WLAN driver */
|
||||||
|
INT32 SocketRawRRB; /* used in RRB RAW protocol */
|
||||||
|
|
||||||
|
#ifdef FT_KDP_FUNC_SOCK_COMM
|
||||||
|
INT32 SocketRawDrv; /* used to receive message from driver */
|
||||||
|
#endif // FT_KDP_FUNC_SOCK_COMM //
|
||||||
|
|
||||||
|
#ifndef FT_KDP_FUNC_SOCK_COMM
|
||||||
|
#ifdef IAPP_OS_LINUX
|
||||||
|
#define FT_KDP_PIPE_ID_READ 0
|
||||||
|
#define FT_KDP_PIPE_ID_WRITE 1
|
||||||
|
INT32 PipeRawDrv[2]; /* used to receive message from driver */
|
||||||
|
#endif // IAPP_OS_LINUX //
|
||||||
|
#endif // FT_KDP_FUNC_SOCK_COMM //
|
||||||
|
|
||||||
|
#ifdef IAPP_OS_VXWORKS
|
||||||
|
VOID *pBcCookie[FT_KDP_BR_ETH_IF_NUM]; /* for bridge L2 frame */
|
||||||
|
VOID *pDrvCookieTo; /* for ioctl to WLAN driver */
|
||||||
|
VOID *pDrvCookieFrom; /* for ioctl from WLAN driver */
|
||||||
|
VOID *pRrbCookieTo[FT_KDP_BR_ETH_IF_NUM]; /* used in RRB protocol */
|
||||||
|
VOID *pRrbCookieFrom; /* for ioctl from WLAN driver */
|
||||||
|
|
||||||
|
#define IAPP_KDP_PIPE_DRV "/pipe/IAPP_Drv"
|
||||||
|
#define IAPP_KDP_PIPE_ETH "/pipe/IAPP_Eth"
|
||||||
|
#endif // IAPP_OS_VXWORKS //
|
||||||
|
|
||||||
|
#ifdef IAPP_EVENT_LOG
|
||||||
|
INT32 MsgId;
|
||||||
|
BOOLEAN FlgIsMsgReady;
|
||||||
|
#endif // IAPP_EVENT_LOG //
|
||||||
|
|
||||||
|
pid_t PID; /* IAPP task PID */
|
||||||
|
UINT16 PacketIdentifier; /* used in IAPP frame identifier */
|
||||||
|
|
||||||
|
#ifdef FT_KDP_FUNC_PKT_ENCRYPT
|
||||||
|
/* common key, ASCII, the last byte must be 0x00 */
|
||||||
|
CHAR CommonKey[IAPP_ENCRYPT_KEY_MAX_SIZE + 1];
|
||||||
|
#endif // FT_KDP_FUNC_PKT_ENCRYPT //
|
||||||
|
|
||||||
|
FT_CLIENT_TABLE SelfFtStaTable;
|
||||||
|
} RTMP_IAPP, *PRTMP_IAPP;
|
||||||
|
|
||||||
|
/* key information */
|
||||||
|
#define FT_IP_ADDRESS_SIZE 4
|
||||||
|
#define FT_NONCE_SIZE 8
|
||||||
|
|
||||||
|
#define FT_KDP_WPA_NAME_MAX_SIZE 16
|
||||||
|
#define FT_KDP_R0KHID_MAX_SIZE 48
|
||||||
|
#define FT_KDP_R1KHID_MAX_SIZE 6
|
||||||
|
#define FT_KDP_S1KHID_MAX_SIZE 6
|
||||||
|
#define FT_KDP_PMKR1_MAX_SIZE 32 /* 256-bit key */
|
||||||
|
|
||||||
|
#define FT_R1KH_ENTRY_TABLE_SIZE 64
|
||||||
|
#define FT_R1KH_ENTRY_HASH_TABLE_SIZE FT_R1KH_ENTRY_TABLE_SIZE
|
||||||
|
|
||||||
|
typedef struct PACKED _FT_KDP_PMK_KEY_INFO {
|
||||||
|
|
||||||
|
UCHAR R0KHID[FT_KDP_R0KHID_MAX_SIZE];
|
||||||
|
UCHAR R0KHIDLen;
|
||||||
|
UCHAR PMKR0Name[FT_KDP_WPA_NAME_MAX_SIZE]; /* an ID that names the PMK-R0 */
|
||||||
|
|
||||||
|
UCHAR R1KHID[FT_KDP_R1KHID_MAX_SIZE];
|
||||||
|
UCHAR S1KHID[FT_KDP_S1KHID_MAX_SIZE];
|
||||||
|
|
||||||
|
/* reserved field */
|
||||||
|
UCHAR RSV[4];
|
||||||
|
|
||||||
|
} FT_KDP_PMK_KEY_INFO;
|
||||||
|
|
||||||
|
typedef struct PACKED _FT_KDP_EVT_KEY_ELM {
|
||||||
|
/* must be 65535, Proprietary Information */
|
||||||
|
#define FT_KDP_ELM_ID_PRI 65535
|
||||||
|
UINT16 ElmId;
|
||||||
|
|
||||||
|
#define FT_KDP_ELM_PRI_LEN (sizeof(FT_KDP_EVT_KEY_ELM) - 4)
|
||||||
|
UINT16 ElmLen;
|
||||||
|
|
||||||
|
/* must be 0x00 0x0E 0x2E, RALINK */
|
||||||
|
#define FT_KDP_ELM_PRI_OUI_0 0x00
|
||||||
|
#define FT_KDP_ELM_PRI_OUI_1 0x0E
|
||||||
|
#define FT_KDP_ELM_PRI_OUI_2 0x2E
|
||||||
|
#define FT_KDP_ELM_PRI_OUI_SIZE 3
|
||||||
|
UCHAR OUI[3];
|
||||||
|
|
||||||
|
/* station MAC */
|
||||||
|
UCHAR MacAddr[ETH_ALEN];
|
||||||
|
UCHAR RSV[3];
|
||||||
|
|
||||||
|
/* used in request */
|
||||||
|
FT_KDP_PMK_KEY_INFO KeyInfo;
|
||||||
|
|
||||||
|
/* used in response */
|
||||||
|
UCHAR PMKR1Name[FT_KDP_WPA_NAME_MAX_SIZE]; /* an ID that names the PMK-R1 */
|
||||||
|
UCHAR PMKR1[FT_KDP_PMKR1_MAX_SIZE]; /* PMK R1 Key */
|
||||||
|
UCHAR R0KH_MAC[ETH_ALEN]; /* MAC of R0KH */
|
||||||
|
|
||||||
|
/*
|
||||||
|
During a Fast BSS Transition a non-AP STA shall negotiate the same
|
||||||
|
pairwise cipher suite with Target APs as was negotiated in the FT
|
||||||
|
Initial Mobility Domain association. The target AP shall verify
|
||||||
|
that the same pairwise cipher suite selector is used, using the
|
||||||
|
pairwise cipher suite selector value in the PMK-R1 SA received from
|
||||||
|
the R0KH.
|
||||||
|
*/
|
||||||
|
UCHAR PairwisChipher[4];
|
||||||
|
UCHAR AkmSuite[4];
|
||||||
|
|
||||||
|
UINT32 KeyLifeTime;
|
||||||
|
UINT32 ReassocDeadline;
|
||||||
|
} FT_KDP_EVT_KEY_ELM;
|
||||||
|
|
||||||
|
/* ---------------------------- API Definition ------------------------ */
|
||||||
|
|
||||||
|
VOID IAPP_HexDump(CHAR *pPromptStr, CHAR *pSrcBufVA, UINT32 SrcBufLen);
|
||||||
|
|
||||||
|
BOOLEAN IAPP_IoctlToWLAN(RTMP_IAPP *pCtrlBK, INT32 Param, CHAR *pData,
|
||||||
|
INT32 *pDataLen, UCHAR ApIdx, INT32 Flags);
|
||||||
|
|
||||||
|
BOOLEAN mt_iapp_get_wifi_iface_mac(RTMP_IAPP *pCtrlBK);
|
||||||
|
|
||||||
|
INT32 mt_iapp_find_ifidx_by_mac(RTMP_IAPP *pCtrlBK, UCHAR *WifiMAC);
|
||||||
|
|
||||||
|
VOID mt_iapp_set_daemon_information(RTMP_IAPP *pCtrlBK, pid_t *pPidAuth);
|
||||||
|
|
||||||
|
VOID mt_iapp_ft_client_table_init(RTMP_IAPP *pCtrlBK);
|
||||||
|
|
||||||
|
FT_CLIENT_INFO *mt_iapp_ft_client_look_up(FT_CLIENT_TABLE *pFtTable,
|
||||||
|
UCHAR *pAddr);
|
||||||
|
|
||||||
|
FT_CLIENT_INFO *mt_iapp_ft_client_insert(FT_CLIENT_TABLE *pFtTable,
|
||||||
|
UCHAR *pStaAddr, UCHAR *pApAddr,
|
||||||
|
INT32 ApIfIdx);
|
||||||
|
|
||||||
|
VOID mt_iapp_ft_client_delete(FT_CLIENT_TABLE *pFtTable, UCHAR *pStaAddr);
|
||||||
|
|
||||||
|
INT32 mt_iapp_find_ifidx_by_sta_mac(FT_CLIENT_TABLE *pFtTable, UCHAR *pStaMAC);
|
||||||
|
|
||||||
|
#endif /* __RTMP_IAPP_H__ */
|
||||||
|
|
||||||
|
/* End of rtmp_iapp.h */
|
Loading…
Reference in New Issue
Block a user