├── .gitignore ├── ImageBuilder ├── .gitignore ├── Makefile ├── opkg.conf └── repo-base.conf ├── Makefile ├── README.md ├── config-hiwifi-hc5761 ├── config-hiwifi-hc5861 ├── packages └── ralink │ ├── applications │ ├── 8021xd │ │ ├── Makefile │ │ └── src │ │ │ ├── COPYING │ │ │ ├── Makefile │ │ │ ├── README │ │ │ ├── ap.h │ │ │ ├── common.h │ │ │ ├── config.c │ │ │ ├── config.h │ │ │ ├── eapol_sm.c │ │ │ ├── eapol_sm.h │ │ │ ├── eloop.c │ │ │ ├── eloop.h │ │ │ ├── ieee802_1x.c │ │ │ ├── ieee802_1x.h │ │ │ ├── md5.c │ │ │ ├── md5.h │ │ │ ├── radius.c │ │ │ ├── radius.h │ │ │ ├── radius_client.c │ │ │ ├── radius_client.h │ │ │ ├── rtdot1x.c │ │ │ ├── rtdot1x.h │ │ │ ├── rtmp_type.h │ │ │ ├── sta_info.c │ │ │ └── sta_info.h │ ├── luci-mtk-wifi │ │ ├── Makefile │ │ └── files │ │ │ └── usr │ │ │ └── lib │ │ │ └── lua │ │ │ └── luci │ │ │ └── model │ │ │ └── cbi │ │ │ └── admin_network │ │ │ └── wifi.lua │ └── uci2dat │ │ ├── Makefile │ │ └── src │ │ ├── Makefile │ │ └── uci2dat.c │ └── drivers │ ├── mt7610e │ ├── Makefile │ ├── config.in │ ├── files │ │ ├── mt7610e.dat │ │ ├── mt7610e.sh │ │ └── ralink_common.sh │ └── patches │ │ └── 010-compile-standalone-mt7610e.patch │ ├── mt7620 │ ├── Makefile │ ├── config.in │ ├── files │ │ ├── SingleSKU.dat │ │ ├── mt7620.dat │ │ ├── mt7620.eeprom.epa.elna.bin │ │ ├── mt7620.eeprom.ipa.elna.bin │ │ ├── mt7620.eeprom.ipa.ilna.bin │ │ └── mt7620.sh │ └── patches │ │ ├── 001-fix-kernel-warning.patch │ │ └── 010-compile-standalone-mt7620.patch │ ├── mt76x2e │ ├── Makefile │ ├── config.in │ ├── files │ │ ├── SingleSKU.dat │ │ ├── mt7602e.dat │ │ ├── mt7602e.sh │ │ ├── mt7612e.dat │ │ ├── mt7612e.sh │ │ └── ralink_common.sh │ └── patches │ │ └── 010-compile-standalone-mt76x2e.patch │ └── mtk-wifi-gpl │ └── Makefile ├── patches ├── 01-hiwifi-hc5x61.patch ├── 10-odhcpd-nodnsv6.patch ├── 11-enable-dnsmasq-ipset.patch └── 12-disable-pdnsd.patch └── recovery.bin ├── Makefile ├── openwrt-HC5661-uboot.bin ├── openwrt-HC5761-uboot.bin ├── tftpd32.exe └── tftpd64.exe /.gitignore: -------------------------------------------------------------------------------- 1 | /openwrt-ramips 2 | /.config.extra 3 | /.install_feeds 4 | /.update_feeds 5 | /.patched 6 | /.checkout_svn 7 | /.check_hostdeps 8 | /config 9 | -------------------------------------------------------------------------------- /ImageBuilder/.gitignore: -------------------------------------------------------------------------------- 1 | /.patched 2 | /OpenWrt-ImageBuilder-* 3 | /OpenWrt-SDK-* 4 | -------------------------------------------------------------------------------- /ImageBuilder/Makefile: -------------------------------------------------------------------------------- 1 | 2 | BUILDER := OpenWrt-ImageBuilder-ramips_mt7620a-for-linux-x86_64 3 | SDK := OpenWrt-SDK-ramips-for-linux-x86_64-gcc-4.8-linaro_uClibc-0.9.33.2 4 | 5 | EXTRA_PACKAGES := kmod-tun \ 6 | iptables-mod-conntrack-extra iptables-mod-extra iptables-mod-filter \ 7 | iptables-mod-nat-extra ip6tables-extra ip6tables-mod-nat \ 8 | ppp-mod-pppol2tp ppp-mod-pptp 9 | 10 | all: HC5661 HC5761 HC5861 11 | 12 | define BeforeBuildImage 13 | mkdir -p $(BUILDER)/dl 14 | cp -f repo-base.conf $(BUILDER)/repositories.conf 15 | @[ -n "$(SDK)" -a -f "$(SDK)"/bin/ramips/packages/Packages ] && \ 16 | echo "src ralink file:$(shell cd $(SDK)/bin/ramips/packages; pwd)" >> $(BUILDER)/repositories.conf || : 17 | mkdir -p $(BUILDER)/target/linux/ramips/base-files/etc 18 | cp -f opkg.conf $(BUILDER)/target/linux/ramips/base-files/etc/opkg.conf 19 | endef 20 | 21 | HC5661: patch_ib 22 | $(call BeforeBuildImage) 23 | $(MAKE) -C $(BUILDER) image PROFILE=HC5661 \ 24 | FILES="$(shell cd $(BUILDER) && pwd)/target/linux/ramips/base-files" \ 25 | PACKAGES="$(EXTRA_PACKAGES)" 26 | 27 | HC5761: patch_ib build_drivers 28 | $(call BeforeBuildImage) 29 | $(MAKE) -C $(BUILDER) image PROFILE=HC5761 \ 30 | FILES="$(shell cd $(BUILDER) && pwd)/target/linux/ramips/base-files" \ 31 | PACKAGES="$(EXTRA_PACKAGES) 8021xd uci2dat kmod-mt7610e luci-mtk-wifi" 32 | 33 | HC5861: patch_ib build_drivers 34 | $(call BeforeBuildImage) 35 | $(MAKE) -C $(BUILDER) image PROFILE=HC5861 \ 36 | FILES="$(shell cd $(BUILDER) && pwd)/target/linux/ramips/base-files" \ 37 | PACKAGES="$(EXTRA_PACKAGES) 8021xd uci2dat kmod-mt76x2e luci-mtk-wifi" 38 | 39 | build_drivers: check_sdk 40 | $(MAKE) -C $(SDK) package/8021xd/compile package/uci2dat/compile package/mt7610e/compile package/mt76x2e/compile package/luci-mtk-wifi/compile V=s 41 | cd "$(SDK)/bin/ramips/packages" && ../../../scripts/ipkg-make-index.sh . > Packages && gzip -9c Packages > Packages.gz 42 | 43 | patch_ib: check_ib 44 | @[ -f .patched ] && exit 0; \ 45 | mkdir -p $(BUILDER)/target/linux/ramips/patches-3.10; \ 46 | cat ../patches/01-hiwifi-hc5x61.patch > .patching; \ 47 | patch -d $(BUILDER) -p0 < .patching && mv .patching .patched 48 | 49 | # Try extracting ImageBuilder & SDK to current directory 50 | check_sdk: $(SDK) 51 | cd $(SDK) && [ ! -L dl -a -d /var/dl ] && { rmdir dl && ln -s /var/dl; } || : 52 | cd $(SDK)/package && { [ -d ralink ] || ln -sv ../../../packages/ralink; } 53 | check_ib: $(BUILDER) 54 | 55 | $(SDK): $(SDK).tar.bz2 56 | tar axvf $< || { rm -rf $@; exit 1; } 57 | $(BUILDER): $(BUILDER).tar.bz2 58 | tar axvf $< || { rm -rf $@; exit 1; } 59 | 60 | help: 61 | @echo "Usage:" 62 | @echo " make HC5661|HC5761|HC5861" 63 | 64 | clean: 65 | rm -f patching .patched 66 | rm -rf $(BUILDER) $(SDK) 67 | 68 | .FORCE: 69 | 70 | -------------------------------------------------------------------------------- /ImageBuilder/opkg.conf: -------------------------------------------------------------------------------- 1 | dest root / 2 | dest ram /tmp 3 | lists_dir ext /var/opkg-lists 4 | option overlay_root /overlay 5 | src/gz barrier_breaker_base http://downloads.openwrt.org/barrier_breaker/14.07/ramips/mt7620a/packages/base 6 | src/gz barrier_breaker_luci http://downloads.openwrt.org/barrier_breaker/14.07/ramips/mt7620a/packages/luci 7 | src/gz barrier_breaker_oldpackages http://downloads.openwrt.org/barrier_breaker/14.07/ramips/mt7620a/packages/oldpackages 8 | src/gz barrier_breaker_packages http://downloads.openwrt.org/barrier_breaker/14.07/ramips/mt7620a/packages/packages 9 | src/gz barrier_breaker_routing http://downloads.openwrt.org/barrier_breaker/14.07/ramips/mt7620a/packages/routing 10 | src/gz barrier_breaker_telephony http://downloads.openwrt.org/barrier_breaker/14.07/ramips/mt7620a/packages/telephony 11 | -------------------------------------------------------------------------------- /ImageBuilder/repo-base.conf: -------------------------------------------------------------------------------- 1 | ## Place your custom repositories here, they must match the architecture and version. 2 | # src/gz barrier_breaker http://downloads.openwrt.org/barrier_breaker/14.07/ramips/mt7620a/packages 3 | # src custom file:///usr/src/openwrt/bin/ramips/packages 4 | 5 | ## This is the local package repository, do not remove! 6 | src imagebuilder file:packages 7 | 8 | src/gz barrier_breaker_base http://downloads.openwrt.org/barrier_breaker/14.07/ramips/mt7620a/packages/base 9 | src/gz barrier_breaker_luci http://downloads.openwrt.org/barrier_breaker/14.07/ramips/mt7620a/packages/luci 10 | src/gz barrier_breaker_oldpackages http://downloads.openwrt.org/barrier_breaker/14.07/ramips/mt7620a/packages/oldpackages 11 | src/gz barrier_breaker_packages http://downloads.openwrt.org/barrier_breaker/14.07/ramips/mt7620a/packages/packages 12 | src/gz barrier_breaker_routing http://downloads.openwrt.org/barrier_breaker/14.07/ramips/mt7620a/packages/routing 13 | src/gz barrier_breaker_telephony http://downloads.openwrt.org/barrier_breaker/14.07/ramips/mt7620a/packages/telephony 14 | 15 | -------------------------------------------------------------------------------- /Makefile: -------------------------------------------------------------------------------- 1 | # 2 | # 3 | hiwifi_root = $(shell pwd) 4 | openwrt_dir = openwrt-ramips 5 | host_packages = build-essential git flex gettext libncurses5-dev unzip gawk liblzma-dev u-boot-tools 6 | CONFIG_FILENAME = config 7 | 8 | define CheckConfigSymlink 9 | @if ! [ -e $(CONFIG_FILENAME) ]; then \ 10 | echo "*** Please make a symbolic of either config file to '$(CONFIG_FILENAME)'."; \ 11 | exit 1; \ 12 | fi 13 | endef 14 | 15 | HC5X61: .install_feeds 16 | @cd $(openwrt_dir); \ 17 | if [ -e .config ]; then \ 18 | mv -vf .config .config.bak; \ 19 | echo "WARNING: .config is updated, backed up as '.config.bak'"; \ 20 | fi 21 | $(call CheckConfigSymlink) 22 | cp -vf $(CONFIG_FILENAME) $(openwrt_dir)/.config 23 | @[ -f .config.extra ] && cat .config.extra >> $(openwrt_dir)/.config || : 24 | $(MAKE) -C $(openwrt_dir) V=s 25 | 26 | recovery.bin: HC5X61 27 | $(MAKE) -C recovery.bin 28 | 29 | .install_feeds: .update_feeds 30 | @cd $(openwrt_dir)/package; \ 31 | [ -e extra-packages ] || ln -s ../../packages extra-packages 32 | @touch .install_feeds 33 | 34 | .update_feeds: .patched 35 | @cd $(openwrt_dir); ./scripts/feeds update; 36 | @touch .update_feeds 37 | 38 | .patched: .checkout_svn 39 | $(call CheckConfigSymlink) 40 | @cp -vf $(CONFIG_FILENAME) $(openwrt_dir)/.config 41 | @cd $(openwrt_dir); cat ../patches/*.patch | patch -p0 42 | @touch .patched 43 | 44 | # 2. Checkout source code: 45 | .checkout_svn: .check_hostdeps 46 | # svn co svn://svn.openwrt.org/openwrt/branches/barrier_breaker $(openwrt_dir) -r43166 || : 47 | @git clone https://github.com/i80s/barrier_breaker.git $(openwrt_dir) && \ 48 | cd $(openwrt_dir) && git reset --hard b763ba211deeab857ef7c2e5275e92c15dd5e249 49 | @[ -d /var/dl ] && ln -sf /var/dl $(openwrt_dir)/dl || : 50 | @touch .checkout_svn 51 | 52 | .check_hostdeps: 53 | # 1. Install required host components: 54 | @which dpkg >/dev/null 2>&1 || exit 0; \ 55 | for p in $(host_packages); do \ 56 | dpkg -s $$p >/dev/null 2>&1 || to_install="$$to_install$$p "; \ 57 | done; \ 58 | if [ -n "$$to_install" ]; then \ 59 | echo "Please install missing packages by running the following commands:"; \ 60 | echo " sudo apt-get update"; \ 61 | echo " sudo apt-get install -y $$to_install"; \ 62 | exit 1; \ 63 | fi; 64 | @touch .check_hostdeps 65 | 66 | menuconfig: .install_feeds 67 | @cd $(openwrt_dir); [ -f .config ] && mv -vf .config .config.bak || : 68 | $(call CheckConfigSymlink) 69 | @cp -vf $(CONFIG_FILENAME) $(openwrt_dir)/.config 70 | @touch $(CONFIG_FILENAME) # change modification time 71 | @$(MAKE) -C $(openwrt_dir) menuconfig 72 | @[ $(openwrt_dir)/.config -nt $(CONFIG_FILENAME) ] && cp -vf $(openwrt_dir)/.config $(CONFIG_FILENAME) || : 73 | 74 | clean: 75 | $(MAKE) clean -C recovery.bin 76 | $(MAKE) clean -C $(openwrt_dir) V=s 77 | 78 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | openwrt-hc5x61 2 | ============== 3 | 4 | OpenWrt Patch for HiWiFi HC5661 / HC5761 / HC5861 (based on "barrier_breaker" branch) 5 | 6 | 极路由 HC5661 / HC5761 / HC5861 (极1S、极2、极3)OpenWrt补丁(基于barrier_breaker分支) 7 | 8 | ### 关于极路由 9 | * 极路由官方产品页:http://www.hiwifi.com/ 10 | 11 | ------- 12 | 13 | Chaos Calmer - 15.05 版本请参考本项目的 chaos_calmer 分支: https://github.com/rssnsj/openwrt-hc5x61/tree/chaos_calmer 14 | 15 | ------- 16 | 17 | #### OpenWrt补丁及ImageBuilder说明 18 | 19 | * 包含了HC5661、HC5761、HC5861 3个机型的OpenWrt补丁; 20 | * 可以Checkout下来代码直接make,会自动打补丁、自动载入menuconfig配置,并自动编译; 21 | * 也可以直接利用ImageBuilder,将机型支持代码(dts描述文件),与OpenWrt官方二进制程序合并成相应机型的固件。 22 | 23 | #### 固件包含的功能 24 | * 基于 OpenWrt Barrier Breaker - r43770 版本; 25 | * 支持获取正确的MAC地址(HiWiFi bdinfo中的文本格式); 26 | * 完全适配HiWiFi的flash layout,不会丢key; 27 | * 自带5G Wi-Fi驱动; 28 | * 内置基于IP地址、域名列表的透明代理服务(SS),及其LuCi配置界面; 29 | * 内置基于IP地址、域名列表的非标准VPN服务(minivtun),及其LuCI配置界面; 30 | * 内置“文件中转站”功能,自动挂载USB存储以及自动配置Samba服务。 31 | 32 | #### 编译好的固件下载 33 | * 请在本项目的Releases下载,或者 http://rssn.cn/roms/ 。 34 | 35 | #### 前提工作 36 | 37 | # 安装必需的软件包(仅限Ubuntu/Debian) 38 | sudo apt-get install build-essential git subversion wget flex gettext libncurses5-dev unzip gawk liblzma-dev zlib1g-dev ccache u-boot-tools 39 | 40 | # Checkout项目代码 41 | git clone https://github.com/rssnsj/openwrt-hc5x61.git 42 | 43 | #### 固件生成方法1 - 编译 44 | 45 | cd openwrt-hc5x61 46 | make 47 | # 编译成功后,固件文件位于: openwrt-ramips/bin/oopenwrt-ramips-mt7620a-hiwifi-hc5761-squashfs-sysupgrade.bin 48 | 49 | #### 固件生成方法2 - 利用ImageBuilder将机型支持代码与OpenWrt官方二进制程序合并生成固件 50 | 51 | cd openwrt-hc5x61/ImageBuilder 52 | 53 | # 解压ImageBuilder和SDK(事先从downloads.openwrt.org下载好) 54 | tar jxvf xxx/OpenWrt-ImageBuilder-ramips_mt7620a-for-linux-x86_64.tar.bz2 55 | tar jxvf xxx/OpenWrt-SDK-ramips-for-linux-x86_64-gcc-4.8-linaro_uClibc-0.9.33.2.tar.bz2 56 | 57 | # 生成极2固件: 58 | make HC5761 FEEDS=1 RALINK=1 59 | # 生成极3固件: 60 | make HC5861 FEEDS=1 RALINK=1 61 | # FEEDS=1 表示包含项目 rssnsj/network-feeds 的功能在内 62 | # RALINK=1 表示包含5G驱动在固件中 63 | 64 | #### 刷机方法 65 | 以极2为例,openwrt-ramips-mt7620a-hiwifi-hc5761-squashfs-sysupgrade.bin 是sysupgrade格式的固件,传到路由器的/tmp下,通过SSH或串口登录路由器Shell。 66 | 67 | 首先最好将U-boot替换成解锁版(tftp刷机时U-boot不对固件做校验)的,以防止万一刷砖无法直接tftp刷root固件: 68 | 69 | # 极1S 70 | cd /tmp 71 | wget http://rssn.cn/roms/uboot/HC5661-uboot.bin 72 | mtd write HC5661-uboot.bin u-boot 73 | 74 | # 极2 75 | cd /tmp 76 | wget http://rssn.cn/roms/uboot/HC5761-uboot.bin 77 | mtd write HC5761-uboot.bin u-boot 78 | 79 | # 极3 80 | cd /tmp 81 | wget http://rssn.cn/roms/uboot/HC5861-uboot.bin 82 | mtd write HC5861-uboot.bin u-boot 83 | 84 | 如果上面的地址失效,也可以从这里获取U-boot映像: https://github.com/rssnsj/firmware-tools/tree/hiwifi 85 | 86 | 然后刷入固件: 87 | 88 | sysupgrade -F -n openwrt-ramips-mt7620a-hiwifi-hc5761-squashfs-sysupgrade.bin 89 | 90 | #### 说明 91 | * Releases中提供的xxx-hiwifi-hc5761-xxx是极1S、极2通用的,xxx-hiwifi-hc5861-xxx是极3; 92 | * 编译时若碰到代码包下载失败,或下载过于缓慢,请先 Ctrl + C 暂停,手动下载同名的文件放到 openwrt-ramips/dl 下面,再执行“make”继续编译; 93 | * HC5761(极2)的5G(MT7610E)、HC5861(极3)的5G(MT7612E)驱动暂未有开源支持,Releases中可下载到编译好的已带5G驱动的固件,但由于MTK版权限制本项目不提供其源代码。 94 | 95 | -------------------------------------------------------------------------------- /packages/ralink/applications/8021xd/Makefile: -------------------------------------------------------------------------------- 1 | # 2 | # Copyright (C) 2010-2013 hua.shao@mediatek.com 3 | # 4 | # Ralink Property Software. 5 | # 6 | 7 | include $(TOPDIR)/rules.mk 8 | 9 | PKG_NAME:=8021xd 10 | PKG_RELEASE:=1 11 | 12 | PKG_BUILD_DIR:=$(BUILD_DIR)/$(PKG_NAME) 13 | PKG_KCONFIG:=RALINK_MT7620 RALINK_MT7621 RALINK_MT7628 14 | PKG_CONFIG_DEPENDS:=$(foreach c, $(PKG_KCONFIG),$(if $(CONFIG_$c),CONFIG_$(c))) 15 | 16 | 17 | include $(INCLUDE_DIR)/package.mk 18 | include $(INCLUDE_DIR)/kernel.mk 19 | 20 | define Package/8021xd 21 | SECTION:=Ralink Properties 22 | CATEGORY:=Ralink Properties 23 | TITLE:=802.1X Daemon 24 | SUBMENU:=Applications 25 | endef 26 | 27 | define Package/8021xd/description 28 | 802.1X Daemon 29 | endef 30 | 31 | define Build/Prepare 32 | mkdir -p $(PKG_BUILD_DIR) 33 | $(CP) ./src/* $(PKG_BUILD_DIR)/ 34 | endef 35 | 36 | #TARGET_CFLAGS += \ 37 | # -I$(LINUX_DIR)/include 38 | 39 | MAKE_FLAGS += \ 40 | CFLAGS="$(TARGET_CFLAGS)" 41 | 42 | define Package/8021xd/install 43 | $(INSTALL_DIR) $(1)/bin 44 | $(INSTALL_BIN) $(PKG_BUILD_DIR)/8021xd $(1)/bin/8021xd 45 | ln $(1)/bin/8021xd $(1)/bin/8021xdi 46 | endef 47 | 48 | 49 | $(eval $(call BuildPackage,8021xd)) 50 | 51 | -------------------------------------------------------------------------------- /packages/ralink/applications/8021xd/src/Makefile: -------------------------------------------------------------------------------- 1 | EXE:=8021xd 2 | 3 | EXTRA_CFLAGS += -O2 -Wall -g $(CFLAGS) 4 | 5 | # If you want to support multiple radius server for multiple bssid, add following line 6 | EXTRA_CFLAGS += -DMULTIPLE_RADIUS=1 7 | 8 | # If you want to debug daemon, add following line 9 | EXTRA_CFLAGS += -DDBG=1 10 | 11 | OBJS = rtdot1x.o eloop.o eapol_sm.o radius.o md5.o \ 12 | config.o ieee802_1x.o \ 13 | sta_info.o radius_client.o 14 | 15 | all: $(EXE) 16 | 17 | $(EXE): $(OBJS) 18 | $(CC) $(EXTRA_CFLAGS) -o $@ $(OBJS) 19 | 20 | clean: 21 | -@rm -f *~ *.o $(EXE) *.d 22 | 23 | $(OBJS): %.o : %.c 24 | $(CC) $(EXTRA_CFLAGS) -c $< -o $@ 25 | 26 | -------------------------------------------------------------------------------- /packages/ralink/applications/8021xd/src/README: -------------------------------------------------------------------------------- 1 | 2 | RTDOT1XD - user space IEEE 802.1X Authenticator 3 | for RT_WIFI linux driver, Ralink Tech Corp. 4 | ================================================================= 5 | Copyright (c) 2002-2003, Jouni Malinen 6 | 7 | This program is free software; you can redistribute it and/or modify 8 | it under the terms of the GNU General Public License version 2 as 9 | published by the Free Software Foundation. See COPYING for more 10 | details. 11 | 12 | ================================================================= 13 | 14 | This is the README file for the 802.1x daemon - rtdot1xd, which comes with RT_WIFI linux driver. 15 | This README explains the relationship between the linux driver and 802.1x daemon. 16 | In addtiion, this will teach you how to use this 802.1x daemon. 17 | For programmers who want to add other interfaces for linux driver or 802.1x daemon, 18 | This README has also mentions below. 19 | 20 | I. Introduction 21 | ================================================================= 22 | rtdot1xd is an optional user space component for RT_WIFI linux driver. 23 | It adds 802.1x Authenticator feature using external RADIUS Authentication 24 | Server(AS). 25 | 26 | 27 | II. IEEE 802.1X features in rtdot1xd 28 | ================================================================= 29 | IEEE Std 802.1X-2001 is a standard for port-based network access 30 | control. It introduces a extensible mechanism for authenticating 31 | and authorizing users. 32 | 33 | rtdot1xd implements partial IEEE 802.1x features that helps AS authenrizing 34 | Supplicant and in the mean time proves itself a valid Authenticator for AS. 35 | Noticed that Key management state machine is not included in rtdot1xd. 36 | And those key management is included in RT_WIFI linux driver. 37 | 38 | rtdot1xd relays the frames between the Supplicant and the AS. 39 | Not until either one timeout or Success or Fail frame 40 | indicated does rtdot1xd finish the authentication process. 41 | The port control entity is implemented in linux driver for RT_WIFI. 42 | 43 | 44 | III. How to start rtdot1xd 45 | ================================================================= 46 | 1. First we need to compile the source code using 'make' command 47 | 2. The command synopsis as below, 48 | rtdot1xd [-d debug_level] [-i card_number] 49 | 50 | -d debug_level 51 | Allow user to set debug level. This debug_level 52 | parameter must be 0~4. 53 | 0 : RT_DEBUG_OFF 54 | 1 : RT_DEBUG_ERROR 55 | 2 : RT_DEBUG_WARN 56 | 3 : RT_DEBUG_TRACE 57 | 4 : RT_DEBUG_INFO 58 | 59 | -i card_number 60 | Only work for multiple card function of RT_WIFI linux 61 | driver. This command provides users to assign the 62 | corresponding wireless card. 63 | p.s. 64 | The card_number set 1, it mean that the daemon works with the 1st card(ra00-x). 65 | The card_number set 2, it mean that the daemon works with the 2nd card(ra01-x). 66 | .... 67 | 68 | 3. Manually start rtdot1xd, default type $rtdot1xd 69 | 70 | IV. rtdot1xd configuration for IEEE 802.1X 71 | ================================================================= 72 | When rtdot1xd starts, it reads the configuraion file to derive parameters. 73 | For any changes to make, one need to first edit the configuration file, then 74 | restart rtdot1xd. Noted that manually restarting rtdot1xd is unnecessary, 75 | because setting linux driver's SSID with command 'iwpriv' will automatically restart rtdot1xd. 76 | In a word, edit the configuraion file and then set its SSID is all to do to change 77 | any settings related to 802.1x authenticaion. 78 | 79 | This common configuraion file is RT2860AP.dat, located in /etc/Wireless/RT2860AP/. 80 | The format of configuraion file is "Paramater = Value". Each line contains one parameter setting. 81 | The following describes how to achieve : 82 | 83 | 1.) How to configure RT_WIFI driver? 84 | ======================================== 85 | Add correct values for AuthMode and EncrypType parameters. 86 | If you edit like this, 87 | AuthMode=WPA 88 | EncrypType=TKIP 89 | you would like the AP to use WPA with TKIP to encrypt the data packets. 90 | 91 | To change SSID, you can type $iwpriv ra0 set SSID=yourssid 92 | 93 | 94 | 2.) How to configure 802.1x daemon? 95 | ======================================== 96 | 4 essential paramters for 802.1x authenticaion are RADIUS_Server, RADIUS_Port, RADIUS_Key and own_ip_addr. 97 | for example, 98 | RADIUS_Server=192.168.2.3 99 | RADIUS_Port=1812 100 | RADIUS_Key=password 101 | own_ip_addr=192.168.1.123 102 | This implies the RADIUS Server' IP is 192.168.2.3. Port 1812 is used for 802.1x authenticaion. 103 | The RADIUS secret between AP(RADIUS client) and RADIUS server is password. AP's IP is 192.168.1.123. 104 | For any changes to make, edit the configuraion file, and set the AP's SSID again to restart rtdot1xd. 105 | 106 | The optional variables as below, 107 | session_timeout_interval is for 802.1x reauthentication setting. 108 | set zero to disable 802.1x reauthentication service for each session. 109 | session_timeout_interval unit is second and must be larger than 60. 110 | for example, 111 | session_timeout_interval = 120 112 | will reauthenticate each session every 2 minutes. 113 | session_timeout_interval = 0 114 | will disable reauthenticate service. 115 | 116 | EAPifname is assigned as the binding interface for EAP negotiation. 117 | Its default value is "br0". But if the wireless interface doesn't attach to bridge interface 118 | or the bridge interface name isn't "br0", please modify it. 119 | for example, 120 | EAPifname=br0 121 | 122 | PreAuthifname is assigned as the binding interface for WPA2 Pre-authentication. 123 | Its default value is "br0". But if the ethernet interface doesn't attach to bridge interface 124 | or the bridge interface name isn't "br0", please modify it. 125 | for example, 126 | PreAuthifname=br0 127 | 128 | V. How to add other interfaces to this linux driver and 802.1x daemon? 129 | ================================================================= 130 | For programmers who want to add interface for 802.1x daemon and linux driver, 131 | edit the configuration file and reset its SSID via linux IOCTL. 132 | Detailed linux IOCTL informtaion is in the interface.txt come with 802.1x daemon. 133 | Please refer to that. 134 | 135 | 136 | VI. Multiple RADIUS Server supporting 137 | ================================================================= 138 | We use complier option to turn on/off the multiple RADIUS servers for 802.1x. 139 | If you want to enable the feature, make sure that "MULTIPLE_RADIUS" is defined in Makefile. 140 | Default is disabled. Besides, you must modify the file "RT2860AP.dat" to co-operate with 802.1x. 141 | We extend some variables to support individual RADIUS server IP address, port and secret key for MBSS. 142 | 143 | For example : 144 | RADIUS_Server=192.168.2.1;192.168.2.2;192.168.2.3;192.168.2.4 145 | RADIUS_Port=1811;1812;1813;1814 146 | RADIUS_Key=ralink_1;ralink_2;ralink_3;ralink_4 147 | or 148 | RADIUS_Key1=ralink_1 149 | RADIUS_Key2=ralink_2 150 | RADIUS_Key3=ralink_3 151 | RADIUS_Key4=ralink_4 152 | 153 | For backward compatible, driver would parse "RADIUS_Key" or "RADIUS_KeyX"(X=1~4) for radius key usage. 154 | But the paramter "RADIUS_Key" has the first priority. 155 | 156 | p.s. This implies the RADIUS server IP of ra0 is 192.168.2.1, its port is 1811 and its secret key is ralink_1. 157 | The RADIUS server IP of ra1 is 192.168.2.2, its port is 1812 and its secret key is ralink_2. 158 | The RADIUS server IP of ra2 is 192.168.2.3, its port is 1813 and its secret key is ralink_3. 159 | The RADIUS server IP of ra3 is 192.168.2.4, its port is 1814 and its secret key is ralink_4. 160 | 161 | VII. Enhance dynamic wep keying 162 | ================================================================= 163 | In OPEN-WEP with 802.1x mode, the authentication process generates broadcast and unicast key. 164 | The unicast key is unique for every individual client so it is always generated randomly by 165 | 802.1x daemon. 166 | But the broadcast key is shared for all associated clients, it can be pre-set manually by users or 167 | generated randomly by 802.1x daemon. 168 | 169 | Through the parameter "DefaultKeyID" and its corresponding parameter "KeyXStr"(i.e. X = the value of DefaultKeyID) 170 | in RT2860AP.dat, the 802.1x daemon would use it as the broadcast key material. But if the corresponding parameter "KeyXStr" is 171 | empty or unsuitable, the broadcast key would be generated randomly by the 802.1x daemon. 172 | 173 | The 802.1x daemon need to read RT2860AP.dat to decide whether the broadcast key is generated 174 | randomly or not, so please update the RT2860AP.dat and restart rtdot1xd if those correlative parameters are changed. 175 | 176 | 177 | -------------------------------------------------------------------------------- /packages/ralink/applications/8021xd/src/ap.h: -------------------------------------------------------------------------------- 1 | #ifndef AP_H 2 | #define AP_H 3 | 4 | /* STA flags */ 5 | #define WLAN_STA_AUTH BIT(0) 6 | #define WLAN_STA_ASSOC BIT(1) 7 | #define WLAN_STA_PS BIT(2) 8 | #define WLAN_STA_TIM BIT(3) 9 | #define WLAN_STA_PERM BIT(4) 10 | #define WLAN_STA_PENDING_POLL BIT(6) /* pending activity poll not ACKed */ 11 | 12 | #define WLAN_RATE_1M BIT(0) 13 | #define WLAN_RATE_2M BIT(1) 14 | #define WLAN_RATE_5M5 BIT(2) 15 | #define WLAN_RATE_11M BIT(3) 16 | #define WLAN_RATE_COUNT 4 17 | 18 | /* Maximum size of Supported Rates info element. IEEE 802.11 has a limit of 8, 19 | * but some pre-standard IEEE 802.11g products use longer elements. */ 20 | #define WLAN_SUPP_RATES_MAX 32 21 | 22 | 23 | struct sta_info 24 | { 25 | struct sta_info *next; /* next entry in sta list */ 26 | struct sta_info *hnext; /* next entry in hash table list */ 27 | u8 addr[6]; 28 | u16 aid; /* STA's unique AID (1 .. 2007) or 0 if not yet assigned */ 29 | u32 flags; 30 | u16 capability; 31 | u16 listen_interval; /* or beacon_int for APs */ 32 | u8 supported_rates[WLAN_SUPP_RATES_MAX]; 33 | u8 tx_supp_rates; 34 | 35 | enum { STA_NULLFUNC = 0, STA_DISASSOC, STA_DEAUTH } timeout_next; 36 | 37 | /* IEEE 802.1X related data */ 38 | struct eapol_state_machine *eapol_sm; 39 | int radius_identifier; 40 | /* TODO: check when the last messages can be released */ 41 | struct radius_msg *last_recv_radius; 42 | u8 *last_eap_supp; /* last received EAP Response from Supplicant */ 43 | size_t last_eap_supp_len; 44 | u8 *last_eap_radius; /* last received EAP Response from Authentication Server */ 45 | size_t last_eap_radius_len; 46 | u8 *identity; 47 | size_t identity_len; 48 | 49 | /* Keys for encrypting and signing EAPOL-Key frames */ 50 | u8 *eapol_key_sign; 51 | size_t eapol_key_sign_len; 52 | u8 *eapol_key_crypt; 53 | size_t eapol_key_crypt_len; 54 | 55 | /* IEEE 802.11f (IAPP) related data */ 56 | struct ieee80211_mgmt *last_assoc_req; 57 | 58 | // Multiple SSID interface 59 | u8 ApIdx; 60 | u16 ethertype; 61 | 62 | // From which raw socket 63 | int SockNum; 64 | }; 65 | 66 | #define MAX_STA_COUNT 1024 67 | 68 | /* Maximum number of AIDs to use for STAs; must be 2007 or lower 69 | * (8802.11 limitation) */ 70 | #define MAX_AID_TABLE_SIZE 256 71 | 72 | #define STA_HASH_SIZE 256 73 | #define STA_HASH(sta) (sta[5]) 74 | 75 | /* Default value for maximum station inactivity. After AP_MAX_INACTIVITY has 76 | * passed since last received frame from the station, a nullfunc data frame is 77 | * sent to the station. If this frame is not acknowledged and no other frames 78 | * have been received, the station will be disassociated after 79 | * AP_DISASSOC_DELAY. Similarily, a the station will be deauthenticated after 80 | * AP_DEAUTH_DELAY. AP_TIMEOUT_RESOLUTION is the resolution that is used with 81 | * max inactivity timer. All these times are in seconds. */ 82 | #define AP_MAX_INACTIVITY (5* 60) 83 | #define AP_DISASSOC_DELAY (1) 84 | #define AP_DEAUTH_DELAY (1) 85 | 86 | #endif /* AP_H */ 87 | -------------------------------------------------------------------------------- /packages/ralink/applications/8021xd/src/common.h: -------------------------------------------------------------------------------- 1 | #ifndef COMMON_H 2 | #define COMMON_H 3 | 4 | #include 5 | #include 6 | #if __BYTE_ORDER == __LITTLE_ENDIAN 7 | #define le_to_host16(n) (n) 8 | #define host_to_le16(n) (n) 9 | #define be_to_host16(n) bswap_16(n) 10 | #define host_to_be16(n) bswap_16(n) 11 | #else 12 | #define le_to_host16(n) bswap_16(n) 13 | #define host_to_le16(n) bswap_16(n) 14 | #define be_to_host16(n) (n) 15 | #define host_to_be16(n) (n) 16 | #endif 17 | 18 | 19 | #include 20 | typedef uint64_t u64; 21 | typedef uint32_t u32; 22 | typedef uint16_t u16; 23 | typedef uint8_t u8; 24 | typedef int64_t s64; 25 | typedef int32_t s32; 26 | typedef int16_t s16; 27 | typedef int8_t s8; 28 | 29 | void hostapd_hexdump(const char *title, u8 *buf, size_t len); 30 | int hwaddr_aton(char *txt, u8 *addr); 31 | 32 | static inline void print_char(char c) 33 | { 34 | if (c >= 32 && c < 127) 35 | printf("%c", c); 36 | else 37 | printf("<%02x>", c); 38 | } 39 | 40 | static inline void fprint_char(FILE *f, char c) 41 | { 42 | if (c >= 32 && c < 127) 43 | fprintf(f, "%c", c); 44 | else 45 | fprintf(f, "<%02x>", c); 46 | } 47 | 48 | #endif /* COMMON_H */ 49 | -------------------------------------------------------------------------------- /packages/ralink/applications/8021xd/src/config.h: -------------------------------------------------------------------------------- 1 | #ifndef CONFIG_H 2 | #define CONFIG_H 3 | 4 | typedef u8 macaddr[ETH_ALEN]; 5 | 6 | struct hostapd_radius_server 7 | { 8 | struct in_addr addr; 9 | int port; 10 | u8 *shared_secret; 11 | size_t shared_secret_len; 12 | }; 13 | 14 | struct rtapd_config 15 | { 16 | char iface_name[IFNAMSIZ + 1]; 17 | int SsidNum; 18 | 19 | int DefaultKeyID[MAX_MBSSID_NUM]; 20 | int individual_wep_key_len[MAX_MBSSID_NUM]; 21 | int individual_wep_key_idx[MAX_MBSSID_NUM]; 22 | u8 IEEE8021X_ikey[MAX_MBSSID_NUM][WEP8021X_KEY_LEN]; 23 | 24 | #define HOSTAPD_MODULE_IEEE80211 BIT(0) 25 | #define HOSTAPD_MODULE_IEEE8021X BIT(1) 26 | #define HOSTAPD_MODULE_RADIUS BIT(2) 27 | 28 | enum { HOSTAPD_DEBUG_NO = 0, HOSTAPD_DEBUG_MINIMAL = 1, 29 | HOSTAPD_DEBUG_VERBOSE = 2, 30 | HOSTAPD_DEBUG_MSGDUMPS = 3 31 | } debug; /* debug verbosity level */ 32 | int daemonize; /* fork into background */ 33 | 34 | struct in_addr own_ip_addr; 35 | 36 | /* RADIUS Authentication and Accounting servers in priority order */ 37 | #if MULTIPLE_RADIUS 38 | struct hostapd_radius_server *mbss_auth_servers[MAX_MBSSID_NUM], *mbss_auth_server[MAX_MBSSID_NUM]; 39 | int mbss_num_auth_servers[MAX_MBSSID_NUM]; 40 | #else 41 | struct hostapd_radius_server *auth_servers, *auth_server; 42 | int num_auth_servers; 43 | #endif 44 | 45 | int num_eap_if; 46 | char eap_if_name[MAX_MBSSID_NUM][IFNAMSIZ]; 47 | 48 | int num_preauth_if; 49 | char preauth_if_name[MAX_MBSSID_NUM][IFNAMSIZ]; 50 | 51 | int radius_retry_primary_interval; 52 | 53 | int session_timeout_set; 54 | int session_timeout_interval; 55 | 56 | /* The initialization value used for the quietWhile timer. 57 | Its default value is 60 s; it can be set by management 58 | to any value in the range from 0 to 65535 s. 59 | 60 | NOTE 1 - The Authenticator may increase the value of quietPeriod 61 | per Port to ignore authorization failures for longer periods 62 | of time after a number of authorization failures have occurred.*/ 63 | int quiet_interval; 64 | 65 | u8 nasId[MAX_MBSSID_NUM][32]; 66 | int nasId_len[MAX_MBSSID_NUM]; 67 | }; 68 | 69 | 70 | struct rtapd_config * Config_read(int ioctl_sock, char *prefix_name); 71 | void Config_free(struct rtapd_config *conf); 72 | 73 | 74 | #endif /* CONFIG_H */ 75 | -------------------------------------------------------------------------------- /packages/ralink/applications/8021xd/src/eapol_sm.h: -------------------------------------------------------------------------------- 1 | #ifndef EAPOL_SM_H 2 | #define EAPOL_SM_H 3 | 4 | /* IEEE Std 802.1X-2001, 8.5 */ 5 | 6 | typedef enum { ForceUnauthorized, ForceAuthorized, Auto } PortTypes; 7 | typedef enum { Unauthorized, Authorized } PortState; 8 | typedef enum { EAPRequestIdentity } EAPMsgType; 9 | typedef unsigned int Counter; 10 | 11 | 12 | /* Authenticator PAE state machine */ 13 | struct eapol_auth_pae_sm 14 | { 15 | /* variables */ 16 | Boolean eapLogoff; 17 | Boolean eapStart; 18 | PortTypes portMode; 19 | unsigned int reAuthCount; 20 | Boolean rxInitialRsp; 21 | 22 | /* constants */ 23 | unsigned int quietPeriod; /* default 60; 0..65535 */ 24 | 25 | EAPMsgType initialEAPMsg; /* IEEE 802.1aa/D4 */ 26 | #define AUTH_PAE_DEFAULT_initialEAPMsg EAPRequestIdentity 27 | unsigned int reAuthMax; /* default 2 */ 28 | #define AUTH_PAE_DEFAULT_reAuthMax 2 29 | unsigned int txPeriod; /* default 30; 1..65535 */ 30 | #define AUTH_PAE_DEFAULT_txPeriod 30 31 | 32 | /* counters */ 33 | Counter authEntersConnecting; 34 | Counter authEapLogoffsWhileConnecting; 35 | Counter authEntersAuthenticating; 36 | Counter authAuthSuccessesWhileAuthenticating; 37 | Counter authAuthTimeoutsWhileAuthenticating; 38 | Counter authAuthFailWhileAuthenticating; 39 | Counter authAuthReauthsWhileAuthenticating; 40 | Counter authAuthEapStartsWhileAuthenticating; 41 | Counter authAuthEapLogoffWhileAuthenticating; 42 | Counter authAuthReauthsWhileAuthenticated; 43 | Counter authAuthEapStartsWhileAuthenticated; 44 | Counter authAuthEapLogoffWhileAuthenticated; 45 | 46 | enum { AUTH_PAE_INITIALIZE, AUTH_PAE_DISCONNECTED, AUTH_PAE_CONNECTING, 47 | AUTH_PAE_AUTHENTICATING, AUTH_PAE_AUTHENTICATED, 48 | AUTH_PAE_ABORTING, AUTH_PAE_HELD, AUTH_PAE_FORCE_AUTH, 49 | AUTH_PAE_FORCE_UNAUTH 50 | } state; 51 | }; 52 | 53 | 54 | /* Backend Authentication state machine */ 55 | struct eapol_backend_auth_sm 56 | { 57 | /* variables */ 58 | unsigned int reqCount; 59 | Boolean rxResp; 60 | Boolean aSuccess; 61 | Boolean aFail; 62 | Boolean aReq; 63 | u8 idFromServer; 64 | 65 | /* constants */ 66 | unsigned int suppTimeout; /* default 30; 1..X */ 67 | #define BE_AUTH_DEFAULT_suppTimeout 30 68 | unsigned int serverTimeout; /* default 30; 1..X */ 69 | #define BE_AUTH_DEFAULT_serverTimeout 30 70 | unsigned int maxReq; /* default 2; 1..10 */ 71 | #define BE_AUTH_DEFAULT_maxReq 2 72 | 73 | /* counters */ 74 | Counter backendResponses; 75 | Counter backendAccessChallenges; 76 | Counter backendOtherRequestsToSupplicant; 77 | Counter backendNonNakResponsesFromSupplicant; 78 | Counter backendAuthSuccesses; 79 | Counter backendAuthFails; 80 | 81 | enum { BE_AUTH_REQUEST, BE_AUTH_RESPONSE, BE_AUTH_SUCCESS, 82 | BE_AUTH_FAIL, BE_AUTH_TIMEOUT, BE_AUTH_IDLE, BE_AUTH_INITIALIZE 83 | } state; 84 | }; 85 | 86 | 87 | /* Reauthentication Timer state machine */ 88 | struct eapol_reauth_timer_sm 89 | { 90 | /* constants */ 91 | unsigned int reAuthPeriod; /* default 3600 s */ 92 | Boolean reAuthEnabled; 93 | 94 | enum { REAUTH_TIMER_INITIALIZE, REAUTH_TIMER_REAUTHENTICATE } state; 95 | }; 96 | 97 | 98 | /* Authenticator Key Transmit state machine */ 99 | struct eapol_auth_key_tx 100 | { 101 | enum { AUTH_KEY_TX_NO_KEY_TRANSMIT, AUTH_KEY_TX_KEY_TRANSMIT } state; 102 | }; 103 | 104 | 105 | struct eapol_state_machine 106 | { 107 | /* timers */ 108 | int aWhile; 109 | int quietWhile; 110 | int reAuthWhen; 111 | int txWhen; 112 | 113 | /* global variables */ 114 | Boolean authAbort; 115 | Boolean authFail; 116 | Boolean authStart; 117 | Boolean authTimeout; 118 | Boolean authSuccess; 119 | u8 currentId; 120 | Boolean initialize; 121 | Boolean keyAvailable; /* 802.1aa; was in Auth Key Transmit sm in .1x */ 122 | Boolean keyTxEnabled; /* 802.1aa; was in Auth Key Transmit sm in .1x 123 | * stace machines do not change this */ 124 | PortTypes portControl; 125 | Boolean portEnabled; 126 | PortState portStatus; 127 | Boolean portValid; /* 802.1aa */ 128 | Boolean reAuthenticate; 129 | 130 | 131 | /* Port Timers state machine */ 132 | /* 'Boolean tick' implicitly handled as registered timeout */ 133 | 134 | struct eapol_auth_pae_sm auth_pae; 135 | struct eapol_backend_auth_sm be_auth; 136 | struct eapol_reauth_timer_sm reauth_timer; 137 | struct eapol_auth_key_tx auth_key_tx; 138 | 139 | /* Somewhat nasty pointers to global hostapd and STA data to avoid 140 | * passing these to every function */ 141 | rtapd *rtapd; 142 | struct sta_info *sta; 143 | }; 144 | 145 | 146 | struct eapol_state_machine *eapol_sm_alloc(rtapd *rtapd, 147 | struct sta_info *sta); 148 | void eapol_sm_free(struct eapol_state_machine *sm); 149 | void eapol_sm_step(struct eapol_state_machine *sm); 150 | void eapol_sm_initialize(struct eapol_state_machine *sm); 151 | 152 | #endif /* EAPOL_SM_H */ 153 | -------------------------------------------------------------------------------- /packages/ralink/applications/8021xd/src/eloop.c: -------------------------------------------------------------------------------- 1 | 2 | #include 3 | #include 4 | #include 5 | #include 6 | #include 7 | #include 8 | #include 9 | #include 10 | 11 | #include "eloop.h" 12 | 13 | 14 | struct eloop_sock 15 | { 16 | int sock; 17 | void *eloop_data; 18 | void *user_data; 19 | void (*handler)(int sock, void *eloop_ctx, void *sock_ctx); 20 | }; 21 | 22 | struct eloop_timeout 23 | { 24 | struct timeval time; 25 | void *eloop_data; 26 | void *user_data; 27 | void (*handler)(void *eloop_ctx, void *sock_ctx); 28 | struct eloop_timeout *next; 29 | }; 30 | 31 | struct eloop_signal 32 | { 33 | int sig; 34 | void *user_data; 35 | void (*handler)(int sig, void *eloop_ctx, void *signal_ctx); 36 | }; 37 | 38 | struct eloop_data 39 | { 40 | void *user_data; 41 | 42 | int max_sock, reader_count; 43 | struct eloop_sock *readers; 44 | 45 | struct eloop_timeout *timeout; 46 | 47 | int signal_count; 48 | struct eloop_signal *signals; 49 | 50 | int terminate; 51 | int reload; 52 | }; 53 | 54 | static struct eloop_data eloop; 55 | 56 | 57 | void eloop_init(void *user_data) 58 | { 59 | memset(&eloop, 0, sizeof(eloop)); 60 | eloop.user_data = user_data; 61 | } 62 | 63 | 64 | int eloop_register_read_sock(int sock, void (*handler)(int sock, void *eloop_ctx, void *sock_ctx), 65 | void *eloop_data, void *user_data) 66 | { 67 | struct eloop_sock *tmp; 68 | 69 | tmp = (struct eloop_sock *) realloc(eloop.readers, (eloop.reader_count + 1) * sizeof(struct eloop_sock)); 70 | if (tmp == NULL) 71 | return -1; 72 | 73 | tmp[eloop.reader_count].sock = sock; 74 | tmp[eloop.reader_count].eloop_data = eloop_data; 75 | tmp[eloop.reader_count].user_data = user_data; 76 | tmp[eloop.reader_count].handler = handler; 77 | eloop.reader_count++; 78 | eloop.readers = tmp; 79 | 80 | if (sock > eloop.max_sock) 81 | eloop.max_sock = sock; 82 | 83 | return 0; 84 | } 85 | 86 | int eloop_register_timeout(unsigned int secs, unsigned int usecs, 87 | void (*handler)(void *eloop_ctx, void *timeout_ctx), 88 | void *eloop_data, void *user_data) 89 | { 90 | struct eloop_timeout *timeout, *tmp, *prev; 91 | 92 | timeout = (struct eloop_timeout *) malloc(sizeof(*timeout)); 93 | if (timeout == NULL) 94 | return -1; 95 | 96 | gettimeofday(&timeout->time, NULL); 97 | timeout->time.tv_sec += secs; 98 | timeout->time.tv_usec += usecs; 99 | 100 | while (timeout->time.tv_usec >= 1000000) 101 | { 102 | timeout->time.tv_sec++; 103 | timeout->time.tv_usec -= 1000000; 104 | } 105 | timeout->eloop_data = eloop_data; 106 | timeout->user_data = user_data; 107 | timeout->handler = handler; 108 | timeout->next = NULL; 109 | 110 | if (eloop.timeout == NULL) 111 | { 112 | eloop.timeout = timeout; 113 | return 0; 114 | } 115 | 116 | prev = NULL; 117 | tmp = eloop.timeout; 118 | while (tmp != NULL) 119 | { 120 | if (timercmp(&timeout->time, &tmp->time, <)) 121 | break; 122 | prev = tmp; 123 | tmp = tmp->next; 124 | } 125 | 126 | if (prev == NULL) 127 | { 128 | timeout->next = eloop.timeout; 129 | eloop.timeout = timeout; 130 | } 131 | else 132 | { 133 | timeout->next = prev->next; 134 | prev->next = timeout; 135 | } 136 | 137 | return 0; 138 | } 139 | 140 | int eloop_cancel_timeout(void (*handler)(void *eloop_ctx, void *sock_ctx), 141 | void *eloop_data, void *user_data) 142 | { 143 | struct eloop_timeout *timeout, *prev, *next; 144 | int removed = 0; 145 | 146 | prev = NULL; 147 | timeout = eloop.timeout; 148 | while (timeout != NULL) 149 | { 150 | next = timeout->next; 151 | 152 | if (timeout->handler == handler && (timeout->eloop_data == eloop_data || eloop_data == ELOOP_ALL_CTX) 153 | && (timeout->user_data == user_data || user_data == ELOOP_ALL_CTX)) 154 | { 155 | if (prev == NULL) 156 | eloop.timeout = next; 157 | else 158 | prev->next = next; 159 | free(timeout); 160 | removed++; 161 | } 162 | else 163 | prev = timeout; 164 | 165 | timeout = next; 166 | } 167 | 168 | return removed; 169 | } 170 | 171 | static void eloop_handle_signal(int sig) 172 | { 173 | int i; 174 | for (i = 0; i < eloop.signal_count; i++) 175 | { 176 | if (eloop.signals[i].sig == sig) 177 | { 178 | eloop.signals[i].handler(eloop.signals[i].sig, eloop.user_data, eloop.signals[i].user_data); 179 | break; 180 | } 181 | } 182 | } 183 | 184 | int eloop_register_signal(int sig, void (*handler)(int sig, void *eloop_ctx, void *signal_ctx), void *user_data) 185 | { 186 | struct eloop_signal *tmp; 187 | 188 | tmp = (struct eloop_signal *) realloc(eloop.signals, (eloop.signal_count + 1) * sizeof(struct eloop_signal)); 189 | if (tmp == NULL) 190 | return -1; 191 | 192 | tmp[eloop.signal_count].sig = sig; 193 | tmp[eloop.signal_count].user_data = user_data; 194 | tmp[eloop.signal_count].handler = handler; 195 | eloop.signal_count++; 196 | eloop.signals = tmp; 197 | signal(sig, eloop_handle_signal); 198 | 199 | return 0; 200 | } 201 | 202 | void eloop_run(void) 203 | { 204 | fd_set rfds; 205 | int i, res; 206 | struct timeval tv, now; 207 | 208 | while (!eloop.terminate && (eloop.timeout || eloop.reader_count > 0)) 209 | { 210 | if (eloop.timeout) 211 | { 212 | gettimeofday(&now, NULL); 213 | if (timercmp(&now, &eloop.timeout->time, >=)) 214 | tv.tv_sec = tv.tv_usec = 0; 215 | else 216 | timersub(&eloop.timeout->time, &now, &tv); 217 | } 218 | 219 | FD_ZERO(&rfds); 220 | for (i = 0; i < eloop.reader_count; i++) 221 | FD_SET(eloop.readers[i].sock, &rfds); 222 | res = select(eloop.max_sock + 1, &rfds, NULL, NULL, 223 | eloop.timeout ? &tv : NULL); 224 | if (res < 0 && errno != EINTR) 225 | { 226 | perror("select"); 227 | return ; 228 | } 229 | 230 | /* check if some registered timeouts have occurred */ 231 | if (eloop.timeout) 232 | { 233 | struct eloop_timeout *tmp; 234 | 235 | gettimeofday(&now, NULL); 236 | if (timercmp(&now, &eloop.timeout->time, >=)) 237 | { 238 | tmp = eloop.timeout; 239 | eloop.timeout = eloop.timeout->next; 240 | tmp->handler(tmp->eloop_data, tmp->user_data); 241 | free(tmp); 242 | } 243 | 244 | } 245 | 246 | if (res <= 0) 247 | continue; 248 | 249 | for (i = 0; i < eloop.reader_count; i++) 250 | { 251 | if (FD_ISSET(eloop.readers[i].sock, &rfds)) 252 | { 253 | eloop.readers[i].handler(eloop.readers[i].sock, eloop.readers[i].eloop_data, eloop.readers[i].user_data); 254 | } 255 | } 256 | } 257 | } 258 | 259 | void eloop_terminate(void) 260 | { 261 | eloop.terminate = 1; 262 | } 263 | 264 | void eloop_reload(void) 265 | { 266 | eloop.reload = 1; 267 | } 268 | 269 | void eloop_destroy(void) 270 | { 271 | struct eloop_timeout *timeout, *prev; 272 | 273 | timeout = eloop.timeout; 274 | while (timeout != NULL) 275 | { 276 | prev = timeout; 277 | timeout = timeout->next; 278 | free(prev); 279 | } 280 | free(eloop.readers); 281 | free(eloop.signals); 282 | } 283 | 284 | int eloop_terminated(void) 285 | { 286 | return eloop.terminate; 287 | } 288 | -------------------------------------------------------------------------------- /packages/ralink/applications/8021xd/src/eloop.h: -------------------------------------------------------------------------------- 1 | #ifndef ELOOP_H 2 | #define ELOOP_H 3 | 4 | /* Magic number for eloop_cancel_timeout() */ 5 | #define ELOOP_ALL_CTX (void *) -1 6 | 7 | /* Initialize global event loop data - must be called before any other eloop_* 8 | * function. user_data is a pointer to global data structure and will be passed 9 | * as eloop_ctx to signal handlers. */ 10 | void eloop_init(void *user_data); 11 | 12 | /* Register handler for read event */ 13 | int eloop_register_read_sock(int sock, 14 | void (*handler)(int sock, void *eloop_ctx, 15 | void *sock_ctx), 16 | void *eloop_data, void *user_data); 17 | 18 | /* Register timeout */ 19 | int eloop_register_timeout(unsigned int secs, unsigned int usecs, 20 | void (*handler)(void *eloop_ctx, void *timeout_ctx), 21 | void *eloop_data, void *user_data); 22 | 23 | /* Cancel timeouts matching . 24 | * ELOOP_ALL_CTX can be used as a wildcard for cancelling all timeouts 25 | * regardless of eloop_data/user_data. */ 26 | int eloop_cancel_timeout(void (*handler)(void *eloop_ctx, void *sock_ctx), 27 | void *eloop_data, void *user_data); 28 | 29 | /* Register handler for signal. 30 | * Note: signals are 'global' events and there is no local eloop_data pointer 31 | * like with other handlers. The (global) pointer given to eloop_init() will be 32 | * used as eloop_ctx for signal handlers. */ 33 | int eloop_register_signal(int sock, 34 | void (*handler)(int sig, void *eloop_ctx, 35 | void *signal_ctx), 36 | void *user_data); 37 | 38 | /* Start event loop and continue running as long as there are any registered 39 | * event handlers. */ 40 | void eloop_run(void); 41 | 42 | /* Terminate event loop even if there are registered events. */ 43 | void eloop_terminate(void); 44 | void eloop_reload(void); 45 | 46 | /* Free any reserved resources. After calling eloop_destoy(), other eloop_* 47 | * functions must not be called before re-running eloop_init(). */ 48 | void eloop_destroy(void); 49 | 50 | /* Check whether event loop has been terminated. */ 51 | int eloop_terminated(void); 52 | 53 | #endif /* ELOOP_H */ 54 | -------------------------------------------------------------------------------- /packages/ralink/applications/8021xd/src/ieee802_1x.h: -------------------------------------------------------------------------------- 1 | #ifndef IEEE802_1X_H 2 | #define IEEE802_1X_H 3 | 4 | #include "rtmp_type.h" 5 | 6 | /* IEEE Std 802.1X-2001, 7.2 */ 7 | struct ieee802_1x_hdr 8 | { 9 | u8 version; 10 | u8 type; 11 | u16 length; 12 | /* followed by length octets of data */ 13 | } __attribute__ ((packed)); 14 | 15 | #define LENGTH_8021X_HDR 4 16 | 17 | #define EAPOL_VERSION 1 18 | #define EAPOL_VERSION_2 2 //for WPA2(pre-auth) 19 | 20 | #define LENGTH_802_1_H 8 21 | 22 | enum { IEEE802_1X_TYPE_EAP_PACKET = 0, 23 | IEEE802_1X_TYPE_EAPOL_START = 1, 24 | IEEE802_1X_TYPE_EAPOL_LOGOFF = 2, 25 | IEEE802_1X_TYPE_EAPOL_KEY = 3, 26 | IEEE802_1X_TYPE_EAPOL_ENCAPSULATED_ASF_ALERT = 4 27 | }; 28 | 29 | struct ieee802_1x_eapol_key 30 | { 31 | u8 type; 32 | u16 key_length; 33 | u8 replay_counter[8]; /* does not repeat within the life of the keying 34 | * material used to encrypt the Key field; 35 | * 64-bit NTP timestamp MAY be used here */ 36 | u8 key_iv[16]; /* cryptographically random number */ 37 | u8 key_index; /* key flag in the most significant bit: 38 | * 0 = broadcast (default key), 39 | * 1 = unicast (key mapping key); key index is in the 40 | * 7 least significant bits */ 41 | u8 key_signature[16]; /* HMAC-MD5 message integrity check computed with 42 | * MS-MPPE-Send-Key as the key */ 43 | 44 | /* followed by key: if packet body length = 44 + key length, then the 45 | * key field (of key_length bytes) contains the key in encrypted form; 46 | * if packet body length = 44, key field is absent and key_length 47 | * represents the number of least significant octets from 48 | * MS-MPPE-Send-Key attribute to be used as the keying material; 49 | * RC4 key used in encryption = Key-IV + MS-MPPE-Recv-Key */ 50 | } __attribute__ ((packed)); 51 | 52 | enum { EAPOL_KEY_TYPE_RC4 = 1 }; 53 | 54 | 55 | /* RFC 2284 - PPP Extensible Authentication Protocol (EAP) */ 56 | 57 | struct eap_hdr 58 | { 59 | u8 code; 60 | u8 identifier; 61 | u16 length; /* including code and identifier */ 62 | /* followed by length-2 octets of data */ 63 | } __attribute__ ((packed)); 64 | 65 | #define LENGTH_EAP_HDR 4 66 | 67 | enum { EAP_CODE_REQUEST = 1, EAP_CODE_RESPONSE = 2, EAP_CODE_SUCCESS = 3, 68 | EAP_CODE_FAILURE = 4 69 | }; 70 | 71 | /* EAP Request and Response data begins with one octet Type. Success and 72 | * Failure do not have additional data. */ 73 | 74 | /* RFC 2284, 3.0 */ 75 | enum { EAP_TYPE_IDENTITY = 1, 76 | EAP_TYPE_NOTIFICATION = 2, 77 | EAP_TYPE_NAK = 3 /* Response only */, 78 | EAP_TYPE_MD5_CHALLENGE = 4, 79 | EAP_TYPE_ONE_TIME_PASSWORD = 5 /* RFC 1938 */, 80 | EAP_TYPE_GENERIC_TOKEN_CARD = 6, 81 | EAP_TYPE_TLS = 13 /* RFC 2716 */, 82 | EAP_TYPE_TTLS = 21 /* draft-ietf-pppext-eap-ttls-02.txt */, 83 | EAP_TYPE_PEAP = 25 /* draft-josefsson-pppext-eap-tls-eap-06.txt */, 84 | }; 85 | 86 | typedef enum _Dot1xInternalCmd 87 | { 88 | DOT1X_DISCONNECT_ENTRY, 89 | DOT1X_RELOAD_CONFIG, 90 | } DOT1X_INTERNAL_CMD; 91 | 92 | // Key mapping keys require a BSSID 93 | typedef struct _NDIS_802_11_KEY 94 | { 95 | u32 Length; // Length of this structure 96 | u8 addr[6]; 97 | u32 KeyIndex; 98 | u32 KeyLength; // length of key in bytes 99 | u8 KeyMaterial[64]; // variable length depending on above field 100 | } NDIS_802_11_KEY, *PNDIS_802_11_KEY; 101 | 102 | // The definition MUST synchronize with driver(in oid.h) 103 | #define MAX_RADIUS_SRV_NUM 2 // 802.1x failover number 104 | 105 | typedef struct PACKED _RADIUS_SRV_INFO 106 | { 107 | unsigned int radius_ip; 108 | unsigned int radius_port; 109 | unsigned char radius_key[64]; 110 | unsigned char radius_key_len; 111 | } RADIUS_SRV_INFO, *PRADIUS_SRV_INFO; 112 | 113 | typedef struct PACKED _DOT1X_BSS_INFO 114 | { 115 | unsigned char radius_srv_num; 116 | RADIUS_SRV_INFO radius_srv_info[MAX_RADIUS_SRV_NUM]; 117 | unsigned char ieee8021xWEP; // dynamic WEP 118 | unsigned char key_index; 119 | unsigned char key_length; // length of key in bytes 120 | unsigned char key_material[13]; 121 | unsigned char nasId[IFNAMSIZ]; 122 | unsigned char nasId_len; 123 | } DOT1X_BSS_INFO, *PDOT1X_BSS_INFO; 124 | 125 | // It's used by 802.1x daemon to require relative configuration 126 | typedef struct PACKED _DOT1X_CMM_CONF 127 | { 128 | unsigned int Length; // Length of this structure 129 | unsigned char mbss_num; // indicate multiple BSS number 130 | unsigned int own_ip_addr; 131 | unsigned int retry_interval; 132 | unsigned int session_timeout_interval; 133 | unsigned int quiet_interval; 134 | unsigned char EAPifname[MAX_MBSSID_NUM][IFNAMSIZ]; 135 | unsigned char EAPifname_len[MAX_MBSSID_NUM]; 136 | unsigned char PreAuthifname[MAX_MBSSID_NUM][IFNAMSIZ]; 137 | unsigned char PreAuthifname_len[MAX_MBSSID_NUM]; 138 | DOT1X_BSS_INFO Dot1xBssInfo[MAX_MBSSID_NUM]; 139 | } DOT1X_CMM_CONF, *PDOT1X_CMM_CONF; 140 | 141 | typedef struct PACKED _DOT1X_IDLE_TIMEOUT 142 | { 143 | unsigned char StaAddr[MAC_ADDR_LEN]; 144 | unsigned int idle_timeout; 145 | } DOT1X_IDLE_TIMEOUT, *PDOT1X_IDLE_TIMEOUT; 146 | 147 | void ieee802_1x_new_station(rtapd *apd, struct sta_info *sta); 148 | void ieee802_1x_free_station(struct sta_info *sta); 149 | 150 | void ieee802_1x_request_identity(rtapd *apd, struct sta_info *sta, u8 id); 151 | void ieee802_1x_tx_canned_eap(rtapd *apd, struct sta_info *sta, u8 id, int success); 152 | void ieee802_1x_tx_req(rtapd *apd, struct sta_info *sta, u8 id); 153 | void ieee802_1x_tx_key(rtapd *hapd, struct sta_info *sta, u8 id); 154 | void ieee802_1x_send_resp_to_server(rtapd *apd, struct sta_info *sta); 155 | void ieee802_1x_set_sta_authorized(rtapd *rtapd, struct sta_info *sta, int authorized); 156 | int ieee802_1x_init(rtapd *apd); 157 | void ieee802_1x_new_auth_session(rtapd *apd, struct sta_info *sta); 158 | 159 | #endif /* IEEE802_1X_H */ 160 | -------------------------------------------------------------------------------- /packages/ralink/applications/8021xd/src/md5.h: -------------------------------------------------------------------------------- 1 | #ifndef __MD5_H__ 2 | #define __MD5_H__ 3 | 4 | #ifndef ULONG 5 | #define INT int 6 | #define UINT u32 7 | #define ULONG u32 8 | #define USHORT u16 9 | #define UCHAR u8 10 | 11 | #define BOOLEAN u8 12 | #define LONGLONG s64 13 | #define ULONGLONG u64 14 | #define VOID void 15 | #define LONG int 16 | #endif // ULONG 17 | 18 | #define NdisZeroMemory(buff, buff_size) \ 19 | { \ 20 | memset(buff, 0, buff_size); \ 21 | } 22 | 23 | #define NdisMoveMemory(buff, key, buff_size) \ 24 | { \ 25 | memcpy(buff, key, buff_size); \ 26 | } 27 | 28 | #ifdef ASSERT 29 | #undef ASSERT 30 | #endif 31 | 32 | #define ASSERT(x) \ 33 | { \ 34 | if (!(x)) \ 35 | { \ 36 | printk(KERN_WARNING __FILE__ ":%d assert " #x "failed\n", __LINE__); \ 37 | } \ 38 | } 39 | 40 | #define MD5_MAC_LEN 16 41 | 42 | typedef struct _MD5_CTX 43 | { 44 | ULONG Buf[4]; // buffers of four states 45 | ULONG LenInBitCount[2]; // length counter for input message, 0 up to 64 bits 46 | UCHAR Input[64]; // input message 47 | } MD5_CTX; 48 | 49 | int hostapd_get_rand(u8 *buf, size_t len); 50 | void MD5Init(MD5_CTX *pCtx); 51 | void MD5Update(MD5_CTX *pCtx, UCHAR *pData, ULONG LenInBytes); 52 | 53 | void MD5Final(UCHAR Digest[16], MD5_CTX *pCtx); 54 | void MD5Transform(ULONG Buf[4], ULONG Mes[16]); 55 | 56 | void md5_mac(UCHAR *key, ULONG key_len, UCHAR *data, ULONG data_len, UCHAR *mac); 57 | void hmac_md5(UCHAR *key, ULONG key_len, UCHAR *data, ULONG data_len, UCHAR *mac); 58 | 59 | #endif // __MD5_H__ 60 | 61 | #ifndef RC4_H 62 | #define RC4_H 63 | 64 | void rc4(u8 *buf, size_t len, u8 *key, size_t key_len); 65 | 66 | #endif /* RC4_H */ 67 | -------------------------------------------------------------------------------- /packages/ralink/applications/8021xd/src/radius.h: -------------------------------------------------------------------------------- 1 | #ifndef RADIUS_H 2 | #define RADIUS_H 3 | 4 | /* RFC 2865 - RADIUS */ 5 | 6 | struct radius_hdr 7 | { 8 | u8 code; 9 | u8 identifier; 10 | u16 length; /* including this header */ 11 | u8 authenticator[16]; 12 | /* followed by length-20 octets of attributes */ 13 | } __attribute__ ((packed)); 14 | 15 | enum { RADIUS_CODE_ACCESS_REQUEST = 1, 16 | RADIUS_CODE_ACCESS_ACCEPT = 2, 17 | RADIUS_CODE_ACCESS_REJECT = 3, 18 | RADIUS_CODE_ACCOUNTING_REQUEST = 4, 19 | RADIUS_CODE_ACCOUNTING_RESPONSE = 5, 20 | RADIUS_CODE_ACCESS_CHALLENGE = 11, 21 | RADIUS_CODE_STATUS_SERVER = 12, 22 | RADIUS_CODE_STATUS_CLIENT = 13, 23 | RADIUS_CODE_RESERVED = 255 24 | }; 25 | 26 | struct radius_attr_hdr 27 | { 28 | u8 type; 29 | u8 length; /* including this header */ 30 | /* followed by length-2 octets of attribute value */ 31 | } __attribute__ ((packed)); 32 | 33 | #define RADIUS_MAX_ATTR_LEN (255 - sizeof(struct radius_attr_hdr)) 34 | 35 | enum { RADIUS_ATTR_USER_NAME = 1, 36 | RADIUS_ATTR_USER_PASSWORD = 2, 37 | RADIUS_ATTR_NAS_IP_ADDRESS = 4, 38 | RADIUS_ATTR_NAS_PORT = 5, 39 | RADIUS_ATTR_FRAMED_MTU = 12, 40 | RADIUS_ATTR_STATE = 24, 41 | RADIUS_ATTR_VENDOR_SPECIFIC = 26, 42 | RADIUS_ATTR_SESSION_TIMEOUT = 27, 43 | RADIUS_ATTR_IDLE_TIMEOUT = 28, 44 | RADIUS_ATTR_TERMINATION_ACTION = 29, 45 | RADIUS_ATTR_CALLED_STATION_ID = 30, 46 | RADIUS_ATTR_CALLING_STATION_ID = 31, 47 | RADIUS_ATTR_NAS_IDENTIFIER = 32, 48 | RADIUS_ATTR_ACCT_STATUS_TYPE = 40, 49 | RADIUS_ATTR_ACCT_DELAY_TIME = 41, 50 | RADIUS_ATTR_ACCT_INPUT_OCTETS = 42, 51 | RADIUS_ATTR_ACCT_OUTPUT_OCTETS = 43, 52 | RADIUS_ATTR_ACCT_SESSION_ID = 44, 53 | RADIUS_ATTR_ACCT_AUTHENTIC = 45, 54 | RADIUS_ATTR_ACCT_SESSION_TIME = 46, 55 | RADIUS_ATTR_ACCT_INPUT_PACKETS = 47, 56 | RADIUS_ATTR_ACCT_OUTPUT_PACKETS = 48, 57 | RADIUS_ATTR_ACCT_TERMINATE_CAUSE = 49, 58 | RADIUS_ATTR_ACCT_MULTI_SESSION_ID = 50, 59 | RADIUS_ATTR_ACCT_LINK_COUNT = 51, 60 | RADIUS_ATTR_NAS_PORT_TYPE = 61, 61 | RADIUS_ATTR_CONNECT_INFO = 77, 62 | RADIUS_ATTR_EAP_MESSAGE = 79, 63 | RADIUS_ATTR_MESSAGE_AUTHENTICATOR = 80 64 | }; 65 | 66 | 67 | /* Termination-Action */ 68 | #define RADIUS_TERMINATION_ACTION_DEFAULT 0 69 | #define RADIUS_TERMINATION_ACTION_RADIUS_REQUEST 1 70 | 71 | /* NAS-Port-Type */ 72 | #define RADIUS_NAS_PORT_TYPE_IEEE_802_11 19 73 | 74 | 75 | /* RFC 2548 - Microsoft Vendor-specific RADIUS Attributes */ 76 | #define RADIUS_VENDOR_ID_MICROSOFT 311 77 | 78 | struct radius_attr_vendor_microsoft 79 | { 80 | u8 vendor_type; 81 | u8 vendor_length; 82 | } __attribute__ ((packed)); 83 | 84 | enum { RADIUS_VENDOR_ATTR_MS_MPPE_SEND_KEY = 16, 85 | RADIUS_VENDOR_ATTR_MS_MPPE_RECV_KEY = 17 86 | }; 87 | 88 | struct radius_ms_mppe_keys 89 | { 90 | u8 *send; 91 | size_t send_len; 92 | u8 *recv; 93 | size_t recv_len; 94 | }; 95 | 96 | 97 | /* RADIUS message structure for new and parsed messages */ 98 | struct radius_msg 99 | { 100 | unsigned char *buf; 101 | size_t buf_size; /* total size allocated for buf */ 102 | size_t buf_used; /* bytes used in buf */ 103 | 104 | struct radius_hdr *hdr; 105 | 106 | struct radius_attr_hdr **attrs; /* array of pointers to attributes */ 107 | size_t attr_size; /* total size of the attribute pointer array */ 108 | size_t attr_used; /* total number of attributes in the array */ 109 | }; 110 | 111 | 112 | /* Default size to be allocated for new RADIUS messages */ 113 | #define RADIUS_DEFAULT_MSG_SIZE 1024 114 | 115 | /* Default size to be allocated for attribute array */ 116 | #define RADIUS_DEFAULT_ATTR_COUNT 16 117 | 118 | 119 | /* MAC address ASCII format for IEEE 802.1X use 120 | * (draft-congdon-radius-8021x-20.txt) */ 121 | #define RADIUS_802_1X_ADDR_FORMAT "%02X-%02X-%02X-%02X-%02X-%02X" 122 | /* MAC address ASCII format for non-802.1X use */ 123 | #define RADIUS_ADDR_FORMAT "%02x%02x%02x%02x%02x%02x" 124 | 125 | struct radius_msg *Radius_msg_new(u8 code, u8 identifier); 126 | int Radius_msg_initialize(struct radius_msg *msg, size_t init_len); 127 | void Radius_msg_set_hdr(struct radius_msg *msg, u8 code, u8 identifier); 128 | void Radius_msg_free(struct radius_msg *msg); 129 | void Radius_msg_finish(struct radius_msg *msg, u8 *secret, size_t secret_len); 130 | struct radius_attr_hdr *Radius_msg_add_attr(struct radius_msg *msg, u8 type, 131 | u8 *data, size_t data_len); 132 | struct radius_msg *Radius_msg_parse(const u8 *data, size_t len); 133 | int Radius_msg_add_eap(struct radius_msg *msg, u8 *data, size_t data_len); 134 | u8 *Radius_msg_get_eap(struct radius_msg *msg, size_t *len); 135 | int Radius_msg_verify(struct radius_msg *msg, u8 *secret, size_t secret_len, 136 | struct radius_msg *sent_msg); 137 | int Radius_msg_verify_acct(struct radius_msg *msg, u8 *secret, 138 | size_t secret_len, struct radius_msg *sent_msg); 139 | int Radius_msg_copy_attr(struct radius_msg *dst, struct radius_msg *src, u8 type); 140 | void Radius_msg_make_authenticator(struct radius_msg *msg, u8 *data, size_t len); 141 | struct radius_ms_mppe_keys * 142 | Radius_msg_get_ms_keys(struct radius_msg *msg, struct radius_msg *sent_msg, 143 | u8 *secret, size_t secret_len); 144 | struct radius_attr_hdr * 145 | Radius_msg_add_attr_user_password(struct radius_msg *msg, 146 | u8 *data, size_t data_len, u8 *secret, size_t secret_len); 147 | int Radius_msg_get_attr(struct radius_msg *msg, u8 type, u8 *buf, size_t len); 148 | 149 | static inline int Radius_msg_add_attr_int32(struct radius_msg *msg, u8 type, u32 value) 150 | { 151 | u32 val = htonl(value); 152 | return Radius_msg_add_attr(msg, type, (u8 *) &val, 4) != NULL; 153 | } 154 | 155 | static inline int Radius_msg_get_attr_int32(struct radius_msg *msg, u8 type, u32 *value) 156 | { 157 | u32 val; 158 | int res; 159 | res = Radius_msg_get_attr(msg, type, (u8 *) &val, 4); 160 | if (res != 4) 161 | return -1; 162 | 163 | *value = ntohl(val); 164 | return 0; 165 | } 166 | 167 | #endif /* RADIUS_H */ 168 | -------------------------------------------------------------------------------- /packages/ralink/applications/8021xd/src/radius_client.h: -------------------------------------------------------------------------------- 1 | #ifndef RADIUS_CLIENT_H 2 | #define RADIUS_CLIENT_H 3 | 4 | typedef enum 5 | { 6 | RADIUS_AUTH 7 | } RadiusType; 8 | 9 | /* RADIUS message retransmit list */ 10 | struct radius_msg_list 11 | { 12 | struct radius_msg *msg; 13 | RadiusType msg_type; 14 | time_t first_try; 15 | time_t next_try; 16 | int attempts; 17 | int next_wait; 18 | 19 | u8 *shared_secret; 20 | size_t shared_secret_len; 21 | 22 | u8 ApIdx; // Multiple SSID interface 23 | /* TODO: server config with failover to backup server(s) */ 24 | 25 | struct radius_msg_list *next; 26 | }; 27 | 28 | 29 | typedef enum 30 | { 31 | RADIUS_RX_PROCESSED, 32 | RADIUS_RX_QUEUED, 33 | RADIUS_RX_UNKNOWN 34 | } RadiusRxResult; 35 | 36 | struct radius_rx_handler 37 | { 38 | RadiusRxResult (*handler)(rtapd *apd, struct radius_msg *msg, struct radius_msg *req, 39 | u8 *shared_secret, size_t shared_secret_len, void *data); 40 | void *data; 41 | }; 42 | 43 | struct radius_client_data 44 | { 45 | 46 | #if MULTIPLE_RADIUS 47 | int mbss_auth_serv_sock[MAX_MBSSID_NUM]; /* socket for authentication RADIUS messages */ 48 | #else 49 | int auth_serv_sock; /* socket for authentication RADIUS messages */ 50 | #endif 51 | 52 | struct radius_rx_handler *auth_handlers; 53 | size_t num_auth_handlers; 54 | 55 | struct radius_msg_list *msgs; 56 | size_t num_msgs; 57 | 58 | u8 next_radius_identifier; 59 | 60 | }; 61 | 62 | int Radius_client_register(rtapd *apd, RadiusType msg_type, 63 | RadiusRxResult (*handler) (rtapd *apd, struct radius_msg *msg, struct radius_msg *req, 64 | u8 *shared_secret, size_t shared_secret_len, void *data), void *data); 65 | int Radius_client_send(rtapd *rtapd, struct radius_msg *msg, RadiusType msg_type, u8 ApIdx); 66 | u8 Radius_client_get_id(rtapd *rtapd); 67 | void Radius_client_flush(rtapd *rtapd); 68 | int Radius_client_init(rtapd *rtapd); 69 | void Radius_client_deinit(rtapd *rtapd); 70 | 71 | #endif /* RADIUS_CLIENT_H */ 72 | -------------------------------------------------------------------------------- /packages/ralink/applications/8021xd/src/rtdot1x.h: -------------------------------------------------------------------------------- 1 | #ifndef RTDOT1XD_H 2 | #define RTDOT1XD_H 3 | 4 | #include "common.h" 5 | #include "ap.h" 6 | 7 | 8 | #define MAC_ADDR_LEN 6 9 | #define MAX_MBSSID_NUM 8 10 | #define WEP8021X_KEY_LEN 13 11 | 12 | #ifndef ETH_ALEN 13 | #define ETH_ALEN 6 14 | #endif 15 | #ifndef IFNAMSIZ 16 | #define IFNAMSIZ 16 17 | #endif 18 | #ifndef ETH_P_ALL 19 | #define ETH_P_ALL 0x0003 20 | #endif 21 | 22 | #include "config.h" 23 | 24 | /* It shall be the same with wireless driver */ 25 | #define dot1x_version "2.6.0.0" 26 | 27 | #define NIC_DBG_STRING ("[DOT1X] ") 28 | 29 | #define RT_DEBUG_OFF 0 30 | #define RT_DEBUG_ERROR 1 31 | #define RT_DEBUG_WARN 2 32 | #define RT_DEBUG_TRACE 3 33 | #define RT_DEBUG_INFO 4 34 | 35 | // OID definition 36 | #define OID_GET_SET_TOGGLE 0x8000 37 | #define RT_QUERY_SIGNAL_CONTEXT 0x0402 38 | #define RT_SET_APD_PID 0x0405 39 | #define RT_SET_DEL_MAC_ENTRY 0x0406 40 | 41 | 42 | #define RT_PRIV_IOCTL (SIOCIWFIRSTPRIV + 0x01) 43 | #if 0 44 | #define OID_802_11_RADIUS_QUERY_SETTING 0x0540 45 | #define RTPRIV_IOCTL_ADD_PMKID_CACHE (SIOCIWFIRSTPRIV + 0x0A) 46 | #define RTPRIV_IOCTL_RADIUS_DATA (SIOCIWFIRSTPRIV + 0x0C) 47 | #define RTPRIV_IOCTL_ADD_WPA_KEY (SIOCIWFIRSTPRIV + 0x0E) 48 | #define RTPRIV_IOCTL_STATIC_WEP_COPY (SIOCIWFIRSTPRIV + 0x10) 49 | #else 50 | #define OID_802_DOT1X_CONFIGURATION 0x0540 51 | #define OID_802_DOT1X_PMKID_CACHE 0x0541 52 | #define OID_802_DOT1X_RADIUS_DATA 0x0542 53 | #define OID_802_DOT1X_WPA_KEY 0x0543 54 | #define OID_802_DOT1X_STATIC_WEP_COPY 0x0544 55 | #define OID_802_DOT1X_IDLE_TIMEOUT 0x0545 56 | 57 | #define RT_OID_802_DOT1X_PMKID_CACHE (OID_GET_SET_TOGGLE | OID_802_DOT1X_PMKID_CACHE) 58 | #define RT_OID_802_DOT1X_RADIUS_DATA (OID_GET_SET_TOGGLE | OID_802_DOT1X_RADIUS_DATA) 59 | #define RT_OID_802_DOT1X_WPA_KEY (OID_GET_SET_TOGGLE | OID_802_DOT1X_WPA_KEY) 60 | #define RT_OID_802_DOT1X_STATIC_WEP_COPY (OID_GET_SET_TOGGLE | OID_802_DOT1X_STATIC_WEP_COPY) 61 | #define RT_OID_802_DOT1X_IDLE_TIMEOUT (OID_GET_SET_TOGGLE | OID_802_DOT1X_IDLE_TIMEOUT) 62 | #endif 63 | 64 | #define MAC2STR(a) (a)[0], (a)[1], (a)[2], (a)[3], (a)[4], (a)[5] 65 | #define MACSTR "%02x:%02x:%02x:%02x:%02x:%02x" 66 | #ifndef ETH_P_PAE 67 | #define ETH_P_PAE 0x888E /* Port Access Entity (IEEE 802.1X) */ 68 | #endif /* ETH_P_PAE */ 69 | 70 | #ifndef ETH_P_PRE_AUTH 71 | #define ETH_P_PRE_AUTH 0x88C7 /* Port Access Entity (WPA2 pre-auth mode) */ 72 | #endif /* ETH_P_PRE_AUTH */ 73 | 74 | #ifndef ETH_P_VLAN 75 | #define ETH_P_VLAN 0x8100 /* VLAN Protocol */ 76 | #endif /* ETH_P_VLAN */ 77 | 78 | #define BIT(x) (1 << (x)) 79 | #define REAUTH_TIMER_DEFAULT_reAuthEnabled TRUE 80 | #define REAUTH_TIMER_DEFAULT_reAuthPeriod 3600 81 | #define AUTH_PAE_DEFAULT_quietPeriod 60 82 | #define DEFAULT_IDLE_INTERVAL 60 83 | 84 | 85 | #ifdef DBG 86 | extern u32 RTDebugLevel; 87 | #define DBGPRINT(Level, ...) \ 88 | { \ 89 | if (Level <= RTDebugLevel) \ 90 | { \ 91 | printf(NIC_DBG_STRING); \ 92 | printf(__VA_ARGS__); \ 93 | } \ 94 | } 95 | #else 96 | #define DBGPRINT(Level, fmt, args...) 97 | #endif 98 | 99 | struct ieee8023_hdr 100 | { 101 | u8 dAddr[6]; 102 | u8 sAddr[6]; 103 | u16 eth_type; 104 | } __attribute__ ((packed)); 105 | 106 | typedef struct apd_data 107 | { 108 | struct rtapd_config *conf; 109 | char *prefix_wlan_name; /* the prefix name of wireless interface */ 110 | 111 | int wlan_sock[MAX_MBSSID_NUM]; /* raw packet socket for wireless interface access */ 112 | int eth_sock[MAX_MBSSID_NUM]; /* raw packet socket for ethernet interface access */ 113 | int ioctl_sock; /* socket for ioctl() use */ 114 | u8 own_addr[MAX_MBSSID_NUM][MAC_ADDR_LEN]; /* indicate the wireless MAC address */ 115 | 116 | int num_sta; /* number of entries in sta_list */ 117 | struct sta_info *sta_list; /* STA info list head */ 118 | struct sta_info *sta_hash[STA_HASH_SIZE]; 119 | 120 | /* pointers to STA info; based on allocated AID or NULL if AID free 121 | * AID is in the range 1-2007, so sta_aid[0] corresponders to AID 1 122 | * and so on 123 | */ 124 | struct sta_info *sta_aid[MAX_AID_TABLE_SIZE]; 125 | 126 | struct radius_client_data *radius; 127 | 128 | } rtapd; 129 | 130 | typedef struct recv_from_ra 131 | { 132 | u8 daddr[6]; 133 | u8 saddr[6]; 134 | u8 ethtype[2]; 135 | u8 xframe[1]; 136 | } __attribute__ ((packed)) priv_rec; 137 | 138 | void ieee802_1x_receive(rtapd *apd, u8 *sa, u8 *apidx, u8 *buf, size_t len, u16 ethertype, int SockNum); 139 | u16 RTMPCompareMemory(void *pSrc1,void *pSrc2, u16 Length); 140 | void Handle_term(int sig, void *eloop_ctx, void *signal_ctx); 141 | int RT_ioctl(int sid, int param, char *data, int data_len, char *prefix_name, unsigned char apidx, int flags); 142 | 143 | void dot1x_set_IdleTimeoutAction( 144 | rtapd *rtapd, 145 | struct sta_info *sta, 146 | u32 idle_timeout); 147 | 148 | #endif // RTDOT1XD_H // 149 | -------------------------------------------------------------------------------- /packages/ralink/applications/8021xd/src/rtmp_type.h: -------------------------------------------------------------------------------- 1 | 2 | #ifndef __RTMP_TYPE_H__ 3 | #define __RTMP_TYPE_H__ 4 | 5 | // Put platform dependent declaration here 6 | // For example, linux type definition 7 | //#ifdef Linux 8 | 9 | typedef unsigned short UINT16; 10 | typedef unsigned long UINT32; 11 | typedef unsigned long long UINT64; 12 | 13 | //#endif // Linux 14 | 15 | /* 16 | #ifdef Win32 17 | 18 | #undef BIG_ENDIAN // Only little endian foe WIN32 system 19 | 20 | typedef unsigned short UINT16; 21 | typedef unsigned long UINT32; 22 | typedef unsigned __int64 UINT64; 23 | 24 | #endif // Win32 25 | */ 26 | 27 | #define PACKED __attribute__ ((packed)) 28 | 29 | // Endian byte swapping codes 30 | #ifdef BIG_ENDIAN 31 | #define SWAP16(x) \ 32 | ((UINT16)( \ 33 | (((UINT16)(x) & (UINT16) 0x00ffU) << 8) | \ 34 | (((UINT16)(x) & (UINT16) 0xff00U) >> 8) )) 35 | 36 | #define SWAP32(x) \ 37 | ((UINT32)( \ 38 | (((UINT32)(x) & (UINT32) 0x000000ffUL) << 24) | \ 39 | (((UINT32)(x) & (UINT32) 0x0000ff00UL) << 8) | \ 40 | (((UINT32)(x) & (UINT32) 0x00ff0000UL) >> 8) | \ 41 | (((UINT32)(x) & (UINT32) 0xff000000UL) >> 24) )) 42 | 43 | #define SWAP64(x) \ 44 | ((UINT64)( \ 45 | (UINT64)(((UINT64)(x) & (UINT64) 0x00000000000000ffULL) << 56) | \ 46 | (UINT64)(((UINT64)(x) & (UINT64) 0x000000000000ff00ULL) << 40) | \ 47 | (UINT64)(((UINT64)(x) & (UINT64) 0x0000000000ff0000ULL) << 24) | \ 48 | (UINT64)(((UINT64)(x) & (UINT64) 0x00000000ff000000ULL) << 8) | \ 49 | (UINT64)(((UINT64)(x) & (UINT64) 0x000000ff00000000ULL) >> 8) | \ 50 | (UINT64)(((UINT64)(x) & (UINT64) 0x0000ff0000000000ULL) >> 24) | \ 51 | (UINT64)(((UINT64)(x) & (UINT64) 0x00ff000000000000ULL) >> 40) | \ 52 | (UINT64)(((UINT64)(x) & (UINT64) 0xff00000000000000ULL) >> 56) )) 53 | #else 54 | 55 | #define SWAP16(x) 56 | #define SWAP32(x) 57 | #define SWAP64(x) 58 | 59 | #endif // BIG_ENDIAN 60 | 61 | 62 | #ifdef BIG_ENDIAN 63 | 64 | #define cpu2le64(x) SWAP64((x)) 65 | #define le2cpu64(x) SWAP64((x)) 66 | #define cpu2le32(x) SWAP32((x)) 67 | #define le2cpu32(x) SWAP32((x)) 68 | #define cpu2le16(x) SWAP16((x)) 69 | #define le2cpu16(x) SWAP16((x)) 70 | #define cpu2be64(x) ((UINT64)(x)) 71 | #define be2cpu64(x) ((UINT64)(x)) 72 | #define cpu2be32(x) ((UINT32)(x)) 73 | #define be2cpu32(x) ((UINT32)(x)) 74 | #define cpu2be16(x) ((UINT16)(x)) 75 | #define be2cpu16(x) ((UINT16)(x)) 76 | 77 | #else // Little_Endian 78 | 79 | #define cpu2le64(x) ((UINT64)(x)) 80 | #define le2cpu64(x) ((UINT64)(x)) 81 | #define cpu2le32(x) ((UINT32)(x)) 82 | #define le2cpu32(x) ((UINT32)(x)) 83 | #define cpu2le16(x) ((UINT16)(x)) 84 | #define le2cpu16(x) ((UINT16)(x)) 85 | #define cpu2be64(x) SWAP64((x)) 86 | #define be2cpu64(x) SWAP64((x)) 87 | #define cpu2be32(x) SWAP32((x)) 88 | #define be2cpu32(x) SWAP32((x)) 89 | #define cpu2be16(x) SWAP16((x)) 90 | #define be2cpu16(x) SWAP16((x)) 91 | 92 | #endif // BIG_ENDIAN 93 | 94 | typedef enum { FALSE = 0, TRUE = 1 } Boolean; 95 | 96 | #endif // __RTMP_TYPE_H__ 97 | 98 | -------------------------------------------------------------------------------- /packages/ralink/applications/8021xd/src/sta_info.c: -------------------------------------------------------------------------------- 1 | 2 | 3 | #include 4 | #include 5 | #include 6 | #include 7 | #include 8 | #include 9 | 10 | #include /* for IFNAMSIZ and co... */ 11 | #include 12 | 13 | #include "rtdot1x.h" 14 | #include "sta_info.h" 15 | #include "eloop.h" 16 | #include "ieee802_1x.h" 17 | #include "radius.h" 18 | 19 | struct sta_info* Ap_get_sta(rtapd *apd, u8 *sa, u8 *apidx, u16 ethertype, int sock) 20 | { 21 | struct sta_info *s; 22 | 23 | s = apd->sta_hash[STA_HASH(sa)]; 24 | while (s != NULL && memcmp(s->addr, sa, 6) != 0) 25 | s = s->hnext; 26 | 27 | if (s == NULL) 28 | { 29 | if (apd->num_sta >= MAX_STA_COUNT) 30 | { 31 | /* FIX: might try to remove some old STAs first? */ 32 | DBGPRINT(RT_DEBUG_ERROR,"No more room for new STAs (%d/%d)\n", apd->num_sta, MAX_STA_COUNT); 33 | return NULL; 34 | } 35 | 36 | s = (struct sta_info *) malloc(sizeof(struct sta_info)); 37 | if (s == NULL) 38 | { 39 | DBGPRINT(RT_DEBUG_ERROR,"Malloc failed\n"); 40 | return NULL; 41 | } 42 | 43 | memset(s, 0, sizeof(struct sta_info)); 44 | s->radius_identifier = -1; 45 | 46 | s->ethertype = ethertype; 47 | if (apd->conf->SsidNum > 1) 48 | s->ApIdx = *apidx; 49 | else 50 | s->ApIdx = 0; 51 | 52 | DBGPRINT(RT_DEBUG_TRACE,"Create a new STA(in %s%d)\n", apd->prefix_wlan_name, s->ApIdx); 53 | 54 | s->SockNum = sock; 55 | memcpy(s->addr, sa, ETH_ALEN); 56 | s->next = apd->sta_list; 57 | apd->sta_list = s; 58 | apd->num_sta++; 59 | Ap_sta_hash_add(apd, s); 60 | ieee802_1x_new_station(apd, s); 61 | return s; 62 | } 63 | else 64 | { 65 | DBGPRINT(RT_DEBUG_TRACE,"A STA has existed(in %s%d)\n", apd->prefix_wlan_name, s->ApIdx); 66 | } 67 | 68 | return s; 69 | } 70 | 71 | struct sta_info* Ap_get_sta_radius_identifier(rtapd *apd, u8 radius_identifier) 72 | { 73 | struct sta_info *s; 74 | 75 | s = apd->sta_list; 76 | 77 | while (s) 78 | { 79 | if (s->radius_identifier >= 0 && s->radius_identifier == radius_identifier) 80 | return s; 81 | s = s->next; 82 | } 83 | 84 | return NULL; 85 | } 86 | 87 | static void Ap_sta_list_del(rtapd *apd, struct sta_info *sta) 88 | { 89 | struct sta_info *tmp; 90 | 91 | if (apd->sta_list == sta) 92 | { 93 | apd->sta_list = sta->next; 94 | return; 95 | } 96 | 97 | tmp = apd->sta_list; 98 | while (tmp != NULL && tmp->next != sta) 99 | tmp = tmp->next; 100 | if (tmp == NULL) 101 | { 102 | DBGPRINT(RT_DEBUG_ERROR,"Could not remove STA " MACSTR " from list.\n", MAC2STR(sta->addr)); 103 | } 104 | else 105 | tmp->next = sta->next; 106 | } 107 | 108 | void Ap_sta_hash_add(rtapd *apd, struct sta_info *sta) 109 | { 110 | sta->hnext = apd->sta_hash[STA_HASH(sta->addr)]; 111 | apd->sta_hash[STA_HASH(sta->addr)] = sta; 112 | } 113 | 114 | static void Ap_sta_hash_del(rtapd *apd, struct sta_info *sta) 115 | { 116 | struct sta_info *s; 117 | 118 | s = apd->sta_hash[STA_HASH(sta->addr)]; 119 | if (s == NULL) return; 120 | if (memcmp(s->addr, sta->addr, 6) == 0) 121 | { 122 | apd->sta_hash[STA_HASH(sta->addr)] = s->hnext; 123 | return; 124 | } 125 | 126 | while (s->hnext != NULL && memcmp(s->hnext->addr, sta->addr, 6) != 0) 127 | s = s->hnext; 128 | if (s->hnext != NULL) 129 | s->hnext = s->hnext->hnext; 130 | else 131 | DBGPRINT(RT_DEBUG_ERROR,"AP: could not remove STA " MACSTR " from hash table\n", MAC2STR(sta->addr)); 132 | } 133 | 134 | /* 135 | ======================================================================== 136 | Routine Description: 137 | remove the specified input-argumented sta from linked list.. 138 | Arguments: 139 | *sta to-be-removed station. 140 | Return Value: 141 | ======================================================================== 142 | */ 143 | void Ap_free_sta(rtapd *apd, struct sta_info *sta) 144 | { 145 | DBGPRINT(RT_DEBUG_TRACE," AP_free_sta \n") 146 | 147 | Ap_sta_hash_del(apd, sta); 148 | Ap_sta_list_del(apd, sta); 149 | 150 | if (sta->aid > 0) 151 | apd->sta_aid[sta->aid - 1] = NULL; 152 | 153 | apd->num_sta--; 154 | 155 | ieee802_1x_free_station(sta); 156 | 157 | if (sta->last_assoc_req) 158 | free(sta->last_assoc_req); 159 | 160 | free(sta); 161 | } 162 | 163 | /* 164 | ======================================================================== 165 | Description: 166 | remove all stations. 167 | ======================================================================== 168 | */ 169 | void Apd_free_stas(rtapd *apd) 170 | { 171 | struct sta_info *sta, *prev; 172 | 173 | sta = apd->sta_list; 174 | DBGPRINT(RT_DEBUG_TRACE,"Apd_free_stas\n"); 175 | while (sta) 176 | { 177 | prev = sta; 178 | sta = sta->next; 179 | DBGPRINT(RT_DEBUG_ERROR,"Removing station " MACSTR "\n", MAC2STR(prev->addr)); 180 | Ap_free_sta(apd, prev); 181 | } 182 | } 183 | 184 | void Ap_handle_session_timer(void *eloop_ctx, void *timeout_ctx) 185 | { 186 | char *buf; 187 | rtapd *apd = eloop_ctx; 188 | size_t len; 189 | struct ieee8023_hdr *hdr3; 190 | struct sta_info *sta = timeout_ctx; 191 | 192 | DBGPRINT(RT_DEBUG_TRACE,"AP_HANDLE_SESSION_TIMER \n"); 193 | len = sizeof(*hdr3) + 2; 194 | buf = (char *) malloc(len); 195 | if (buf == NULL) 196 | { 197 | DBGPRINT(RT_DEBUG_ERROR,"malloc() failed for ieee802_1x_send(len=%d)\n", len); 198 | return; 199 | } 200 | 201 | memset(buf, 0, len); 202 | hdr3 = (struct ieee8023_hdr *) buf; 203 | memcpy(hdr3->dAddr, sta->addr, ETH_ALEN); 204 | memcpy(hdr3->sAddr, apd->own_addr[sta->ApIdx], ETH_ALEN); 205 | // send deauth 206 | DBGPRINT(RT_DEBUG_TRACE,"AP_HANDLE_SESSION_TIMER : Send Deauth \n"); 207 | if (RT_ioctl(apd->ioctl_sock, 208 | RT_PRIV_IOCTL, buf, len, 209 | apd->prefix_wlan_name, sta->ApIdx, 210 | RT_OID_802_DOT1X_RADIUS_DATA)) 211 | { 212 | DBGPRINT(RT_DEBUG_ERROR," ioctl \n"); 213 | return; 214 | } 215 | free(buf); 216 | 217 | // Ap_free_sta(apd, sta); 218 | } 219 | 220 | void Ap_sta_session_timeout(rtapd *apd, struct sta_info *sta, u32 session_timeout) 221 | { 222 | DBGPRINT(RT_DEBUG_TRACE,"AP_STA_SESSION_TIMEOUT %d seconds \n",session_timeout); 223 | eloop_cancel_timeout(Ap_handle_session_timer, apd, sta); 224 | eloop_register_timeout(session_timeout, 0, Ap_handle_session_timer, apd, sta); 225 | } 226 | 227 | void Ap_sta_no_session_timeout(rtapd *apd, struct sta_info *sta) 228 | { 229 | eloop_cancel_timeout(Ap_handle_session_timer, apd, sta); 230 | } 231 | -------------------------------------------------------------------------------- /packages/ralink/applications/8021xd/src/sta_info.h: -------------------------------------------------------------------------------- 1 | #ifndef STA_INFO_H 2 | #define STA_INFO_H 3 | 4 | struct sta_info* Ap_get_sta(rtapd *apd, u8 *sa, u8 *apidx, u16 ethertype, int sock); 5 | struct sta_info* Ap_get_sta_radius_identifier(rtapd *apd, u8 radius_identifier); 6 | void Ap_sta_hash_add(rtapd *apd, struct sta_info *sta); 7 | void Ap_free_sta(rtapd *apd, struct sta_info *sta); 8 | void Apd_free_stas(rtapd *apd); 9 | void Ap_sta_session_timeout(rtapd *apd, struct sta_info *sta, u32 session_timeout); 10 | void Ap_sta_no_session_timeout(rtapd *apd, struct sta_info *sta); 11 | 12 | #endif /* STA_INFO_H */ 13 | -------------------------------------------------------------------------------- /packages/ralink/applications/luci-mtk-wifi/Makefile: -------------------------------------------------------------------------------- 1 | # 2 | # Copyright (c) 2015 Justin Liu 3 | # Author: Justin Liu 4 | # 5 | 6 | include $(TOPDIR)/rules.mk 7 | 8 | PKG_NAME:=luci-mtk-wifi 9 | PKG_VERSION:=20150716 10 | PKG_RELEASE:= 11 | 12 | PKG_BUILD_DIR:=$(BUILD_DIR)/$(PKG_NAME)-$(PKG_VERSION) 13 | 14 | include $(INCLUDE_DIR)/package.mk 15 | 16 | define Package/luci-mtk-wifi 17 | CATEGORY:=Network 18 | TITLE:=LuCI patch for MTK Wi-Fi drivers 19 | MAINTAINER:=Justin Liu 20 | DEPENDS:=+luci-mod-admin-full 21 | endef 22 | 23 | define Build/Prepare 24 | mkdir -p $(PKG_BUILD_DIR) 25 | endef 26 | 27 | define Build/Compile/Default 28 | 29 | endef 30 | Build/Compile = $(Build/Compile/Default) 31 | 32 | define Package/luci-mtk-wifi/install 33 | $(CP) -a files/* $(1)/ 34 | endef 35 | 36 | #define Package/luci-mtk-wifi/postinst 37 | ##!/bin/sh 38 | #if [ -e /etc/openwrt_release ]; then 39 | # /etc/init.d/ss-redir.sh enable || : 40 | #fi 41 | #endef 42 | 43 | $(eval $(call BuildPackage,luci-mtk-wifi)) 44 | -------------------------------------------------------------------------------- /packages/ralink/applications/uci2dat/Makefile: -------------------------------------------------------------------------------- 1 | # 2 | # Copyright (C) 2010-2013 hua.shao@mediatek.com 3 | # 4 | # Ralink Property Software. 5 | # 6 | 7 | include $(TOPDIR)/rules.mk 8 | 9 | PKG_NAME:=uci2dat 10 | PKG_RELEASE:=1 11 | 12 | PKG_BUILD_DIR:=$(BUILD_DIR)/$(PKG_NAME) 13 | PKG_CONFIG_DEPENDS:= 14 | 15 | include $(INCLUDE_DIR)/package.mk 16 | 17 | define Package/uci2dat 18 | SECTION:=Ralink Properties 19 | CATEGORY:=Ralink Properties 20 | DEPENDS:=+libuci 21 | TITLE:=Translate uci config into ralink wifi dat format 22 | SUBMENU:=Applications 23 | endef 24 | 25 | define Package/uci2dat/description 26 | Translate uci config into ralink wifi dat format 27 | endef 28 | 29 | define Build/Prepare 30 | mkdir -p $(PKG_BUILD_DIR) 31 | $(CP) ./src/* $(PKG_BUILD_DIR)/ 32 | endef 33 | 34 | TARGET_CFLAGS += -luci -Wall 35 | TARGET_CFLAGS += -Wno-error=format-security 36 | 37 | define Build/Configure 38 | endef 39 | 40 | define Package/uci2dat/install 41 | $(INSTALL_DIR) $(1)/usr/bin 42 | $(INSTALL_BIN) $(PKG_BUILD_DIR)/uci2dat $(1)/usr/bin 43 | endef 44 | 45 | 46 | $(eval $(call BuildPackage,uci2dat)) 47 | 48 | -------------------------------------------------------------------------------- /packages/ralink/applications/uci2dat/src/Makefile: -------------------------------------------------------------------------------- 1 | 2 | uci2dat: 3 | $(CC) $(CFLAGS) $(LDFLAGS) -o $@ uci2dat.c 4 | 5 | clean: 6 | -rm -f *.o *.elf *.gbd 7 | 8 | -------------------------------------------------------------------------------- /packages/ralink/drivers/mt7610e/Makefile: -------------------------------------------------------------------------------- 1 | # All rights reserved. 2 | # 3 | # This is free software, licensed under the GNU General Public License v2. 4 | # See /LICENSE for more information. 5 | 6 | include $(TOPDIR)/rules.mk 7 | include $(INCLUDE_DIR)/kernel.mk 8 | 9 | PKG_NAME:=mt7610e 10 | PKG_REV:=5 11 | PKG_VERSION:=$(PKG_REV) 12 | PKG_RELEASE:=20150604 13 | 14 | PKG_SOURCE_PROTO:=svn 15 | PKG_SOURCE_VERSION:=$(PKG_REV) 16 | PKG_SOURCE_SUBDIR:=$(PKG_NAME)-$(PKG_VERSION) 17 | PKG_SOURCE_URL:=https://github.com/i80s/mtk-sources/trunk/mt7610e 18 | PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.bz2 19 | 20 | PKG_BUILD_DIR:=$(KERNEL_BUILD_DIR)/$(PKG_NAME)-$(PKG_VERSION) 21 | 22 | PKG_KCONFIG:= \ 23 | RALINK_MT7620 RT_SECOND_CARD MT7610_AP MT7610_AP_V24_DATA_STRUCTURE MT7610_AP_LED MT7610_AP_WSC MT7610_AP_WSC_V2 \ 24 | MT7610_AP_LLTD MT7610_AP_WDS MT7610_AP_MBSS NEW_MBSSID_MODE MT7610_AP_APCLI MT7610_AP_MAC_REPEATER \ 25 | MT7610_AP_IGMP_SNOOP MT7610_AP_DFS MT7610_AP_CARRIER M7610_CON_WPS_SUPPORT MT7610_AP_80211N_DRAFT3 \ 26 | MT7610_AP_ATE MT7610_AP_QA MT7610_AP_FLASH MT7610_AP_BIG_ENDIAN MT7610_AP_TSSI_COMPENSATION \ 27 | RTMP_TEMPERATURE_COMPENSATION MT7610_AP_SINGLE_SKU 28 | 29 | PKG_CONFIG_DEPENDS:=$(foreach c, $(PKG_KCONFIG),$(if $(CONFIG_$c),CONFIG_$(c))) 30 | 31 | include $(INCLUDE_DIR)/package.mk 32 | 33 | define KernelPackage/mt7610e 34 | CATEGORY:=Ralink Properties 35 | TITLE:=Ralink mt7610e wifi AP driver 36 | FILES:=$(PKG_BUILD_DIR)/build/mt7610e.ko 37 | AUTOLOAD:=$(call AutoLoad,91,mt7610e) 38 | SUBMENU:=Drivers 39 | DEPENDS:=+uci2dat +8021xd 40 | MENU:=1 41 | endef 42 | 43 | define KernelPackage/mt7610e/config 44 | source "$(SOURCE)/config.in" 45 | endef 46 | 47 | define P4/Info 48 | P4URL:=//Embedded_WIFI/MP/MT7610/rlt_wifi/ 49 | endef 50 | 51 | define P4/Release 52 | make release 53 | mkdir -p build 54 | cp Makefile.ap.soc.dpa build/Makefile 55 | cp Kconfig.ap.soc build/Kconfig 56 | mv DPA src 57 | tar cjf mt7610e.tar.bz2 build src 58 | endef 59 | 60 | 61 | 62 | define Build/Compile 63 | $(MAKE) -C "$(LINUX_DIR)" \ 64 | CROSS_COMPILE="$(TARGET_CROSS)" \ 65 | ARCH="$(LINUX_KARCH)" \ 66 | SUBDIRS="$(PKG_BUILD_DIR)/build/" \ 67 | $(foreach c, $(PKG_KCONFIG),$(if $(CONFIG_$c),CONFIG_$(c)=$(CONFIG_$(c))))\ 68 | CONFIG_SUPPORT_OPENWRT=y \ 69 | modules 70 | endef 71 | 72 | define KernelPackage/mt7610e/install 73 | $(INSTALL_DIR) $(1)/lib/wifi/ 74 | $(INSTALL_BIN) ./files/mt7610e.sh ./files/ralink_common.sh $(1)/lib/wifi/ 75 | $(INSTALL_DIR) $(1)/etc/wireless/mt7610e/ 76 | $(INSTALL_BIN) ./files/mt7610e.dat $(1)/etc/wireless/mt7610e/ 77 | -$(INSTALL_BIN) ./files/mt7610e.eeprom.bin $(1)/etc/wireless/mt7610e/ 78 | echo p$(P4REV) > $(1)/etc/wireless/mt7610e/version 79 | endef 80 | 81 | $(eval $(call KernelPackage,mt7610e)) 82 | -------------------------------------------------------------------------------- /packages/ralink/drivers/mt7610e/config.in: -------------------------------------------------------------------------------- 1 | if PACKAGE_kmod-mt7610e 2 | 3 | config RT_SECOND_CARD 4 | string 5 | default 7610 6 | depends on PACKAGE_kmod-mt7610e 7 | 8 | config SECOND_IF_MT7610E 9 | bool 10 | default y 11 | depends on PACKAGE_kmod-mt7610e 12 | 13 | config MT7610_AP 14 | bool # "Ralink MT7610 802.11n AP support" 15 | default y 16 | depends on PACKAGE_kmod-mt7610e 17 | # depends on NET_RADIO 18 | select WIRELESS_EXT 19 | select WEXT_SPY 20 | select WEXT_PRIV 21 | 22 | config MT7610_AP_V24_DATA_STRUCTURE 23 | bool 24 | depends on MT7610_AP 25 | default y 26 | 27 | config MT7610_AP_LED 28 | bool "LED Support" 29 | depends on MT7610_AP 30 | 31 | config MT7610_AP_WSC 32 | bool "WSC (WiFi Simple Config)" 33 | depends on MT7610_AP 34 | default y 35 | 36 | config MT7610_AP_WSC_V2 37 | bool "WSC 2.0(WiFi Simple Config 2.0)" 38 | depends on MT7610_AP_WSC 39 | default y 40 | 41 | config MT7610_AP_LLTD 42 | bool "LLTD (Link Layer Topology Discovery Protocol)" 43 | depends on MT7610_AP 44 | 45 | config MT7610_AP_WDS 46 | bool "WDS" 47 | depends on MT7610_AP 48 | 49 | #config MT7610_AP_WMM_ACM 50 | # bool "WMM ACM" 51 | # depends on MT7610_AP 52 | 53 | config MT7610_AP_MBSS 54 | bool "MBSSID" 55 | depends on MT7610_AP 56 | default y 57 | 58 | config NEW_MBSSID_MODE 59 | bool "New MBSSID MODE" 60 | depends on MT7610_AP 61 | depends on MT7610_AP_MBSS 62 | depends on RALINK_RT3883 || RALINK_RT3352 || RALINK_MT7620 63 | default y 64 | 65 | config MT7610_AP_APCLI 66 | bool "AP-CLient Support" 67 | depends on MT7610_AP 68 | default y 69 | 70 | config MT7610_AP_MAC_REPEATER 71 | bool "Mac Repeater Mode Support" 72 | depends on MT7610_AP 73 | depends on MT7610_AP_APCLI 74 | default y 75 | 76 | config MT7610_AP_IGMP_SNOOP 77 | bool "IGMP snooping" 78 | depends on MT7610_AP 79 | 80 | #config MT7610_AP_NETIF_BLOCK 81 | # bool "NETIF Block" 82 | # depends on MT7610_AP 83 | # help 84 | # Support Net interface block while Tx-Sw queue full 85 | 86 | config MT7610_AP_DFS 87 | bool "DFS" 88 | depends on MT7610_AP 89 | # select RALINK_TIMER 90 | # select RALINK_TIMER_DFS 91 | 92 | config MT7610_AP_CARRIER 93 | bool "Carrier Detect" 94 | depends on MT7610_AP 95 | # select RALINK_TIMER 96 | # select RALINK_TIMER_DFS 97 | 98 | #config MT7610_AP_DLS 99 | # bool "DLS ((Direct-Link Setup) Support" 100 | # depends on MT7610_AP 101 | 102 | #config MT7610_AP_IDS 103 | # bool "IDS (Intrusion Detection System) Support" 104 | # depends on MT7610_AP 105 | 106 | #Not ready 20120726 107 | #config MT7610_RT3XXX_AP_ANTENNA_DIVERSITY 108 | # bool "Antenna Diversity Support" 109 | # depends on MT7610_AP 110 | 111 | #config MT7610_AP_WAPI 112 | # bool "WAPI Support" 113 | # depends on MT7610_AP 114 | 115 | #config MT7610_AP_COC 116 | # bool "CoC Support" 117 | # depends on MT7610_AP 118 | 119 | #config MT7610_AP_MEMORY_OPTIMIZATION 120 | # bool "Memory Optimization" 121 | # depends on MT7610_AP 122 | 123 | #config MT7610_AP_VIDEO_TURBINE 124 | # bool "Video Turbine support" 125 | # depends on MT7610_AP 126 | 127 | #config RA_CLASSIFIER 128 | # tristate "Ralink Flow Classifier" 129 | # depends on MT7610_AP_VIDEO_TURBINE 130 | # default n 131 | 132 | #config MT7610_AP_INTELLIGENT_RATE_ADAPTION 133 | # bool "Intelligent Rate Adaption" 134 | # depends on MT7610_AP 135 | # depends on RALINK_RT2883 || RALINK_RT3883 136 | 137 | #config MT7610_AP_TXBF 138 | # bool "Tx Bean Forming Support (Only 3883)" 139 | # depends on MT7610_AP 140 | # depends on RALINK_RT2883 || RALINK_RT3883 141 | 142 | config M7610_CON_WPS_SUPPORT 143 | bool "Concurrent WPS Support" 144 | depends on MT7610_AP 145 | depends on MT7610_AP_APCLI 146 | depends on MT7610_AP_WSC 147 | depends on MT7610_AP_WSC_V2 148 | default n 149 | 150 | #config MT7610_EXT_CHANNEL_LIST 151 | # bool "Extension Channel List" 152 | # depends on MT7610_AP 153 | 154 | #config MT7610_KTHREAD 155 | # bool "Kernel Thread" 156 | # depends on MT7610_AP 157 | 158 | #config MT7610_AUTO_CH_SELECT_ENHANCE 159 | # bool "Auto Channel Selection Enhancement" 160 | # depends on MT7610_AP 161 | 162 | config MT7610_AP_80211N_DRAFT3 163 | bool "802.11n Draft3" 164 | depends on MT7610_AP 165 | default y 166 | 167 | config MT7610_AP_ATE 168 | bool "ATE support" 169 | depends on MT7610_AP 170 | 171 | config MT7610_AP_QA 172 | bool "QA support" 173 | depends on MT7610_AP 174 | 175 | #config MT7610_AP_CSO 176 | # bool "CSO Support" 177 | # depends on MT7610_AP 178 | 179 | config MT7610_AP_FLASH 180 | bool "Flash Mode Support" 181 | default y 182 | depends on MT7610_AP 183 | 184 | #config MT7610_AP_HDR_TRANS 185 | # bool "Header Translation Rx Support" 186 | # depends on MT7610_AP 187 | 188 | config MT7610_AP_BIG_ENDIAN 189 | bool "Big-endian platform Support" 190 | depends on MT7610_AP 191 | 192 | config MT7610_AP_TSSI_COMPENSATION 193 | bool "TSSI DC Calibration & TSSI compensation Support" 194 | depends on MT7610_AP 195 | 196 | config RTMP_TEMPERATURE_COMPENSATION 197 | bool "Tx Power Temperature Compensation" 198 | depends on MT7610_AP 199 | 200 | config MT7610_AP_SINGLE_SKU 201 | bool "SingleSKU Support" 202 | depends on MT7610_AP 203 | 204 | #config MT7610_80211R_FT 205 | # bool "802.11r Fast BSS Transition" 206 | # depends on MT7610_AP 207 | 208 | #config MT7610_80211R_RR 209 | # bool "802.11k Radio Resource Management" 210 | # depends on MT7610_AP 211 | 212 | #config MT7610_MCAST_RATE_SPECIFIC 213 | # bool "User specific tx rate of mcast pkt" 214 | # depends on MT7610_AP 215 | 216 | #config MT7610_SNMP 217 | # bool "Net-SNMP Support" 218 | # depends on MT7610_AP 219 | 220 | endif 221 | -------------------------------------------------------------------------------- /packages/ralink/drivers/mt7610e/files/mt7610e.dat: -------------------------------------------------------------------------------- 1 | #The word of "Default" must not be removed 2 | Default 3 | CountryRegion= 4 | CountryRegionABand=7 5 | CountryCode= 6 | BssidNum=1 7 | SSID1=OpenWrt-MT7610e 8 | SSID2= 9 | SSID3= 10 | SSID4= 11 | WirelessMode=9 12 | TxRate=0 13 | Channel=auto 14 | BasicRate=15 15 | BeaconPeriod=100 16 | DtimPeriod=1 17 | TxPower=100 18 | DisableOLBC=0 19 | BGProtection=0 20 | MaxStaNum=0 21 | TxPreamble=0 22 | RTSThreshold=2347 23 | FragThreshold=2346 24 | TxBurst=1 25 | PktAggregate=0 26 | TurboRate=0 27 | WmmCapable=1 28 | APSDCapable=1 29 | DLSCapable=0 30 | APAifsn=3;7;1;1 31 | APCwmin=4;4;3;2 32 | APCwmax=6;10;4;3 33 | APTxop=0;0;94;47 34 | APACM=0;0;0;0 35 | BSSAifsn=3;7;2;2 36 | BSSCwmin=4;4;3;2 37 | BSSCwmax=10;10;4;3 38 | BSSTxop=0;0;94;47 39 | BSSACM=0;0;0;0 40 | AckPolicy=0;0;0;0 41 | NoForwarding=0 42 | NoForwardingBTNBSSID=0 43 | HideSSID=0 44 | StationKeepAlive=0 45 | ShortSlot=1 46 | AutoChannelSelect=0 47 | IEEE8021X=0 48 | IEEE80211H=0 49 | CSPeriod=10 50 | WirelessEvent=0 51 | IdsEnable=0 52 | AuthFloodThreshold=32 53 | AssocReqFloodThreshold=32 54 | ReassocReqFloodThreshold=32 55 | ProbeReqFloodThreshold=32 56 | DisassocFloodThreshold=32 57 | DeauthFloodThreshold=32 58 | EapReqFooldThreshold=32 59 | PreAuth=0 60 | AuthMode=OPEN 61 | EncrypType=NONE 62 | RekeyInterval=0 63 | RekeyMethod=DISABLE 64 | PMKCachePeriod=10 65 | WPAPSK1= 66 | WPAPSK2= 67 | WPAPSK3= 68 | WPAPSK4= 69 | DefaultKeyID=1 70 | Key1Type=1;1;1;1 71 | Key1Str1= 72 | Key1Str2= 73 | Key1Str3= 74 | Key1Str4= 75 | Key2Type=1;1;1;1 76 | Key2Str1= 77 | Key2Str2= 78 | Key2Str3= 79 | Key2Str4= 80 | Key3Type=1;1;1;1 81 | Key3Str1= 82 | Key3Str2= 83 | Key3Str3= 84 | Key3Str4= 85 | Key4Type=1;1;1;1 86 | Key4Str1= 87 | Key4Str2= 88 | Key4Str3= 89 | Key4Str4= 90 | HSCounter=0 91 | AccessPolicy0=0 92 | AccessControlList0= 93 | AccessPolicy1=0 94 | AccessControlList1= 95 | AccessPolicy2=0 96 | AccessControlList2= 97 | AccessPolicy3=0 98 | AccessControlList3= 99 | WdsEnable=0 100 | WdsEncrypType=NONE 101 | WdsList=EOF 102 | WdsKey= 103 | RADIUS_Server=192.168.2.3 104 | RADIUS_Port=1812 105 | RADIUS_Key=ralink 106 | own_ip_addr=192.168.5.234 107 | EAPifname=br-lan 108 | PreAuthifname=br-lan 109 | HT_HTC=0 110 | HT_RDG=0 111 | HT_EXTCHA=0 112 | HT_LinkAdapt=0 113 | HT_OpMode=0 114 | HT_MpduDensity=5 115 | HT_BW=0 116 | HT_AutoBA=1 117 | HT_AMSDU=0 118 | HT_BAWinSize=64 119 | HT_GI=1 120 | HT_MCS=33 121 | 122 | # WPS stuff 123 | # 1 = enrollee, 2 = proxy, 4 = registrar (bitmask) 124 | # This value is enabled later on, for WPA only 125 | WscConfMode=0 126 | # 1 = disabled, 2 = enabled 127 | WscConfStatus=2 128 | # 2 = PBC, 1 = PIN 129 | WscMode = 2 130 | 131 | HT_TxStream=2 132 | HT_RxStream=2 133 | -------------------------------------------------------------------------------- /packages/ralink/drivers/mt7610e/files/mt7610e.sh: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | append DRIVERS "mt7610e" 3 | 4 | . /lib/wifi/ralink_common.sh 5 | 6 | prepare_mt7610e() { 7 | prepare_ralink_wifi mt7610e 8 | } 9 | 10 | scan_mt7610e() { 11 | scan_ralink_wifi mt7610e mt7610e 12 | } 13 | 14 | disable_mt7610e() { 15 | disable_ralink_wifi mt7610e 16 | } 17 | 18 | enable_mt7610e() { 19 | enable_ralink_wifi mt7610e mt7610e 20 | } 21 | 22 | detect_mt7610e() { 23 | # detect_ralink_wifi mt7610e mt7610e 24 | cd /sys/module 25 | [ -d $module ] || return 26 | uci get wireless.mt7610e >/dev/null 2>&1 && return 27 | ifconfig rai0 >/dev/null 2>&1 || return 28 | cat <>/tmp/wifi.log 6 | vifs=`uci show wireless | grep "=wifi-iface" | sed -n "s/=wifi-iface//gp"` 7 | echo $vifs >>/tmp/wifi.log 8 | 9 | ifn5g=0 10 | ifn2g=0 11 | for vif in $vifs; do 12 | local netif nettype device netif_new 13 | echo "<<<<<<<<<<<<<<<<<" >>/tmp/wifi.log 14 | netif=`uci -q get ${vif}.ifname` 15 | nettype=`uci -q get ${vif}.network` 16 | device=`uci -q get ${vif}.device` 17 | if [ "$device" == "" ]; then 18 | echo "device cannot be empty!!" >>/tmp/wifi.log 19 | return 20 | fi 21 | echo "device name $device!!" >>/tmp/wifi.log 22 | echo "netif $netif" >>/tmp/wifi.log 23 | echo "nettype $nettype" >>/tmp/wifi.log 24 | 25 | case "$device" in 26 | mt7620 | mt7602e | mt7603e | mt7628 | mt7688) 27 | netif_new="ra"${ifn2g} 28 | ifn2g=$(( $ifn2g + 1 )) 29 | ;; 30 | mt7610e | mt7612e ) 31 | netif_new="rai"${ifn5g} 32 | ifn5g=$(( $ifn5g + 1 )) 33 | ;; 34 | * ) 35 | echo "device $device not recognized!! " >>/tmp/wifi.log 36 | ;; 37 | esac 38 | 39 | echo "ifn5g = ${ifn5g}, ifn2g = ${ifn2g}" >>/tmp/wifi.log 40 | echo "netif_new = ${netif_new}" >>/tmp/wifi.log 41 | 42 | if [ "$netif" == "" ]; then 43 | echo "ifname empty, we'll fix it with ${netif_new}" >>/tmp/wifi.log 44 | uci -q set ${vif}.ifname=${netif_new} 45 | fi 46 | if [ "$nettype" == "" ]; then 47 | nettype="lan" 48 | echo "nettype empty, we'll fix it with ${nettype}" >>/tmp/wifi.log 49 | uci -q set ${vif}.network=${nettype} 50 | fi 51 | echo ">>>>>>>>>>>>>>>>>" >>/tmp/wifi.log 52 | done 53 | uci changes >>/tmp/wifi.log 54 | uci commit 55 | } 56 | 57 | 58 | sync_uci_with_dat() { 59 | echo "sync_uci_with_dat($1,$2,$3,$4)" >>/tmp/wifi.log 60 | local device="$1" 61 | local datpath="$2" 62 | uci2dat -d $device -f $datpath > /tmp/uci2dat.log 63 | } 64 | 65 | 66 | 67 | chk8021x() { 68 | local x8021x="0" encryption device="$1" prefix 69 | #vifs=`uci show wireless | grep "=wifi-iface" | sed -n "s/=wifi-iface//gp"` 70 | echo "u8021x dev $device" > /tmp/802.$device.log 71 | config_get vifs "$device" vifs 72 | for vif in $vifs; do 73 | config_get ifname $vif ifname 74 | echo "ifname = $ifname" >> /tmp/802.$device.log 75 | config_get encryption $vif encryption 76 | echo "enc = $encryption" >> /tmp/802.$device.log 77 | case "$encryption" in 78 | wpa+*) 79 | [ "$x8021x" == "0" ] && x8021x=1 80 | echo 111 >> /tmp/802.$device.log 81 | ;; 82 | wpa2+*) 83 | [ "$x8021x" == "0" ] && x8021x=1 84 | echo 1l2 >> /tmp/802.$device.log 85 | ;; 86 | wpa-mixed*) 87 | [ "$x8021x" == "0" ] && x8021x=1 88 | echo 1l3 >> /tmp/802.$device.log 89 | ;; 90 | esac 91 | ifpre=$(echo $ifname | cut -c1-3) 92 | echo "prefix = $ifpre" >> /tmp/802.$device.log 93 | if [ "$ifpre" == "rai" ]; then 94 | prefix="rai" 95 | else 96 | prefix="ra" 97 | fi 98 | if [ "1" == "$x8021x" ]; then 99 | break 100 | fi 101 | done 102 | echo "x8021x $x8021x, pre $prefix" >>/tmp/802.$device.log 103 | if [ "1" == $x8021x ]; then 104 | if [ "$prefix" == "ra" ]; then 105 | echo "killall 8021xd" >>/tmp/802.$device.log 106 | killall 8021xd 107 | echo "/bin/8021xd -d 9" >>/tmp/802.$device.log 108 | /bin/8021xd -d 9 >> /tmp/802.$device.log 2>&1 109 | else # $prefixa == rai 110 | echo "killall 8021xdi" >>/tmp/802.$device.log 111 | killall 8021xdi 112 | echo "/bin/8021xdi -d 9" >>/tmp/802.$device.log 113 | /bin/8021xdi -d 9 >> /tmp/802.$device.log 2>&1 114 | fi 115 | else 116 | if [ "$prefix" == "ra" ]; then 117 | echo "killall 8021xd" >>/tmp/802.$device.log 118 | killall 8021xd 119 | else # $prefixa == rai 120 | echo "killall 8021xdi" >>/tmp/802.$device.log 121 | killall 8021xdi 122 | fi 123 | fi 124 | } 125 | 126 | 127 | # $1=device, $2=module 128 | reinit_wifi() { 129 | echo "reinit_wifi($1,$2,$3,$4)" >>/tmp/wifi.log 130 | local device="$1" 131 | local module="$2" 132 | config_get vifs "$device" vifs 133 | 134 | # shut down all vifs first 135 | for vif in $vifs; do 136 | config_get ifname $vif ifname 137 | ifconfig $ifname down 138 | done 139 | 140 | # in some case we have to reload drivers. (mbssid eg) 141 | #ref=`cat /sys/module/$module/refcnt` 142 | #if [ $ref != "0" ]; then 143 | # # but for single driver, we only need to reload once. 144 | # echo "$module ref=$ref, skip reload module" >>/tmp/wifi.log 145 | #else 146 | # echo "rmmod $module" >>/tmp/wifi.log 147 | # rmmod $module 148 | # echo "insmod $module" >>/tmp/wifi.log 149 | # insmod $module 150 | #fi 151 | 152 | # bring up vifs 153 | for vif in $vifs; do 154 | config_get ifname $vif ifname 155 | config_get disabled $vif disabled 156 | echo "ifconfig $ifname down" >>/tmp/wifi.log 157 | if [ "$disabled" == "1" ]; then 158 | echo "$ifname marked disabled, skip" >>/tmp/wifi.log 159 | continue 160 | else 161 | echo "ifconfig $ifname up" >>/tmp/wifi.log 162 | ifconfig $ifname up 163 | fi 164 | done 165 | 166 | chk8021x $device 167 | } 168 | 169 | prepare_ralink_wifi() { 170 | echo "prepare_ralink_wifi($1,$2,$3,$4)" >>/tmp/wifi.log 171 | local device=$1 172 | config_get channel $device channel 173 | config_get ssid $2 ssid 174 | config_get mode $device mode 175 | config_get ht $device ht 176 | config_get country $device country 177 | config_get regdom $device regdom 178 | 179 | # HT40 mode can be enabled only in bgn (mode = 9), gn (mode = 7) 180 | # or n (mode = 6). 181 | HT=0 182 | [ "$mode" = 6 -o "$mode" = 7 -o "$mode" = 9 ] && [ "$ht" != "20" ] && HT=1 183 | 184 | # In HT40 mode, a second channel is used. If EXTCHA=0, the extra 185 | # channel is $channel + 4. If EXTCHA=1, the extra channel is 186 | # $channel - 4. If the channel is fixed to 1-4, we'll have to 187 | # use + 4, otherwise we can just use - 4. 188 | EXTCHA=0 189 | [ "$channel" != auto ] && [ "$channel" -lt "5" ] && EXTCHA=1 190 | 191 | } 192 | 193 | scan_ralink_wifi() { 194 | local device="$1" 195 | local module="$2" 196 | echo "scan_ralink_wifi($1,$2,$3,$4)" >>/tmp/wifi.log 197 | repair_wireless_uci 198 | sync_uci_with_dat $device /etc/wireless/$device/$device.dat 199 | } 200 | 201 | disable_ralink_wifi() { 202 | echo "disable_ralink_wifi($1,$2,$3,$4)" >>/tmp/wifi.log 203 | local device="$1" 204 | config_get vifs "$device" vifs 205 | for vif in $vifs; do 206 | config_get ifname $vif ifname 207 | ifconfig $ifname down 208 | done 209 | 210 | # kill any running ap_clients 211 | killall ap_client 2>/dev/null || true 212 | } 213 | 214 | enable_ralink_wifi() { 215 | echo "enable_ralink_wifi($1,$2,$3,$4)" >>/tmp/wifi.log 216 | local device="$1" 217 | config_get vifs "$device" vifs 218 | 219 | # bring up vifs 220 | for vif in $vifs; do 221 | config_get ifname $vif ifname 222 | config_get disabled $vif disabled 223 | config_get radio $device radio 224 | ifconfig $ifname down 225 | echo "ifconfig $ifname down" >>/dev/null 226 | if [ "$disabled" == "1" ]; then 227 | echo "$ifname marked disabled, skip" >>/dev/null 228 | continue 229 | else 230 | echo "ifconfig $ifname up" >>/dev/null 231 | ifconfig $ifname up 232 | fi 233 | #Radio On/Off only support iwpriv command but dat file 234 | [ "$radio" == "0" ] && iwpriv $ifname set RadioOn=0 235 | local net_cfg bridge 236 | net_cfg="$(find_net_config "$vif")" 237 | [ -z "$net_cfg" ] || { 238 | bridge="$(bridge_interface "$net_cfg")" 239 | config_set "$vif" bridge "$bridge" 240 | start_net "$ifname" "$net_cfg" 241 | } 242 | chk8021x $device 243 | set_wifi_up "$vif" "$ifname" 244 | brctl addif "$bridge" "$ifname" 2>/dev/null 245 | done 246 | } 247 | 248 | detect_ralink_wifi() { 249 | echo "detect_ralink_wifi($1,$2,$3,$4)" >>/tmp/wifi.log 250 | local channel 251 | local device="$1" 252 | local module="$2" 253 | local band 254 | local ifname 255 | cd /sys/module/ 256 | [ -d $module ] || return 257 | config_get channel $device channel 258 | [ -z "$channel" ] || return 259 | case "$device" in 260 | mt7620 | mt7602e | mt7603e | mt7628 ) 261 | ifname="ra0" 262 | band="2.4G" 263 | ;; 264 | mt7610e | mt7612e ) 265 | ifname="rai0" 266 | band="5G" 267 | ;; 268 | * ) 269 | echo "device $device not recognized!! " >>/tmp/wifi.log 270 | ;; 271 | esac 272 | cat < 7 | +#include 8 | +#include 9 | +#include 10 | +#include 11 | +#include 12 | +#include 13 | +#include 14 | +#include 15 | +#include 16 | +#include 17 | +#include 18 | +#include 19 | +#include 20 | +#include 21 | +#include 22 | + 23 | +struct proc_dir_entry *procRegDir; 24 | +/* 25 | + * Flash API: ra_mtd_read, ra_mtd_write 26 | + * Arguments: 27 | + * - num: specific the mtd number 28 | + * - to/from: the offset to read from or written to 29 | + * - len: length 30 | + * - buf: data to be read/written 31 | + * Returns: 32 | + * - return -errno if failed 33 | + * - return the number of bytes read/written if successed 34 | + */ 35 | +int ra_mtd_write_nm(char *name, loff_t to, size_t len, const u_char *buf) 36 | +{ 37 | + int ret = -1; 38 | + size_t rdlen, wrlen; 39 | + struct mtd_info *mtd; 40 | + struct erase_info ei; 41 | + u_char *bak = NULL; 42 | + 43 | + mtd = get_mtd_device_nm(name); 44 | + 45 | + if (IS_ERR(mtd)) { 46 | + ret = (int)mtd; 47 | + goto out; 48 | + } 49 | + 50 | + if (len > mtd->erasesize) { 51 | + put_mtd_device(mtd); 52 | + ret = -E2BIG; 53 | + goto out; 54 | + } 55 | + 56 | + bak = kzalloc(mtd->erasesize, GFP_KERNEL); 57 | + if (bak == NULL) { 58 | + put_mtd_device(mtd); 59 | + ret = -ENOMEM; 60 | + goto out; 61 | + } 62 | + 63 | +#if LINUX_VERSION_CODE >= KERNEL_VERSION(3,3,0) 64 | + ret = mtd_read(mtd, 0, mtd->erasesize, &rdlen, bak); 65 | +#else 66 | + ret = mtd->read(mtd, 0, mtd->erasesize, &rdlen, bak); 67 | +#endif 68 | + if (ret) { 69 | + goto free_out; 70 | + } 71 | + 72 | + if (rdlen != mtd->erasesize) 73 | + printk("warning: ra_mtd_write_nm: rdlen is not equal to erasesize\n"); 74 | + 75 | + memcpy(bak + to, buf, len); 76 | + 77 | + ei.mtd = mtd; 78 | + ei.callback = NULL; 79 | + ei.addr = 0; 80 | + ei.len = mtd->erasesize; 81 | + ei.priv = 0; 82 | + 83 | +#if LINUX_VERSION_CODE >= KERNEL_VERSION(3,3,0) 84 | + ret = mtd_erase(mtd, &ei); 85 | +#else 86 | + ret = mtd->erase(mtd, &ei); 87 | +#endif 88 | + if (ret != 0) 89 | + goto free_out; 90 | + 91 | +#if LINUX_VERSION_CODE >= KERNEL_VERSION(3,3,0) 92 | + ret = mtd_write(mtd, 0, mtd->erasesize, &wrlen, bak); 93 | +#else 94 | + ret = mtd->write(mtd, 0, mtd->erasesize, &wrlen, bak); 95 | +#endif 96 | + 97 | + udelay(10); /* add delay after write */ 98 | + 99 | +free_out: 100 | + if (mtd) 101 | + put_mtd_device(mtd); 102 | + 103 | + if (bak) 104 | + kfree(bak); 105 | +out: 106 | + return ret; 107 | +} 108 | + 109 | +int ra_mtd_read_nm(char *name, loff_t from, size_t len, u_char *buf) 110 | +{ 111 | + int ret; 112 | + size_t rdlen = 0; 113 | + struct mtd_info *mtd; 114 | + 115 | + mtd = get_mtd_device_nm(name); 116 | + if (IS_ERR(mtd)) 117 | + return (int)mtd; 118 | + 119 | +#if LINUX_VERSION_CODE >= KERNEL_VERSION(3,3,0) 120 | + ret = mtd_read(mtd, from, len, &rdlen, buf); 121 | +#else 122 | + ret = mtd->read(mtd, from, len, &rdlen, buf); 123 | +#endif 124 | + if (rdlen != len) 125 | + printk("warning: ra_mtd_read_nm: rdlen is not equal to len\n"); 126 | + 127 | + put_mtd_device(mtd); 128 | + return ret; 129 | +} 130 | + 131 | +EXPORT_SYMBOL(ra_mtd_write_nm); 132 | +EXPORT_SYMBOL(ra_mtd_read_nm); 133 | +EXPORT_SYMBOL(procRegDir); 134 | + 135 | +MODULE_AUTHOR("Steven Liu "); 136 | +MODULE_DESCRIPTION("Ralink APSoC Flash Map"); 137 | +MODULE_LICENSE("GPL"); 138 | Index: src/os/linux/rt_linux.c 139 | =================================================================== 140 | --- a/src/os/linux/rt_linux.c (revision 268) 141 | +++ b/src/os/linux/rt_linux.c (working copy) 142 | @@ -291,7 +291,7 @@ 143 | #ifdef RA_MTD_RW_BY_NUM 144 | ra_mtd_read(MTD_NUM_FACTORY, 0, (size_t) b, p); 145 | #else 146 | - ra_mtd_read_nm("Factory", a&0xFFFF, (size_t) b, p); 147 | + ra_mtd_read_nm("factory", a&0xFFFF, (size_t) b, p); 148 | #endif 149 | #endif /* CONFIG_RALINK_FLASH_API */ 150 | } 151 | @@ -307,7 +307,7 @@ 152 | #ifdef RA_MTD_RW_BY_NUM 153 | ra_mtd_write(MTD_NUM_FACTORY, 0, (size_t) b, p); 154 | #else 155 | - ra_mtd_write_nm("Factory", a&0xFFFF, (size_t) b, p); 156 | + ra_mtd_write_nm("factory", a&0xFFFF, (size_t) b, p); 157 | #endif 158 | #endif /* CONFIG_RALINK_FLASH_API */ 159 | } 160 | Index: build/Makefile 161 | =================================================================== 162 | --- a/build/Makefile (revision 267) 163 | +++ b/build/Makefile (working copy) 164 | @@ -10,6 +10,7 @@ 165 | SRC_DIR = . 166 | obj-$(CONFIG_MT7610_AP) += $(DRV_NAME).o 167 | endif 168 | +EXTRA_CFLAGS += -DPRE_ASSIGN_MAC_ADDR -DCONFIG_SUPPORT_OPENWRT 169 | 170 | obj-$(CONFIG_MT7610_AP) += MT7610_ap.o 171 | 172 | @@ -30,6 +31,7 @@ 173 | $(DRV_NAME)-objs += $(SRC_DIR)/os/linux/rt_linux.o 174 | $(DRV_NAME)-objs += $(SRC_DIR)/os/linux/rt_proc.o 175 | $(DRV_NAME)-objs += $(SRC_DIR)/os/linux/rt_main_dev.o 176 | +$(DRV_NAME)-objs += $(SRC_DIR)/os/linux/rt_flash.o 177 | #$(DRV_NAME)-objs += $(SRC_DIR)/mcu/rtmp_and.o 178 | $(DRV_NAME)-objs += $(SRC_DIR)/mcu/mcu.o 179 | $(DRV_NAME)-objs += $(SRC_DIR)/mcu/mcu_and.o 180 | -------------------------------------------------------------------------------- /packages/ralink/drivers/mt7620/Makefile: -------------------------------------------------------------------------------- 1 | # All rights reserved. 2 | # 3 | # This is free software, licensed under the GNU General Public License v2. 4 | # See /LICENSE for more information. 5 | 6 | include $(TOPDIR)/rules.mk 7 | include $(INCLUDE_DIR)/kernel.mk 8 | 9 | PKG_NAME:=mt7620 10 | P4REV:=113050 11 | PKG_VERSION:=p4rev-$(P4REV) 12 | PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.bz2 13 | PKG_SOURCE_URL:=http://localhost/ 14 | PKG_BUILD_DIR:=$(KERNEL_BUILD_DIR)/$(PKG_NAME)-$(PKG_VERSION) 15 | 16 | PKG_KCONFIG:=RALINK_MT7620 RALINK_RT5350 RALINK_3883 RALINK_RT3352 RT2860V2_AP RT2860V2_AP_V24_DATA_STRUCTURE \ 17 | RT2860V2_AP_WSC RT2860V2_AP_WSC_V2 RT2860V2_AP_LLTD RT2860V2_AP_WDS RT2860V2_AP_MBSS NEW_MBSSID_MODE \ 18 | RT2860V2_AP_APCLI RT2860V2_AP_MAC_REPEATER RT2860V2_AP_IGMP_SNOOP RT2860V2_AP_NETIF_BLOCK RT2860V2_AP_DFS \ 19 | RT2860V2_AP_CARRIER RT2860V2_AP_DLS RT2860V2_AP_IDS RT2860V2_HW_ANTENNA_DIVERSITY RT2860V2_AP_COC \ 20 | RT2860V2_AP_MEMORY_OPTIMIZATION RT2860V2_AP_VIDEO_TURBINE RA_CLASSIFIER RT2860V2_AP_INTELLIGENT_RATE_ADAPTION \ 21 | RT2860V2_AP_TXBF RT2860V2_AP_80211N_DRAFT3 RT2860V2_ADJ_PWR_CONSUMPTION_SUPPORT RT2860V2_SINGLE_SKU \ 22 | RT2860V2_AP_RTMP_INTERNAL_TX_ALC RT2860V2_AP_RTMP_TEMPERATURE_COMPENSATION RT2860V2_AP_LED \ 23 | INTERNAL_PA_INTERNAL_LNA INTERNAL_PA_EXTERNAL_LNA EXTERNAL_PA_EXTERNAL_LNA RT2860V2_EXT_CHANNEL_LIST RT2860V2_AP_EDCCA_MONITOR 24 | PKG_CONFIG_DEPENDS:=$(foreach c, $(PKG_KCONFIG),$(if $(CONFIG_$c),CONFIG_$(c))) 25 | 26 | include $(INCLUDE_DIR)/package.mk 27 | 28 | TAR_CMD=$(HOST_TAR) -C $(1)/ $(TAR_OPTIONS) 29 | 30 | define KernelPackage/mt7620 31 | CATEGORY:=Ralink Properties 32 | TITLE:=Ralink MT7620 wifi AP driver 33 | FILES:=$(PKG_BUILD_DIR)/build/mt7620.ko 34 | DEPENDS:=@TARGET_ramips_mt7620a 35 | AUTOLOAD:=$(call AutoLoad,90,mt7620) 36 | SUBMENU:=Drivers 37 | MENU:=1 38 | endef 39 | 40 | define KernelPackage/mt7620/config 41 | source "$(SOURCE)/config.in" 42 | endef 43 | 44 | define P4/Info 45 | P4URL:=//Embedded_WIFI/MP/MT7620/WIFI_MT7620/ 46 | endef 47 | 48 | define P4/Release 49 | make release 50 | mkdir -p build 51 | cp rt2860v2_ap/Makefile build/Makefile 52 | cp rt2860v2_ap/Kconfig build/Kconfig 53 | mv ARCH src 54 | tar cjf mt7620.tar.bz2 build src 55 | endef 56 | 57 | define Build/Compile 58 | $(MAKE) -C "$(LINUX_DIR)" \ 59 | CROSS_COMPILE="$(TARGET_CROSS)" \ 60 | ARCH="$(LINUX_KARCH)" \ 61 | SUBDIRS="$(PKG_BUILD_DIR)/build/" \ 62 | $(foreach c, $(PKG_KCONFIG),$(if $(CONFIG_$c),CONFIG_$(c)=y))\ 63 | CONFIG_SUPPORT_OPENWRT=y \ 64 | modules 65 | endef 66 | 67 | define KernelPackage/mt7620/install 68 | $(INSTALL_DIR) $(1)/lib/wifi/ 69 | $(INSTALL_BIN) ./files/mt7620.sh $(1)/lib/wifi/ 70 | $(INSTALL_DIR) $(1)/etc/wireless/mt7620/ 71 | $(INSTALL_BIN) ./files/mt7620.dat $(1)/etc/wireless/mt7620/ 72 | $(INSTALL_BIN) ./files/SingleSKU.dat $(1)/etc/wireless/mt7620/ 73 | -if [ "$$(CONFIG_INTERNAL_PA_INTERNAL_LNA)" = "y" ]; then \ 74 | $(INSTALL_BIN) ./files/mt7620.eeprom.ipa.ilna.bin $(1)/etc/wireless/mt7620/mt7620.eeprom.bin; \ 75 | elif [ "$$(CONFIG_INTERNAL_PA_EXTERNAL_LNA)" = "y" ]; then \ 76 | $(INSTALL_BIN) ./files/mt7620.eeprom.ipa.elna.bin $(1)/etc/wireless/mt7620/mt7620.eeprom.bin; \ 77 | elif [ "$$(CONFIG_EXTERNAL_PA_EXTERNAL_LNA)" = "y" ]; then \ 78 | $(INSTALL_BIN) ./files/mt7620.eeprom.epa.elna.bin $(1)/etc/wireless/mt7620/mt7620.eeprom.bin; \ 79 | else \ 80 | $(INSTALL_BIN) ./files/mt7620.eeprom.ipa.elna.bin $(1)/etc/wireless/mt7620/mt7620.eeprom.bin; \ 81 | fi 82 | echo p$(P4REV) > $(1)/etc/wireless/mt7620/version 83 | endef 84 | 85 | $(eval $(call KernelPackage,mt7620)) 86 | -------------------------------------------------------------------------------- /packages/ralink/drivers/mt7620/config.in: -------------------------------------------------------------------------------- 1 | if PACKAGE_kmod-mt7620 2 | 3 | config FIRST_IF_RT2860 4 | bool 5 | default y 6 | depends on PACKAGE_kmod-mt7620 7 | 8 | config RALINK_MT7620 9 | bool 10 | default y 11 | depends on PACKAGE_kmod-mt7620 12 | 13 | config RT_FIRST_CARD 14 | int 15 | depends on PACKAGE_kmod-mt7620 16 | default 2860 17 | 18 | config RT_FIRST_CARD_EEPROM 19 | string 20 | depends on FIRST_IF_RT2860 21 | default "flash" 22 | 23 | config RT2860V2_AP 24 | bool # "Ralink RT2860 802.11n AP support" 25 | default y 26 | 27 | config RT2860V2_AP_V24_DATA_STRUCTURE 28 | bool 29 | depends on RT2860V2_AP 30 | default y 31 | 32 | config RT2860V2_AP_LED 33 | bool "LED Support" 34 | depends on RT2860V2_AP 35 | 36 | config RT2860V2_AP_WSC 37 | bool "WSC (WiFi Simple Config)" 38 | depends on RT2860V2_AP 39 | default y 40 | 41 | config RT2860V2_AP_WSC_V2 42 | bool "WSC 2.0(WiFi Simple Config 2.0)" 43 | depends on RT2860V2_AP_WSC 44 | default y 45 | 46 | config RT2860V2_AP_LLTD 47 | bool "LLTD (Link Layer Topology Discovery Protocol)" 48 | depends on RT2860V2_AP 49 | 50 | config RT2860V2_AP_WDS 51 | bool "WDS" 52 | depends on RT2860V2_AP 53 | 54 | #config RT2860V2_AP_WMM_ACM 55 | # bool "WMM ACM" 56 | # depends on RT2860V2_AP 57 | 58 | config RT2860V2_AP_MBSS 59 | bool "MBSSID" 60 | depends on RT2860V2_AP 61 | default y 62 | 63 | config NEW_MBSSID_MODE 64 | bool "New MBSSID MODE" 65 | depends on RT2860V2_AP 66 | depends on RT2860V2_AP_MBSS 67 | depends on RALINK_RT3883 || RALINK_RT3352 || RALINK_RT5350 || RALINK_RT6352 || RALINK_MT7620 68 | default y 69 | 70 | config RT2860V2_AP_APCLI 71 | bool "AP-CLient Support" 72 | depends on RT2860V2_AP 73 | default y 74 | 75 | config RT2860V2_AP_MAC_REPEATER 76 | bool "MAC Repeater Support" 77 | depends on RT2860V2_AP 78 | depends on RT2860V2_AP_APCLI 79 | depends on RALINK_RT6352 || RALINK_MT7620 80 | default y 81 | 82 | config RT2860V2_AP_IGMP_SNOOP 83 | bool "IGMP snooping" 84 | depends on RT2860V2_AP 85 | 86 | config RT2860V2_AP_NETIF_BLOCK 87 | bool "NETIF Block" 88 | depends on RT2860V2_AP 89 | help 90 | Support Net interface block while Tx-Sw queue full 91 | 92 | config RT2860V2_AP_DFS 93 | bool "DFS" 94 | depends on RT2860V2_AP && BROKEN 95 | select RALINK_TIMER_DFS 96 | 97 | config RT2860V2_AP_CARRIER 98 | bool "Carrier Detect" 99 | depends on RT2860V2_AP 100 | 101 | config RT2860V2_AP_DLS 102 | bool "DLS ((Direct-Link Setup) Support" 103 | depends on RT2860V2_AP 104 | 105 | config RT2860V2_AP_IDS 106 | bool "IDS (Intrusion Detection System) Support" 107 | depends on RT2860V2_AP 108 | 109 | config RT2860V2_HW_ANTENNA_DIVERSITY 110 | bool "Antenna Diversity Support" 111 | depends on RT2860V2_AP 112 | depends on RALINK_RT5350 113 | 114 | #config RT2860V2_AP_WAPI 115 | # bool "WAPI Support" 116 | # depends on RT2860V2_AP 117 | 118 | config RT2860V2_AP_COC 119 | bool "CoC Support" 120 | depends on RT2860V2_AP 121 | default y 122 | 123 | config RT2860V2_AP_MEMORY_OPTIMIZATION 124 | bool "Memory Optimization" 125 | depends on RT2860V2_AP 126 | 127 | config RT2860V2_AP_VIDEO_TURBINE 128 | bool "Video Turbine support" 129 | depends on RT2860V2_AP && BROKEN 130 | 131 | config RA_CLASSIFIER 132 | tristate "Ralink Flow Classifier" 133 | depends on RT2860V2_AP_VIDEO_TURBINE 134 | default n 135 | 136 | config RT2860V2_AP_INTELLIGENT_RATE_ADAPTION 137 | bool "Intelligent Rate Adaption" 138 | depends on RT2860V2_AP 139 | depends on RALINK_RT2883 || RALINK_RT3883 140 | 141 | config RT2860V2_AP_TXBF 142 | bool "Tx Bean Forming Support (Only 3883)" 143 | depends on RT2860V2_AP 144 | depends on RALINK_RT2883 || RALINK_RT3883 145 | default y 146 | 147 | #config RT2860V2_EXT_CHANNEL_LIST 148 | # bool "Extension Channel List" 149 | # depends on RT2860V2_AP 150 | 151 | #config RT2860V2_KTHREAD 152 | # bool "Kernel Thread" 153 | # depends on RT2860V2_AP 154 | 155 | #config RT2860V2_AUTO_CH_SELECT_ENHANCE 156 | # bool "Auto Channel Selection Enhancement" 157 | # depends on RT2860V2_AP 158 | 159 | config RT2860V2_AP_80211N_DRAFT3 160 | bool "802.11n Draft3" 161 | depends on RT2860V2_AP 162 | default y 163 | 164 | #config RT2860V2_AP_RTMP_INTERNAL_TX_ALC 165 | # bool "TSSI Compensation" 166 | # depends on RT2860V2_AP 167 | # depends on RALINK_RT3350 || RALINK_RT3352 || RALINK_RT5350 || RALINK_MT7620 || RALINK_RT6352 168 | # default n 169 | 170 | config RT2860V2_ADJ_PWR_CONSUMPTION_SUPPORT 171 | bool "Adjust Power Consumption Support" 172 | depends on RT2860V2_AP 173 | depends on RALINK_MT7620 || RALINK_RT6352 174 | default n 175 | 176 | config RT2860V2_SINGLE_SKU 177 | bool "Single SKU" 178 | depends on RT2860V2_AP 179 | default n 180 | 181 | choice 182 | prompt "Choose Power Design" 183 | depends on RALINK_MT7620 || RALINK_RT6352 184 | default INTERNAL_PA_EXTERNAL_LNA 185 | 186 | config INTERNAL_PA_INTERNAL_LNA 187 | bool "Internal PA and Internal LNA" 188 | config INTERNAL_PA_EXTERNAL_LNA 189 | bool "Internal PA and External LNA" 190 | config EXTERNAL_PA_EXTERNAL_LNA 191 | bool "External PA and External LNA" 192 | endchoice 193 | 194 | config RT2860V2_AP_RTMP_INTERNAL_TX_ALC 195 | bool "TSSI Compensation" 196 | depends on RT2860V2_AP 197 | depends on RALINK_RT3350 || RALINK_RT3352 || RALINK_RT5350 || RALINK_MT7620 || RALINK_RT6352 198 | depends on INTERNAL_PA_INTERNAL_LNA || INTERNAL_PA_EXTERNAL_LNA 199 | default n 200 | 201 | config RT2860V2_AP_RTMP_TEMPERATURE_COMPENSATION 202 | bool "Temperature Compensation" 203 | depends on RT2860V2_AP 204 | depends on RALINK_MT7620 || RALINK_RT6352 205 | default n 206 | 207 | #config RT2860V2_80211R_FT 208 | # bool "802.11r Fast BSS Transition" 209 | # depends on RT2860V2_AP 210 | 211 | #config RT2860V2_80211R_RR 212 | # bool "802.11k Radio Resource Management" 213 | # depends on RT2860V2_AP 214 | 215 | #config RT2860V2_MCAST_RATE_SPECIFIC 216 | # bool "User specific tx rate of mcast pkt" 217 | # depends on RT2860V2_AP 218 | 219 | #config RT2860V2_SNMP 220 | # bool "Net-SNMP Support" 221 | # depends on RT2860V2_AP 222 | 223 | endif 224 | -------------------------------------------------------------------------------- /packages/ralink/drivers/mt7620/files/SingleSKU.dat: -------------------------------------------------------------------------------- 1 | # Single SKU Max Power Table 2 | # |CCK 1~11 | | OFDM 6 ~ 54 | | HT20 MCS 0 ~ 15 | | HT40 MCS 0 ~ 15 | 3 | ch1 16 16 16 16 14 14 14 14 14 14 14 14 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 4 | ch2 18 18 18 18 16 16 16 16 16 16 16 16 16 16 16 16 16 16 16 16 16 16 16 16 16 16 16 16 5 | ch3 18 18 18 18 16 16 16 16 16 16 16 16 16 16 16 16 16 16 16 16 16 16 16 16 16 16 16 16 12 12 12 12 12 12 12 12 12 12 12 12 12 12 12 12 6 | ch4 18 18 18 18 16 16 16 16 16 16 16 16 16 16 16 16 16 16 16 16 16 16 16 16 16 16 16 16 16 16 16 16 16 16 16 16 16 16 16 16 16 16 16 16 7 | ch5 18 18 18 18 16 16 16 16 16 16 16 16 16 16 16 16 16 16 16 16 16 16 16 16 16 16 16 16 16 16 16 16 16 16 16 16 16 16 16 16 16 16 16 16 8 | ch6 18 18 18 18 16 16 16 16 16 16 16 16 16 16 16 16 16 16 16 16 16 16 16 16 16 16 16 16 16 16 16 16 16 16 16 16 16 16 16 16 16 16 16 16 9 | ch7 18 18 18 18 16 16 16 16 16 16 16 16 16 16 16 16 16 16 16 16 16 16 16 16 16 16 16 16 16 16 16 16 16 16 16 16 16 16 16 16 16 16 16 16 10 | ch8 18 18 18 18 16 16 16 16 16 16 16 16 16 16 16 16 16 16 16 16 16 16 16 16 16 16 16 16 16 16 16 16 16 16 16 16 16 16 16 16 16 16 16 16 11 | ch9 18 18 18 18 16 16 16 16 16 16 16 16 16 16 16 16 16 16 16 16 16 16 16 16 16 16 16 16 12 12 12 12 12 12 12 12 12 12 12 12 12 12 12 12 12 | ch10 18 18 18 18 16 16 16 16 16 16 16 16 16 16 16 16 16 16 16 16 16 16 16 16 16 16 16 16 13 | ch11 16 16 16 16 14 14 14 14 14 14 14 14 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 14 | ch12 15 | ch13 16 | ch14 17 | 18 | # OFDM 6 ~ 54 | | HT20 MCS 0 ~ 15 | | HT40 MCS 0 ~ 15 | | VHT80 MCS 0 ~ 9 | 19 | ch36 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 20 | ch38 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 21 | ch40 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 22 | ch42 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 23 | ch44 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 24 | ch46 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 25 | ch48 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 26 | ch52 15 15 15 15 15 15 15 15 15 15 15 15 15 15 15 15 15 15 15 15 15 15 15 15 15 15 15 15 15 15 15 15 15 15 15 15 15 15 15 15 13 13 13 13 13 13 13 13 13 13 27 | ch54 15 15 15 15 15 15 15 15 15 15 15 15 15 15 15 15 15 15 15 15 15 15 15 15 15 15 15 15 15 15 15 15 15 15 15 15 15 15 15 15 13 13 13 13 13 13 13 13 13 13 28 | ch56 15 15 15 15 15 15 15 15 15 15 15 15 15 15 15 15 15 15 15 15 15 15 15 15 15 15 15 15 15 15 15 15 15 15 15 15 15 15 15 15 13 13 13 13 13 13 13 13 13 13 29 | ch58 15 15 15 15 15 15 15 15 15 15 15 15 15 15 15 15 15 15 15 15 15 15 15 15 15 15 15 15 15 15 15 15 15 15 15 15 15 15 15 15 13 13 13 13 13 13 13 13 13 13 30 | ch60 15 15 15 15 15 15 15 15 15 15 15 15 15 15 15 15 15 15 15 15 15 15 15 15 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 31 | ch62 15 15 15 15 15 15 15 15 15 15 15 15 15 15 15 15 15 15 15 15 15 15 15 15 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 32 | ch64 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 33 | ch100 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 34 | ch102 18 18 18 18 18 18 18 18 18 18 18 18 18 18 18 18 18 18 18 18 18 18 18 18 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 35 | ch104 18 18 18 18 18 18 18 18 18 18 18 18 18 18 18 18 18 18 18 18 18 18 18 18 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 36 | ch106 18 18 18 18 18 18 18 18 18 18 18 18 18 18 18 18 18 18 18 18 18 18 18 18 18 18 18 18 18 18 18 18 18 18 18 18 18 18 18 18 13 13 13 13 13 13 13 13 13 13 37 | ch108 18 18 18 18 18 18 18 18 18 18 18 18 18 18 18 18 18 18 18 18 18 18 18 18 18 18 18 18 18 18 18 18 18 18 18 18 18 18 18 18 13 13 13 13 13 13 13 13 13 13 38 | ch110 18 18 18 18 18 18 18 18 18 18 18 18 18 18 18 18 18 18 18 18 18 18 18 18 18 18 18 18 18 18 18 18 18 18 18 18 18 18 18 18 13 13 13 13 13 13 13 13 13 13 39 | ch112 18 18 18 18 18 18 18 18 18 18 18 18 18 18 18 18 18 18 18 18 18 18 18 18 18 18 18 18 18 18 18 18 18 18 18 18 18 18 18 18 13 13 13 13 13 13 13 13 13 13 40 | ch116 18 18 18 18 18 18 18 18 18 18 18 18 18 18 18 18 18 18 18 18 18 18 18 18 18 18 18 18 18 18 18 18 18 18 18 18 18 18 18 18 18 18 18 18 18 18 18 18 18 18 41 | ch118 18 18 18 18 18 18 18 18 18 18 18 18 18 18 18 18 18 18 18 18 18 18 18 18 18 18 18 18 18 18 18 18 18 18 18 18 18 18 18 18 18 18 18 18 18 18 18 18 18 18 42 | ch120 18 18 18 18 18 18 18 18 18 18 18 18 18 18 18 18 18 18 18 18 18 18 18 18 18 18 18 18 18 18 18 18 18 18 18 18 18 18 18 18 18 18 18 18 18 18 18 18 18 18 43 | ch122 18 18 18 18 18 18 18 18 18 18 18 18 18 18 18 18 18 18 18 18 18 18 18 18 18 18 18 18 18 18 18 18 18 18 18 18 18 18 18 18 18 18 18 18 18 18 18 18 18 18 44 | ch124 18 18 18 18 18 18 18 18 18 18 18 18 18 18 18 18 18 18 18 18 18 18 18 18 18 18 18 18 18 18 18 18 18 18 18 18 18 18 18 18 18 18 18 18 18 18 18 18 18 18 45 | ch126 18 18 18 18 18 18 18 18 18 18 18 18 18 18 18 18 18 18 18 18 18 18 18 18 18 18 18 18 18 18 18 18 18 18 18 18 18 18 18 18 18 18 18 18 18 18 18 18 18 18 46 | ch128 18 18 18 18 18 18 18 18 18 18 18 18 18 18 18 18 18 18 18 18 18 18 18 18 18 18 18 18 18 18 18 18 18 18 18 18 18 18 18 18 18 18 18 18 18 18 18 18 18 18 47 | ch132 18 18 18 18 18 18 18 18 18 18 18 18 18 18 18 18 18 18 18 18 18 18 18 18 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 18 18 18 18 18 18 18 18 18 18 48 | ch134 18 18 18 18 18 18 18 18 18 18 18 18 18 18 18 18 18 18 18 18 18 18 18 18 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 18 18 18 18 18 18 18 18 18 18 49 | ch136 18 18 18 18 18 18 18 18 18 18 18 18 18 18 18 18 18 18 18 18 18 18 18 18 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 18 18 18 18 18 18 18 18 18 18 50 | ch140 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 18 18 18 18 18 18 18 18 18 18 18 18 18 18 18 18 18 18 18 18 18 18 18 18 18 18 51 | ch149 21 21 21 21 19 19 19 19 21 21 21 21 19 19 19 19 21 21 21 21 19 19 19 19 21 21 21 21 19 19 19 19 21 21 21 21 19 19 19 19 21 21 21 21 19 19 19 19 17 17 52 | ch151 21 21 21 21 19 19 19 19 21 21 21 21 19 19 19 19 21 21 21 21 19 19 19 19 21 21 21 21 19 19 19 19 21 21 21 21 19 19 19 19 21 21 21 21 19 19 19 19 17 17 53 | ch153 21 21 21 21 19 19 19 19 21 21 21 21 19 19 19 19 21 21 21 21 19 19 19 19 21 21 21 21 19 19 19 19 21 21 21 21 19 19 19 19 21 21 21 21 19 19 19 19 17 17 54 | ch155 21 21 21 21 19 19 19 19 21 21 21 21 19 19 19 19 21 21 21 21 19 19 19 19 21 21 21 21 19 19 19 19 21 21 21 21 19 19 19 19 21 21 21 21 19 19 19 19 17 17 55 | ch157 21 21 21 21 19 19 19 19 21 21 21 21 19 19 19 19 21 21 21 21 19 19 19 19 21 21 21 21 19 19 19 19 21 21 21 21 19 19 19 19 21 21 21 21 19 19 19 19 17 17 56 | ch159 21 21 21 21 19 19 19 19 21 21 21 21 19 19 19 19 21 21 21 21 19 19 19 19 21 21 21 21 19 19 19 19 21 21 21 21 19 19 19 19 21 21 21 21 19 19 19 19 17 17 57 | ch161 21 21 21 21 19 19 19 19 21 21 21 21 19 19 19 19 21 21 21 21 19 19 19 19 21 21 21 21 19 19 19 19 21 21 21 21 19 19 19 19 21 21 21 21 19 19 19 19 17 17 58 | ch165 21 21 21 21 19 19 19 19 21 21 21 21 19 19 19 19 21 21 21 21 19 19 19 19 21 21 21 21 19 19 19 19 21 21 21 21 19 19 19 19 21 21 21 21 19 19 19 19 17 17 59 | ch169 21 21 21 21 19 19 19 19 21 21 21 21 19 19 19 19 21 21 21 21 19 19 19 19 21 21 21 21 19 19 19 19 21 21 21 21 19 19 19 19 21 21 21 21 19 19 19 19 17 17 60 | ch173 21 21 21 21 19 19 19 19 21 21 21 21 19 19 19 19 21 21 21 21 19 19 19 19 21 21 21 21 19 19 19 19 21 21 21 21 19 19 19 19 21 21 21 21 19 19 19 19 17 17 61 | 62 | 63 | -------------------------------------------------------------------------------- /packages/ralink/drivers/mt7620/files/mt7620.dat: -------------------------------------------------------------------------------- 1 | #The word of "Default" must not be removed 2 | Default 3 | CountryRegion=1 4 | CountryRegionABand=0 5 | CountryCode= 6 | BssidNum=1 7 | SSID1=OpenWrt-MT7620 8 | SSID2= 9 | SSID3= 10 | SSID4= 11 | WirelessMode=9 12 | TxRate=0 13 | Channel=6 14 | BasicRate=15 15 | BeaconPeriod=100 16 | DtimPeriod=1 17 | TxPower=100 18 | DisableOLBC=0 19 | BGProtection=0 20 | MaxStaNum=0 21 | TxPreamble=0 22 | RTSThreshold=2347 23 | FragThreshold=2346 24 | TxBurst=1 25 | PktAggregate=0 26 | TurboRate=0 27 | WmmCapable=1 28 | APSDCapable=1 29 | DLSCapable=0 30 | APAifsn=3;7;1;1 31 | APCwmin=4;4;3;2 32 | APCwmax=6;10;4;3 33 | APTxop=0;0;94;47 34 | APACM=0;0;0;0 35 | BSSAifsn=3;7;2;2 36 | BSSCwmin=4;4;3;2 37 | BSSCwmax=10;10;4;3 38 | BSSTxop=0;0;94;47 39 | BSSACM=0;0;0;0 40 | AckPolicy=0;0;0;0 41 | NoForwarding=0 42 | NoForwardingBTNBSSID=0 43 | HideSSID=0 44 | StationKeepAlive=0 45 | ShortSlot=1 46 | AutoChannelSelect=0 47 | IEEE8021X=0 48 | IEEE80211H=0 49 | CSPeriod=10 50 | WirelessEvent=0 51 | IdsEnable=0 52 | AuthFloodThreshold=32 53 | AssocReqFloodThreshold=32 54 | ReassocReqFloodThreshold=32 55 | ProbeReqFloodThreshold=32 56 | DisassocFloodThreshold=32 57 | DeauthFloodThreshold=32 58 | EapReqFooldThreshold=32 59 | PreAuth=0 60 | AuthMode=OPEN 61 | EncrypType=NONE 62 | RekeyInterval=0 63 | RekeyMethod=DISABLE 64 | PMKCachePeriod=10 65 | WPAPSK1= 66 | WPAPSK2= 67 | WPAPSK3= 68 | WPAPSK4= 69 | DefaultKeyID=1 70 | Key1Type=1;1;1;1 71 | Key1Str1= 72 | Key1Str2= 73 | Key1Str3= 74 | Key1Str4= 75 | Key2Type=1;1;1;1 76 | Key2Str1= 77 | Key2Str2= 78 | Key2Str3= 79 | Key2Str4= 80 | Key3Type=1;1;1;1 81 | Key3Str1= 82 | Key3Str2= 83 | Key3Str3= 84 | Key3Str4= 85 | Key4Type=1;1;1;1 86 | Key4Str1= 87 | Key4Str2= 88 | Key4Str3= 89 | Key4Str4= 90 | HSCounter=0 91 | AccessPolicy0=0 92 | AccessControlList0= 93 | AccessPolicy1=0 94 | AccessControlList1= 95 | AccessPolicy2=0 96 | AccessControlList2= 97 | AccessPolicy3=0 98 | AccessControlList3= 99 | WdsEnable=0 100 | WdsEncrypType=NONE 101 | WdsList=EOF 102 | WdsKey= 103 | RADIUS_Server=192.168.2.3 104 | RADIUS_Port=1812 105 | RADIUS_Key=ralink 106 | own_ip_addr=192.168.5.234 107 | EAPifname=br-lan 108 | PreAuthifname=br-lan 109 | HT_HTC=0 110 | HT_RDG=0 111 | HT_EXTCHA=0 112 | HT_LinkAdapt=0 113 | HT_OpMode=0 114 | HT_MpduDensity=5 115 | HT_BW=1 116 | HT_AutoBA=1 117 | HT_AMSDU=0 118 | HT_BAWinSize=64 119 | HT_GI=1 120 | HT_MCS=33 121 | 122 | # WPS stuff 123 | # 1 = enrollee, 2 = proxy, 4 = registrar (bitmask) 124 | # This value is enabled later on, for WPA only 125 | WscConfMode=0 126 | # 1 = disabled, 2 = enabled 127 | WscConfStatus=2 128 | # 2 = PBC, 1 = PIN 129 | WscMode = 2 130 | 131 | HT_TxStream=2 132 | HT_RxStream=2 133 | -------------------------------------------------------------------------------- /packages/ralink/drivers/mt7620/files/mt7620.eeprom.epa.elna.bin: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/rssnsj/openwrt-hc5x61/883bf60357694dc9a397a90dd9c3b3aeaa118762/packages/ralink/drivers/mt7620/files/mt7620.eeprom.epa.elna.bin -------------------------------------------------------------------------------- /packages/ralink/drivers/mt7620/files/mt7620.eeprom.ipa.elna.bin: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/rssnsj/openwrt-hc5x61/883bf60357694dc9a397a90dd9c3b3aeaa118762/packages/ralink/drivers/mt7620/files/mt7620.eeprom.ipa.elna.bin -------------------------------------------------------------------------------- /packages/ralink/drivers/mt7620/files/mt7620.eeprom.ipa.ilna.bin: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/rssnsj/openwrt-hc5x61/883bf60357694dc9a397a90dd9c3b3aeaa118762/packages/ralink/drivers/mt7620/files/mt7620.eeprom.ipa.ilna.bin -------------------------------------------------------------------------------- /packages/ralink/drivers/mt7620/files/mt7620.sh: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | append DRIVERS "mt7620" 3 | 4 | . /lib/wifi/ralink_common.sh 5 | 6 | prepare_mt7620() { 7 | prepare_ralink_wifi mt7620 8 | } 9 | 10 | scan_mt7620() { 11 | scan_ralink_wifi mt7620 mt7620 12 | } 13 | 14 | 15 | disable_mt7620() { 16 | disable_ralink_wifi mt7620 17 | } 18 | 19 | enable_mt7620() { 20 | enable_ralink_wifi mt7620 mt7620 21 | } 22 | 23 | detect_mt7620() { 24 | # detect_ralink_wifi mt7620 mt7620 25 | ssid=mt7620-`ifconfig eth0 | grep HWaddr | cut -c 51- | sed 's/://g'` 26 | cd /sys/module/ 27 | [ -d $module ] || return 28 | [ -e /etc/config/wireless ] && return 29 | cat <OS_Cookie; 10 | +#ifdef WORKQUEUE_BH 11 | + RTMP_OS_TASKLET_SCHE(&pObj->pretbtt_work); 12 | +#else 13 | + RTMP_OS_TASKLET_SCHE(&pObj->pretbtt_task); 14 | +#endif 15 | + 16 | +#if 0 17 | RTMP_IO_WRITE32(pAd, MCU_INT_STATUS, 0x14); 18 | pAd->MacTab.fMcastPsQEnable = FALSE; 19 | 20 | @@ -1222,6 +1230,7 @@ VOID RTMPHandlePreTBTTInterrupt( 21 | pAd->MacTab.fMcastPsQEnable = TRUE; 22 | } 23 | } 24 | +#endif 25 | } 26 | else 27 | #endif /* CONFIG_AP_SUPPORT */ 28 | Index: mt7620-p4rev-113050/src/include/os/rt_drv.h 29 | =================================================================== 30 | --- mt7620-p4rev-113050.orig/src/include/os/rt_drv.h 31 | +++ mt7620-p4rev-113050/src/include/os/rt_drv.h 32 | @@ -337,6 +337,7 @@ struct os_cookie { 33 | RTMP_NET_TASK_STRUCT hcca_dma_done_work; 34 | 35 | RTMP_NET_TASK_STRUCT tbtt_work; 36 | + RTMP_NET_TASK_STRUCT pretbtt_work; 37 | 38 | #else 39 | RTMP_NET_TASK_STRUCT rx_done_task; 40 | @@ -350,6 +351,7 @@ struct os_cookie { 41 | RTMP_NET_TASK_STRUCT ac3_dma_done_task; 42 | RTMP_NET_TASK_STRUCT hcca_dma_done_task; 43 | RTMP_NET_TASK_STRUCT tbtt_task; 44 | + RTMP_NET_TASK_STRUCT pretbtt_task; 45 | #endif /* WORKQUEUE_BH */ 46 | 47 | #ifdef RTMP_MAC_PCI 48 | Index: mt7620-p4rev-113050/src/include/os/rt_linux.h 49 | =================================================================== 50 | --- mt7620-p4rev-113050.orig/src/include/os/rt_linux.h 51 | +++ mt7620-p4rev-113050/src/include/os/rt_linux.h 52 | @@ -664,6 +664,7 @@ struct os_cookie { 53 | struct work_struct hcca_dma_done_work; 54 | 55 | struct work_struct tbtt_work; 56 | + struct work_struct pretbtt_work; 57 | 58 | #else 59 | RTMP_NET_TASK_STRUCT rx_done_task; 60 | @@ -677,6 +678,7 @@ struct os_cookie { 61 | RTMP_NET_TASK_STRUCT ac3_dma_done_task; 62 | RTMP_NET_TASK_STRUCT hcca_dma_done_task; 63 | RTMP_NET_TASK_STRUCT tbtt_task; 64 | + RTMP_NET_TASK_STRUCT pretbtt_task; 65 | #endif /* WORKQUEUE_BH */ 66 | 67 | #ifdef RTMP_MAC_PCI 68 | Index: mt7620-p4rev-113050/src/include/rtmp.h 69 | =================================================================== 70 | --- mt7620-p4rev-113050.orig/src/include/rtmp.h 71 | +++ mt7620-p4rev-113050/src/include/rtmp.h 72 | @@ -9631,8 +9631,10 @@ VOID RtmpMgmtTaskExit( 73 | 74 | #ifdef WORKQUEUE_BH 75 | void tbtt_workq(struct work_struct *work); 76 | +void pretbtt_workq(struct work_struct *work); 77 | #else 78 | void tbtt_tasklet(unsigned long data); 79 | +void pretbtt_tasklet(unsigned long data); 80 | #endif /* WORKQUEUE_BH */ 81 | 82 | 83 | Index: mt7620-p4rev-113050/src/os/linux/rt_profile.c 84 | =================================================================== 85 | --- mt7620-p4rev-113050.orig/src/os/linux/rt_profile.c 86 | +++ mt7620-p4rev-113050/src/os/linux/rt_profile.c 87 | @@ -515,6 +515,96 @@ void tbtt_tasklet(unsigned long data) 88 | #endif /* CONFIG_AP_SUPPORT */ 89 | } 90 | 91 | +#ifdef WORKQUEUE_BH 92 | +void pretbtt_workq(struct work_struct *work) 93 | +#else 94 | +void pretbtt_tasklet(unsigned long data) 95 | +#endif /* WORKQUEUE_BH */ 96 | +{ 97 | +/*#define MAX_TX_IN_TBTT (16) */ 98 | + 99 | +#ifdef CONFIG_AP_SUPPORT 100 | +#ifdef WORKQUEUE_BH 101 | + POS_COOKIE pObj = container_of(work, struct os_cookie, pretbtt_work); 102 | + PRTMP_ADAPTER pAd = pObj->pAd_va; 103 | +#else 104 | + PRTMP_ADAPTER pAd = (PRTMP_ADAPTER) data; 105 | +#endif /* WORKQUEUE_BH */ 106 | + 107 | + RTMP_IO_WRITE32(pAd, MCU_INT_STATUS, 0x14); 108 | + pAd->MacTab.fMcastPsQEnable = FALSE; 109 | + 110 | + if ((pAd->ApCfg.DtimCount == 0) && 111 | + (pAd->MacTab.McastPsQueue.Head)) 112 | + { 113 | + UINT32 macValue; 114 | + PQUEUE_ENTRY pEntry; 115 | + BOOLEAN bPS = FALSE; 116 | + UINT count = 0; 117 | + unsigned long IrqFlags; 118 | + 119 | + RTMP_IO_READ32(pAd, PBF_CFG, &macValue); 120 | + macValue &= (~0x0C); 121 | + RTMP_IO_WRITE32(pAd, PBF_CFG, macValue); 122 | + 123 | + RTMP_IRQ_LOCK(&pAd->irq_lock, IrqFlags); 124 | + 125 | + while (pAd->MacTab.McastPsQueue.Head) 126 | + { 127 | + bPS = TRUE; 128 | +#if 0 129 | + if (pAd->TxSwQueue[QID_AC_BE].Number <= (MAX_PACKETS_IN_QUEUE + MAX_PACKETS_IN_MCAST_PS_QUEUE)) 130 | +#else 131 | + if (pAd->TxSwQueue[QID_HCCA].Number <= (MAX_PACKETS_IN_QUEUE + MAX_PACKETS_IN_MCAST_PS_QUEUE)) 132 | +#endif 133 | + { 134 | + pEntry = RemoveHeadQueue(&pAd->MacTab.McastPsQueue); 135 | + 136 | + if (count) 137 | + { 138 | + RTMP_SET_PACKET_MOREDATA(pEntry, TRUE); 139 | + } 140 | +#if 0 141 | + InsertHeadQueue(&pAd->TxSwQueue[QID_AC_BE], pEntry); 142 | +#else 143 | + InsertHeadQueue(&pAd->TxSwQueue[QID_HCCA], pEntry); 144 | +#endif 145 | + count++; 146 | + } 147 | + else 148 | + { 149 | + break; 150 | + } 151 | + } 152 | + 153 | + RTMP_IRQ_UNLOCK(&pAd->irq_lock, IrqFlags); 154 | + 155 | + if (pAd->MacTab.McastPsQueue.Number == 0) 156 | + { 157 | + UINT bss_index; 158 | + 159 | + /* clear MCAST/BCAST backlog bit for all BSS */ 160 | + for(bss_index=BSS0; bss_indexApCfg.BssidNum; bss_index++) 161 | + WLAN_MR_TIM_BCMC_CLEAR(bss_index); 162 | + /* End of for */ 163 | + } 164 | + pAd->MacTab.PsQIdleCount = 0; 165 | + 166 | + // Dequeue outgoing framea from TxSwQueue0..3 queue and process it 167 | + if (bPS == TRUE) 168 | + { 169 | + UINT32 macValue1, idx; 170 | +#if 0 171 | + RTMPDeQueuePacket(pAd, FALSE, NUM_OF_TX_RING, /*MAX_TX_IN_TBTT*/MAX_PACKETS_IN_MCAST_PS_QUEUE); 172 | +#else 173 | + RTMPDeQueuePacket(pAd, FALSE, QID_HCCA, /*MAX_TX_IN_TBTT*/MAX_PACKETS_IN_MCAST_PS_QUEUE); 174 | +#endif 175 | + pAd->MacTab.fMcastPsQEnable = TRUE; 176 | + } 177 | + } 178 | +#endif /* CONFIG_AP_SUPPORT */ 179 | +} 180 | + 181 | 182 | void announce_802_3_packet( 183 | IN VOID *pAdSrc, 184 | Index: mt7620-p4rev-113050/src/os/linux/rt_rbus_pci_drv.c 185 | =================================================================== 186 | --- mt7620-p4rev-113050.orig/src/os/linux/rt_rbus_pci_drv.c 187 | +++ mt7620-p4rev-113050/src/os/linux/rt_rbus_pci_drv.c 188 | @@ -93,6 +93,7 @@ NDIS_STATUS RtmpNetTaskInit(IN RTMP_ADAP 189 | RTMP_OS_TASKLET_INIT(pAd, &pObj->ac3_dma_done_work, ac3_dma_done_workq); 190 | RTMP_OS_TASKLET_INIT(pAd, &pObj->hcca_dma_done_work, hcca_dma_done_workq); 191 | RTMP_OS_TASKLET_INIT(pAd, &pObj->tbtt_work, tbtt_workq); 192 | + RTMP_OS_TASKLET_INIT(pAd, &pObj->pretbtt_work, pretbtt_workq); 193 | RTMP_OS_TASKLET_INIT(pAd, &pObj->fifo_statistic_full_work, fifo_statistic_full_workq); 194 | #ifdef UAPSD_SUPPORT 195 | RTMP_OS_TASKLET_INIT(pAd, &pObj->uapsd_eosp_sent_work, uapsd_eosp_sent_workq); 196 | @@ -121,6 +122,7 @@ NDIS_STATUS RtmpNetTaskInit(IN RTMP_ADAP 197 | RTMP_OS_TASKLET_INIT(pAd, &pObj->ac3_dma_done_task, ac3_dma_done_tasklet, (unsigned long)pAd); 198 | RTMP_OS_TASKLET_INIT(pAd, &pObj->hcca_dma_done_task, hcca_dma_done_tasklet, (unsigned long)pAd); 199 | RTMP_OS_TASKLET_INIT(pAd, &pObj->tbtt_task, tbtt_tasklet, (unsigned long)pAd); 200 | + RTMP_OS_TASKLET_INIT(pAd, &pObj->pretbtt_task, pretbtt_tasklet, (unsigned long)pAd); 201 | RTMP_OS_TASKLET_INIT(pAd, &pObj->fifo_statistic_full_task, fifo_statistic_full_tasklet, (unsigned long)pAd); 202 | #ifdef UAPSD_SUPPORT 203 | RTMP_OS_TASKLET_INIT(pAd, &pObj->uapsd_eosp_sent_task, uapsd_eosp_sent_tasklet, (unsigned long)pAd); 204 | @@ -160,6 +162,7 @@ void RtmpNetTaskExit(IN RTMP_ADAPTER *pA 205 | RTMP_OS_TASKLET_KILL(&pObj->ac3_dma_done_task); 206 | RTMP_OS_TASKLET_KILL(&pObj->hcca_dma_done_task); 207 | RTMP_OS_TASKLET_KILL(&pObj->tbtt_task); 208 | + RTMP_OS_TASKLET_KILL(&pObj->pretbtt_task); 209 | RTMP_OS_TASKLET_KILL(&pObj->fifo_statistic_full_task); 210 | #ifdef UAPSD_SUPPORT 211 | RTMP_OS_TASKLET_KILL(&pObj->uapsd_eosp_sent_task); 212 | -------------------------------------------------------------------------------- /packages/ralink/drivers/mt7620/patches/010-compile-standalone-mt7620.patch: -------------------------------------------------------------------------------- 1 | Index: src/os/linux/rt_rbus_pci_drv.c 2 | =================================================================== 3 | --- a/src/os/linux/rt_rbus_pci_drv.c (revision 272) 4 | +++ b/src/os/linux/rt_rbus_pci_drv.c (working copy) 5 | @@ -772,6 +772,12 @@ 6 | RTMP_INT_UNLOCK(&pAd->LockInterrupt, flags); 7 | } 8 | 9 | +#ifdef RALINK_ATE 10 | +static void ate_ac0_dma_done_tasklet(unsigned long data) 11 | +{ 12 | + return; 13 | +} 14 | +#endif // RALINK_ATE // 15 | 16 | 17 | #ifdef UAPSD_SUPPORT 18 | Index: src/os/linux/rt_flash.c 19 | =================================================================== 20 | --- a/src/os/linux/rt_flash.c (revision 0) 21 | +++ b/src/os/linux/rt_flash.c (revision 0) 22 | @@ -0,0 +1,132 @@ 23 | +#include 24 | +#include 25 | +#include 26 | +#include 27 | +#include 28 | +#include 29 | +#include 30 | +#include 31 | +#include 32 | +#include 33 | +#include 34 | +#include 35 | +#include 36 | +#include 37 | +#include 38 | +#include 39 | + 40 | +struct proc_dir_entry *procRegDir; 41 | +/* 42 | + * Flash API: ra_mtd_read, ra_mtd_write 43 | + * Arguments: 44 | + * - num: specific the mtd number 45 | + * - to/from: the offset to read from or written to 46 | + * - len: length 47 | + * - buf: data to be read/written 48 | + * Returns: 49 | + * - return -errno if failed 50 | + * - return the number of bytes read/written if successed 51 | + */ 52 | +int ra_mtd_write_nm(char *name, loff_t to, size_t len, const u_char *buf) 53 | +{ 54 | + int ret = -1; 55 | + size_t rdlen, wrlen; 56 | + struct mtd_info *mtd; 57 | + struct erase_info ei; 58 | + u_char *bak = NULL; 59 | + 60 | + mtd = get_mtd_device_nm(name); 61 | + 62 | + if (IS_ERR(mtd)) { 63 | + ret = (int)mtd; 64 | + goto out; 65 | + } 66 | + 67 | + if (len > mtd->erasesize) { 68 | + put_mtd_device(mtd); 69 | + ret = -E2BIG; 70 | + goto out; 71 | + } 72 | + 73 | + bak = kzalloc(mtd->erasesize, GFP_KERNEL); 74 | + if (bak == NULL) { 75 | + put_mtd_device(mtd); 76 | + ret = -ENOMEM; 77 | + goto out; 78 | + } 79 | + 80 | +#if LINUX_VERSION_CODE >= KERNEL_VERSION(3,3,0) 81 | + ret = mtd_read(mtd, 0, mtd->erasesize, &rdlen, bak); 82 | +#else 83 | + ret = mtd->read(mtd, 0, mtd->erasesize, &rdlen, bak); 84 | +#endif 85 | + if (ret) { 86 | + goto free_out; 87 | + } 88 | + 89 | + if (rdlen != mtd->erasesize) 90 | + printk("warning: ra_mtd_write_nm: rdlen is not equal to erasesize\n"); 91 | + 92 | + memcpy(bak + to, buf, len); 93 | + 94 | + ei.mtd = mtd; 95 | + ei.callback = NULL; 96 | + ei.addr = 0; 97 | + ei.len = mtd->erasesize; 98 | + ei.priv = 0; 99 | + 100 | +#if LINUX_VERSION_CODE >= KERNEL_VERSION(3,3,0) 101 | + ret = mtd_erase(mtd, &ei); 102 | +#else 103 | + ret = mtd->erase(mtd, &ei); 104 | +#endif 105 | + if (ret != 0) 106 | + goto free_out; 107 | + 108 | +#if LINUX_VERSION_CODE >= KERNEL_VERSION(3,3,0) 109 | + ret = mtd_write(mtd, 0, mtd->erasesize, &wrlen, bak); 110 | +#else 111 | + ret = mtd->write(mtd, 0, mtd->erasesize, &wrlen, bak); 112 | +#endif 113 | + 114 | + udelay(10); /* add delay after write */ 115 | + 116 | +free_out: 117 | + if (mtd) 118 | + put_mtd_device(mtd); 119 | + 120 | + if (bak) 121 | + kfree(bak); 122 | +out: 123 | + return ret; 124 | +} 125 | + 126 | +int ra_mtd_read_nm(char *name, loff_t from, size_t len, u_char *buf) 127 | +{ 128 | + int ret; 129 | + size_t rdlen = 0; 130 | + struct mtd_info *mtd; 131 | + 132 | + mtd = get_mtd_device_nm(name); 133 | + if (IS_ERR(mtd)) 134 | + return (int)mtd; 135 | + 136 | +#if LINUX_VERSION_CODE >= KERNEL_VERSION(3,3,0) 137 | + ret = mtd_read(mtd, from, len, &rdlen, buf); 138 | +#else 139 | + ret = mtd->read(mtd, from, len, &rdlen, buf); 140 | +#endif 141 | + if (rdlen != len) 142 | + printk("warning: ra_mtd_read_nm: rdlen is not equal to len\n"); 143 | + 144 | + put_mtd_device(mtd); 145 | + return ret; 146 | +} 147 | + 148 | +EXPORT_SYMBOL(ra_mtd_write_nm); 149 | +EXPORT_SYMBOL(ra_mtd_read_nm); 150 | +EXPORT_SYMBOL(procRegDir); 151 | + 152 | +MODULE_AUTHOR("Steven Liu "); 153 | +MODULE_DESCRIPTION("Ralink APSoC Flash Map"); 154 | +MODULE_LICENSE("GPL"); 155 | Index: src/os/linux/rt_linux.c 156 | =================================================================== 157 | --- a/src/os/linux/rt_linux.c (revision 272) 158 | +++ b/src/os/linux/rt_linux.c (working copy) 159 | @@ -321,7 +321,7 @@ 160 | #ifdef RA_MTD_RW_BY_NUM 161 | ra_mtd_read(MTD_NUM_FACTORY, 0, (size_t) b, p); 162 | #else 163 | - ra_mtd_read_nm("Factory", a&0xFFFF, (size_t) b, p); 164 | + ra_mtd_read_nm("factory", a&0xFFFF, (size_t) b, p); 165 | #endif 166 | #endif /* CONFIG_RALINK_FLASH_API */ 167 | } 168 | @@ -337,7 +337,7 @@ 169 | #ifdef RA_MTD_RW_BY_NUM 170 | ra_mtd_write(MTD_NUM_FACTORY, 0, (size_t) b, p); 171 | #else 172 | - ra_mtd_write_nm("Factory", a&0xFFFF, (size_t) b, p); 173 | + ra_mtd_write_nm("factory", a&0xFFFF, (size_t) b, p); 174 | #endif 175 | #endif /* CONFIG_RALINK_FLASH_API */ 176 | } 177 | Index: build/Makefile 178 | =================================================================== 179 | --- a/build/Makefile (revision 272) 180 | +++ b/build/Makefile (working copy) 181 | @@ -9,6 +9,7 @@ 182 | SRC_DIR = ../rt2860v2 183 | obj-$(CONFIG_RT2860V2_AP) += $(DRV_NAME).o 184 | endif 185 | +EXTRA_CFLAGS += -DPRE_ASSIGN_MAC_ADDR -DCONFIG_SUPPORT_OPENWRT 186 | 187 | 188 | $(DRV_NAME)-objs += $(SRC_DIR)/common/crypt_md5.o 189 | @@ -70,6 +71,7 @@ 190 | 191 | $(DRV_NAME)-objs += $(SRC_DIR)/os/linux/rt_proc.o 192 | $(DRV_NAME)-objs += $(SRC_DIR)/os/linux/rt_linux.o 193 | +$(DRV_NAME)-objs += $(SRC_DIR)/os/linux/rt_flash.o 194 | $(DRV_NAME)-objs += $(SRC_DIR)/os/linux/rt_profile.o 195 | $(DRV_NAME)-objs += $(SRC_DIR)/os/linux/rt_main_dev.o 196 | $(DRV_NAME)-objs += $(SRC_DIR)/os/linux/ap_ioctl.o 197 | -------------------------------------------------------------------------------- /packages/ralink/drivers/mt76x2e/Makefile: -------------------------------------------------------------------------------- 1 | # All rights reserved. 2 | # 3 | # This is free software, licensed under the GNU General Public License v2. 4 | # See /LICENSE for more information. 5 | 6 | include $(TOPDIR)/rules.mk 7 | include $(INCLUDE_DIR)/kernel.mk 8 | 9 | PKG_NAME:=mt76x2e 10 | PKG_REV:=5 11 | PKG_VERSION:=$(PKG_REV) 12 | PKG_RELEASE:=20150604 13 | 14 | PKG_SOURCE_PROTO:=svn 15 | PKG_SOURCE_VERSION:=$(PKG_REV) 16 | PKG_SOURCE_SUBDIR:=$(PKG_NAME)-$(PKG_VERSION) 17 | PKG_SOURCE_URL:=https://github.com/i80s/mtk-sources/trunk/mt76x2e 18 | PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.bz2 19 | 20 | PKG_BUILD_DIR:=$(KERNEL_BUILD_DIR)/$(PKG_NAME)-$(PKG_VERSION) 21 | 22 | PKG_KCONFIG:= \ 23 | RALINK_MT7612E RALINK_MT7620 RLT_AP_SUPPORT WDS_SUPPORT MBSS_SUPPORT ENHANCE_NEW_MBSSID_MODE \ 24 | APCLI_SUPPORT DFS_SUPPORT LLTD_SUPPORT NINTENDO_AP COC_SUPPORT \ 25 | DELAYED_TCP_ACK_SUPPORT RT_FIRST_CARD_EEPROM \ 26 | RT_FIRST_IF_RF_OFFSET RT_SECOND_IF_RF_OFFSET \ 27 | RT_FIRST_CARD RT_SECOND_CARD SNIFFER_SUPPORT CFG80211_SUPPORT \ 28 | RT_FIRST_CARD_EEPROM FIRST_IF_EEPROM_PROM FIRST_IF_EEPROM_EFUSE FIRST_IF_EEPROM_FLASH \ 29 | SECOND_IF_EEPROM_PROM SECOND_IF_EEPROM_EFUSE SECOND_IF_EEPROM_FLASH \ 30 | WIFI_BASIC_FUNC WSC_INCLUDED WSC_V2_SUPPORT WSC_NFC_SUPPORT DOT11N_DRAFT3 DOT11_VHT_AC \ 31 | DOT11W_PMF_SUPPORT TXBF_SUPPORT LLTD_SUPPORT QOS_DLS_SUPPORT \ 32 | CARRIER_DETECTION_SUPPORT IGMP_SNOOP_SUPPORT BLOCK_NET_IF \ 33 | TXBF_SUPPORT RATE_ADAPTION NEW_RATE_ADAPT_SUPPORT AGS_SUPPORT \ 34 | IDS_SUPPORT WIFI_WORK_QUEUE WIFI_SKB_RECYCLE RTMP_FLASH_SUPPORT \ 35 | LED_CONTROL_SUPPORT HW_ANTENNA_DIVERSITY ATE_SUPPORT \ 36 | RT2860V2_AP_V24_DATA_STRUCTURE RT2860V2_AP_32B_DESC MEMORY_OPTIMIZATION \ 37 | RTMP_INTERNAL_TX_ALC RTMP_TEMPERATURE_CALIBRATION HOTSPOT \ 38 | SINGLE_SKU_V2 RLT_MAC RLT_BBP RLT_RF RTMP_MAC RTMP_BBP RTMP_RF \ 39 | RTMP_PCI_SUPPORT RTMP_USB_SUPPORT RTMP_RBUS_SUPPORT DISABLE_EDCCA MULTI_CORE_SUPPORT 40 | 41 | PKG_CONFIG_DEPENDS:=$(foreach c, $(PKG_KCONFIG),$(if $(CONFIG_$c),CONFIG_$(c))) 42 | 43 | include $(INCLUDE_DIR)/package.mk 44 | 45 | define KernelPackage/mt76x2e 46 | CATEGORY:=Ralink Properties 47 | TITLE:=Ralink mt76x2e wifi AP driver 48 | FILES:=$(PKG_BUILD_DIR)/build/mt76x2e.ko 49 | DEPENDS:=+kmod-cfg80211 +uci2dat +8021xd 50 | AUTOLOAD:=$(call AutoLoad,91,mt76x2e) 51 | SUBMENU:=Drivers 52 | MENU:=1 53 | endef 54 | 55 | define KernelPackage/mt76x2e/config 56 | source "$(SOURCE)/config.in" 57 | endef 58 | 59 | define P4/Info 60 | P4URL:=//Embedded_WIFI/MP/MT76x2/MT7612e/AP/rlt_wifi/ 61 | endef 62 | 63 | define P4/Release 64 | make release 65 | mkdir -p build 66 | cp os/linux/Makefile.rlt_wifi_ap build/Makefile 67 | cp os/linux/Kconfig.rlt_wifi_ap build/Kconfig 68 | mv DPA src 69 | tar cjf mt76x2e.tar.bz2 build src 70 | endef 71 | 72 | define Build/Compile 73 | $(MAKE) -C "$(LINUX_DIR)" \ 74 | CROSS_COMPILE="$(TARGET_CROSS)" \ 75 | ARCH="$(LINUX_KARCH)" \ 76 | SUBDIRS="$(PKG_BUILD_DIR)/build/" \ 77 | $(foreach c, $(PKG_KCONFIG),$(if $(CONFIG_MT76X2E_$c),CONFIG_$(c)=$(CONFIG_MT76X2E_$c)))\ 78 | CONFIG_SUPPORT_OPENWRT=y \ 79 | modules 80 | endef 81 | 82 | define KernelPackage/mt76x2e/install 83 | $(INSTALL_DIR) $(1)/lib/wifi/ 84 | echo ------------------------------------------------------------------- $(CONFIG_RT_SECOND_CARD) 85 | # if [ "$$(CONFIG_MT76X2E_RT_FIRST_CARD)" = "7602" ] || [ "$$(CONFIG_MT76X2E_RT_FIRST_CARD)" = "7602e" ]; then \ 86 | # $(INSTALL_DIR) $(1)/etc/wireless/mt7602e/ ; \ 87 | # $(INSTALL_BIN) ./files/mt7602e.sh $(1)/lib/wifi/ ; \ 88 | # $(INSTALL_BIN) ./files/mt7602e.dat $(1)/etc/wireless/mt7602e/ ; \ 89 | # $(INSTALL_BIN) ./files/mt7602e*.bin $(1)/etc/wireless/mt7602e/ ; \ 90 | # $(INSTALL_BIN) ./files/SingleSKU.dat $(1)/etc/wireless/mt7602/SingleSKU.dat ; \ 91 | # echo p$(P4REV) > $(1)/etc/wireless/mt7602e/version; \ 92 | # fi 93 | if [ "$$(CONFIG_MT76X2E_RT_SECOND_CARD)" = "7612" ] || [ "$$(CONFIG_MT76X2E_RT_SECOND_CARD)" = "7612e" ]; then \ 94 | $(INSTALL_DIR) $(1)/etc/wireless/mt7612e/ ; \ 95 | $(INSTALL_BIN) ./files/mt7612e.sh $(1)/lib/wifi/ ; \ 96 | $(INSTALL_BIN) ./files/ralink_common.sh $(1)/lib/wifi/ ; \ 97 | $(INSTALL_BIN) ./files/mt7612e.dat $(1)/etc/wireless/mt7612e/ ; \ 98 | $(INSTALL_BIN) ./files/mt7612e*.bin $(1)/etc/wireless/mt7612e/ ; \ 99 | $(INSTALL_BIN) ./files/SingleSKU.dat $(1)/etc/wireless/mt7612/SingleSKU.dat ; \ 100 | echo p$(P4REV) > $(1)/etc/wireless/mt7612e/version; \ 101 | fi 102 | endef 103 | 104 | $(eval $(call KernelPackage,mt76x2e)) 105 | -------------------------------------------------------------------------------- /packages/ralink/drivers/mt76x2e/config.in: -------------------------------------------------------------------------------- 1 | if PACKAGE_kmod-mt76x2e 2 | 3 | config MT76X2E_RT_FIRST_CARD 4 | int 5 | default 7602 6 | depends on ! PACKAGE_kmod-mt7620 7 | depends on ! PACKAGE_kmod-mt7628 8 | depends on ! PACKAGE_kmod-mt7603e 9 | 10 | config MT76X2E_RT_SECOND_CARD 11 | int 12 | default 7612 13 | depends on PACKAGE_kmod-mt76x2e 14 | 15 | config MT76X2E_WIFI_MODE_AP 16 | bool 17 | default y 18 | 19 | config MT76X2E_RT_FIRST_IF_RF_OFFSET 20 | int 21 | default 262144 22 | 23 | config MT76X2E_RT_SECOND_IF_RF_OFFSET 24 | int 25 | default 294912 26 | 27 | config MT76X2E_RALINK_MT7612E 28 | bool 29 | default y 30 | 31 | menu "AP Features" 32 | depends on MT76X2E_WIFI_MODE_AP 33 | 34 | config MT76X2E_RLT_AP_SUPPORT 35 | tristate "Ralink RT2860 802.11n AP support" 36 | # depends on NET_RADIO 37 | select WIRELESS_EXT 38 | select WEXT_SPY 39 | select WEXT_PRIV 40 | default y 41 | 42 | config MT76X2E_WDS_SUPPORT 43 | bool "WDS" 44 | depends on MT76X2E_RLT_AP_SUPPORT 45 | 46 | config MT76X2E_SNIFFER_SUPPORT 47 | bool "Sniffer Support" 48 | depends on MT76X2E_RLT_AP_SUPPORT 49 | default n 50 | 51 | config MT76X2E_CFG80211_SUPPORT 52 | bool "CFG80211 Support" 53 | depends on MT76X2E_RLT_AP_SUPPORT 54 | default n 55 | 56 | config MT76X2E_MBSS_SUPPORT 57 | bool "MBSSID" 58 | depends on MT76X2E_RLT_AP_SUPPORT 59 | default y 60 | 61 | config MT76X2E_NEW_MBSSID_MODE 62 | bool "New MBSSID MODE" 63 | depends on MT76X2E_RLT_AP_SUPPORT && MT76X2E_WMBSS_SUPPORT 64 | depends on RALINK_RT3883 || RALINK_RT3352 || RALINK_RT5350 || RALINK_RT6352 || RALINK_MT7620 65 | default y 66 | 67 | config MT76X2E_ENHANCE_NEW_MBSSID_MODE 68 | bool "Enhanced MBSSID mode" 69 | depends on MT76X2E_WNEW_MBSSID_MODE 70 | default y 71 | 72 | config MT76X2E_APCLI_SUPPORT 73 | bool "AP-Client Support" 74 | depends on MT76X2E_RLT_AP_SUPPORT 75 | default y 76 | 77 | config MT76X2E_MAC_REPEATER_SUPPORT 78 | bool "MAC Repeater Support" 79 | depends on MT76X2E_RLT_AP_SUPPORT 80 | depends on MT76X2E_WAPCLI_SUPPORT 81 | depends on RALINK_RT6352 || RALINK_MT7620 82 | default y 83 | 84 | #config MT76X2E_MESH_SUPPORT 85 | # bool "MESH Support" 86 | # depends on MT76X2E_RLT_AP_SUPPORT 87 | 88 | config MT76X2E_DFS_SUPPORT 89 | bool "DFS" 90 | depends on MT76X2E_RLT_AP_SUPPORT 91 | select RALINK_TIMER_DFS 92 | 93 | #config MT76X2E_DOT11R_FT_SUPPORT 94 | # bool "802.11r Fast BSS Transition" 95 | # depends on MT76X2E_RLT_AP_SUPPORT 96 | 97 | #config MT76X2E_DOT11K_RRM_SUPPORT 98 | # bool "802.11k Radio Resource Management" 99 | # depends on MT76X2E_RLT_AP_SUPPORT 100 | 101 | config MT76X2E_LLTD_SUPPORT 102 | bool "LLTD (Link Layer Topology Discovery Protocol)" 103 | depends on MT76X2E_RLT_AP_SUPPORT 104 | 105 | config MT76X2E_NINTENDO_AP 106 | bool "Nintendo AP" 107 | depends on MT76X2E_RLT_AP_SUPPORT 108 | 109 | config MT76X2E_COC_SUPPORT 110 | bool "CoC Support" 111 | depends on MT76X2E_RLT_AP_SUPPORT 112 | default n 113 | 114 | config MT76X2E_DELAYED_TCP_ACK_SUPPORT 115 | bool "Delayed TCP ACK Support" 116 | depends on MT76X2E_RLT_AP_SUPPORT 117 | default n 118 | 119 | #config MT76X2E_ RT2860V2_SNMP 120 | # bool "Net-SNMP Support" 121 | # depends on MT76X2E_RLT_AP_SUPPORT 122 | 123 | #config MT76X2E_MCAST_RATE_SPECIFIC 124 | # bool "User specific tx rate of mcast pkt" 125 | # depends on MT76X2E_RLT_AP_SUPPORT 126 | 127 | #config MT76X2E_EXT_BUILD_CHANNEL_LIST 128 | # bool "Extension Channel List" 129 | # depends on MT76X2E_RLT_AP_SUPPORT 130 | 131 | #config MT76X2E_AUTO_CH_SELECT_ENHANCE 132 | # bool "Auto Channel Selection Enhancement" 133 | # depends on MT76X2E_RLT_AP_SUPPORT 134 | 135 | config MT76X2E_DISABLE_EDCCA 136 | bool "Disable EDCCA" 137 | depends on MT76X2E_RLT_AP_SUPPORT 138 | default n 139 | 140 | config MT76X2E_MULTI_CORE_SUPPORT 141 | bool "multi core support" 142 | depends on TARGET_ramips_mt7621 143 | default y 144 | endmenu 145 | 146 | menu "WiFi Features" 147 | 148 | config MT76X2E_FIRST_IF_EEPROM_FLASH 149 | bool 150 | default y 151 | 152 | config MT76X2E_SECOND_IF_EEPROM_FLASH 153 | bool 154 | default y 155 | 156 | config MT76X2E_RT_FIRST_CARD_EEPROM 157 | string 158 | default "flash" 159 | 160 | config MT76X2E_RT_SECOND_CARD_EEPROM 161 | string 162 | default "flash" 163 | 164 | config MT76X2E_MULTI_INF_SUPPORT 165 | bool 166 | #default y if !MT76X2E_WFIRST_IF_NONE && !MT76X2E_WSECOND_IF_NONE 167 | 168 | config MT76X2E_WIFI_BASIC_FUNC 169 | bool "Basic Functions" 170 | select WIRELESS_EXT 171 | select WEXT_SPY 172 | select WEXT_PRIV 173 | default y 174 | 175 | config MT76X2E_WSC_INCLUDED 176 | bool "WSC (WiFi Simple Config)" 177 | default y 178 | 179 | config MT76X2E_WSC_V2_SUPPORT 180 | bool "WSC V2(WiFi Simple Config Version 2.0)" 181 | default y 182 | depends on MT76X2E_WWSC_INCLUDED 183 | 184 | config MT76X2E_WSC_NFC_SUPPORT 185 | bool "WSC by NFC" 186 | default n 187 | depends on MT76X2E_WWSC_INCLUDED 188 | 189 | config MT76X2E_DOT11N_DRAFT3 190 | bool "802.11n Draft3" 191 | default y 192 | 193 | config MT76X2E_DOT11_VHT_AC 194 | bool "802.11 ac" 195 | default y 196 | 197 | config MT76X2E_DOT11W_PMF_SUPPORT 198 | bool "PMF" 199 | default n 200 | 201 | config MT76X2E_TXBF_SUPPORT 202 | bool "Tx Bean Forming Support" 203 | default n 204 | 205 | #config MT76X2E_WMM_ACM_SUPPORT 206 | # bool "WMM ACM" 207 | # default n 208 | 209 | config MT76X2E_LLTD_SUPPORT 210 | bool "LLTD (Link Layer Topology Discovery Protocol)" 211 | default y 212 | 213 | config MT76X2E_QOS_DLS_SUPPORT 214 | bool "802.11e DLS ((Direct-Link Setup) Support" 215 | default n 216 | 217 | #config MT76X2E_WAPI_SUPPORT 218 | # bool "WAPI Support" 219 | # default n 220 | 221 | config MT76X2E_CARRIER_DETECTION_SUPPORT 222 | bool "Carrier Detect" 223 | default n 224 | 225 | config MT76X2E_IGMP_SNOOP_SUPPORT 226 | bool "IGMP snooping" 227 | default n 228 | 229 | config MT76X2E_BLOCK_NET_IF 230 | bool "NETIF Block" 231 | default n 232 | help 233 | Support Net interface block while Tx-Sw queue full 234 | 235 | config MT76X2E_TXBF_SUPPORT 236 | bool "Tx Bean Forming Support (Only 3883)" 237 | depends on RALINK_RT2883 || RALINK_RT3883 238 | default n 239 | 240 | #config MT76X2E_VIDEO_TURBINE_SUPPORT 241 | # bool "Video Turbine support" 242 | # default n 243 | 244 | #config MT76X2E_RA_CLASSIFIER 245 | # tristate "Ralink Flow Classifier" 246 | # default n 247 | 248 | config MT76X2E_RATE_ADAPTION 249 | bool "New Rate Adaptation support" 250 | default y 251 | 252 | config MT76X2E_NEW_RATE_ADAPT_SUPPORT 253 | bool "Intelligent Rate Adaption" 254 | default y 255 | 256 | config MT76X2E_AGS_SUPPORT 257 | bool "Adaptive Group Switching" 258 | default n 259 | 260 | config MT76X2E_IDS_SUPPORT 261 | bool "IDS (Intrusion Detection System) Support" 262 | default n 263 | 264 | config MT76X2E_WIFI_WORK_QUEUE 265 | bool "Work Queue" 266 | default n 267 | 268 | config MT76X2E_WIFI_SKB_RECYCLE 269 | bool "SKB Recycle(Linux)" 270 | default y 271 | 272 | config MT76X2E_RTMP_FLASH_SUPPORT 273 | bool "Flash Support" 274 | default y 275 | 276 | config MT76X2E_LED_CONTROL_SUPPORT 277 | bool "LED Support" 278 | default n 279 | 280 | #config MT76X2E_SINGLE_SKU 281 | # bool "Single SKU" 282 | # default n 283 | 284 | #config MT76X2E_SINGLE_SKU_V2 285 | # bool "Single SKU V2" 286 | # depends on MT76X2E_WSINGLE_SKU && RALINK_RT6352 287 | # default n 288 | 289 | config MT76X2E_HW_ANTENNA_DIVERSITY 290 | bool "Antenna Diversity Support" 291 | depends on MT76X2E_RLT_AP_SUPPORT || MT76X2E_WRLT_STA_SUPPORT 292 | depends on RALINK_RT5350 293 | default n 294 | 295 | config MT76X2E_ATE_SUPPORT 296 | bool "ATE/QA Support" 297 | default y 298 | 299 | config MT76X2E_RT2860V2_AP_V24_DATA_STRUCTURE 300 | bool 301 | default y 302 | 303 | config MT76X2E_RT2860V2_AP_32B_DESC 304 | bool "32 Byte Descriptor Support" 305 | depends on RALINK_RT6352 || RALINK_MT7620 306 | default n 307 | 308 | config MT76X2E_MEMORY_OPTIMIZATION 309 | bool "Memory Optimization" 310 | default n 311 | 312 | config MT76X2E_RTMP_INTERNAL_TX_ALC 313 | bool "TSSI Compensation" 314 | depends on RALINK_RT3350 || RALINK_RT3352 || RALINK_RT5350 || RALINK_RT6352 315 | default n 316 | 317 | config MT76X2E_RTMP_TEMPERATURE_CALIBRATION 318 | bool "Temperature Calibration" 319 | depends on RALINK_RT6352 320 | default n 321 | 322 | config MT76X2E_HOTSPOT 323 | bool "Passpoint-R1" 324 | default n 325 | 326 | config MT76X2E_SINGLE_SKU_V2 327 | bool "Single SKU V2" 328 | default n 329 | 330 | # 331 | # Section for chip architectures 332 | # 333 | # "RLT MAC Support" 334 | config MT76X2E_RLT_MAC 335 | bool 336 | default y 337 | 338 | config MT76X2E_RLT_BBP 339 | bool 340 | 341 | config MT76X2E_RLT_RF 342 | bool 343 | 344 | # "RTMP MAC Support" 345 | #config MT76X2E_RTMP_MAC 346 | # bool 347 | # default y 348 | # 349 | #config MT76X2E_RTMP_BBP 350 | # bool 351 | # 352 | #config MT76X2E_RTMP_RF 353 | # bool 354 | 355 | # 356 | # Section for interfaces 357 | # 358 | config MT76X2E_RTMP_PCI_SUPPORT 359 | bool 360 | 361 | config MT76X2E_RTMP_USB_SUPPORT 362 | bool 363 | 364 | config MT76X2E_RTMP_RBUS_SUPPORT 365 | bool 366 | 367 | endmenu 368 | 369 | endif 370 | 371 | -------------------------------------------------------------------------------- /packages/ralink/drivers/mt76x2e/files/SingleSKU.dat: -------------------------------------------------------------------------------- 1 | # Single SKU Max Power Table 2 | # |CCK 1~11 | | OFDM 6 ~ 54 | | HT20 MCS 0 ~ 15 | | HT40 MCS 0 ~ 15 | 3 | ch1 16 16 16 16 14 14 14 14 14 14 14 14 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 4 | ch2 18 18 18 18 16 16 16 16 16 16 16 16 16 16 16 16 16 16 16 16 16 16 16 16 16 16 16 16 5 | ch3 18 18 18 18 16 16 16 16 16 16 16 16 16 16 16 16 16 16 16 16 16 16 16 16 16 16 16 16 12 12 12 12 12 12 12 12 12 12 12 12 12 12 12 12 6 | ch4 18 18 18 18 16 16 16 16 16 16 16 16 16 16 16 16 16 16 16 16 16 16 16 16 16 16 16 16 16 16 16 16 16 16 16 16 16 16 16 16 16 16 16 16 7 | ch5 18 18 18 18 16 16 16 16 16 16 16 16 16 16 16 16 16 16 16 16 16 16 16 16 16 16 16 16 16 16 16 16 16 16 16 16 16 16 16 16 16 16 16 16 8 | ch6 18 18 18 18 16 16 16 16 16 16 16 16 16 16 16 16 16 16 16 16 16 16 16 16 16 16 16 16 16 16 16 16 16 16 16 16 16 16 16 16 16 16 16 16 9 | ch7 18 18 18 18 16 16 16 16 16 16 16 16 16 16 16 16 16 16 16 16 16 16 16 16 16 16 16 16 16 16 16 16 16 16 16 16 16 16 16 16 16 16 16 16 10 | ch8 18 18 18 18 16 16 16 16 16 16 16 16 16 16 16 16 16 16 16 16 16 16 16 16 16 16 16 16 16 16 16 16 16 16 16 16 16 16 16 16 16 16 16 16 11 | ch9 18 18 18 18 16 16 16 16 16 16 16 16 16 16 16 16 16 16 16 16 16 16 16 16 16 16 16 16 12 12 12 12 12 12 12 12 12 12 12 12 12 12 12 12 12 | ch10 18 18 18 18 16 16 16 16 16 16 16 16 16 16 16 16 16 16 16 16 16 16 16 16 16 16 16 16 13 | ch11 16 16 16 16 14 14 14 14 14 14 14 14 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 14 | ch12 15 | ch13 16 | ch14 17 | 18 | # OFDM 6 ~ 54 | | HT20 MCS 0 ~ 15 | | HT40 MCS 0 ~ 15 | | VHT80 MCS 0 ~ 9 | 19 | ch36 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 20 | ch38 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 21 | ch40 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 22 | ch42 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 23 | ch44 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 24 | ch46 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 25 | ch48 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 26 | ch52 15 15 15 15 15 15 15 15 15 15 15 15 15 15 15 15 15 15 15 15 15 15 15 15 15 15 15 15 15 15 15 15 15 15 15 15 15 15 15 15 13 13 13 13 13 13 13 13 13 13 27 | ch54 15 15 15 15 15 15 15 15 15 15 15 15 15 15 15 15 15 15 15 15 15 15 15 15 15 15 15 15 15 15 15 15 15 15 15 15 15 15 15 15 13 13 13 13 13 13 13 13 13 13 28 | ch56 15 15 15 15 15 15 15 15 15 15 15 15 15 15 15 15 15 15 15 15 15 15 15 15 15 15 15 15 15 15 15 15 15 15 15 15 15 15 15 15 13 13 13 13 13 13 13 13 13 13 29 | ch58 15 15 15 15 15 15 15 15 15 15 15 15 15 15 15 15 15 15 15 15 15 15 15 15 15 15 15 15 15 15 15 15 15 15 15 15 15 15 15 15 13 13 13 13 13 13 13 13 13 13 30 | ch60 15 15 15 15 15 15 15 15 15 15 15 15 15 15 15 15 15 15 15 15 15 15 15 15 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 31 | ch62 15 15 15 15 15 15 15 15 15 15 15 15 15 15 15 15 15 15 15 15 15 15 15 15 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 32 | ch64 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 33 | ch100 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 34 | ch102 18 18 18 18 18 18 18 18 18 18 18 18 18 18 18 18 18 18 18 18 18 18 18 18 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 35 | ch104 18 18 18 18 18 18 18 18 18 18 18 18 18 18 18 18 18 18 18 18 18 18 18 18 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 36 | ch106 18 18 18 18 18 18 18 18 18 18 18 18 18 18 18 18 18 18 18 18 18 18 18 18 18 18 18 18 18 18 18 18 18 18 18 18 18 18 18 18 13 13 13 13 13 13 13 13 13 13 37 | ch108 18 18 18 18 18 18 18 18 18 18 18 18 18 18 18 18 18 18 18 18 18 18 18 18 18 18 18 18 18 18 18 18 18 18 18 18 18 18 18 18 13 13 13 13 13 13 13 13 13 13 38 | ch110 18 18 18 18 18 18 18 18 18 18 18 18 18 18 18 18 18 18 18 18 18 18 18 18 18 18 18 18 18 18 18 18 18 18 18 18 18 18 18 18 13 13 13 13 13 13 13 13 13 13 39 | ch112 18 18 18 18 18 18 18 18 18 18 18 18 18 18 18 18 18 18 18 18 18 18 18 18 18 18 18 18 18 18 18 18 18 18 18 18 18 18 18 18 13 13 13 13 13 13 13 13 13 13 40 | ch116 18 18 18 18 18 18 18 18 18 18 18 18 18 18 18 18 18 18 18 18 18 18 18 18 18 18 18 18 18 18 18 18 18 18 18 18 18 18 18 18 18 18 18 18 18 18 18 18 18 18 41 | ch118 18 18 18 18 18 18 18 18 18 18 18 18 18 18 18 18 18 18 18 18 18 18 18 18 18 18 18 18 18 18 18 18 18 18 18 18 18 18 18 18 18 18 18 18 18 18 18 18 18 18 42 | ch120 18 18 18 18 18 18 18 18 18 18 18 18 18 18 18 18 18 18 18 18 18 18 18 18 18 18 18 18 18 18 18 18 18 18 18 18 18 18 18 18 18 18 18 18 18 18 18 18 18 18 43 | ch122 18 18 18 18 18 18 18 18 18 18 18 18 18 18 18 18 18 18 18 18 18 18 18 18 18 18 18 18 18 18 18 18 18 18 18 18 18 18 18 18 18 18 18 18 18 18 18 18 18 18 44 | ch124 18 18 18 18 18 18 18 18 18 18 18 18 18 18 18 18 18 18 18 18 18 18 18 18 18 18 18 18 18 18 18 18 18 18 18 18 18 18 18 18 18 18 18 18 18 18 18 18 18 18 45 | ch126 18 18 18 18 18 18 18 18 18 18 18 18 18 18 18 18 18 18 18 18 18 18 18 18 18 18 18 18 18 18 18 18 18 18 18 18 18 18 18 18 18 18 18 18 18 18 18 18 18 18 46 | ch128 18 18 18 18 18 18 18 18 18 18 18 18 18 18 18 18 18 18 18 18 18 18 18 18 18 18 18 18 18 18 18 18 18 18 18 18 18 18 18 18 18 18 18 18 18 18 18 18 18 18 47 | ch132 18 18 18 18 18 18 18 18 18 18 18 18 18 18 18 18 18 18 18 18 18 18 18 18 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 18 18 18 18 18 18 18 18 18 18 48 | ch134 18 18 18 18 18 18 18 18 18 18 18 18 18 18 18 18 18 18 18 18 18 18 18 18 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 18 18 18 18 18 18 18 18 18 18 49 | ch136 18 18 18 18 18 18 18 18 18 18 18 18 18 18 18 18 18 18 18 18 18 18 18 18 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 18 18 18 18 18 18 18 18 18 18 50 | ch140 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 18 18 18 18 18 18 18 18 18 18 18 18 18 18 18 18 18 18 18 18 18 18 18 18 18 18 51 | ch149 21 21 21 21 19 19 19 19 21 21 21 21 19 19 19 19 21 21 21 21 19 19 19 19 21 21 21 21 19 19 19 19 21 21 21 21 19 19 19 19 21 21 21 21 19 19 19 19 17 17 52 | ch151 21 21 21 21 19 19 19 19 21 21 21 21 19 19 19 19 21 21 21 21 19 19 19 19 21 21 21 21 19 19 19 19 21 21 21 21 19 19 19 19 21 21 21 21 19 19 19 19 17 17 53 | ch153 21 21 21 21 19 19 19 19 21 21 21 21 19 19 19 19 21 21 21 21 19 19 19 19 21 21 21 21 19 19 19 19 21 21 21 21 19 19 19 19 21 21 21 21 19 19 19 19 17 17 54 | ch155 21 21 21 21 19 19 19 19 21 21 21 21 19 19 19 19 21 21 21 21 19 19 19 19 21 21 21 21 19 19 19 19 21 21 21 21 19 19 19 19 21 21 21 21 19 19 19 19 17 17 55 | ch157 21 21 21 21 19 19 19 19 21 21 21 21 19 19 19 19 21 21 21 21 19 19 19 19 21 21 21 21 19 19 19 19 21 21 21 21 19 19 19 19 21 21 21 21 19 19 19 19 17 17 56 | ch159 21 21 21 21 19 19 19 19 21 21 21 21 19 19 19 19 21 21 21 21 19 19 19 19 21 21 21 21 19 19 19 19 21 21 21 21 19 19 19 19 21 21 21 21 19 19 19 19 17 17 57 | ch161 21 21 21 21 19 19 19 19 21 21 21 21 19 19 19 19 21 21 21 21 19 19 19 19 21 21 21 21 19 19 19 19 21 21 21 21 19 19 19 19 21 21 21 21 19 19 19 19 17 17 58 | ch165 21 21 21 21 19 19 19 19 21 21 21 21 19 19 19 19 21 21 21 21 19 19 19 19 21 21 21 21 19 19 19 19 21 21 21 21 19 19 19 19 21 21 21 21 19 19 19 19 17 17 59 | ch169 21 21 21 21 19 19 19 19 21 21 21 21 19 19 19 19 21 21 21 21 19 19 19 19 21 21 21 21 19 19 19 19 21 21 21 21 19 19 19 19 21 21 21 21 19 19 19 19 17 17 60 | ch173 21 21 21 21 19 19 19 19 21 21 21 21 19 19 19 19 21 21 21 21 19 19 19 19 21 21 21 21 19 19 19 19 21 21 21 21 19 19 19 19 21 21 21 21 19 19 19 19 17 17 61 | 62 | 63 | -------------------------------------------------------------------------------- /packages/ralink/drivers/mt76x2e/files/mt7602e.dat: -------------------------------------------------------------------------------- 1 | #The word of "Default" must not be removed 2 | Default 3 | CountryRegion=1 4 | CountryRegionABand=7 5 | CountryCode= 6 | BssidNum=1 7 | SSID1=OpenWrt-MT7602e 8 | SSID2= 9 | SSID3= 10 | SSID4= 11 | SSID5= 12 | SSID6= 13 | SSID7= 14 | SSID8= 15 | WirelessMode=9 16 | FixedTxMode=HT 17 | TxRate=0 18 | Channel=6 19 | BasicRate=15 20 | BeaconPeriod=100 21 | DtimPeriod=1 22 | TxPower=100 23 | DisableOLBC=0 24 | BGProtection=0 25 | TxAntenna= 26 | RxAntenna= 27 | TxPreamble=0 28 | RTSThreshold=2347 29 | FragThreshold=2346 30 | TxBurst=1 31 | PktAggregate=1 32 | AutoProvisionEn=0 33 | FreqDelta=0 34 | TurboRate=0 35 | WmmCapable=1 36 | APAifsn=3;7;1;1 37 | APCwmin=4;4;3;2 38 | APCwmax=6;10;4;3 39 | APTxop=0;0;94;47 40 | APACM=0;0;0;0 41 | BSSAifsn=3;7;2;2 42 | BSSCwmin=4;4;3;2 43 | BSSCwmax=10;10;4;3 44 | BSSTxop=0;0;94;47 45 | BSSACM=0;0;0;0 46 | AckPolicy=0;0;0;0 47 | APSDCapable=0 48 | DLSCapable=0 49 | NoForwarding=0 50 | NoForwardingBTNBSSID=0 51 | HideSSID=0 52 | ShortSlot=1 53 | AutoChannelSelect=0 54 | IEEE8021X=0 55 | IEEE80211H=0 56 | CarrierDetect=0 57 | ITxBfEn=0 58 | PreAntSwitch= 59 | PhyRateLimit=0 60 | DebugFlags=0 61 | ETxBfEnCond=0 62 | ITxBfTimeout=0 63 | ETxBfTimeout=0 64 | ETxBfNoncompress=0 65 | ETxBfIncapable=0 66 | FineAGC=0 67 | StreamMode=0 68 | StreamModeMac0= 69 | StreamModeMac1= 70 | StreamModeMac2= 71 | StreamModeMac3= 72 | CSPeriod=6 73 | RDRegion= 74 | StationKeepAlive=0 75 | DfsLowerLimit=0 76 | DfsUpperLimit=0 77 | DfsOutdoor=0 78 | SymRoundFromCfg=0 79 | BusyIdleFromCfg=0 80 | DfsRssiHighFromCfg=0 81 | DfsRssiLowFromCfg=0 82 | DFSParamFromConfig=0 83 | FCCParamCh0= 84 | FCCParamCh1= 85 | FCCParamCh2= 86 | FCCParamCh3= 87 | CEParamCh0= 88 | CEParamCh1= 89 | CEParamCh2= 90 | CEParamCh3= 91 | JAPParamCh0= 92 | JAPParamCh1= 93 | JAPParamCh2= 94 | JAPParamCh3= 95 | JAPW53ParamCh0= 96 | JAPW53ParamCh1= 97 | JAPW53ParamCh2= 98 | JAPW53ParamCh3= 99 | FixDfsLimit=0 100 | LongPulseRadarTh=0 101 | AvgRssiReq=0 102 | DFS_R66=0 103 | BlockCh= 104 | GreenAP=0 105 | PreAuth=0 106 | AuthMode=OPEN 107 | EncrypType=NONE 108 | WapiPsk1= 109 | WapiPsk2= 110 | WapiPsk3= 111 | WapiPsk4= 112 | WapiPsk5= 113 | WapiPsk6= 114 | WapiPsk7= 115 | WapiPsk8= 116 | WapiPskType= 117 | Wapiifname= 118 | WapiAsCertPath= 119 | WapiUserCertPath= 120 | WapiAsIpAddr= 121 | WapiAsPort= 122 | RekeyMethod=DISABLE 123 | RekeyInterval=3600 124 | PMKCachePeriod=10 125 | MeshAutoLink=0 126 | MeshAuthMode= 127 | MeshEncrypType= 128 | MeshDefaultkey=0 129 | MeshWEPKEY= 130 | MeshWPAKEY= 131 | MeshId= 132 | WPAPSK1=12345678 133 | WPAPSK2= 134 | WPAPSK3= 135 | WPAPSK4= 136 | WPAPSK5= 137 | WPAPSK6= 138 | WPAPSK7= 139 | WPAPSK8= 140 | DefaultKeyID=1 141 | Key1Type=1;1;1;1;1;1;1;1 142 | Key1Str1= 143 | Key1Str2= 144 | Key1Str3= 145 | Key1Str4= 146 | Key1Str5= 147 | Key1Str6= 148 | Key1Str7= 149 | Key1Str8= 150 | Key2Type=1;1;1;1;1;1;1;1 151 | Key2Str1= 152 | Key2Str2= 153 | Key2Str3= 154 | Key2Str4= 155 | Key2Str5= 156 | Key2Str6= 157 | Key2Str7= 158 | Key2Str8= 159 | Key3Type=1;1;1;1;1;1;1;1 160 | Key3Str1= 161 | Key3Str2= 162 | Key3Str3= 163 | Key3Str4= 164 | Key3Str5= 165 | Key3Str6= 166 | Key3Str7= 167 | Key3Str8= 168 | Key4Type=1;1;1;1;1;1;1;1 169 | Key4Str1= 170 | Key4Str2= 171 | Key4Str3= 172 | Key4Str4= 173 | Key4Str5= 174 | Key4Str6= 175 | Key4Str7= 176 | Key4Str8= 177 | HSCounter=1;1;1;1;1;1;1;1 178 | HT_HTC=1 179 | HT_RDG=1 180 | HT_LinkAdapt=0 181 | HT_OpMode=0 182 | HT_MpduDensity=5 183 | HT_EXTCHA=1 184 | HT_BW=1 185 | HT_AutoBA=1 186 | HT_BADecline=0 187 | HT_AMSDU=0 188 | HT_BAWinSize=64 189 | HT_GI=1 190 | HT_STBC=0 191 | HT_MCS=33 192 | HT_TxStream=2 193 | HT_RxStream=2 194 | HT_PROTECT=1 195 | HT_DisallowTKIP=0 196 | HT_BSSCoexistence=0 197 | HT_LDPC=1 198 | GreenAP=0 199 | VHT_BW=0 200 | VHT_STBC=0 201 | VHT_SGI=0 202 | VHT_BW_SIGNAL=0 203 | VHT_LDPC=0 204 | WscConfMode=0 205 | WscConfStatus=2 206 | WCNTest=0 207 | AccessPolicy0=0 208 | AccessControlList0= 209 | AccessPolicy1=0 210 | AccessControlList1= 211 | AccessPolicy2=0 212 | AccessControlList2= 213 | AccessPolicy3=0 214 | AccessControlList3= 215 | AccessPolicy4=0 216 | AccessControlList4= 217 | AccessPolicy5=0 218 | AccessControlList5= 219 | AccessPolicy6=0 220 | AccessControlList6= 221 | AccessPolicy7=0 222 | AccessControlList7= 223 | WdsEnable=0 224 | WdsPhyMode= 225 | WdsEncrypType=NONE 226 | WdsList= 227 | Wds0Key= 228 | Wds1Key= 229 | Wds2Key= 230 | Wds3Key= 231 | RADIUS_Server=0 232 | RADIUS_Port=1812 233 | RADIUS_Key1= 234 | RADIUS_Key2= 235 | RADIUS_Key3= 236 | RADIUS_Key4= 237 | RADIUS_Key5= 238 | RADIUS_Key6= 239 | RADIUS_Key7= 240 | RADIUS_Key8= 241 | RADIUS_Acct_Server= 242 | RADIUS_Acct_Port=1813 243 | RADIUS_Acct_Key= 244 | own_ip_addr= 245 | Ethifname= 246 | EAPifname= 247 | PreAuthifname= 248 | session_timeout_interval=0 249 | idle_timeout_interval=0 250 | WiFiTest=0 251 | TGnWifiTest=0 252 | ApCliEnable=0 253 | ApCliSsid= 254 | ApCliBssid= 255 | ApCliAuthMode= 256 | ApCliEncrypType= 257 | ApCliWPAPSK= 258 | ApCliDefaultKeyID=0 259 | ApCliKey1Type=0 260 | ApCliKey1Str= 261 | ApCliKey2Type=0 262 | ApCliKey2Str= 263 | ApCliKey3Type=0 264 | ApCliKey3Str= 265 | ApCliKey4Type=0 266 | ApCliKey4Str= 267 | EfuseBufferMode=0 268 | E2pAccessMode=2 269 | RadioOn=1 270 | BW_Enable=0 271 | BW_Root=0 272 | BW_Priority= 273 | BW_Guarantee_Rate= 274 | BW_Maximum_Rate= 275 | SSID= 276 | WPAPSK= 277 | Key1Str= 278 | Key2Str= 279 | Key3Str= 280 | Key4Str= 281 | -------------------------------------------------------------------------------- /packages/ralink/drivers/mt76x2e/files/mt7602e.sh: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | append DRIVERS "mt7602e" 3 | 4 | . /lib/wifi/ralink_common.sh 5 | 6 | prepare_mt7602e() { 7 | prepare_ralink_wifi mt7602e 8 | } 9 | 10 | scan_mt7602e() { 11 | scan_ralink_wifi mt7602e mt76x2e 12 | } 13 | 14 | disable_mt7602e() { 15 | disable_ralink_wifi mt7602e 16 | } 17 | 18 | enable_mt7602e() { 19 | enable_ralink_wifi mt7602e mt76x2e 20 | } 21 | 22 | detect_mt7602e() { 23 | # detect_ralink_wifi mt7602e mt76x2e 24 | ssid=mt7602e-`ifconfig eth0 | grep HWaddr | cut -c 51- | sed 's/://g'` 25 | cd /sys/module/ 26 | [ -d $module ] || return 27 | [ -e /etc/config/wireless ] && return 28 | cat </dev/null 2>&1 && return 27 | ifconfig rai0 >/dev/null 2>&1 || return 28 | cat <>/tmp/wifi.log 6 | vifs=`uci show wireless | grep "=wifi-iface" | sed -n "s/=wifi-iface//gp"` 7 | echo $vifs >>/tmp/wifi.log 8 | 9 | ifn5g=0 10 | ifn2g=0 11 | for vif in $vifs; do 12 | local netif nettype device netif_new 13 | echo "<<<<<<<<<<<<<<<<<" >>/tmp/wifi.log 14 | netif=`uci -q get ${vif}.ifname` 15 | nettype=`uci -q get ${vif}.network` 16 | device=`uci -q get ${vif}.device` 17 | if [ "$device" == "" ]; then 18 | echo "device cannot be empty!!" >>/tmp/wifi.log 19 | return 20 | fi 21 | echo "device name $device!!" >>/tmp/wifi.log 22 | echo "netif $netif" >>/tmp/wifi.log 23 | echo "nettype $nettype" >>/tmp/wifi.log 24 | 25 | case "$device" in 26 | mt7620 | mt7602e | mt7603e | mt7628 | mt7688) 27 | netif_new="ra"${ifn2g} 28 | ifn2g=$(( $ifn2g + 1 )) 29 | ;; 30 | mt7610e | mt7612e ) 31 | netif_new="rai"${ifn5g} 32 | ifn5g=$(( $ifn5g + 1 )) 33 | ;; 34 | * ) 35 | echo "device $device not recognized!! " >>/tmp/wifi.log 36 | ;; 37 | esac 38 | 39 | echo "ifn5g = ${ifn5g}, ifn2g = ${ifn2g}" >>/tmp/wifi.log 40 | echo "netif_new = ${netif_new}" >>/tmp/wifi.log 41 | 42 | if [ "$netif" == "" ]; then 43 | echo "ifname empty, we'll fix it with ${netif_new}" >>/tmp/wifi.log 44 | uci -q set ${vif}.ifname=${netif_new} 45 | fi 46 | if [ "$nettype" == "" ]; then 47 | nettype="lan" 48 | echo "nettype empty, we'll fix it with ${nettype}" >>/tmp/wifi.log 49 | uci -q set ${vif}.network=${nettype} 50 | fi 51 | echo ">>>>>>>>>>>>>>>>>" >>/tmp/wifi.log 52 | done 53 | uci changes >>/tmp/wifi.log 54 | uci commit 55 | } 56 | 57 | 58 | sync_uci_with_dat() { 59 | echo "sync_uci_with_dat($1,$2,$3,$4)" >>/tmp/wifi.log 60 | local device="$1" 61 | local datpath="$2" 62 | uci2dat -d $device -f $datpath > /tmp/uci2dat.log 63 | } 64 | 65 | 66 | 67 | chk8021x() { 68 | local x8021x="0" encryption device="$1" prefix 69 | #vifs=`uci show wireless | grep "=wifi-iface" | sed -n "s/=wifi-iface//gp"` 70 | echo "u8021x dev $device" > /tmp/802.$device.log 71 | config_get vifs "$device" vifs 72 | for vif in $vifs; do 73 | config_get ifname $vif ifname 74 | echo "ifname = $ifname" >> /tmp/802.$device.log 75 | config_get encryption $vif encryption 76 | echo "enc = $encryption" >> /tmp/802.$device.log 77 | case "$encryption" in 78 | wpa+*) 79 | [ "$x8021x" == "0" ] && x8021x=1 80 | echo 111 >> /tmp/802.$device.log 81 | ;; 82 | wpa2+*) 83 | [ "$x8021x" == "0" ] && x8021x=1 84 | echo 1l2 >> /tmp/802.$device.log 85 | ;; 86 | wpa-mixed*) 87 | [ "$x8021x" == "0" ] && x8021x=1 88 | echo 1l3 >> /tmp/802.$device.log 89 | ;; 90 | esac 91 | ifpre=$(echo $ifname | cut -c1-3) 92 | echo "prefix = $ifpre" >> /tmp/802.$device.log 93 | if [ "$ifpre" == "rai" ]; then 94 | prefix="rai" 95 | else 96 | prefix="ra" 97 | fi 98 | if [ "1" == "$x8021x" ]; then 99 | break 100 | fi 101 | done 102 | echo "x8021x $x8021x, pre $prefix" >>/tmp/802.$device.log 103 | if [ "1" == $x8021x ]; then 104 | if [ "$prefix" == "ra" ]; then 105 | echo "killall 8021xd" >>/tmp/802.$device.log 106 | killall 8021xd 107 | echo "/bin/8021xd -d 9" >>/tmp/802.$device.log 108 | /bin/8021xd -d 9 >> /tmp/802.$device.log 2>&1 109 | else # $prefixa == rai 110 | echo "killall 8021xdi" >>/tmp/802.$device.log 111 | killall 8021xdi 112 | echo "/bin/8021xdi -d 9" >>/tmp/802.$device.log 113 | /bin/8021xdi -d 9 >> /tmp/802.$device.log 2>&1 114 | fi 115 | else 116 | if [ "$prefix" == "ra" ]; then 117 | echo "killall 8021xd" >>/tmp/802.$device.log 118 | killall 8021xd 119 | else # $prefixa == rai 120 | echo "killall 8021xdi" >>/tmp/802.$device.log 121 | killall 8021xdi 122 | fi 123 | fi 124 | } 125 | 126 | 127 | # $1=device, $2=module 128 | reinit_wifi() { 129 | echo "reinit_wifi($1,$2,$3,$4)" >>/tmp/wifi.log 130 | local device="$1" 131 | local module="$2" 132 | config_get vifs "$device" vifs 133 | 134 | # shut down all vifs first 135 | for vif in $vifs; do 136 | config_get ifname $vif ifname 137 | ifconfig $ifname down 138 | done 139 | 140 | # in some case we have to reload drivers. (mbssid eg) 141 | #ref=`cat /sys/module/$module/refcnt` 142 | #if [ $ref != "0" ]; then 143 | # # but for single driver, we only need to reload once. 144 | # echo "$module ref=$ref, skip reload module" >>/tmp/wifi.log 145 | #else 146 | # echo "rmmod $module" >>/tmp/wifi.log 147 | # rmmod $module 148 | # echo "insmod $module" >>/tmp/wifi.log 149 | # insmod $module 150 | #fi 151 | 152 | # bring up vifs 153 | for vif in $vifs; do 154 | config_get ifname $vif ifname 155 | config_get disabled $vif disabled 156 | echo "ifconfig $ifname down" >>/tmp/wifi.log 157 | if [ "$disabled" == "1" ]; then 158 | echo "$ifname marked disabled, skip" >>/tmp/wifi.log 159 | continue 160 | else 161 | echo "ifconfig $ifname up" >>/tmp/wifi.log 162 | ifconfig $ifname up 163 | fi 164 | done 165 | 166 | chk8021x $device 167 | } 168 | 169 | prepare_ralink_wifi() { 170 | echo "prepare_ralink_wifi($1,$2,$3,$4)" >>/tmp/wifi.log 171 | local device=$1 172 | config_get channel $device channel 173 | config_get ssid $2 ssid 174 | config_get mode $device mode 175 | config_get ht $device ht 176 | config_get country $device country 177 | config_get regdom $device regdom 178 | 179 | # HT40 mode can be enabled only in bgn (mode = 9), gn (mode = 7) 180 | # or n (mode = 6). 181 | HT=0 182 | [ "$mode" = 6 -o "$mode" = 7 -o "$mode" = 9 ] && [ "$ht" != "20" ] && HT=1 183 | 184 | # In HT40 mode, a second channel is used. If EXTCHA=0, the extra 185 | # channel is $channel + 4. If EXTCHA=1, the extra channel is 186 | # $channel - 4. If the channel is fixed to 1-4, we'll have to 187 | # use + 4, otherwise we can just use - 4. 188 | EXTCHA=0 189 | [ "$channel" != auto ] && [ "$channel" -lt "5" ] && EXTCHA=1 190 | 191 | } 192 | 193 | scan_ralink_wifi() { 194 | local device="$1" 195 | local module="$2" 196 | echo "scan_ralink_wifi($1,$2,$3,$4)" >>/tmp/wifi.log 197 | repair_wireless_uci 198 | sync_uci_with_dat $device /etc/wireless/$device/$device.dat 199 | } 200 | 201 | disable_ralink_wifi() { 202 | echo "disable_ralink_wifi($1,$2,$3,$4)" >>/tmp/wifi.log 203 | local device="$1" 204 | config_get vifs "$device" vifs 205 | for vif in $vifs; do 206 | config_get ifname $vif ifname 207 | ifconfig $ifname down 208 | done 209 | 210 | # kill any running ap_clients 211 | killall ap_client 2>/dev/null || true 212 | } 213 | 214 | enable_ralink_wifi() { 215 | echo "enable_ralink_wifi($1,$2,$3,$4)" >>/tmp/wifi.log 216 | local device="$1" 217 | config_get vifs "$device" vifs 218 | 219 | # bring up vifs 220 | for vif in $vifs; do 221 | config_get ifname $vif ifname 222 | config_get disabled $vif disabled 223 | config_get radio $device radio 224 | ifconfig $ifname down 225 | echo "ifconfig $ifname down" >>/dev/null 226 | if [ "$disabled" == "1" ]; then 227 | echo "$ifname marked disabled, skip" >>/dev/null 228 | continue 229 | else 230 | echo "ifconfig $ifname up" >>/dev/null 231 | ifconfig $ifname up 232 | fi 233 | #Radio On/Off only support iwpriv command but dat file 234 | [ "$radio" == "0" ] && iwpriv $ifname set RadioOn=0 235 | local net_cfg bridge 236 | net_cfg="$(find_net_config "$vif")" 237 | [ -z "$net_cfg" ] || { 238 | bridge="$(bridge_interface "$net_cfg")" 239 | config_set "$vif" bridge "$bridge" 240 | start_net "$ifname" "$net_cfg" 241 | } 242 | chk8021x $device 243 | set_wifi_up "$vif" "$ifname" 244 | brctl addif "$bridge" "$ifname" 2>/dev/null 245 | done 246 | } 247 | 248 | detect_ralink_wifi() { 249 | echo "detect_ralink_wifi($1,$2,$3,$4)" >>/tmp/wifi.log 250 | local channel 251 | local device="$1" 252 | local module="$2" 253 | local band 254 | local ifname 255 | cd /sys/module/ 256 | [ -d $module ] || return 257 | config_get channel $device channel 258 | [ -z "$channel" ] || return 259 | case "$device" in 260 | mt7620 | mt7602e | mt7603e | mt7628 ) 261 | ifname="ra0" 262 | band="2.4G" 263 | ;; 264 | mt7610e | mt7612e ) 265 | ifname="rai0" 266 | band="5G" 267 | ;; 268 | * ) 269 | echo "device $device not recognized!! " >>/tmp/wifi.log 270 | ;; 271 | esac 272 | cat < 27 | +#include 28 | +#include 29 | +#include 30 | +#include 31 | +#include 32 | +#include 33 | +#include 34 | +#include 35 | +#include 36 | +#include 37 | +#include 38 | +#include 39 | +#include 40 | +#include 41 | +#include 42 | + 43 | +struct proc_dir_entry *procRegDir; 44 | +/* 45 | + * Flash API: ra_mtd_read, ra_mtd_write 46 | + * Arguments: 47 | + * - num: specific the mtd number 48 | + * - to/from: the offset to read from or written to 49 | + * - len: length 50 | + * - buf: data to be read/written 51 | + * Returns: 52 | + * - return -errno if failed 53 | + * - return the number of bytes read/written if successed 54 | + */ 55 | +int ra_mtd_write_nm(char *name, loff_t to, size_t len, const u_char *buf) 56 | +{ 57 | + int ret = -1; 58 | + size_t rdlen, wrlen; 59 | + struct mtd_info *mtd; 60 | + struct erase_info ei; 61 | + u_char *bak = NULL; 62 | + 63 | + mtd = get_mtd_device_nm(name); 64 | + 65 | + if (IS_ERR(mtd)) { 66 | + ret = (int)mtd; 67 | + goto out; 68 | + } 69 | + 70 | + if (len > mtd->erasesize) { 71 | + put_mtd_device(mtd); 72 | + ret = -E2BIG; 73 | + goto out; 74 | + } 75 | + 76 | + bak = kzalloc(mtd->erasesize, GFP_KERNEL); 77 | + if (bak == NULL) { 78 | + put_mtd_device(mtd); 79 | + ret = -ENOMEM; 80 | + goto out; 81 | + } 82 | + 83 | +#if LINUX_VERSION_CODE >= KERNEL_VERSION(3,3,0) 84 | + ret = mtd_read(mtd, 0, mtd->erasesize, &rdlen, bak); 85 | +#else 86 | + ret = mtd->read(mtd, 0, mtd->erasesize, &rdlen, bak); 87 | +#endif 88 | + if (ret) { 89 | + goto free_out; 90 | + } 91 | + 92 | + if (rdlen != mtd->erasesize) 93 | + printk("warning: ra_mtd_write_nm: rdlen is not equal to erasesize\n"); 94 | + 95 | + memcpy(bak + to, buf, len); 96 | + 97 | + ei.mtd = mtd; 98 | + ei.callback = NULL; 99 | + ei.addr = 0; 100 | + ei.len = mtd->erasesize; 101 | + ei.priv = 0; 102 | + 103 | +#if LINUX_VERSION_CODE >= KERNEL_VERSION(3,3,0) 104 | + ret = mtd_erase(mtd, &ei); 105 | +#else 106 | + ret = mtd->erase(mtd, &ei); 107 | +#endif 108 | + if (ret != 0) 109 | + goto free_out; 110 | + 111 | +#if LINUX_VERSION_CODE >= KERNEL_VERSION(3,3,0) 112 | + ret = mtd_write(mtd, 0, mtd->erasesize, &wrlen, bak); 113 | +#else 114 | + ret = mtd->write(mtd, 0, mtd->erasesize, &wrlen, bak); 115 | +#endif 116 | + 117 | + udelay(10); /* add delay after write */ 118 | + 119 | +free_out: 120 | + if (mtd) 121 | + put_mtd_device(mtd); 122 | + 123 | + if (bak) 124 | + kfree(bak); 125 | +out: 126 | + return ret; 127 | +} 128 | + 129 | +int ra_mtd_read_nm(char *name, loff_t from, size_t len, u_char *buf) 130 | +{ 131 | + int ret; 132 | + size_t rdlen = 0; 133 | + struct mtd_info *mtd; 134 | + 135 | + mtd = get_mtd_device_nm(name); 136 | + if (IS_ERR(mtd)) 137 | + return (int)mtd; 138 | + 139 | +#if LINUX_VERSION_CODE >= KERNEL_VERSION(3,3,0) 140 | + ret = mtd_read(mtd, from, len, &rdlen, buf); 141 | +#else 142 | + ret = mtd->read(mtd, from, len, &rdlen, buf); 143 | +#endif 144 | + if (rdlen != len) 145 | + printk("warning: ra_mtd_read_nm: rdlen is not equal to len\n"); 146 | + 147 | + put_mtd_device(mtd); 148 | + return ret; 149 | +} 150 | + 151 | +EXPORT_SYMBOL(ra_mtd_write_nm); 152 | +EXPORT_SYMBOL(ra_mtd_read_nm); 153 | +EXPORT_SYMBOL(procRegDir); 154 | + 155 | +MODULE_AUTHOR("Steven Liu "); 156 | +MODULE_DESCRIPTION("Ralink APSoC Flash Map"); 157 | +MODULE_LICENSE("GPL"); 158 | Index: src/os/linux/rt_linux.c 159 | =================================================================== 160 | --- a/src/os/linux/rt_linux.c (revision 270) 161 | +++ b/src/os/linux/rt_linux.c (working copy) 162 | @@ -328,7 +328,7 @@ 163 | #ifdef RA_MTD_RW_BY_NUM 164 | ra_mtd_read(MTD_NUM_FACTORY, 0, (size_t) b, p); 165 | #else 166 | - ra_mtd_read_nm("Factory", a&0xFFFF, (size_t) b, p); 167 | + ra_mtd_read_nm("factory", a&0xFFFF, (size_t) b, p); 168 | #endif 169 | #endif /* CONFIG_RALINK_FLASH_API */ 170 | } 171 | @@ -344,7 +344,7 @@ 172 | #ifdef RA_MTD_RW_BY_NUM 173 | ra_mtd_write(MTD_NUM_FACTORY, 0, (size_t) b, p); 174 | #else 175 | - ra_mtd_write_nm("Factory", a&0xFFFF, (size_t) b, p); 176 | + ra_mtd_write_nm("factory", a&0xFFFF, (size_t) b, p); 177 | #endif 178 | #endif /* CONFIG_RALINK_FLASH_API */ 179 | } 180 | -------------------------------------------------------------------------------- /packages/ralink/drivers/mtk-wifi-gpl/Makefile: -------------------------------------------------------------------------------- 1 | # All rights reserved. 2 | # 3 | # This is free software, licensed under the GNU General Public License v2. 4 | # See /LICENSE for more information. 5 | 6 | include $(TOPDIR)/rules.mk 7 | include $(INCLUDE_DIR)/kernel.mk 8 | 9 | PKG_NAME:=mtk-wifi-gpl 10 | PKG_VERSION:=20140529 11 | PKG_RELEASE=$(PKG_SOURCE_VERSION) 12 | 13 | PKG_BUILD_DIR:=$(BUILD_DIR)/$(PKG_NAME)-$(PKG_VERSION) 14 | PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.bz2 15 | PKG_SOURCE_SUBDIR:=$(PKG_NAME)-$(PKG_VERSION) 16 | PKG_SOURCE_URL:=https://github.com/openwrt/mtk-wifi-gpl.git 17 | PKG_SOURCE_PROTO:=git 18 | PKG_SOURCE_VERSION:=5e8dae211cb1b9f30dd3e7281cb8fab434a5483f 19 | 20 | PKG_BUILD_PARALLEL:=1 21 | 22 | include $(INCLUDE_DIR)/package.mk 23 | 24 | define KernelPackage/mtk-wifi-gpl 25 | SECTION:=kernel 26 | CATEGORY:=Kernel modules 27 | TITLE:=Mediatek MT76x2 802.11ac device driver 28 | DEPENDS:=+kmod-cfg80211 29 | FILES:=$(PKG_BUILD_DIR)/os/linux/mt76x2.ko 30 | AUTOLOAD:=$(call AutoLoad,91,MT76x2_ap) 31 | SUBMENU:=Wireless Drivers 32 | endef 33 | 34 | #define Build/Prepare 35 | # mkdir -p $(PKG_BUILD_DIR) 36 | # ln -s $(CURDIR)/../../.git $(PKG_BUILD_DIR) 37 | # (cd $(PKG_BUILD_DIR); git checkout .) 38 | #endef 39 | 40 | define Build/Compile 41 | +$(MAKE) $(PKG_JOBS) -C "$(LINUX_DIR)" \ 42 | CROSS_COMPILE="$(TARGET_CROSS)" \ 43 | ARCH="$(LINUX_KARCH)" \ 44 | SUBDIRS="$(PKG_BUILD_DIR)/os/linux/" \ 45 | RT28xx_DIR="$(PKG_BUILD_DIR)" \ 46 | NOSTDINC_FLAGS="-I$(STAGING_DIR)/usr/include/mac80211-backport/uapi -I$(STAGING_DIR)/usr/include/mac80211-backport \ 47 | -I$(STAGING_DIR)/usr/include/mac80211/uapi -I$(STAGING_DIR)/usr/include/mac80211 \ 48 | -include backport/backport.h \ 49 | -Wno-unused-variable -Wno-unused-function \ 50 | -Wno-return-type" \ 51 | modules 52 | endef 53 | 54 | define KernelPackage/mtk-wifi-gpl/install 55 | $(INSTALL_DIR) $(1)/etc/Wireless/RT2860AP 56 | $(CP) $(PKG_BUILD_DIR)/conf/RT2860AP.dat_ac $(1)/etc/Wireless/RT2860AP/RT2860AP.dat 57 | endef 58 | 59 | $(eval $(call KernelPackage,mtk-wifi-gpl)) 60 | 61 | -------------------------------------------------------------------------------- /patches/01-hiwifi-hc5x61.patch: -------------------------------------------------------------------------------- 1 | Index: target/linux/ramips/base-files/etc/diag.sh 2 | =================================================================== 3 | --- target/linux/ramips/base-files/etc/diag.sh.orig 2014-09-21 16:32:37.000000000 +0800 4 | +++ target/linux/ramips/base-files/etc/diag.sh 2018-12-19 12:40:43.910978057 +0800 5 | @@ -54,6 +54,15 @@ 6 | fonera20n) 7 | status_led="fonera20n:green:power" 8 | ;; 9 | + hc5661) 10 | + status_led="hc5661:blue:system" 11 | + ;; 12 | + hc5761) 13 | + status_led="hc5761:blue:system" 14 | + ;; 15 | + hc5861) 16 | + status_led="hc5861:blue:system" 17 | + ;; 18 | ip2202) 19 | status_led="ip2202:green:run" 20 | ;; 21 | Index: target/linux/ramips/base-files/etc/uci-defaults/01_leds 22 | =================================================================== 23 | --- target/linux/ramips/base-files/etc/uci-defaults/01_leds.orig 2014-09-21 16:32:37.000000000 +0800 24 | +++ target/linux/ramips/base-files/etc/uci-defaults/01_leds 2018-12-19 12:40:43.910978057 +0800 25 | @@ -106,6 +106,24 @@ 26 | set_usb_led "fonera20n:orange:usb" 27 | set_wifi_led "fonera20n:orange:wifi" 28 | ;; 29 | + hc5661) 30 | + ucidef_set_led_default "system" "system" "hc5661:blue:system" "1" 31 | + ucidef_set_led_netdev "internet" "internet" "hc5661:blue:internet" "eth0.2" 32 | + set_wifi_led "hc5661:blue:wlan2g" 33 | + ;; 34 | + hc5761) 35 | + ucidef_set_led_default "system" "system" "hc5761:blue:system" "1" 36 | + ucidef_set_led_netdev "internet" "internet" "hc5761:blue:internet" "eth0.2" 37 | + set_wifi_led "hc5761:blue:wlan2g" 38 | + ucidef_set_led_netdev "wifi5g" "wifi5g" "hc5761:blue:wlan5g" "rai0" 39 | + ;; 40 | + hc5861) 41 | + ucidef_set_led_default "system" "system" "hc5861:blue:system" "1" 42 | + ucidef_set_led_netdev "internet" "internet" "hc5861:blue:internet" "eth0.2" 43 | + set_wifi_led "hc5861:blue:wlan2g" 44 | + ucidef_set_led_netdev "wifi5g" "wifi5g" "hc5861:blue:wlan5g" "rai0" 45 | + ucidef_set_led_default "turbo" "turbo" "hc5861:blue:turbo" "0" 46 | + ;; 47 | hlk-rm04) 48 | set_wifi_led "rt2800pci-phy0::radio" 49 | ;; 50 | Index: target/linux/ramips/base-files/etc/uci-defaults/02_network 51 | =================================================================== 52 | --- target/linux/ramips/base-files/etc/uci-defaults/02_network.orig 2014-09-21 16:32:37.000000000 +0800 53 | +++ target/linux/ramips/base-files/etc/uci-defaults/02_network 2018-12-19 12:45:44.938893829 +0800 54 | @@ -184,6 +184,7 @@ ramips_setup_interfaces() 55 | ucidef_add_switch_vlan "switch0" "2" "4 6t" 56 | ;; 57 | 58 | + hc5*61 |\ 59 | y1 |\ 60 | y1s) 61 | ucidef_set_interfaces_lan_wan "eth0.1" "eth0.2" 62 | @@ -274,6 +275,12 @@ ramips_setup_macs() 63 | wan_mac=$(mtd_get_mac_binary factory 40) 64 | ;; 65 | 66 | + hc5*61) 67 | + lan_mac=`mtd_get_mac_ascii bdinfo "Vfac_mac "` 68 | + [ -n "$lan_mac" ] || lan_mac=$(cat /sys/class/net/eth0/address) 69 | + wan_mac=$(macaddr_add "$lan_mac" 1) 70 | + ;; 71 | + 72 | rt-n56u) 73 | lan_mac=$(cat /sys/class/net/eth0/address) 74 | lan_mac=$(macaddr_setbit_la "$lan_mac") 75 | Index: target/linux/ramips/base-files/lib/ramips.sh 76 | =================================================================== 77 | --- target/linux/ramips/base-files/lib/ramips.sh.orig 2014-09-21 16:32:37.000000000 +0800 78 | +++ target/linux/ramips/base-files/lib/ramips.sh 2018-12-19 12:40:43.910978057 +0800 79 | @@ -160,6 +160,15 @@ 80 | *"HAME MPR-A2") 81 | name="mpr-a2" 82 | ;; 83 | + *"HC5661") 84 | + name="hc5661" 85 | + ;; 86 | + *"HC5761") 87 | + name="hc5761" 88 | + ;; 89 | + *"HC5861") 90 | + name="hc5861" 91 | + ;; 92 | *"Kingston MLW221") 93 | name="mlw221" 94 | ;; 95 | Index: target/linux/ramips/base-files/lib/upgrade/platform.sh 96 | =================================================================== 97 | --- target/linux/ramips/base-files/lib/upgrade/platform.sh.orig 2014-09-21 16:32:37.000000000 +0800 98 | +++ target/linux/ramips/base-files/lib/upgrade/platform.sh 2018-12-19 12:40:43.910978057 +0800 99 | @@ -51,6 +51,7 @@ 100 | freestation5 | \ 101 | hw550-3g | \ 102 | hg255d | \ 103 | + hc5*61 | \ 104 | hlk-rm04 | \ 105 | ip2202 | \ 106 | m3 | \ 107 | Index: target/linux/ramips/dts/HC5661.dts 108 | =================================================================== 109 | --- /dev/null 1970-01-01 00:00:00.000000000 +0000 110 | +++ target/linux/ramips/dts/HC5661.dts 2018-12-19 12:40:43.910978057 +0800 111 | @@ -0,0 +1,32 @@ 112 | +/dts-v1/; 113 | + 114 | +/include/ "HC5XXX.dtsi" 115 | + 116 | +/ { 117 | + compatible = "HC5661", "ralink,mt7620a-soc"; 118 | + model = "HiWiFi HC5661"; 119 | + 120 | + gpio-leds { 121 | + compatible = "gpio-leds"; 122 | + 123 | + system { 124 | + label = "hc5661:blue:system"; 125 | + gpios = <&gpio0 9 1>; 126 | + }; 127 | + 128 | + internet { 129 | + label = "hc5661:blue:internet"; 130 | + gpios = <&gpio0 11 1>; 131 | + }; 132 | + 133 | + wlan2g { 134 | + label = "hc5661:blue:wlan2g"; 135 | + gpios = <&gpio3 0 1>; 136 | + }; 137 | + 138 | + wlan5g { 139 | + label = "hc5661:blue:wlan5g"; 140 | + gpios = <&gpio0 7 1>; 141 | + }; 142 | + }; 143 | +}; 144 | Index: target/linux/ramips/dts/HC5761.dts 145 | =================================================================== 146 | --- /dev/null 1970-01-01 00:00:00.000000000 +0000 147 | +++ target/linux/ramips/dts/HC5761.dts 2018-12-19 12:40:43.910978057 +0800 148 | @@ -0,0 +1,32 @@ 149 | +/dts-v1/; 150 | + 151 | +/include/ "HC5XXX.dtsi" 152 | + 153 | +/ { 154 | + compatible = "HC5761", "ralink,mt7620a-soc"; 155 | + model = "HiWiFi HC5761"; 156 | + 157 | + gpio-leds { 158 | + compatible = "gpio-leds"; 159 | + 160 | + system { 161 | + label = "hc5761:blue:system"; 162 | + gpios = <&gpio0 9 1>; 163 | + }; 164 | + 165 | + internet { 166 | + label = "hc5761:blue:internet"; 167 | + gpios = <&gpio0 11 1>; 168 | + }; 169 | + 170 | + wlan2g { 171 | + label = "hc5761:blue:wlan2g"; 172 | + gpios = <&gpio3 0 1>; 173 | + }; 174 | + 175 | + wlan5g { 176 | + label = "hc5761:blue:wlan5g"; 177 | + gpios = <&gpio0 7 1>; 178 | + }; 179 | + }; 180 | +}; 181 | Index: target/linux/ramips/dts/HC5861.dts 182 | =================================================================== 183 | --- /dev/null 1970-01-01 00:00:00.000000000 +0000 184 | +++ target/linux/ramips/dts/HC5861.dts 2018-12-19 12:40:43.910978057 +0800 185 | @@ -0,0 +1,92 @@ 186 | +/dts-v1/; 187 | + 188 | +/include/ "HC5XXX.dtsi" 189 | + 190 | +/ { 191 | + compatible = "HC5861", "ralink,mt7620a-soc"; 192 | + model = "HiWiFi HC5861"; 193 | + 194 | + ethernet@10100000 { 195 | + status = "okay"; 196 | + mtd-mac-address = <&factory 0x4>; 197 | + pinctrl-names = "default"; 198 | + pinctrl-0 = <&rgmii1_pins &rgmii2_pins &mdio_pins>; 199 | + ralink,port-map = "wllll"; 200 | + 201 | + port@4 { 202 | + status = "okay"; 203 | + phy-handle = <&phy4>; 204 | + phy-mode = "rgmii"; 205 | + }; 206 | + 207 | + port@5 { 208 | + status = "okay"; 209 | + phy-handle = <&phy5>; 210 | + phy-mode = "rgmii"; 211 | + }; 212 | + 213 | + mdio-bus { 214 | + status = "okay"; 215 | + 216 | + phy4: ethernet-phy@4 { 217 | + reg = <4>; 218 | + phy-mode = "rgmii"; 219 | + }; 220 | + 221 | + phy5: ethernet-phy@5 { 222 | + reg = <5>; 223 | + phy-mode = "rgmii"; 224 | + }; 225 | + }; 226 | + }; 227 | + 228 | + gsw@10110000 { 229 | + ralink,port4 = "gmac"; 230 | + }; 231 | + 232 | + gpio-leds { 233 | + compatible = "gpio-leds"; 234 | + 235 | + system { 236 | + label = "hc5861:blue:system"; 237 | + gpios = <&gpio0 9 1>; 238 | + }; 239 | + 240 | + wlan2g { 241 | + label = "hc5861:blue:wlan2g"; 242 | + gpios = <&gpio0 11 1>; 243 | + }; 244 | + 245 | + internet { 246 | + label = "hc5861:blue:internet"; 247 | + gpios = <&gpio3 0 1>; 248 | + }; 249 | + 250 | + wlan5g { 251 | + label = "hc5861:blue:wlan5g"; 252 | + gpios = <&gpio0 7 1>; 253 | + }; 254 | + 255 | + turbo { 256 | + label = "hc5861:blue:turbo"; 257 | + gpios = <&gpio0 10 1>; 258 | + }; 259 | + }; 260 | + 261 | + gpio_export { 262 | + compatible = "gpio-export"; 263 | + #size-cells = <0>; 264 | + 265 | + usbpower { 266 | + gpio-export,name = "usbpower"; 267 | + gpio-export,output = <0>; 268 | + gpios = <&gpio0 13 0>; 269 | + }; 270 | + 271 | + sdpower { 272 | + gpio-export,name = "sdpower"; 273 | + gpio-export,output = <0>; 274 | + gpios = <&gpio0 8 0>; 275 | + }; 276 | + }; 277 | +}; 278 | Index: target/linux/ramips/dts/HC5XXX.dtsi 279 | =================================================================== 280 | --- /dev/null 1970-01-01 00:00:00.000000000 +0000 281 | +++ target/linux/ramips/dts/HC5XXX.dtsi 2018-12-19 12:40:43.910978057 +0800 282 | @@ -0,0 +1,141 @@ 283 | +/include/ "mt7620a.dtsi" 284 | + 285 | +/ { 286 | + chosen { 287 | + bootargs = "console=ttyS0,115200"; 288 | + }; 289 | + 290 | + palmbus@10000000 { 291 | + sysc@0 { 292 | + ralink,gpiomux = "i2c", "jtag"; 293 | + ralink,uartmux = "gpio"; 294 | + ralink,wdtmux = <1>; 295 | + }; 296 | + 297 | + gpio0: gpio@600 { 298 | + status = "okay"; 299 | + }; 300 | + 301 | + gpio2: gpio@660 { 302 | + status = "okay"; 303 | + }; 304 | + 305 | + gpio3: gpio@688 { 306 | + status = "okay"; 307 | + }; 308 | + 309 | + spi@b00 { 310 | + status = "okay"; 311 | + 312 | + m25p80@0 { 313 | + #address-cells = <1>; 314 | + #size-cells = <1>; 315 | + compatible = "w25q128"; 316 | + reg = <0 0>; 317 | + linux,modalias = "m25p80", "w25q128"; 318 | + spi-max-frequency = <10000000>; 319 | + 320 | + partition@0 { 321 | + label = "u-boot"; 322 | + reg = <0x0 0x30000>; 323 | + }; 324 | + 325 | + partition@30000 { 326 | + label = "u-boot-env"; 327 | + reg = <0x30000 0x10000>; 328 | + read-only; 329 | + }; 330 | + 331 | + factory: partition@40000 { 332 | + label = "factory"; 333 | + reg = <0x40000 0x10000>; 334 | + }; 335 | + 336 | + partition@50000 { 337 | + label = "firmware"; 338 | + reg = <0x50000 0xf80000>; 339 | + }; 340 | + 341 | + partition@fd0000 { 342 | + label = "hwf_config"; 343 | + reg = <0xfd0000 0x10000>; 344 | + }; 345 | + 346 | + bdinfo: partition@fe0000 { 347 | + label = "bdinfo"; 348 | + reg = <0xfe0000 0x10000>; 349 | + }; 350 | + 351 | + partition@ff0000 { 352 | + label = "backup"; 353 | + reg = <0xff0000 0x10000>; 354 | + }; 355 | + }; 356 | + }; 357 | + }; 358 | + 359 | + ehci@101c0000 { 360 | + status = "okay"; 361 | + }; 362 | + 363 | + ohci@101c1000 { 364 | + status = "okay"; 365 | + }; 366 | + 367 | + ethernet@10100000 { 368 | + pinctrl-names = "default"; 369 | + pinctrl-0 = <&ephy_pins>; 370 | + mtd-mac-address = <&factory 0x4>; 371 | + ralink,port-map = "wllll"; 372 | + }; 373 | + 374 | + sdhci@10130000 { 375 | + status = "okay"; 376 | + }; 377 | + 378 | + wmac@10180000 { 379 | + ralink,mtd-eeprom = <&factory 0>; 380 | + }; 381 | + 382 | + pcie@10140000 { 383 | + status = "okay"; 384 | + }; 385 | + 386 | + pinctrl { 387 | + state_default: pinctrl0 { 388 | + gpio { 389 | + ralink,group = "uartf", "wled", "nd_sd"; 390 | + ralink,function = "gpio"; 391 | + }; 392 | + 393 | + pa { 394 | + ralink,group = "pa"; 395 | + ralink,function = "pa"; 396 | + }; 397 | + }; 398 | + }; 399 | + 400 | + gpio-keys-polled { 401 | + compatible = "gpio-keys-polled"; 402 | + #address-cells = <1>; 403 | + #size-cells = <0>; 404 | + poll-interval = <20>; 405 | + 406 | + reset { 407 | + label = "reset"; 408 | + gpios = <&gpio0 12 1>; 409 | + linux,code = <0x198>; 410 | + }; 411 | + }; 412 | + 413 | + gpio_export { 414 | + compatible = "gpio-export"; 415 | + #size-cells = <0>; 416 | + 417 | + usbpower { 418 | + gpio-export,name = "usbpower"; 419 | + gpio-export,output = <1>; 420 | + gpios = <&gpio0 13 0>; 421 | + }; 422 | + }; 423 | +}; 424 | Index: target/linux/ramips/image/Makefile 425 | =================================================================== 426 | --- target/linux/ramips/image/Makefile.orig 2014-09-21 16:32:37.000000000 +0800 427 | +++ target/linux/ramips/image/Makefile 2018-12-19 12:40:43.914978129 +0800 428 | @@ -724,6 +724,9 @@ 429 | na930_mtd_size=20971520 430 | Image/Build/Profile/NA930=$(call BuildFirmware/CustomFlash/$(1),$(1),na930,NA930,$(na930_mtd_size)) 431 | Image/Build/Profile/MZK-750DHP=$(call BuildFirmware/Default8M/$(1),$(1),mzk-750dhp,MZK-750DHP) 432 | +Image/Build/Profile/HC5661=$(call BuildFirmware/Default16M/$(1),$(1),hc5661,HC5661) 433 | +Image/Build/Profile/HC5761=$(call BuildFirmware/Default16M/$(1),$(1),hc5761,HC5761) 434 | +Image/Build/Profile/HC5861=$(call BuildFirmware/Default16M/$(1),$(1),hc5861,HC5861) 435 | Image/Build/Profile/Y1=$(call BuildFirmware/Default16M/$(1),$(1),Lenovo-y1,Y1) 436 | Image/Build/Profile/Y1S=$(call BuildFirmware/Default16M/$(1),$(1),Lenovo-y1s,Y1S) 437 | 438 | @@ -740,6 +743,9 @@ 439 | $(call Image/Build/Profile/WHR1166D,$(1)) 440 | $(call Image/Build/Profile/MZK-750DHP,$(1)) 441 | $(call Image/Build/Profile/NA930,$(1)) 442 | + $(call Image/Build/Profile/HC5661,$(1)) 443 | + $(call Image/Build/Profile/HC5761,$(1)) 444 | + $(call Image/Build/Profile/HC5861,$(1)) 445 | $(call Image/Build/Profile/Y1,$(1)) 446 | $(call Image/Build/Profile/Y1S,$(1)) 447 | endef 448 | Index: target/linux/ramips/mt7620a/profiles/hiwifi.mk 449 | =================================================================== 450 | --- /dev/null 1970-01-01 00:00:00.000000000 +0000 451 | +++ target/linux/ramips/mt7620a/profiles/hiwifi.mk 2018-12-19 12:40:43.914978129 +0800 452 | @@ -0,0 +1,47 @@ 453 | +# 454 | +# Copyright (C) 2015 OpenWrt.org 455 | +# 456 | +# This is free software, licensed under the GNU General Public License v2. 457 | +# See /LICENSE for more information. 458 | +# 459 | + 460 | +define Profile/HC5661 461 | + NAME:=HiWiFi HC5661 462 | + PACKAGES:=\ 463 | + kmod-usb-core kmod-usb-dwc2 kmod-usb2 \ 464 | + kmod-mmc-spi kmod-sdhci kmod-sdhci-mt7620 \ 465 | + kmod-ledtrig-usbdev 466 | +endef 467 | + 468 | +define Profile/HC5661/Description 469 | + Support HiWiFi HC5661 model(J1S) 470 | +endef 471 | +$(eval $(call Profile,HC5661)) 472 | + 473 | + 474 | +define Profile/HC5761 475 | + NAME:=HiWiFi HC5761 476 | + PACKAGES:=\ 477 | + kmod-usb-core kmod-usb-dwc2 kmod-usb2 \ 478 | + kmod-mmc-spi kmod-sdhci kmod-sdhci-mt7620 \ 479 | + kmod-ledtrig-usbdev 480 | +endef 481 | + 482 | +define Profile/HC5761/Description 483 | + Support HiWiFi HC5761 model(J2) 484 | +endef 485 | +$(eval $(call Profile,HC5761)) 486 | + 487 | + 488 | +define Profile/HC5861 489 | + NAME:=HiWiFi HC5861 490 | + PACKAGES:=\ 491 | + kmod-usb-core kmod-usb-dwc2 kmod-usb2 \ 492 | + kmod-mmc-spi kmod-sdhci kmod-sdhci-mt7620 \ 493 | + kmod-ledtrig-usbdev 494 | +endef 495 | + 496 | +define Profile/HC5861/Description 497 | + Support HiWiFi HC5861 model(J3) 498 | +endef 499 | +$(eval $(call Profile,HC5861)) 500 | -------------------------------------------------------------------------------- /patches/10-odhcpd-nodnsv6.patch: -------------------------------------------------------------------------------- 1 | Index: package/network/services/odhcpd/patches/100-nodnsv6-opts.patch 2 | =================================================================== 3 | --- package/network/services/odhcpd/patches/100-nodnsv6-opts.patch (revision 0) 4 | +++ package/network/services/odhcpd/patches/100-nodnsv6-opts.patch (revision 0) 5 | @@ -0,0 +1,30 @@ 6 | +--- a/src/dhcpv6.c 7 | ++++ b/src/dhcpv6.c 8 | +@@ -283,6 +283,13 @@ 9 | + [IOV_RELAY_MSG] = {NULL, 0} 10 | + }; 11 | + 12 | ++ if (getenv("NODNSV6")) { 13 | ++ iov[IOV_DNS].iov_len = 0; 14 | ++ iov[IOV_DNS_ADDR].iov_len = 0; 15 | ++ iov[IOV_SEARCH].iov_len = 0; 16 | ++ iov[IOV_SEARCH_DOMAIN].iov_len = 0; 17 | ++ } 18 | ++ 19 | + uint8_t *opts = (uint8_t*)&hdr[1], *opts_end = (uint8_t*)data + len; 20 | + if (hdr->msg_type == DHCPV6_MSG_RELAY_FORW) 21 | + handle_nested_message(data, len, &opts, &opts_end, iov); 22 | +--- a/src/router.c 23 | ++++ b/src/router.c 24 | +@@ -443,6 +443,11 @@ 25 | + {&dns, (dns_cnt) ? sizeof(dns) : 0}, 26 | + {dns_addr, dns_cnt * sizeof(*dns_addr)}, 27 | + {search, search->len * 8}}; 28 | ++ if (getenv("NODNSV6")) { 29 | ++ iov[2].iov_len = 0; 30 | ++ iov[3].iov_len = 0; 31 | ++ iov[4].iov_len = 0; 32 | ++ } 33 | + struct sockaddr_in6 all_nodes = {AF_INET6, 0, 0, ALL_IPV6_NODES, 0}; 34 | + odhcpd_send(router_event.uloop.fd, 35 | + &all_nodes, iov, ARRAY_SIZE(iov), iface); 36 | Index: package/network/services/odhcpd/files/odhcpd.init 37 | =================================================================== 38 | --- package/network/services/odhcpd/files/odhcpd.init (revision 43166) 39 | +++ package/network/services/odhcpd/files/odhcpd.init (working copy) 40 | @@ -7,6 +7,7 @@ 41 | start_service() { 42 | procd_open_instance 43 | procd_set_param command /usr/sbin/odhcpd 44 | + procd_set_param env NODNSV6=Y 45 | procd_set_param respawn 46 | procd_close_instance 47 | } 48 | -------------------------------------------------------------------------------- /patches/11-enable-dnsmasq-ipset.patch: -------------------------------------------------------------------------------- 1 | Index: package/network/services/dnsmasq/Makefile 2 | =================================================================== 3 | --- package/network/services/dnsmasq/Makefile (revision 43770) 4 | +++ package/network/services/dnsmasq/Makefile (working copy) 5 | @@ -88,7 +88,7 @@ 6 | COPTS += -DHAVE_DNSSEC 7 | COPTS += $(if $(CONFIG_LIBNETTLE_MINI),-DNO_GMP,) 8 | else 9 | - COPTS += -DNO_AUTH -DNO_IPSET 10 | + COPTS += -DNO_AUTH 11 | endif 12 | 13 | MAKE_FLAGS := \ 14 | -------------------------------------------------------------------------------- /patches/12-disable-pdnsd.patch: -------------------------------------------------------------------------------- 1 | Index: target/linux/ramips/base-files/etc/uci-defaults/disable-pdnsd 2 | =================================================================== 3 | --- target/linux/ramips/base-files/etc/uci-defaults/disable-pdnsd (revision 0) 4 | +++ target/linux/ramips/base-files/etc/uci-defaults/disable-pdnsd (revision 0) 5 | @@ -0,0 +1,2 @@ 6 | +#!/bin/sh 7 | +[ -x /etc/init.d/pdnsd ] && /etc/init.d/pdnsd disable 8 | -------------------------------------------------------------------------------- /recovery.bin/Makefile: -------------------------------------------------------------------------------- 1 | # 2 | # 3 | KDIR = $(shell ls -d ../openwrt-ramips/build_dir/target-mipsel_*)/linux-ramips_mt7620a 4 | HOSTBIN = ../openwrt-ramips/staging_dir/host/bin 5 | 6 | all: openwrt-HC5761-recovery.bin openwrt-HC5661-recovery.bin 7 | ln -sf $< recovery.bin 8 | @echo "" 9 | @echo ">>>> Final images in 'recovery.bin' format:" 10 | @echo ">>>> $^" 11 | 12 | openwrt-HC5661-recovery.bin: vmlinux-mt7620a root.squashfs 13 | # $(HOSTBIN)/patch-cmdline vmlinux-mt7620a "board=HC5661 console=ttyS1,115200" 14 | $(HOSTBIN)/lzma e vmlinux-mt7620a -lc1 -lp2 -pb2 vmlinux-HC5661.bin.lzma 15 | $(HOSTBIN)/mkimage -A mips -O linux -T kernel -C lzma -a 0x80000000 -e 0x80000000 \ 16 | -n "HC5661" -d vmlinux-HC5661.bin.lzma vmlinux-HC5661.uImage 17 | 18 | cat vmlinux-HC5661.uImage root.squashfs > openwrt-HC5661-sysupgrade.bin 19 | $(HOSTBIN)/padjffs2 openwrt-HC5661-sysupgrade.bin 4 8 16 64 128 256 20 | 21 | @if [ `stat -c%s openwrt-HC5661-sysupgrade.bin` -gt 16318464 ]; then \ 22 | echo "Warning: sysupgrade image is too big"; \ 23 | exit 1; \ 24 | fi 25 | 26 | @( \ 27 | dd if=openwrt-HC5661-uboot.bin bs=327680 conv=sync || exit 1; \ 28 | dd if=openwrt-HC5661-sysupgrade.bin || exit 1; \ 29 | ) > $@ || ( rm -vf $@; exit 1 ); 30 | 31 | openwrt-HC5761-recovery.bin: vmlinux-mt7620a root.squashfs 32 | # $(HOSTBIN)/patch-cmdline vmlinux-mt7620a "board=HC5761 console=ttyS1,115200" 33 | $(HOSTBIN)/lzma e vmlinux-mt7620a -lc1 -lp2 -pb2 vmlinux-HC5761.bin.lzma 34 | $(HOSTBIN)/mkimage -A mips -O linux -T kernel -C lzma -a 0x80000000 -e 0x80000000 \ 35 | -n "HC5761" -d vmlinux-HC5761.bin.lzma vmlinux-HC5761.uImage 36 | 37 | cat vmlinux-HC5761.uImage root.squashfs > openwrt-HC5761-sysupgrade.bin 38 | $(HOSTBIN)/padjffs2 openwrt-HC5761-sysupgrade.bin 4 8 16 64 128 256 39 | 40 | @if [ `stat -c%s openwrt-HC5761-sysupgrade.bin` -gt 16318464 ]; then \ 41 | echo "Warning: sysupgrade image is too big"; \ 42 | exit 1; \ 43 | fi 44 | 45 | @( \ 46 | dd if=openwrt-HC5761-uboot.bin bs=327680 conv=sync || exit 1; \ 47 | dd if=openwrt-HC5761-sysupgrade.bin || exit 1; \ 48 | ) > $@ || ( rm -vf $@; exit 1 ); 49 | 50 | vmlinux-mt7620a: $(KDIR)/vmlinux-hiwifi-hc5761 51 | cp -vf $< $@ 52 | 53 | root.squashfs: $(KDIR)/root.squashfs 54 | cp -vf $< $@ 55 | 56 | clean: 57 | rm -vf vmlinux-mt7620a root.squashfs vmlinux-HC5?61.bin.lzma vmlinux-HC5?61.uImage *-sysupgrade.bin *recovery.bin 58 | 59 | -------------------------------------------------------------------------------- /recovery.bin/openwrt-HC5661-uboot.bin: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/rssnsj/openwrt-hc5x61/883bf60357694dc9a397a90dd9c3b3aeaa118762/recovery.bin/openwrt-HC5661-uboot.bin -------------------------------------------------------------------------------- /recovery.bin/openwrt-HC5761-uboot.bin: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/rssnsj/openwrt-hc5x61/883bf60357694dc9a397a90dd9c3b3aeaa118762/recovery.bin/openwrt-HC5761-uboot.bin -------------------------------------------------------------------------------- /recovery.bin/tftpd32.exe: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/rssnsj/openwrt-hc5x61/883bf60357694dc9a397a90dd9c3b3aeaa118762/recovery.bin/tftpd32.exe -------------------------------------------------------------------------------- /recovery.bin/tftpd64.exe: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/rssnsj/openwrt-hc5x61/883bf60357694dc9a397a90dd9c3b3aeaa118762/recovery.bin/tftpd64.exe --------------------------------------------------------------------------------