mirror of
				https://github.com/Telecominfraproject/wlan-ap.git
				synced 2025-10-31 18:38:10 +00:00 
			
		
		
		
	Compare commits
	
		
			157 Commits
		
	
	
		
			v1.0.0-rc1
			...
			v1.2.0
		
	
	| Author | SHA1 | Date | |
|---|---|---|---|
|   | f4e483f7b4 | ||
|   | 4beda3ab66 | ||
|   | 3531b884c1 | ||
|   | 5ef0556406 | ||
|   | bdbf536c85 | ||
|   | 80bfd39857 | ||
|   | d3f8a54de5 | ||
|   | 8bec57d411 | ||
|   | 36b10b5048 | ||
|   | a019801c15 | ||
|   | dee3bd0d76 | ||
|   | 8d09f695a2 | ||
|   | 3a195281a9 | ||
|   | ce33028760 | ||
|   | d5320b26c2 | ||
|   | 0d48934f34 | ||
|   | 0ec23e8dba | ||
|   | 0d1096b754 | ||
|   | de16ed3a49 | ||
|   | 7436923e62 | ||
|   | f49c70d864 | ||
|   | b613c1815a | ||
|   | 11af12a786 | ||
|   | 17f86797d7 | ||
|   | 29290b5b85 | ||
|   | 9796b90bf3 | ||
|   | bf5fac9d97 | ||
|   | 52867a65b4 | ||
|   | 95f43d6da0 | ||
|   | 60072a8ad6 | ||
|   | 6ca49d80fc | ||
|   | 3cefdead18 | ||
|   | f5470bf439 | ||
|   | 519898ea3b | ||
|   | dedbb75ae6 | ||
|   | 837b4511a1 | ||
|   | bab7b18724 | ||
|   | 5bf882b0e0 | ||
|   | 0546954693 | ||
|   | b6743c34ee | ||
|   | 72fa379804 | ||
|   | d852dcc8f2 | ||
|   | 31abbf39ae | ||
|   | 63443bae1d | ||
|   | 4662b33549 | ||
|   | 7614fc335b | ||
|   | 208b016570 | ||
|   | 78b1f77a53 | ||
|   | d6d45ba609 | ||
|   | bebf6d322d | ||
|   | e8418c0c54 | ||
|   | 1b45173b32 | ||
|   | 29344abf3e | ||
|   | 39bd8f30c0 | ||
|   | 1791870562 | ||
|   | b2a9e6316c | ||
|   | 463f903992 | ||
|   | 547fb36d78 | ||
|   | b9e54ac20e | ||
|   | 490adac587 | ||
|   | 8a69771074 | ||
|   | cfba41d7cc | ||
|   | e6bb6f7d4f | ||
|   | c0cb6baa89 | ||
|   | 28bc1daeac | ||
|   | 80f67521f8 | ||
|   | 7569b618ff | ||
|   | 3881ec638b | ||
|   | b71059cce6 | ||
|   | f68851cc75 | ||
|   | 34c9006ede | ||
|   | e528b832bb | ||
|   | 89640188c9 | ||
|   | 4403a913ca | ||
|   | 60bff767d2 | ||
|   | 53ad416396 | ||
|   | ebaa9b25ce | ||
|   | aea505ddf9 | ||
|   | 94bcfaf93f | ||
|   | ed9379af7b | ||
|   | 25e7374680 | ||
|   | 167d2828b0 | ||
|   | e71df5ebe4 | ||
|   | d7b413bd0e | ||
|   | a1ff0f90f6 | ||
|   | a71436d27c | ||
|   | 915041e40f | ||
|   | 5a5bdac405 | ||
|   | 82e7af0c77 | ||
|   | d3695266fc | ||
|   | d40e1f9d13 | ||
|   | acc7a24464 | ||
|   | 327b85b44a | ||
|   | 811f5e60aa | ||
|   | 93baf6d334 | ||
|   | 63f602a136 | ||
|   | 49383f1c01 | ||
|   | 7ac036af0a | ||
|   | 666e740e0b | ||
|   | 58572f81ae | ||
|   | 0c621a4da1 | ||
|   | b0a660ba31 | ||
|   | 5613bbb6f3 | ||
|   | 7ec23942a0 | ||
|   | 655d284a8f | ||
|   | 593f654d3c | ||
|   | 6021a14426 | ||
|   | 482cfee8d5 | ||
|   | 3fc41fac2c | ||
|   | 8b5e2058f3 | ||
|   | 5815e883a0 | ||
|   | cc8e30e1d4 | ||
|   | e5bc8c9550 | ||
|   | a91e00337c | ||
|   | b4e20e6289 | ||
|   | dd86dfceb0 | ||
|   | 42a87e7fa4 | ||
|   | 315e953110 | ||
|   | fa5c8b06ef | ||
|   | 5d8ce34973 | ||
|   | b717b1361d | ||
|   | 45dcf6a878 | ||
|   | 0fb8809a28 | ||
|   | 077009a263 | ||
|   | 5feaee3327 | ||
|   | 077e1cda3c | ||
|   | 9cb289b605 | ||
|   | bc9f8ba1a7 | ||
|   | 97632b83d6 | ||
|   | 9d7beae903 | ||
|   | ea470687cc | ||
|   | 153e459040 | ||
|   | a9665a0d32 | ||
|   | debb9aad7f | ||
|   | 58793d4349 | ||
|   | c7157c7e9d | ||
|   | 068a6b787a | ||
|   | a886575bce | ||
|   | 8dd73a8c1c | ||
|   | 2cc526b379 | ||
|   | 56f51c8055 | ||
|   | 9598e68a2b | ||
|   | 8d395d868f | ||
|   | d2eaffae16 | ||
|   | ca7b766171 | ||
|   | 9d13fc7330 | ||
|   | 34b495c94c | ||
|   | 623afeafd3 | ||
|   | 799d5bfe9b | ||
|   | 5a57c8e2b1 | ||
|   | 685c25424a | ||
|   | c6ebc8bec7 | ||
|   | 79a65c2985 | ||
|   | 00d39a0835 | ||
|   | d2873b935e | ||
|   | 9215aac0f9 | ||
|   | 63e48453c8 | 
							
								
								
									
										28
									
								
								.github/workflows/build.yml
									
									
									
									
										vendored
									
									
								
							
							
						
						
									
										28
									
								
								.github/workflows/build.yml
									
									
									
									
										vendored
									
									
								
							| @@ -3,6 +3,8 @@ name: Build OpenWrt with OpenSync | |||||||
| on: | on: | ||||||
|   push: |   push: | ||||||
|     branches: [ trunk ] |     branches: [ trunk ] | ||||||
|  |     tags: | ||||||
|  |       - '*' | ||||||
|  |  | ||||||
| jobs: | jobs: | ||||||
|   build-ea8300: |   build-ea8300: | ||||||
| @@ -19,6 +21,8 @@ jobs: | |||||||
|           GH_BUILD_PASSWORD: ${{ secrets.GH_BUILD_PASSWORD }} |           GH_BUILD_PASSWORD: ${{ secrets.GH_BUILD_PASSWORD }} | ||||||
|       run: | |       run: | | ||||||
|         TAG=$(date +%Y-%m-%d)-$(git rev-parse --short HEAD) |         TAG=$(date +%Y-%m-%d)-$(git rev-parse --short HEAD) | ||||||
|  |         [[ "${{ github.ref }}" == "refs/tags/"* ]] && TAG=$(echo "${{ github.ref }}" | sed 's/refs\/tags\/[v]//') | ||||||
|  |  | ||||||
|         echo "ea8300-$TAG" > feeds/wlan-ap/opensync/src/vendor/tip/.pkgname |         echo "ea8300-$TAG" > feeds/wlan-ap/opensync/src/vendor/tip/.pkgname | ||||||
|         make TARGET=IPQ40XX |         make TARGET=IPQ40XX | ||||||
|         TAR_NAME="ea8300-artifacts-$TAG.tar.gz" |         TAR_NAME="ea8300-artifacts-$TAG.tar.gz" | ||||||
| @@ -42,6 +46,8 @@ jobs: | |||||||
|           GH_BUILD_PASSWORD: ${{ secrets.GH_BUILD_PASSWORD }} |           GH_BUILD_PASSWORD: ${{ secrets.GH_BUILD_PASSWORD }} | ||||||
|       run: | |       run: | | ||||||
|         TAG=$(date +%Y-%m-%d)-$(git rev-parse --short HEAD) |         TAG=$(date +%Y-%m-%d)-$(git rev-parse --short HEAD) | ||||||
|  |         [[ "${{ github.ref }}" == "refs/tags/"* ]] && TAG=$(echo "${{ github.ref }}" | sed 's/refs\/tags\/[v]//') | ||||||
|  |  | ||||||
|         echo "ecw5410-$TAG" > feeds/wlan-ap/opensync/src/vendor/tip/.pkgname |         echo "ecw5410-$TAG" > feeds/wlan-ap/opensync/src/vendor/tip/.pkgname | ||||||
|         make TARGET=ECW5410 |         make TARGET=ECW5410 | ||||||
|         TAR_NAME="ecw5410-artifacts-$TAG.tar.gz" |         TAR_NAME="ecw5410-artifacts-$TAG.tar.gz" | ||||||
| @@ -65,6 +71,8 @@ jobs: | |||||||
|           GH_BUILD_PASSWORD: ${{ secrets.GH_BUILD_PASSWORD }} |           GH_BUILD_PASSWORD: ${{ secrets.GH_BUILD_PASSWORD }} | ||||||
|       run: | |       run: | | ||||||
|         TAG=$(date +%Y-%m-%d)-$(git rev-parse --short HEAD) |         TAG=$(date +%Y-%m-%d)-$(git rev-parse --short HEAD) | ||||||
|  |         [[ "${{ github.ref }}" == "refs/tags/"* ]] && TAG=$(echo "${{ github.ref }}" | sed 's/refs\/tags\/[v]//') | ||||||
|  |  | ||||||
|         echo "ap2220-$TAG" > feeds/wlan-ap/opensync/src/vendor/tip/.pkgname |         echo "ap2220-$TAG" > feeds/wlan-ap/opensync/src/vendor/tip/.pkgname | ||||||
|         make TARGET=AP2220 |         make TARGET=AP2220 | ||||||
|         TAR_NAME="ap2220-artifacts-$TAG.tar.gz" |         TAR_NAME="ap2220-artifacts-$TAG.tar.gz" | ||||||
| @@ -88,6 +96,8 @@ jobs: | |||||||
|           GH_BUILD_PASSWORD: ${{ secrets.GH_BUILD_PASSWORD }} |           GH_BUILD_PASSWORD: ${{ secrets.GH_BUILD_PASSWORD }} | ||||||
|       run: | |       run: | | ||||||
|         TAG=$(date +%Y-%m-%d)-$(git rev-parse --short HEAD) |         TAG=$(date +%Y-%m-%d)-$(git rev-parse --short HEAD) | ||||||
|  |         [[ "${{ github.ref }}" == "refs/tags/"* ]] && TAG=$(echo "${{ github.ref }}" | sed 's/refs\/tags\/[v]//') | ||||||
|  |  | ||||||
|         echo "ecw5211-$TAG" > feeds/wlan-ap/opensync/src/vendor/tip/.pkgname |         echo "ecw5211-$TAG" > feeds/wlan-ap/opensync/src/vendor/tip/.pkgname | ||||||
|         make TARGET=ECW5211 |         make TARGET=ECW5211 | ||||||
|         TAR_NAME="ecw5211-artifacts-$TAG.tar.gz" |         TAR_NAME="ecw5211-artifacts-$TAG.tar.gz" | ||||||
| @@ -111,6 +121,8 @@ jobs: | |||||||
|           GH_BUILD_PASSWORD: ${{ secrets.GH_BUILD_PASSWORD }} |           GH_BUILD_PASSWORD: ${{ secrets.GH_BUILD_PASSWORD }} | ||||||
|       run: | |       run: | | ||||||
|         TAG=$(date +%Y-%m-%d)-$(git rev-parse --short HEAD) |         TAG=$(date +%Y-%m-%d)-$(git rev-parse --short HEAD) | ||||||
|  |         [[ "${{ github.ref }}" == "refs/tags/"* ]] && TAG=$(echo "${{ github.ref }}" | sed 's/refs\/tags\/[v]//') | ||||||
|  |  | ||||||
|         echo "ec420-$TAG" > feeds/wlan-ap/opensync/src/vendor/tip/.pkgname |         echo "ec420-$TAG" > feeds/wlan-ap/opensync/src/vendor/tip/.pkgname | ||||||
|         make TARGET=EC420 |         make TARGET=EC420 | ||||||
|         TAR_NAME="ec420-artifacts-$TAG.tar.gz" |         TAR_NAME="ec420-artifacts-$TAG.tar.gz" | ||||||
| @@ -134,6 +146,8 @@ jobs: | |||||||
|           GH_BUILD_PASSWORD: ${{ secrets.GH_BUILD_PASSWORD }} |           GH_BUILD_PASSWORD: ${{ secrets.GH_BUILD_PASSWORD }} | ||||||
|       run: | |       run: | | ||||||
|         TAG=$(date +%Y-%m-%d)-$(git rev-parse --short HEAD) |         TAG=$(date +%Y-%m-%d)-$(git rev-parse --short HEAD) | ||||||
|  |         [[ "${{ github.ref }}" == "refs/tags/"* ]] && TAG=$(echo "${{ github.ref }}" | sed 's/refs\/tags\/[v]//') | ||||||
|  |  | ||||||
|         echo "eap101-$TAG" > feeds/wlan-ap/opensync/src/vendor/tip/.pkgname |         echo "eap101-$TAG" > feeds/wlan-ap/opensync/src/vendor/tip/.pkgname | ||||||
|         make TARGET=EAP101 |         make TARGET=EAP101 | ||||||
|         TAR_NAME="eap101-artifacts-$TAG.tar.gz" |         TAR_NAME="eap101-artifacts-$TAG.tar.gz" | ||||||
| @@ -157,6 +171,8 @@ jobs: | |||||||
|           GH_BUILD_PASSWORD: ${{ secrets.GH_BUILD_PASSWORD }} |           GH_BUILD_PASSWORD: ${{ secrets.GH_BUILD_PASSWORD }} | ||||||
|       run: | |       run: | | ||||||
|         TAG=$(date +%Y-%m-%d)-$(git rev-parse --short HEAD) |         TAG=$(date +%Y-%m-%d)-$(git rev-parse --short HEAD) | ||||||
|  |         [[ "${{ github.ref }}" == "refs/tags/"* ]] && TAG=$(echo "${{ github.ref }}" | sed 's/refs\/tags\/[v]//') | ||||||
|  |  | ||||||
|         echo "eap102-$TAG" > feeds/wlan-ap/opensync/src/vendor/tip/.pkgname |         echo "eap102-$TAG" > feeds/wlan-ap/opensync/src/vendor/tip/.pkgname | ||||||
|         make TARGET=EAP102 |         make TARGET=EAP102 | ||||||
|         TAR_NAME="eap102-artifacts-$TAG.tar.gz" |         TAR_NAME="eap102-artifacts-$TAG.tar.gz" | ||||||
| @@ -180,6 +196,8 @@ jobs: | |||||||
|           GH_BUILD_PASSWORD: ${{ secrets.GH_BUILD_PASSWORD }} |           GH_BUILD_PASSWORD: ${{ secrets.GH_BUILD_PASSWORD }} | ||||||
|       run: | |       run: | | ||||||
|         TAG=$(date +%Y-%m-%d)-$(git rev-parse --short HEAD) |         TAG=$(date +%Y-%m-%d)-$(git rev-parse --short HEAD) | ||||||
|  |         [[ "${{ github.ref }}" == "refs/tags/"* ]] && TAG=$(echo "${{ github.ref }}" | sed 's/refs\/tags\/[v]//') | ||||||
|  |  | ||||||
|         echo "wf188n-$TAG" > feeds/wlan-ap/opensync/src/vendor/tip/.pkgname |         echo "wf188n-$TAG" > feeds/wlan-ap/opensync/src/vendor/tip/.pkgname | ||||||
|         make TARGET=WF188N |         make TARGET=WF188N | ||||||
|         TAR_NAME="wf188n-artifacts-$TAG.tar.gz" |         TAR_NAME="wf188n-artifacts-$TAG.tar.gz" | ||||||
| @@ -203,6 +221,8 @@ jobs: | |||||||
|           GH_BUILD_PASSWORD: ${{ secrets.GH_BUILD_PASSWORD }} |           GH_BUILD_PASSWORD: ${{ secrets.GH_BUILD_PASSWORD }} | ||||||
|       run: | |       run: | | ||||||
|         TAG=$(date +%Y-%m-%d)-$(git rev-parse --short HEAD) |         TAG=$(date +%Y-%m-%d)-$(git rev-parse --short HEAD) | ||||||
|  |         [[ "${{ github.ref }}" == "refs/tags/"* ]] && TAG=$(echo "${{ github.ref }}" | sed 's/refs\/tags\/[v]//') | ||||||
|  |  | ||||||
|         echo "wf194c-$TAG" > feeds/wlan-ap/opensync/src/vendor/tip/.pkgname |         echo "wf194c-$TAG" > feeds/wlan-ap/opensync/src/vendor/tip/.pkgname | ||||||
|         make TARGET=WF194C |         make TARGET=WF194C | ||||||
|         TAR_NAME="wf194c-artifacts-$TAG.tar.gz" |         TAR_NAME="wf194c-artifacts-$TAG.tar.gz" | ||||||
| @@ -226,6 +246,8 @@ jobs: | |||||||
|           GH_BUILD_PASSWORD: ${{ secrets.GH_BUILD_PASSWORD }} |           GH_BUILD_PASSWORD: ${{ secrets.GH_BUILD_PASSWORD }} | ||||||
|       run: | |       run: | | ||||||
|         TAG=$(date +%Y-%m-%d)-$(git rev-parse --short HEAD) |         TAG=$(date +%Y-%m-%d)-$(git rev-parse --short HEAD) | ||||||
|  |         [[ "${{ github.ref }}" == "refs/tags/"* ]] && TAG=$(echo "${{ github.ref }}" | sed 's/refs\/tags\/[v]//') | ||||||
|  |  | ||||||
|         echo "wf610d-$TAG" > feeds/wlan-ap/opensync/src/vendor/tip/.pkgname |         echo "wf610d-$TAG" > feeds/wlan-ap/opensync/src/vendor/tip/.pkgname | ||||||
|         make TARGET=WF610D |         make TARGET=WF610D | ||||||
|         TAR_NAME="wf610d-artifacts-$TAG.tar.gz" |         TAR_NAME="wf610d-artifacts-$TAG.tar.gz" | ||||||
| @@ -249,6 +271,8 @@ jobs: | |||||||
|           GH_BUILD_PASSWORD: ${{ secrets.GH_BUILD_PASSWORD }} |           GH_BUILD_PASSWORD: ${{ secrets.GH_BUILD_PASSWORD }} | ||||||
|       run: | |       run: | | ||||||
|         TAG=$(date +%Y-%m-%d)-$(git rev-parse --short HEAD) |         TAG=$(date +%Y-%m-%d)-$(git rev-parse --short HEAD) | ||||||
|  |         [[ "${{ github.ref }}" == "refs/tags/"* ]] && TAG=$(echo "${{ github.ref }}" | sed 's/refs\/tags\/[v]//') | ||||||
|  |  | ||||||
|         echo "ex227-$TAG" > feeds/wlan-ap/opensync/src/vendor/tip/.pkgname |         echo "ex227-$TAG" > feeds/wlan-ap/opensync/src/vendor/tip/.pkgname | ||||||
|         make TARGET=EX227 |         make TARGET=EX227 | ||||||
|         TAR_NAME="ex227-artifacts-$TAG.tar.gz" |         TAR_NAME="ex227-artifacts-$TAG.tar.gz" | ||||||
| @@ -272,6 +296,8 @@ jobs: | |||||||
|           GH_BUILD_PASSWORD: ${{ secrets.GH_BUILD_PASSWORD }} |           GH_BUILD_PASSWORD: ${{ secrets.GH_BUILD_PASSWORD }} | ||||||
|       run: | |       run: | | ||||||
|         TAG=$(date +%Y-%m-%d)-$(git rev-parse --short HEAD) |         TAG=$(date +%Y-%m-%d)-$(git rev-parse --short HEAD) | ||||||
|  |         [[ "${{ github.ref }}" == "refs/tags/"* ]] && TAG=$(echo "${{ github.ref }}" | sed 's/refs\/tags\/[v]//') | ||||||
|  |  | ||||||
|         echo "ex447-$TAG" > feeds/wlan-ap/opensync/src/vendor/tip/.pkgname |         echo "ex447-$TAG" > feeds/wlan-ap/opensync/src/vendor/tip/.pkgname | ||||||
|         make TARGET=EX447 |         make TARGET=EX447 | ||||||
|         TAR_NAME="ex447-artifacts-$TAG.tar.gz" |         TAR_NAME="ex447-artifacts-$TAG.tar.gz" | ||||||
| @@ -280,5 +306,3 @@ jobs: | |||||||
|         UPGRADE_TAR_NAME="ex447-$TAG.tar.gz" |         UPGRADE_TAR_NAME="ex447-$TAG.tar.gz" | ||||||
|         tar cfz "$UPGRADE_TAR_NAME" -C openwrt/bin/targets/ipq807x/ipq807x $(find openwrt/bin/targets/ipq807x/ipq807x -type f \( -name '*sysupgrade*' -o -name 'sha256sums' \) -printf "%f\n") |         tar cfz "$UPGRADE_TAR_NAME" -C openwrt/bin/targets/ipq807x/ipq807x $(find openwrt/bin/targets/ipq807x/ipq807x -type f \( -name '*sysupgrade*' -o -name 'sha256sums' \) -printf "%f\n") | ||||||
|         curl -u "$GH_BUILD_USERNAME":"$GH_BUILD_PASSWORD" -T "$UPGRADE_TAR_NAME" "https://tip.jfrog.io/artifactory/tip-wlan-ap-firmware/ex447/trunk/"$UPGRADE_TAR_NAME"" |         curl -u "$GH_BUILD_USERNAME":"$GH_BUILD_PASSWORD" -T "$UPGRADE_TAR_NAME" "https://tip.jfrog.io/artifactory/tip-wlan-ap-firmware/ex447/trunk/"$UPGRADE_TAR_NAME"" | ||||||
|  |  | ||||||
|  |  | ||||||
|   | |||||||
							
								
								
									
										626
									
								
								feeds/ipq807x/qca-nss-clients/Makefile
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										626
									
								
								feeds/ipq807x/qca-nss-clients/Makefile
									
									
									
									
									
										Normal file
									
								
							| @@ -0,0 +1,626 @@ | |||||||
|  | include $(TOPDIR)/rules.mk | ||||||
|  | include $(INCLUDE_DIR)/kernel.mk | ||||||
|  |  | ||||||
|  | PKG_NAME:=qca-nss-clients | ||||||
|  | PKG_SOURCE_PROTO:=git | ||||||
|  | PKG_BRANCH:=master | ||||||
|  | PKG_RELEASE:=2 | ||||||
|  | PKG_SOURCE_URL:=https://source.codeaurora.org/quic/qsdk/oss/lklm/nss-clients/ | ||||||
|  | PKG_VERSION:=9136ef60bf68ceed760781d3acbeddb05470e432 | ||||||
|  |  | ||||||
|  | PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.gz | ||||||
|  | PKG_SOURCE_SUBDIR:=$(PKG_NAME)-$(PKG_VERSION) | ||||||
|  | PKG_SOURCE_VERSION:=$(PKG_VERSION) | ||||||
|  |  | ||||||
|  | #PKG_BUILD_DEPENDS := PACKAGE_kmod-qca-nss-crypto:kmod-qca-nss-crypto | ||||||
|  | MAKE_OPTS:= | ||||||
|  |  | ||||||
|  | include $(INCLUDE_DIR)/package.mk | ||||||
|  |  | ||||||
|  | # Keep default as ipq806x for branches that does not have subtarget framework | ||||||
|  | ifeq ($(CONFIG_TARGET_ipq),y) | ||||||
|  | subtarget:=$(SUBTARGET) | ||||||
|  | else | ||||||
|  | subtarget:=$(CONFIG_TARGET_BOARD) | ||||||
|  | endif | ||||||
|  |  | ||||||
|  | ifneq (, $(findstring $(subtarget), "ipq807x" "ipq807x_ipq807x" "ipq60xx" "ipq807x_ipq60xx")) | ||||||
|  | # DTLS Manager v2.0 for Hawkeye/Cypress | ||||||
|  |   DTLSMGR_DIR:=v2.0 | ||||||
|  | # IPsec Manager v2.0 for Hawkeye/Cypress | ||||||
|  |   IPSECMGR_DIR:=v2.0 | ||||||
|  | else | ||||||
|  | # DTLS Manager v1.0 for Akronite. | ||||||
|  |   DTLSMGR_DIR:=v1.0 | ||||||
|  | # IPsec Manager v1.0 for Akronite. | ||||||
|  |   IPSECMGR_DIR:=v1.0 | ||||||
|  | endif | ||||||
|  |  | ||||||
|  | define KernelPackage/qca-nss-drv-tun6rd | ||||||
|  |   SECTION:=kernel | ||||||
|  |   CATEGORY:=Kernel modules | ||||||
|  |   SUBMENU:=Network Devices | ||||||
|  |   TITLE:=Kernel driver for NSS (connection manager) - tun6rd | ||||||
|  |   DEPENDS:=+kmod-qca-nss-drv +kmod-sit @!LINUX_3_18 | ||||||
|  |   FILES:=$(PKG_BUILD_DIR)/qca-nss-tun6rd.ko | ||||||
|  |   AUTOLOAD:=$(call AutoLoad,60,qca-nss-tun6rd) | ||||||
|  | endef | ||||||
|  |  | ||||||
|  | define KernelPackage/qca-nss-drv-tun6rd/Description | ||||||
|  | Kernel modules for NSS connection manager - Support for 6rd tunnel | ||||||
|  | endef | ||||||
|  |  | ||||||
|  | define KernelPackage/qca-nss-drv-dtlsmgr | ||||||
|  |   SECTION:=kernel | ||||||
|  |   CATEGORY:=Kernel modules | ||||||
|  |   SUBMENU:=Network Devices | ||||||
|  |   TITLE:=Kernel driver for NSS (connection manager) - dtlsmgr | ||||||
|  |   DEPENDS:=+kmod-qca-nss-drv +kmod-qca-nss-cfi-cryptoapi @!LINUX_3_18 | ||||||
|  |   FILES:=$(PKG_BUILD_DIR)/dtls/$(DTLSMGR_DIR)/qca-nss-dtlsmgr.ko | ||||||
|  | endef | ||||||
|  |  | ||||||
|  | define KernelPackage/qca-nss-drv-dtls/Description | ||||||
|  | Kernel modules for NSS connection manager - Support for DTLS sessions | ||||||
|  | endef | ||||||
|  |  | ||||||
|  | define KernelPackage/qca-nss-drv-tlsmgr | ||||||
|  |   SECTION:=kernel | ||||||
|  |   CATEGORY:=Kernel modules | ||||||
|  |   SUBMENU:=Network Devices | ||||||
|  |   TITLE:=Kernel driver for NSS (connection manager) - tlsmgr | ||||||
|  |   DEPENDS:=@TARGET_ipq_ipq807x||TARGET_ipq_ipq807x_ipq807x||TARGET_ipq807x||TARGET_ipq807x_ipq807x||TARGET_ipq_ipq60xx||TARGET_ipq807x_ipq60xx +kmod-qca-nss-drv +kmod-qca-nss-cfi @!LINUX_3_18 | ||||||
|  |   FILES:=$(PKG_BUILD_DIR)/tls/qca-nss-tlsmgr.ko | ||||||
|  | endef | ||||||
|  |  | ||||||
|  | define KernelPackage/qca-nss-drv-tls/Description | ||||||
|  | Kernel modules for NSS connection manager - Support for TLS sessions | ||||||
|  | endef | ||||||
|  |  | ||||||
|  | define KernelPackage/qca-nss-drv-l2tpv2 | ||||||
|  |   SECTION:=kernel | ||||||
|  |   CATEGORY:=Kernel modules | ||||||
|  |   SUBMENU:=Network Devices | ||||||
|  |   TITLE:=Kernel driver for NSS (connection manager) - l2tp | ||||||
|  |   DEPENDS:=+kmod-qca-nss-drv +kmod-ppp +kmod-l2tp @!LINUX_3_18 | ||||||
|  |   FILES:=$(PKG_BUILD_DIR)/l2tp/l2tpv2/qca-nss-l2tpv2.ko | ||||||
|  |   AUTOLOAD:=$(call AutoLoad,51,qca-nss-l2tpv2) | ||||||
|  | endef | ||||||
|  |  | ||||||
|  | define KernelPackage/qca-nss-drv-l2tp/Description | ||||||
|  | Kernel modules for NSS connection manager - Support for l2tp tunnel | ||||||
|  | endef | ||||||
|  |  | ||||||
|  | define KernelPackage/qca-nss-drv-pptp | ||||||
|  |   SECTION:=kernel | ||||||
|  |   CATEGORY:=Kernel modules | ||||||
|  |   SUBMENU:=Network Devices | ||||||
|  |   TITLE:=Kernel driver for NSS (connection manager) - PPTP | ||||||
|  |   DEPENDS:=+kmod-qca-nss-drv +kmod-pptp @!LINUX_3_18 | ||||||
|  |   FILES:=$(PKG_BUILD_DIR)/pptp/qca-nss-pptp.ko | ||||||
|  |   AUTOLOAD:=$(call AutoLoad,51,qca-nss-pptp) | ||||||
|  | endef | ||||||
|  |  | ||||||
|  | define KernelPackage/qca-nss-drv-pptp/Description | ||||||
|  | Kernel modules for NSS connection manager - Support for PPTP tunnel | ||||||
|  | endef | ||||||
|  |  | ||||||
|  | define KernelPackage/qca-nss-drv-pppoe | ||||||
|  |   SECTION:=kernel | ||||||
|  |   CATEGORY:=Kernel modules | ||||||
|  |   SUBMENU:=Network Devices | ||||||
|  |   TITLE:=Kernel driver for NSS (connection manager) - PPPoE | ||||||
|  |   DEPENDS:=+kmod-qca-nss-drv +kmod-pppoe @!LINUX_3_18 \ | ||||||
|  | 		+!(TARGET_ipq_ipq807x_QSDK_256||TARGET_ipq_ipq60xx_QSDK_256):kmod-bonding | ||||||
|  |   FILES:=$(PKG_BUILD_DIR)/pppoe/qca-nss-pppoe.ko | ||||||
|  |   AUTOLOAD:=$(call AutoLoad,51,qca-nss-pppoe) | ||||||
|  | endef | ||||||
|  |  | ||||||
|  | define KernelPackage/qca-nss-drv-pppoe/Description | ||||||
|  | Kernel modules for NSS connection manager - Support for PPPoE | ||||||
|  | endef | ||||||
|  |  | ||||||
|  | define KernelPackage/qca-nss-drv-map-t | ||||||
|  |   SECTION:=kernel | ||||||
|  |   CATEGORY:=Kernel modules | ||||||
|  |   SUBMENU:=Network Devices | ||||||
|  |   TITLE:=Kernel driver for NSS (connection manager) - MAP-T | ||||||
|  |   DEPENDS:=+kmod-qca-nss-drv +kmod-nat46 @!LINUX_3_18 | ||||||
|  |   FILES:=$(PKG_BUILD_DIR)/map/map-t/qca-nss-map-t.ko | ||||||
|  |   AUTOLOAD:=$(call AutoLoad,51,qca-nss-map-t) | ||||||
|  | endef | ||||||
|  |  | ||||||
|  | define KernelPackage/qca-nss-drv-map-t/Description | ||||||
|  | Kernel modules for NSS connection manager - Support for MAP-T | ||||||
|  | endef | ||||||
|  |  | ||||||
|  | define KernelPackage/qca-nss-drv-gre | ||||||
|  |   SECTION:=kernel | ||||||
|  |   CATEGORY:=Kernel modules | ||||||
|  |   SUBMENU:=Network Devices | ||||||
|  |   TITLE:=Kernel driver for NSS (connection manager) - GRE | ||||||
|  |   DEPENDS:=@TARGET_ipq_ipq806x||TARGET_ipq806x||TARGET_ipq_ipq807x||TARGET_ipq_ipq807x_ipq807x||TARGET_ipq807x||TARGET_ipq807x_ipq807x||TARGET_ipq_ipq60xx||TARGET_ipq807x_ipq60xx||TARGET_ipq_ipq50xx||TARGET_ipq_ipq50xx_64 \ | ||||||
|  | 	   +kmod-qca-nss-drv @!LINUX_3_18 +kmod-gre6 | ||||||
|  |   FILES:=$(PKG_BUILD_DIR)/gre/qca-nss-gre.ko $(PKG_BUILD_DIR)/gre/test/qca-nss-gre-test.ko | ||||||
|  |   AUTOLOAD:=$(call AutoLoad,51,qca-nss-gre) | ||||||
|  | endef | ||||||
|  |  | ||||||
|  | define KernelPackage/qca-nss-drv-gre/Description | ||||||
|  | Kernel modules for NSS connection manager - Support for GRE | ||||||
|  | endef | ||||||
|  |  | ||||||
|  | define KernelPackage/qca-nss-drv-tunipip6 | ||||||
|  |   SECTION:=kernel | ||||||
|  |   CATEGORY:=Kernel modules | ||||||
|  |   SUBMENU:=Network Devices | ||||||
|  |   TITLE:=Kernel driver for NSS (connection manager) - DS-lite and ipip6 Tunnel | ||||||
|  |   DEPENDS:=+kmod-qca-nss-drv +kmod-iptunnel6 +kmod-ip6-tunnel @!LINUX_3_18 | ||||||
|  |   FILES:=$(PKG_BUILD_DIR)/tunipip6/qca-nss-tunipip6.ko | ||||||
|  |   AUTOLOAD:=$(call AutoLoad,60,qca-nss-tunipip6) | ||||||
|  | endef | ||||||
|  |  | ||||||
|  | define KernelPackage/qca-nss-drv-tunipip6/Description | ||||||
|  | Kernel modules for NSS connection manager | ||||||
|  | Add support for DS-lite and ipip6 tunnel | ||||||
|  | endef | ||||||
|  |  | ||||||
|  | define KernelPackage/qca-nss-drv-profile | ||||||
|  |   SECTION:=kernel | ||||||
|  |   CATEGORY:=Kernel modules | ||||||
|  |   SUBMENU:=Network Devices | ||||||
|  |   DEPENDS:=+kmod-qca-nss-drv @!LINUX_3_18 | ||||||
|  |   TITLE:=Profiler for QCA NSS driver (IPQ806x) | ||||||
|  |   FILES:=$(PKG_BUILD_DIR)/profiler/qca-nss-profile-drv.ko | ||||||
|  | endef | ||||||
|  |  | ||||||
|  | define KernelPackage/qca-nss-drv-profile/Description | ||||||
|  | This package contains a NSS driver profiler for QCA chipset | ||||||
|  | endef | ||||||
|  |  | ||||||
|  | define KernelPackage/qca-nss-drv-ipsecmgr | ||||||
|  |   SECTION:=kernel | ||||||
|  |   CATEGORY:=Kernel modules | ||||||
|  |   SUBMENU:=Network Devices | ||||||
|  |   TITLE:=Kernel driver for NSS (ipsec manager) - ipsecmgr | ||||||
|  |   DEPENDS:=@TARGET_ipq806x||TARGET_ipq_ipq806x||TARGET_ipq_ipq807x||TARGET_ipq_ipq807x_ipq807x||TARGET_ipq807x||TARGET_ipq807x_ipq807x||TARGET_ipq_ipq60xx||TARGET_ipq807x_ipq60xx \ | ||||||
|  | 		+kmod-qca-nss-drv +kmod-qca-nss-cfi-cryptoapi +kmod-qca-nss-cfi-ocf @!LINUX_3_18 | ||||||
|  | ifneq ($(CONFIG_PACKAGE_kmod-qca-nss-drv-l2tpv2),) | ||||||
|  |   DEPENDS:=+kmod-qca-nss-drv-l2tpv2 | ||||||
|  | endif | ||||||
|  |   FILES:=$(PKG_BUILD_DIR)/ipsecmgr/$(IPSECMGR_DIR)/qca-nss-ipsecmgr.ko | ||||||
|  |   AUTOLOAD:=$(call AutoLoad,60,qca-nss-ipsecmgr) | ||||||
|  | endef | ||||||
|  |  | ||||||
|  | define KernelPackage/qca-nss-drv-ipsecmgr/Description | ||||||
|  | Kernel module for NSS IPsec offload manager | ||||||
|  | endef | ||||||
|  |  | ||||||
|  | define KernelPackage/qca-nss-drv-ipsecmgr-klips | ||||||
|  |   SECTION:=kernel | ||||||
|  |   CATEGORY:=Kernel modules | ||||||
|  |   SUBMENU:=Network Devices | ||||||
|  |   TITLE:=Kernel driver for NSS (ipsec klips) | ||||||
|  |   DEPENDS:=@TARGET_ipq_ipq807x||TARGET_ipq_ipq807x_ipq807x||TARGET_ipq807x||TARGET_ipq_ipq60xx||TARGET_ipq807x_ipq60xx \ | ||||||
|  | 		+kmod-qca-nss-drv-ipsecmgr kmod-qca-nss-ecm | ||||||
|  |   FILES:=$(PKG_BUILD_DIR)/ipsecmgr/$(IPSECMGR_DIR)/plugins/klips/qca-nss-ipsec-klips.ko | ||||||
|  | endef | ||||||
|  |  | ||||||
|  | define KernelPackage/qca-nss-drv-ipsecmgr-klips/Description | ||||||
|  | NSS Kernel module for IPsec klips offload | ||||||
|  | endef | ||||||
|  |  | ||||||
|  |  | ||||||
|  | define KernelPackage/qca-nss-drv-capwapmgr | ||||||
|  |   SECTION:=kernel | ||||||
|  |   CATEGORY:=Kernel modules | ||||||
|  |   SUBMENU:=Network Devices | ||||||
|  |   DEPENDS:=+kmod-qca-nss-drv +kmod-qca-nss-drv-dtlsmgr @!LINUX_3_18 | ||||||
|  |   TITLE:=NSS CAPWAP Manager for QCA NSS driver (IPQ806x) | ||||||
|  |   FILES:=$(PKG_BUILD_DIR)/capwapmgr/qca-nss-capwapmgr.ko | ||||||
|  | endef | ||||||
|  |  | ||||||
|  | define KernelPackage/qca-nss-drv-capwapmgr/Description | ||||||
|  | This package contains a NSS CAPWAP Manager | ||||||
|  | endef | ||||||
|  |  | ||||||
|  | define KernelPackage/qca-nss-drv-bridge-mgr | ||||||
|  |   SECTION:=kernel | ||||||
|  |   CATEGORY:=Kernel modules | ||||||
|  |   SUBMENU:=Network Devices | ||||||
|  |   TITLE:=Kernel driver for NSS bridge manager | ||||||
|  |   DEPENDS:=@TARGET_ipq_ipq807x||TARGET_ipq_ipq807x_ipq807x||TARGET_ipq807x||TARGET_ipq807x_ipq807x||TARGET_ipq_ipq60xx||TARGET_ipq807x_ipq60xx \ | ||||||
|  | 		+TARGET_ipq_ipq807x:kmod-qca-nss-drv-vlan-mgr \ | ||||||
|  | 		+TARGET_ipq_ipq807x_ipq807x:kmod-qca-nss-drv-vlan-mgr \ | ||||||
|  | 		+TARGET_ipq807x:kmod-qca-nss-drv-vlan-mgr \ | ||||||
|  | 		+TARGET_ipq807x_ipq807x:kmod-qca-nss-drv-vlan-mgr \ | ||||||
|  | 		+TARGET_ipq_ipq60xx:kmod-qca-nss-drv-vlan-mgr \ | ||||||
|  | 		+TARGET_ipq807x_ipq60xx:kmod-qca-nss-drv-vlan-mgr @!LINUX_3_18 \ | ||||||
|  | 		+!(TARGET_ipq_ipq807x_QSDK_256||TARGET_ipq_ipq60xx_QSDK_256):kmod-bonding | ||||||
|  |   FILES:=$(PKG_BUILD_DIR)/bridge/qca-nss-bridge-mgr.ko | ||||||
|  |   AUTOLOAD:=$(call AutoLoad,51,qca-nss-bridge-mgr) | ||||||
|  | endef | ||||||
|  |  | ||||||
|  | define KernelPackage/qca-nss-drv-bridge-mgr/Description | ||||||
|  | Kernel modules for NSS bridge manager | ||||||
|  | endef | ||||||
|  |  | ||||||
|  | define KernelPackage/qca-nss-drv-vlan-mgr | ||||||
|  |   SECTION:=kernel | ||||||
|  |   CATEGORY:=Kernel modules | ||||||
|  |   SUBMENU:=Network Devices | ||||||
|  |   TITLE:=Kernel driver for NSS vlan manager | ||||||
|  |   DEPENDS:=@TARGET_ipq_ipq807x||TARGET_ipq_ipq807x_ipq807x||TARGET_ipq807x||TARGET_ipq807x_ipq807x||TARGET_ipq_ipq60xx||TARGET_ipq807x_ipq60xx +kmod-qca-nss-drv @!LINUX_3_18 \ | ||||||
|  | 		+!(TARGET_ipq_ipq807x_QSDK_256||TARGET_ipq_ipq60xx_QSDK_256):kmod-bonding | ||||||
|  |   FILES:=$(PKG_BUILD_DIR)/vlan/qca-nss-vlan.ko | ||||||
|  |   AUTOLOAD:=$(call AutoLoad,51,qca-nss-vlan) | ||||||
|  | endef | ||||||
|  |  | ||||||
|  | define KernelPackage/qca-nss-drv-vlan-mgr/Description | ||||||
|  | Kernel modules for NSS vlan manager | ||||||
|  | endef | ||||||
|  |  | ||||||
|  | define KernelPackage/qca-nss-drv-qdisc | ||||||
|  |   SECTION:=kernel | ||||||
|  |   CATEGORY:=Kernel modules | ||||||
|  |   SUBMENU:=Network Support | ||||||
|  |   TITLE:=Qdisc for configuring shapers in NSS | ||||||
|  |   DEPENDS:=+kmod-qca-nss-drv @!LINUX_3_18 | ||||||
|  |   FILES:=$(PKG_BUILD_DIR)/nss_qdisc/qca-nss-qdisc.ko | ||||||
|  |   AUTOLOAD:=$(call AutoLoad,58,qca-nss-qdisc) | ||||||
|  | endef | ||||||
|  |  | ||||||
|  | define KernelPackage/qca-nss-drv-qdisc/Description | ||||||
|  | Linux qdisc that aids in configuring shapers in the NSS | ||||||
|  | endef | ||||||
|  |  | ||||||
|  | define KernelPackage/qca-nss-drv-igs | ||||||
|  |   SECTION:=kernel | ||||||
|  |   CATEGORY:=Kernel modules | ||||||
|  |   SUBMENU:=Network Support | ||||||
|  |   TITLE:=Action for offloading traffic to an IFB interface to perform ingress shaping. | ||||||
|  |   DEPENDS:=@TARGET_ipq_ipq807x||TARGET_ipq_ipq807x_ipq807x||TARGET_ipq_ipq60xx||TARGET_ipq807x_ipq60xx||TARGET_ipq_ipq50xx||TARGET_ipq_ipq50xx_64 \ | ||||||
|  | 	+kmod-qca-nss-drv +kmod-sched-core +kmod-ifb +kmod-qca-nss-drv-qdisc @!LINUX_3_18 | ||||||
|  |   FILES:=$(PKG_BUILD_DIR)/nss_qdisc/igs/act_nssmirred.ko | ||||||
|  | endef | ||||||
|  |  | ||||||
|  | define KernelPackage/qca-nss-drv-igs/Description | ||||||
|  | Linux action that helps in offloading traffic to an IFB interface to perform ingress shaping. | ||||||
|  | endef | ||||||
|  |  | ||||||
|  | define KernelPackage/qca-nss-drv-lag-mgr | ||||||
|  |   SECTION:=kernel | ||||||
|  |   CATEGORY:=Kernel modules | ||||||
|  |   SUBMENU:=Network Devices | ||||||
|  |   TITLE:=Kernel driver for NSS LAG manager | ||||||
|  |   DEPENDS:=+kmod-qca-nss-drv  @!LINUX_3_18 \ | ||||||
|  | 	   +TARGET_ipq_ipq807x:kmod-qca-nss-drv-vlan-mgr \ | ||||||
|  | 	   +TARGET_ipq_ipq807x_ipq807x:kmod-qca-nss-drv-vlan-mgr @!LINUX_3_18 \ | ||||||
|  | 	   +TARGET_ipq807x:kmod-qca-nss-drv-vlan-mgr \ | ||||||
|  | 	   +TARGET_ipq807x_ipq807x:kmod-qca-nss-drv-vlan-mgr @!LINUX_3_18 \ | ||||||
|  | 	   +TARGET_ipq_ipq60xx:kmod-qca-nss-drv-vlan-mgr @!LINUX_3_18 \ | ||||||
|  | 	   +TARGET_ipq807x_ipq60xx:kmod-qca-nss-drv-vlan-mgr @!LINUX_3_18 \ | ||||||
|  | 	   +kmod-bonding | ||||||
|  |   FILES:=$(PKG_BUILD_DIR)/lag/qca-nss-lag-mgr.ko | ||||||
|  |   AUTOLOAD:=$(call AutoLoad,51,qca-nss-lag-mgr) | ||||||
|  | endef | ||||||
|  |  | ||||||
|  | define KernelPackage/qca-nss-drv-lag-mgr/Description | ||||||
|  | Kernel modules for NSS LAG manager | ||||||
|  | endef | ||||||
|  |  | ||||||
|  | define KernelPackage/qca-nss-drv-netlink | ||||||
|  |   SECTION:=kernel | ||||||
|  |   CATEGORY:=Kernel modules | ||||||
|  |   SUBMENU:=Network Devices | ||||||
|  |   DEPENDS:=@TARGET_ipq807x||TARGET_ipq_ipq807x||TARGET_ipq807x_ipq807x||TARGET_ipq_ipq807x_ipq807x||TARGET_ipq_ipq60xx||TARGET_ipq807x_ipq60xx||TARGET_ipq_ipq50xx||TARGET_ipq_ipq50xx_64 \ | ||||||
|  | 		+kmod-qca-nss-drv @!LINUX_3_18 \ | ||||||
|  | 		+PACKAGE_kmod-qca-nss-drv-ipsecmgr:kmod-qca-nss-drv-ipsecmgr \ | ||||||
|  | 		+PACKAGE_kmod-qca-nss-drv-dtlsmgr:kmod-qca-nss-drv-dtlsmgr \ | ||||||
|  | 		+PACKAGE_kmod-qca-nss-drv-capwapmgr:kmod-qca-nss-drv-capwapmgr @!LINUX_3_18 | ||||||
|  |   TITLE:=NSS NETLINK Manager for QCA NSS driver | ||||||
|  |   FILES:=$(PKG_BUILD_DIR)/netlink/qca-nss-netlink.ko | ||||||
|  | endef | ||||||
|  |  | ||||||
|  | define KernelPackage/qca-nss-drv-netlink/Description | ||||||
|  | Kernel module for NSS netlink manager | ||||||
|  | endef | ||||||
|  |  | ||||||
|  | define KernelPackage/qca-nss-drv-ovpn-mgr | ||||||
|  |   SECTION:=kernel | ||||||
|  |   CATEGORY:=Kernel modules | ||||||
|  |   SUBMENU:=Network Devices | ||||||
|  |   TITLE:=Kernel driver for NSS OpenVPN manager | ||||||
|  |   DEPENDS:=+kmod-qca-nss-drv +kmod-qca-nss-cfi +kmod-tun +kmod-ipt-conntrack @!LINUX_3_18 \ | ||||||
|  | 	  @TARGET_ipq_ipq807x||TARGET_ipq_ipq807x_ipq807x||TARGET_ipq_ipq60xx||TARGET_ipq807x_ipq60xx | ||||||
|  |   FILES:=$(PKG_BUILD_DIR)/openvpn/src/qca-nss-ovpn-mgr.ko | ||||||
|  | endef | ||||||
|  |  | ||||||
|  | define KernelPackage/qca-nss-drv-ovpn-mgr/Description | ||||||
|  | Kernel module for NSS OpenVPN manager | ||||||
|  | endef | ||||||
|  |  | ||||||
|  | define KernelPackage/qca-nss-drv-ovpn-link | ||||||
|  |   SECTION:=kernel | ||||||
|  |   CATEGORY:=Kernel modules | ||||||
|  |   SUBMENU:=Network Devices | ||||||
|  |   TITLE:=Kernel driver for interfacing NSS OpenVPN manager with ECM | ||||||
|  |   DEPENDS:=+kmod-qca-nss-drv-ovpn-mgr +kmod-qca-nss-ecm-premium @!LINUX_3_18 \ | ||||||
|  | 	  @TARGET_ipq_ipq807x||TARGET_ipq_ipq807x_ipq807x||TARGET_ipq_ipq60xx||TARGET_ipq807x_ipq60xx | ||||||
|  |   FILES:=$(PKG_BUILD_DIR)/openvpn/plugins/qca-nss-ovpn-link.ko | ||||||
|  | endef | ||||||
|  |  | ||||||
|  | define KernelPackage/qca-nss-drv-ovpn-link/Description | ||||||
|  | This module registers with ECM and communicates with NSS OpenVPN manager for supporting OpenVPN offload. | ||||||
|  | endef | ||||||
|  |  | ||||||
|  | define KernelPackage/qca-nss-drv-pvxlanmgr | ||||||
|  |   SECTION:=kernel | ||||||
|  |   CATEGORY:=Kernel modules | ||||||
|  |   SUBMENU:=Network Devices | ||||||
|  |   DEPENDS:=+kmod-qca-nss-drv @!LINUX_3_18 | ||||||
|  |   TITLE:=NSS PVXLAN Manager for QCA NSS driver | ||||||
|  |   FILES:=$(PKG_BUILD_DIR)/pvxlanmgr/qca-nss-pvxlanmgr.ko | ||||||
|  | endef | ||||||
|  |  | ||||||
|  | define KernelPackage/qca-nss-drv-pvxlanmgr/Description | ||||||
|  | Kernel module for managing NSS PVxLAN | ||||||
|  | endef | ||||||
|  |  | ||||||
|  | define KernelPackage/qca-nss-drv-eogremgr | ||||||
|  |   SECTION:=kernel | ||||||
|  |   CATEGORY:=Kernel modules | ||||||
|  |   SUBMENU:=Network Devices | ||||||
|  |   DEPENDS:=+kmod-qca-nss-drv +kmod-qca-nss-drv-gre @!LINUX_3_18 | ||||||
|  |   TITLE:=NSS EOGRE Manager for QCA NSS driver | ||||||
|  |   FILES:=$(PKG_BUILD_DIR)/eogremgr/qca-nss-eogremgr.ko | ||||||
|  | endef | ||||||
|  |  | ||||||
|  | define KernelPackage/qca-nss-drv-eogremgr/Description | ||||||
|  | Kernel module for managing NSS EoGRE | ||||||
|  | endef | ||||||
|  |  | ||||||
|  | define KernelPackage/qca-nss-drv-clmapmgr | ||||||
|  |   SECTION:=kernel | ||||||
|  |   CATEGORY:=Kernel modules | ||||||
|  |   SUBMENU:=Network Devices | ||||||
|  |   DEPENDS:=+kmod-qca-nss-drv +kmod-qca-nss-drv-eogremgr @!LINUX_3_18 | ||||||
|  |   TITLE:=NSS clmap Manager for QCA NSS driver | ||||||
|  |   FILES:=$(PKG_BUILD_DIR)/clmapmgr/qca-nss-clmapmgr.ko | ||||||
|  | endef | ||||||
|  |  | ||||||
|  | define KernelPackage/qca-nss-drv-clmapmgr/Description | ||||||
|  | Kernel module for managing NSS clmap | ||||||
|  | endef | ||||||
|  |  | ||||||
|  | define KernelPackage/qca-nss-drv-vxlanmgr | ||||||
|  |   SECTION:=kernel | ||||||
|  |   CATEGORY:=Kernel modules | ||||||
|  |   SUBMENU:=Network Devices | ||||||
|  |   DEPENDS:=+kmod-qca-nss-drv +kmod-vxlan @!LINUX_3_18 | ||||||
|  |   TITLE:=NSS VxLAN Manager for QCA NSS driver | ||||||
|  |   FILES:=$(PKG_BUILD_DIR)/vxlanmgr/qca-nss-vxlanmgr.ko | ||||||
|  |   AUTOLOAD:=$(call AutoLoad,51,qca-nss-vxlanmgr) | ||||||
|  | endef | ||||||
|  |  | ||||||
|  | define KernelPackage/qca-nss-drv-vxlanmgr/Description | ||||||
|  | Kernel module for managing NSS VxLAN | ||||||
|  | endef | ||||||
|  |  | ||||||
|  | define KernelPackage/qca-nss-drv-match | ||||||
|  |  SECTION:=kernel | ||||||
|  |  CATEGORY:=Kernel modules | ||||||
|  |  SUBMENU:=Network Devices | ||||||
|  |  DEPENDS:=+kmod-qca-nss-drv @!LINUX_3_18 | ||||||
|  |  TITLE:=NSS Match for QCA NSS driver | ||||||
|  |  FILES:=$(PKG_BUILD_DIR)/match/qca-nss-match.ko | ||||||
|  | endef | ||||||
|  |  | ||||||
|  | define KernelPackage/qca-nss-drv-match/Description | ||||||
|  | Kernel module for managing NSS Match | ||||||
|  | endef | ||||||
|  |  | ||||||
|  | define KernelPackage/qca-nss-drv-mirror | ||||||
|  |  SECTION:=kernel | ||||||
|  |  CATEGORY:=Kernel modules | ||||||
|  |  SUBMENU:=Network Support | ||||||
|  |  TITLE:=Module for mirroring packets from NSS to host. | ||||||
|  |  DEPENDS:=+kmod-qca-nss-drv @!LINUX_3_18 | ||||||
|  |  FILES:=$(PKG_BUILD_DIR)/mirror/qca-nss-mirror.ko | ||||||
|  | endef | ||||||
|  |  | ||||||
|  | define KernelPackage/qca-nss-drv-mirror/Description | ||||||
|  | Kernel module for managing NSS Mirror | ||||||
|  | endef | ||||||
|  |  | ||||||
|  | define Build/InstallDev/qca-nss-clients | ||||||
|  | 	$(INSTALL_DIR) $(1)/usr/include/qca-nss-clients | ||||||
|  | 	$(CP) $(PKG_BUILD_DIR)/netlink/include/* $(1)/usr/include/qca-nss-clients/ | ||||||
|  | 	$(CP) $(PKG_BUILD_DIR)/exports/* $(1)/usr/include/qca-nss-clients/ | ||||||
|  | endef | ||||||
|  |  | ||||||
|  | define Build/InstallDev | ||||||
|  | 	$(call Build/InstallDev/qca-nss-clients,$(1)) | ||||||
|  | endef | ||||||
|  |  | ||||||
|  | define KernelPackage/qca-nss-drv-ovpn-mgr/install | ||||||
|  | 	$(INSTALL_DIR) $(1)/etc/init.d | ||||||
|  | 	$(INSTALL_BIN) ./files/qca-nss-ovpn.init $(1)/etc/init.d/qca-nss-ovpn | ||||||
|  | endef | ||||||
|  |  | ||||||
|  | define KernelPackage/qca-nss-drv-ipsecmgr-klips/install | ||||||
|  | 	$(INSTALL_DIR) $(1)/etc/init.d | ||||||
|  | 	$(INSTALL_BIN) ./files/qca-nss-ipsec $(1)/etc/init.d/qca-nss-ipsec | ||||||
|  | endef | ||||||
|  |  | ||||||
|  | define KernelPackage/qca-nss-drv-igs/install | ||||||
|  | 	$(INSTALL_DIR) $(1)/etc/init.d | ||||||
|  | 	$(INSTALL_BIN) ./files/qca-nss-mirred.init $(1)/etc/init.d/qca-nss-mirred | ||||||
|  | endef | ||||||
|  |  | ||||||
|  | EXTRA_CFLAGS+= \ | ||||||
|  | 	-I$(STAGING_DIR)/usr/include/qca-nss-drv \ | ||||||
|  | 	-I$(STAGING_DIR)/usr/include/qca-nss-crypto \ | ||||||
|  | 	-I$(STAGING_DIR)/usr/include/qca-nss-cfi \ | ||||||
|  | 	-I$(STAGING_DIR)/usr/include/qca-nss-gmac \ | ||||||
|  | 	-I$(STAGING_DIR)/usr/include/qca-ssdk \ | ||||||
|  | 	-I$(STAGING_DIR)/usr/include/qca-ssdk/fal \ | ||||||
|  | 	-I$(STAGING_DIR)/usr/include/nat46 | ||||||
|  |  | ||||||
|  | # Build individual packages if selected | ||||||
|  | ifneq ($(CONFIG_PACKAGE_kmod-qca-nss-drv-profile),) | ||||||
|  | MAKE_OPTS+=profile=y | ||||||
|  | endif | ||||||
|  |  | ||||||
|  | ifneq ($(CONFIG_PACKAGE_kmod-qca-nss-drv-capwapmgr),) | ||||||
|  | MAKE_OPTS+=capwapmgr=y | ||||||
|  | EXTRA_CFLAGS += -DNSS_CAPWAPMGR_ONE_NETDEV | ||||||
|  | endif | ||||||
|  |  | ||||||
|  | ifneq ($(CONFIG_PACKAGE_kmod-qca-nss-drv-tun6rd),) | ||||||
|  | MAKE_OPTS+=tun6rd=m | ||||||
|  | endif | ||||||
|  |  | ||||||
|  | ifneq ($(CONFIG_PACKAGE_kmod-qca-nss-drv-dtlsmgr),) | ||||||
|  | MAKE_OPTS+=dtlsmgr=y | ||||||
|  | endif | ||||||
|  |  | ||||||
|  | ifneq ($(CONFIG_PACKAGE_kmod-qca-nss-drv-tlsmgr),) | ||||||
|  | MAKE_OPTS+=tlsmgr=y | ||||||
|  | endif | ||||||
|  |  | ||||||
|  | ifneq ($(CONFIG_PACKAGE_kmod-qca-nss-drv-l2tpv2),) | ||||||
|  | MAKE_OPTS+=l2tpv2=y | ||||||
|  | EXTRA_CFLAGS += -DNSS_L2TPV2_ENABLED | ||||||
|  | endif | ||||||
|  |  | ||||||
|  | ifneq ($(CONFIG_PACKAGE_kmod-qca-nss-drv-pptp),) | ||||||
|  | MAKE_OPTS+=pptp=y | ||||||
|  | endif | ||||||
|  |  | ||||||
|  | ifneq ($(CONFIG_PACKAGE_kmod-qca-nss-drv-map-t),) | ||||||
|  | MAKE_OPTS+=map-t=y | ||||||
|  | endif | ||||||
|  |  | ||||||
|  | ifneq ($(CONFIG_PACKAGE_kmod-qca-nss-drv-tunipip6),) | ||||||
|  | MAKE_OPTS+=tunipip6=m | ||||||
|  | endif | ||||||
|  |  | ||||||
|  | ifneq ($(CONFIG_PACKAGE_kmod-qca-nss-drv-qdisc),) | ||||||
|  | MAKE_OPTS+=qdisc=y | ||||||
|  | endif | ||||||
|  |  | ||||||
|  | ifneq ($(CONFIG_PACKAGE_kmod-qca-nss-drv-igs),) | ||||||
|  | MAKE_OPTS+=igs=y | ||||||
|  | endif | ||||||
|  |  | ||||||
|  | ifneq ($(CONFIG_PACKAGE_kmod-qca-nss-drv-ipsecmgr),) | ||||||
|  | EXTRA_CFLAGS+= -I$(PKG_BUILD_DIR)/exports | ||||||
|  | MAKE_OPTS+=ipsecmgr=y | ||||||
|  | endif | ||||||
|  |  | ||||||
|  | ifneq ($(CONFIG_PACKAGE_kmod-qca-nss-drv-ipsecmgr-klips),) | ||||||
|  | EXTRA_CFLAGS+= -I$(STAGING_DIR)/usr/include/qca-nss-ecm | ||||||
|  | MAKE_OPTS+=ipsecmgr-klips=m | ||||||
|  | endif | ||||||
|  |  | ||||||
|  |  | ||||||
|  | ifneq ($(CONFIG_PACKAGE_kmod-qca-nss-drv-bridge-mgr),) | ||||||
|  | MAKE_OPTS+=bridge-mgr=y | ||||||
|  | #enable OVS bridge if ovsmgr is enabled | ||||||
|  | ifneq ($(CONFIG_PACKAGE_kmod-qca-ovsmgr),) | ||||||
|  | MAKE_OPTS+= NSS_BRIDGE_MGR_OVS_ENABLE=y | ||||||
|  | EXTRA_CFLAGS+= -I$(STAGING_DIR)/usr/include/qca-ovsmgr | ||||||
|  | endif | ||||||
|  | endif | ||||||
|  |  | ||||||
|  | ifneq ($(CONFIG_PACKAGE_kmod-qca-nss-drv-vlan-mgr),) | ||||||
|  | MAKE_OPTS+=vlan-mgr=y | ||||||
|  | endif | ||||||
|  |  | ||||||
|  | ifneq ($(CONFIG_PACKAGE_kmod-qca-nss-drv-lag-mgr),) | ||||||
|  | MAKE_OPTS+=lag-mgr=y | ||||||
|  | endif | ||||||
|  |  | ||||||
|  | ifneq ($(CONFIG_PACKAGE_kmod-qca-nss-drv-gre),) | ||||||
|  | EXTRA_CFLAGS+= -I$(PKG_BUILD_DIR)/exports | ||||||
|  | MAKE_OPTS+=gre=y | ||||||
|  | endif | ||||||
|  |  | ||||||
|  | ifneq ($(CONFIG_PACKAGE_kmod-qca-nss-drv-pppoe),) | ||||||
|  | MAKE_OPTS+=pppoe=y | ||||||
|  | endif | ||||||
|  |  | ||||||
|  | ifneq ($(CONFIG_PACKAGE_kmod-qca-nss-drv-netlink),) | ||||||
|  | MAKE_OPTS+=netlink=y | ||||||
|  | endif | ||||||
|  |  | ||||||
|  | ifneq ($(CONFIG_PACKAGE_kmod-qca-nss-drv-ovpn-mgr),) | ||||||
|  | MAKE_OPTS+=ovpn-mgr=y | ||||||
|  | endif | ||||||
|  |  | ||||||
|  | ifneq ($(CONFIG_PACKAGE_kmod-qca-nss-drv-ovpn-link),) | ||||||
|  | MAKE_OPTS+=ovpn-link=y | ||||||
|  | endif | ||||||
|  |  | ||||||
|  | ifneq ($(CONFIG_PACKAGE_kmod-qca-nss-drv-pvxlanmgr),) | ||||||
|  | MAKE_OPTS+=pvxlanmgr=y | ||||||
|  | endif | ||||||
|  |  | ||||||
|  | ifneq ($(CONFIG_PACKAGE_kmod-qca-nss-drv-eogremgr),) | ||||||
|  | MAKE_OPTS+=eogremgr=y | ||||||
|  | endif | ||||||
|  |  | ||||||
|  | ifneq ($(CONFIG_PACKAGE_kmod-qca-nss-drv-clmapmgr),) | ||||||
|  | MAKE_OPTS+=clmapmgr=y | ||||||
|  | endif | ||||||
|  |  | ||||||
|  | ifneq ($(CONFIG_PACKAGE_kmod-qca-nss-drv-vxlanmgr),) | ||||||
|  | MAKE_OPTS+=vxlanmgr=y | ||||||
|  | endif | ||||||
|  |  | ||||||
|  | ifneq ($(CONFIG_PACKAGE_kmod-qca-nss-drv-match),) | ||||||
|  | MAKE_OPTS+=match=y | ||||||
|  | endif | ||||||
|  |  | ||||||
|  | ifneq ($(CONFIG_PACKAGE_kmod-qca-nss-drv-mirror),) | ||||||
|  | MAKE_OPTS+=mirror=y | ||||||
|  | endif | ||||||
|  |  | ||||||
|  | define Build/Compile | ||||||
|  | 	$(MAKE) -C "$(LINUX_DIR)" $(strip $(MAKE_OPTS)) \ | ||||||
|  | 		CROSS_COMPILE="$(TARGET_CROSS)" \ | ||||||
|  | 		ARCH="$(LINUX_KARCH)" \ | ||||||
|  | 		M="$(PKG_BUILD_DIR)" \ | ||||||
|  | 		EXTRA_CFLAGS="$(EXTRA_CFLAGS)" \ | ||||||
|  | 		SoC="$(subtarget)" \ | ||||||
|  | 		DTLSMGR_DIR="$(DTLSMGR_DIR)" \ | ||||||
|  | 		IPSECMGR_DIR="$(IPSECMGR_DIR)" \ | ||||||
|  | 		modules | ||||||
|  | endef | ||||||
|  |  | ||||||
|  | $(eval $(call KernelPackage,qca-nss-drv-profile)) | ||||||
|  | #$(eval $(call KernelPackage,qca-nss-drv-capwapmgr)) | ||||||
|  | $(eval $(call KernelPackage,qca-nss-drv-tun6rd)) | ||||||
|  | #$(eval $(call KernelPackage,qca-nss-drv-dtlsmgr)) | ||||||
|  | $(eval $(call KernelPackage,qca-nss-drv-l2tpv2)) | ||||||
|  | $(eval $(call KernelPackage,qca-nss-drv-pptp)) | ||||||
|  | $(eval $(call KernelPackage,qca-nss-drv-pppoe)) | ||||||
|  | $(eval $(call KernelPackage,qca-nss-drv-map-t)) | ||||||
|  | $(eval $(call KernelPackage,qca-nss-drv-tunipip6)) | ||||||
|  | $(eval $(call KernelPackage,qca-nss-drv-qdisc)) | ||||||
|  | $(eval $(call KernelPackage,qca-nss-drv-igs)) | ||||||
|  | #$(eval $(call KernelPackage,qca-nss-drv-netlink)) | ||||||
|  | #$(eval $(call KernelPackage,qca-nss-drv-ipsecmgr)) | ||||||
|  | #$(eval $(call KernelPackage,qca-nss-drv-ipsecmgr-klips)) | ||||||
|  | $(eval $(call KernelPackage,qca-nss-drv-bridge-mgr)) | ||||||
|  | $(eval $(call KernelPackage,qca-nss-drv-vlan-mgr)) | ||||||
|  | $(eval $(call KernelPackage,qca-nss-drv-lag-mgr)) | ||||||
|  | $(eval $(call KernelPackage,qca-nss-drv-gre)) | ||||||
|  | #$(eval $(call KernelPackage,qca-nss-drv-ovpn-mgr)) | ||||||
|  | #$(eval $(call KernelPackage,qca-nss-drv-ovpn-link)) | ||||||
|  | $(eval $(call KernelPackage,qca-nss-drv-pvxlanmgr)) | ||||||
|  | $(eval $(call KernelPackage,qca-nss-drv-eogremgr)) | ||||||
|  | $(eval $(call KernelPackage,qca-nss-drv-clmapmgr)) | ||||||
|  | $(eval $(call KernelPackage,qca-nss-drv-vxlanmgr)) | ||||||
|  | $(eval $(call KernelPackage,qca-nss-drv-match)) | ||||||
|  | #$(eval $(call KernelPackage,qca-nss-drv-tlsmgr)) | ||||||
|  | $(eval $(call KernelPackage,qca-nss-drv-mirror)) | ||||||
							
								
								
									
										92
									
								
								feeds/ipq807x/qca-nss-clients/files/qca-nss-ipsec
									
									
									
									
									
										Executable file
									
								
							
							
						
						
									
										92
									
								
								feeds/ipq807x/qca-nss-clients/files/qca-nss-ipsec
									
									
									
									
									
										Executable file
									
								
							| @@ -0,0 +1,92 @@ | |||||||
|  | #!/bin/sh  /etc/rc.common | ||||||
|  | # | ||||||
|  | # Copyright (c) 2018-2019 The Linux Foundation. All rights reserved. | ||||||
|  | # | ||||||
|  | # Permission to use, copy, modify, and/or distribute this software for any | ||||||
|  | # purpose with or without fee is hereby granted, provided that the above | ||||||
|  | # copyright notice and this permission notice appear in all copies. | ||||||
|  | # | ||||||
|  | # THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES | ||||||
|  | # WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF | ||||||
|  | # MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR | ||||||
|  | # ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES | ||||||
|  | # WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN | ||||||
|  | # ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF | ||||||
|  | # OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. | ||||||
|  |  | ||||||
|  | NSS_IPSEC_LOG_FILE=/tmp/.nss_ipsec_log | ||||||
|  | NSS_IPSEC_LOG_STR_ECM="ECM_Loaded" | ||||||
|  |  | ||||||
|  | ecm_load () { | ||||||
|  | 	if [ ! -d /sys/module/ecm ]; then | ||||||
|  | 		/etc/init.d/qca-nss-ecm start | ||||||
|  | 		if [ -d /sys/module/ecm ]; then | ||||||
|  | 			echo ${NSS_IPSEC_LOG_STR_ECM} >> ${NSS_IPSEC_LOG_FILE} | ||||||
|  | 		fi | ||||||
|  | 	fi | ||||||
|  | } | ||||||
|  |  | ||||||
|  | ecm_unload () { | ||||||
|  | 	if [ -f /tmp/.nss_ipsec_log ]; then | ||||||
|  | 		str=`grep ${NSS_IPSEC_LOG_STR_ECM} ${NSS_IPSEC_LOG_FILE}` | ||||||
|  | 		if [[ $str == ${NSS_IPSEC_LOG_STR_ECM} ]]; then | ||||||
|  | 			/etc/init.d/qca-nss-ecm stop | ||||||
|  | 			`sed 's/${NSS_IPSEC_LOG_STR_ECM}/ /g' $NSS_IPSEC_LOG_FILE >  $NSS_IPSEC_LOG_FILE` | ||||||
|  | 		fi | ||||||
|  | 	fi | ||||||
|  | } | ||||||
|  |  | ||||||
|  | ecm_disable() { | ||||||
|  |  | ||||||
|  | 	if [ ! -d /sys/module/ecm ]; then | ||||||
|  | 		return; | ||||||
|  | 	fi | ||||||
|  |  | ||||||
|  | 	echo 1 > /sys/kernel/debug/ecm/front_end_ipv4_stop | ||||||
|  | 	echo 1 > /sys/kernel/debug/ecm/front_end_ipv6_stop | ||||||
|  | 	echo 1 > /sys/kernel/debug/ecm/ecm_db/defunct_all | ||||||
|  | 	sleep 2 | ||||||
|  | } | ||||||
|  |  | ||||||
|  | ecm_enable() { | ||||||
|  | 	if [ ! -d /sys/module/ecm ]; then | ||||||
|  | 		return; | ||||||
|  | 	fi | ||||||
|  |  | ||||||
|  | 	echo 0 > /sys/kernel/debug/ecm/ecm_db/defunct_all | ||||||
|  | 	echo 0 > /sys/kernel/debug/ecm/front_end_ipv4_stop | ||||||
|  | 	echo 0 > /sys/kernel/debug/ecm/front_end_ipv6_stop | ||||||
|  | } | ||||||
|  |  | ||||||
|  | start() { | ||||||
|  | 	ecm_load | ||||||
|  |  | ||||||
|  | 	local kernel_version=$(uname -r) | ||||||
|  |  | ||||||
|  | 	insmod /lib/modules/${kernel_version}/qca-nss-ipsec-klips.ko | ||||||
|  | 	if [ "$?" -gt 0 ]; then | ||||||
|  | 		echo "Failed to load plugin. Please start ecm if not done already" | ||||||
|  | 		ecm_enable | ||||||
|  | 		return | ||||||
|  | 	fi | ||||||
|  |  | ||||||
|  | 	/etc/init.d/ipsec start | ||||||
|  | 	sleep 2 | ||||||
|  | 	ipsec eroute | ||||||
|  |  | ||||||
|  | 	ecm_enable | ||||||
|  | } | ||||||
|  |  | ||||||
|  | stop() { | ||||||
|  | 	ecm_disable | ||||||
|  |  | ||||||
|  | 	/etc/init.d/ipsec stop | ||||||
|  | 	rmmod qca-nss-ipsec-klips | ||||||
|  |  | ||||||
|  | 	ecm_unload | ||||||
|  | } | ||||||
|  |  | ||||||
|  | restart() { | ||||||
|  | 	stop | ||||||
|  | 	start | ||||||
|  | } | ||||||
							
								
								
									
										28
									
								
								feeds/ipq807x/qca-nss-clients/files/qca-nss-mirred.init
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										28
									
								
								feeds/ipq807x/qca-nss-clients/files/qca-nss-mirred.init
									
									
									
									
									
										Normal file
									
								
							| @@ -0,0 +1,28 @@ | |||||||
|  | #!/bin/sh /etc/rc.common | ||||||
|  |  | ||||||
|  | ########################################################################### | ||||||
|  | # Copyright (c) 2019, The Linux Foundation. All rights reserved. | ||||||
|  | # Permission to use, copy, modify, and/or distribute this software for | ||||||
|  | # any purpose with or without fee is hereby granted, provided that the | ||||||
|  | # above copyright notice and this permission notice appear in all copies. | ||||||
|  | # THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES | ||||||
|  | # WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF | ||||||
|  | # MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR | ||||||
|  | # ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES | ||||||
|  | # WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN | ||||||
|  | # ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT | ||||||
|  | # OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. | ||||||
|  | ########################################################################### | ||||||
|  |  | ||||||
|  | restart() { | ||||||
|  | 	rmmod act_nssmirred.ko | ||||||
|  | 	insmod act_nssmirred.ko | ||||||
|  | } | ||||||
|  |  | ||||||
|  | start() { | ||||||
|  | 	insmod act_nssmirred.ko | ||||||
|  | } | ||||||
|  |  | ||||||
|  | stop() { | ||||||
|  | 	rmmod act_nssmirred.ko | ||||||
|  | } | ||||||
							
								
								
									
										69
									
								
								feeds/ipq807x/qca-nss-clients/files/qca-nss-ovpn.init
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										69
									
								
								feeds/ipq807x/qca-nss-clients/files/qca-nss-ovpn.init
									
									
									
									
									
										Normal file
									
								
							| @@ -0,0 +1,69 @@ | |||||||
|  | #!/bin/sh /etc/rc.common | ||||||
|  |  | ||||||
|  | ########################################################################### | ||||||
|  | # Copyright (c) 2019, The Linux Foundation. All rights reserved. | ||||||
|  | # Permission to use, copy, modify, and/or distribute this software for | ||||||
|  | # any purpose with or without fee is hereby granted, provided that the | ||||||
|  | # above copyright notice and this permission notice appear in all copies. | ||||||
|  | # THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES | ||||||
|  | # WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF | ||||||
|  | # MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR | ||||||
|  | # ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES | ||||||
|  | # WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN | ||||||
|  | # ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT | ||||||
|  | # OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. | ||||||
|  | ########################################################################### | ||||||
|  |  | ||||||
|  | ecm_disable() { | ||||||
|  | 	if [ ! -d /sys/module/ecm ]; then | ||||||
|  | 	   return | ||||||
|  | 	fi | ||||||
|  |  | ||||||
|  | 	echo 1 > /sys/kernel/debug/ecm/front_end_ipv4_stop | ||||||
|  | 	echo 1 > /sys/kernel/debug/ecm/front_end_ipv6_stop | ||||||
|  | 	echo 1 > /sys/kernel/debug/ecm/ecm_db/defunct_all | ||||||
|  | 	sleep 2 | ||||||
|  | } | ||||||
|  |  | ||||||
|  | ecm_enable() { | ||||||
|  | 	if [ ! -d /sys/module/ecm ]; then | ||||||
|  | 	   return | ||||||
|  | 	fi | ||||||
|  |  | ||||||
|  | 	echo 0 > /sys/kernel/debug/ecm/ecm_db/defunct_all | ||||||
|  | 	echo 0 > /sys/kernel/debug/ecm/front_end_ipv4_stop | ||||||
|  | 	echo 0 > /sys/kernel/debug/ecm/front_end_ipv6_stop | ||||||
|  | } | ||||||
|  |  | ||||||
|  | restart() { | ||||||
|  | 	ecm_disable | ||||||
|  |  | ||||||
|  | 	/etc/init.d/openvpn stop | ||||||
|  | 	rmmod qca-nss-ovpn-link | ||||||
|  | 	rmmod qca-nss-ovpn-mgr | ||||||
|  |  | ||||||
|  | 	insmod qca-nss-ovpn-mgr | ||||||
|  | 	insmod qca-nss-ovpn-link | ||||||
|  |  | ||||||
|  | 	if [ "$?" -gt 0 ]; then | ||||||
|  | 		echo "Failed to load plugin. Please start ecm if not done already" | ||||||
|  | 		ecm_enable | ||||||
|  | 		return | ||||||
|  | 	fi | ||||||
|  |  | ||||||
|  | 	ecm_enable | ||||||
|  | } | ||||||
|  |  | ||||||
|  | start() { | ||||||
|  | 	restart | ||||||
|  | } | ||||||
|  |  | ||||||
|  | stop() { | ||||||
|  | 	ecm_disable | ||||||
|  |  | ||||||
|  | 	/etc/init.d/openvpn stop | ||||||
|  | 	rmmod qca-nss-ovpn-link | ||||||
|  | 	rmmod qca-nss-ovpn-mgr | ||||||
|  |  | ||||||
|  | 	ecm_enable | ||||||
|  | } | ||||||
| @@ -99,6 +99,7 @@ ifneq ($(LOCAL_VARIANT),mini) | |||||||
| endif | endif | ||||||
|  |  | ||||||
| ifeq ($(LOCAL_VARIANT),full) | ifeq ($(LOCAL_VARIANT),full) | ||||||
|  |   DRIVER_MAKEOPTS += CONFIG_HS20=y CONFIG_INTERWORKING=y | ||||||
|   ifeq ($(SSL_VARIANT),openssl) |   ifeq ($(SSL_VARIANT),openssl) | ||||||
|     DRIVER_MAKEOPTS += CONFIG_TLS=openssl CONFIG_SAE=y CONFIG_OWE=y CONFIG_SUITEB192=y CONFIG_AP=y CONFIG_MESH=y |     DRIVER_MAKEOPTS += CONFIG_TLS=openssl CONFIG_SAE=y CONFIG_OWE=y CONFIG_SUITEB192=y CONFIG_AP=y CONFIG_MESH=y | ||||||
|     TARGET_LDFLAGS += -lcrypto -lssl |     TARGET_LDFLAGS += -lcrypto -lssl | ||||||
|   | |||||||
| @@ -47,8 +47,18 @@ hostapd_append_wpa_key_mgmt() { | |||||||
| 			[ "${ieee80211w:-0}" -gt 0 ] && append wpa_key_mgmt "WPA-${auth_type_l}-SHA256" | 			[ "${ieee80211w:-0}" -gt 0 ] && append wpa_key_mgmt "WPA-${auth_type_l}-SHA256" | ||||||
| 			[ "${ieee80211ai:-0}" -gt 0 ] && append wpa_key_mgmt "FILS-SHA256" | 			[ "${ieee80211ai:-0}" -gt 0 ] && append wpa_key_mgmt "FILS-SHA256" | ||||||
| 		;; | 		;; | ||||||
|  | 		eap-only) | ||||||
|  | 			append wpa_key_mgmt "WPA-EAP-SHA256" | ||||||
|  | 			[ "${ieee80211r:-0}" -gt 0 ] && append wpa_key_mgmt "FT-EAP" | ||||||
|  | 		;; | ||||||
|  | 		eap-transition) | ||||||
|  | 			append wpa_key_mgmt "WPA-EAP" | ||||||
|  | 			append wpa_key_mgmt "WPA-EAP-SHA256" | ||||||
|  | 			[ "${ieee80211r:-0}" -gt 0 ] && append wpa_key_mgmt "FT-EAP" | ||||||
|  | 		;; | ||||||
| 		eap192) | 		eap192) | ||||||
| 			append wpa_key_mgmt "WPA-EAP-SUITE-B-192" | 			append wpa_key_mgmt "WPA-EAP-SUITE-B-192" | ||||||
|  | 			[ "${ieee80211w:-0}" -gt 0 ] && append wpa_key_mgmt "WPA-EAP-SHA256" | ||||||
| 			[ "${ieee80211r:-0}" -gt 0 ] && append wpa_key_mgmt "FT-EAP" | 			[ "${ieee80211r:-0}" -gt 0 ] && append wpa_key_mgmt "FT-EAP" | ||||||
| 		;; | 		;; | ||||||
| 		eap-eap192) | 		eap-eap192) | ||||||
| @@ -204,6 +214,9 @@ hostapd_common_add_bss_config() { | |||||||
| 	config_add_int maxassoc max_inactivity | 	config_add_int maxassoc max_inactivity | ||||||
| 	config_add_boolean disassoc_low_ack isolate short_preamble | 	config_add_boolean disassoc_low_ack isolate short_preamble | ||||||
|  |  | ||||||
|  | config_add_int signal_connect signal_stay signal_poll_time \ | ||||||
|  | 		signal_drop_reason signal_strikes | ||||||
|  |  | ||||||
| 	config_add_int \ | 	config_add_int \ | ||||||
| 		wep_rekey eap_reauth_period \ | 		wep_rekey eap_reauth_period \ | ||||||
| 		wpa_group_rekey wpa_pair_rekey wpa_master_rekey | 		wpa_group_rekey wpa_pair_rekey wpa_master_rekey | ||||||
| @@ -311,14 +324,15 @@ hostapd_common_add_bss_config() { | |||||||
| 	config_add_string osu_ssid hs20_wan_metrics hs20_operating_class hs20_t_c_filename hs20_t_c_timestamp | 	config_add_string osu_ssid hs20_wan_metrics hs20_operating_class hs20_t_c_filename hs20_t_c_timestamp | ||||||
|  |  | ||||||
| 	config_add_boolean interworking internet | 	config_add_boolean interworking internet | ||||||
| 	config_add_int access_network_type asra esr uesa venue_group venue_type ipaddr_type_availability \ | 	config_add_int access_network_type asra esr uesa venue_group venue_type  \ | ||||||
| 		gas_address3 | 		gas_address3 | ||||||
| 	config_add_string hessid network_auth_type \ | 	config_add_string hessid network_auth_type ipaddr_type_availability \ | ||||||
| 		anqp_3gpp_cell_net anqp_elem domain_name qos_map_set hs20_t_c_server_url | 		anqp_3gpp_cell_net anqp_elem domain_name qos_map_set hs20_t_c_server_url | ||||||
|  |  | ||||||
| 	config_add_array airtime_sta_weight | 	config_add_array airtime_sta_weight | ||||||
| 	config_add_int airtime_bss_weight airtime_bss_limit | 	config_add_int airtime_bss_weight airtime_bss_limit | ||||||
| 	config_add_int rts_threshold | 	config_add_int rts_threshold | ||||||
|  | 	config_add_boolean multicast_to_unicast proxy_arp | ||||||
| } | } | ||||||
|  |  | ||||||
| hostapd_set_vlan_file() { | hostapd_set_vlan_file() { | ||||||
| @@ -474,6 +488,7 @@ hostapd_set_bss_options() { | |||||||
| 	local wep_rekey wpa_group_rekey wpa_pair_rekey wpa_master_rekey wpa_key_mgmt | 	local wep_rekey wpa_group_rekey wpa_pair_rekey wpa_master_rekey wpa_key_mgmt | ||||||
|  |  | ||||||
| 	json_get_vars \ | 	json_get_vars \ | ||||||
|  | 	signal_connect signal_stay signal_poll_time signal_drop_reason signal_strikes \ | ||||||
| 		wep_rekey wpa_group_rekey wpa_pair_rekey wpa_master_rekey wpa_strict_rekey \ | 		wep_rekey wpa_group_rekey wpa_pair_rekey wpa_master_rekey wpa_strict_rekey \ | ||||||
| 		wpa_disable_eapol_key_retries tdls_prohibit \ | 		wpa_disable_eapol_key_retries tdls_prohibit \ | ||||||
| 		maxassoc max_inactivity disassoc_low_ack isolate auth_cache \ | 		maxassoc max_inactivity disassoc_low_ack isolate auth_cache \ | ||||||
| @@ -485,7 +500,8 @@ hostapd_set_bss_options() { | |||||||
| 		bss_load_update_period chan_util_avg_period sae_require_mfp \ | 		bss_load_update_period chan_util_avg_period sae_require_mfp \ | ||||||
| 		multi_ap multi_ap_backhaul_ssid multi_ap_backhaul_key \ | 		multi_ap multi_ap_backhaul_ssid multi_ap_backhaul_key \ | ||||||
| 		airtime_bss_weight airtime_bss_limit airtime_sta_weight \ | 		airtime_bss_weight airtime_bss_limit airtime_sta_weight \ | ||||||
| 		rssi_reject_assoc_rssi rssi_ignore_probe_request rts_threshold  | 		rssi_reject_assoc_rssi rssi_ignore_probe_request rts_threshold \ | ||||||
|  | 		proxy_arp multicast_to_unicast | ||||||
|  |  | ||||||
| 	set_default isolate 0 | 	set_default isolate 0 | ||||||
| 	set_default maxassoc 0 | 	set_default maxassoc 0 | ||||||
| @@ -508,6 +524,14 @@ hostapd_set_bss_options() { | |||||||
| 	set_default rssi_reject_assoc_rssi 0 | 	set_default rssi_reject_assoc_rssi 0 | ||||||
| 	set_default rssi_ignore_probe_request 0 | 	set_default rssi_ignore_probe_request 0 | ||||||
| 	set_default rts_threshold -1 | 	set_default rts_threshold -1 | ||||||
|  | 	set_default signal_connect -128 | ||||||
|  | 	set_default signal_stay -128 | ||||||
|  | 	set_default signal_poll_time 5 | ||||||
|  | 	set_default signal_drop_reason 3 | ||||||
|  | 	set_default signal_strikes 3 | ||||||
|  | 	set_default proxy_arp 1 | ||||||
|  | 	set_default multicast_to_unicast 0 | ||||||
|  |  | ||||||
|  |  | ||||||
| 	append bss_conf "ctrl_interface=/var/run/hostapd" | 	append bss_conf "ctrl_interface=/var/run/hostapd" | ||||||
| 	if [ "$isolate" -gt 0 ]; then | 	if [ "$isolate" -gt 0 ]; then | ||||||
| @@ -536,6 +560,14 @@ hostapd_set_bss_options() { | |||||||
| 	append bss_conf "rssi_reject_assoc_rssi=$rssi_reject_assoc_rssi" "$N" | 	append bss_conf "rssi_reject_assoc_rssi=$rssi_reject_assoc_rssi" "$N" | ||||||
| 	append bss_conf "rssi_ignore_probe_request=$rssi_ignore_probe_request" "$N" | 	append bss_conf "rssi_ignore_probe_request=$rssi_ignore_probe_request" "$N" | ||||||
| 	append bss_conf "rts_threshold=$rts_threshold" "$N" | 	append bss_conf "rts_threshold=$rts_threshold" "$N" | ||||||
|  | 	append bss_conf "signal_connect=$signal_connect" "$N" | ||||||
|  | 	append bss_conf "signal_stay=$signal_stay" "$N" | ||||||
|  | 	append bss_conf "signal_poll_time=$signal_poll_time" "$N" | ||||||
|  | 	append bss_conf "signal_strikes=$signal_strikes" "$N" | ||||||
|  | 	append bss_conf "signal_drop_reason=$signal_drop_reason" "$N" | ||||||
|  |  | ||||||
|  | 	[ -n "$proxy_arp" ] && append bss_conf "proxy_arp=$proxy_arp" "$N" | ||||||
|  | 	[ -n "$multicast_to_unicast" ] && append bss_conf "multicast_to_unicast=$multicast_to_unicast" "$N" | ||||||
|  |  | ||||||
| 	[ "$tdls_prohibit" -gt 0 ] && append bss_conf "tdls_prohibit=$tdls_prohibit" "$N" | 	[ "$tdls_prohibit" -gt 0 ] && append bss_conf "tdls_prohibit=$tdls_prohibit" "$N" | ||||||
|  |  | ||||||
| @@ -557,11 +589,11 @@ hostapd_set_bss_options() { | |||||||
| 	} | 	} | ||||||
|  |  | ||||||
| 	case "$auth_type" in | 	case "$auth_type" in | ||||||
| 		sae|owe|eap192|eap-eap192) | 		sae|owe|eap192|eap-eap192|eap-only) | ||||||
| 			set_default ieee80211w 2 | 			set_default ieee80211w 2 | ||||||
| 			set_default sae_require_mfp 1 | 			set_default sae_require_mfp 1 | ||||||
| 		;; | 		;; | ||||||
| 		psk-sae) | 		psk-sae|eap-transition) | ||||||
| 			set_default ieee80211w 1 | 			set_default ieee80211w 1 | ||||||
| 			set_default sae_require_mfp 1 | 			set_default sae_require_mfp 1 | ||||||
| 		;; | 		;; | ||||||
| @@ -603,7 +635,7 @@ hostapd_set_bss_options() { | |||||||
| 			vlan_possible=1 | 			vlan_possible=1 | ||||||
| 			wps_possible=1 | 			wps_possible=1 | ||||||
| 		;; | 		;; | ||||||
| 		eap|eap192|eap-eap192) | 		eap|eap192|eap-eap192|eap-only|eap-transition) | ||||||
| 			json_get_vars \ | 			json_get_vars \ | ||||||
| 				auth_server auth_secret auth_port \ | 				auth_server auth_secret auth_port \ | ||||||
| 				dae_client dae_secret dae_port \ | 				dae_client dae_secret dae_port \ | ||||||
| @@ -815,7 +847,15 @@ hostapd_set_bss_options() { | |||||||
| 				json_get_vars ieee80211w_mgmt_cipher ieee80211w_max_timeout ieee80211w_retry_timeout | 				json_get_vars ieee80211w_mgmt_cipher ieee80211w_max_timeout ieee80211w_retry_timeout | ||||||
| 				append bss_conf "ieee80211w=$ieee80211w" "$N" | 				append bss_conf "ieee80211w=$ieee80211w" "$N" | ||||||
| 				[ "$ieee80211w" -gt "0" ] && { | 				[ "$ieee80211w" -gt "0" ] && { | ||||||
| 					append bss_conf "group_mgmt_cipher=${ieee80211w_mgmt_cipher:-AES-128-CMAC}" "$N" | 					case "$auth_type" in | ||||||
|  | 						eap192) | ||||||
|  | 							append bss_conf "group_mgmt_cipher=BIP-GMAC-256" "$N" | ||||||
|  | 							append bss_conf "group_cipher=GCMP-256" "$N" | ||||||
|  | 						;; | ||||||
|  | 						*) | ||||||
|  | 							append bss_conf "group_mgmt_cipher=${ieee80211w_mgmt_cipher:-AES-128-CMAC}" "$N" | ||||||
|  | 						;; | ||||||
|  | 					esac | ||||||
| 					[ -n "$ieee80211w_max_timeout" ] && \ | 					[ -n "$ieee80211w_max_timeout" ] && \ | ||||||
| 						append bss_conf "assoc_sa_query_max_timeout=$ieee80211w_max_timeout" "$N" | 						append bss_conf "assoc_sa_query_max_timeout=$ieee80211w_max_timeout" "$N" | ||||||
| 					[ -n "$ieee80211w_retry_timeout" ] && \ | 					[ -n "$ieee80211w_retry_timeout" ] && \ | ||||||
| @@ -932,15 +972,23 @@ hostapd_set_bss_options() { | |||||||
| 	set_default hs20 0 | 	set_default hs20 0 | ||||||
| 	set_default disable_dgaf $hs20 | 	set_default disable_dgaf $hs20 | ||||||
| 	set_default osen 0 | 	set_default osen 0 | ||||||
|  | 	set_default internet 0 | ||||||
|  | 	set_default asra 0 | ||||||
|  | 	set_default esr 0 | ||||||
|  | 	set_default uesa  0 | ||||||
| 	set_default anqp_domain_id 0 | 	set_default anqp_domain_id 0 | ||||||
|  | 	set_default access_network_type 0 | ||||||
|  | 	set_default venue_group 0 | ||||||
|  | 	set_default venue_type 0 | ||||||
|  | 	set_default gas_address3 0 | ||||||
| 	set_default hs20_deauth_req_timeout 60 | 	set_default hs20_deauth_req_timeout 60 | ||||||
| 	if [ "$hs20" = "1" ]; then | 	if [ "$hs20" = "1" ]; then | ||||||
| 		append bss_conf "hs20=1" "$N" | 		append bss_conf "hs20=1" "$N" | ||||||
| 		append_hs20_icons | 		append_hs20_icons | ||||||
| 		[ -n "$disable_dgaf"] && append bss_conf "disable_dgaf=$disable_dgaf" "$N" | 		[ -n "$disable_dgaf" ] && append bss_conf "disable_dgaf=$disable_dgaf" "$N" | ||||||
| 		[ -n "$osen"] && append bss_conf "osen=$osen" "$N" | 		[ -n "$osen" ] && append bss_conf "osen=$osen" "$N" | ||||||
| 		[ -n "$anqp_domain_id"] && append bss_conf "anqp_domain_id=$anqp_domain_id" "$N" | 		[ "$anqp_domain_id" -gt 0 ] && append bss_conf "anqp_domain_id=$anqp_domain_id" "$N" | ||||||
| 		[ -n "$hs20_deauth_req_timeout"] && append bss_conf "hs20_deauth_req_timeout=$hs20_deauth_req_timeout" "$N" | 		[ -n "$hs20_deauth_req_timeout" ] && append bss_conf "hs20_deauth_req_timeout=$hs20_deauth_req_timeout" "$N" | ||||||
| 		[ -n "$osu_ssid" ] && append bss_conf "osu_ssid=$osu_ssid" "$N" | 		[ -n "$osu_ssid" ] && append bss_conf "osu_ssid=$osu_ssid" "$N" | ||||||
| 		[ -n "$hs20_wan_metrics" ] && append bss_conf "hs20_wan_metrics=$hs20_wan_metrics" "$N" | 		[ -n "$hs20_wan_metrics" ] && append bss_conf "hs20_wan_metrics=$hs20_wan_metrics" "$N" | ||||||
| 		[ -n "$hs20_operating_class" ] && append bss_conf "hs20_operating_class=$hs20_operating_class" "$N" | 		[ -n "$hs20_operating_class" ] && append bss_conf "hs20_operating_class=$hs20_operating_class" "$N" | ||||||
| @@ -952,19 +1000,18 @@ hostapd_set_bss_options() { | |||||||
| 		json_for_each_item append_venue_url venue_url | 		json_for_each_item append_venue_url venue_url | ||||||
| 		json_for_each_item append_nai_realm nai_realm | 		json_for_each_item append_nai_realm nai_realm | ||||||
| 		json_for_each_item append_hs20_conn_capab hs20_conn_capab | 		json_for_each_item append_hs20_conn_capab hs20_conn_capab | ||||||
| 		json_for_each_item append_hs20_oper_friendly_name hs20_oper_friendly_name |  | ||||||
| 		json_for_each_item append_osu_provider osu_provider | 		json_for_each_item append_osu_provider osu_provider | ||||||
| 		json_for_each_item append_operator_icon operator_icon | 		json_for_each_item append_operator_icon operator_icon | ||||||
| 		[ -n "$interworking" ] && append bss_conf "interworking=$interworking" "$N" | 		[ -n "$interworking" ] && append bss_conf "interworking=$interworking" "$N" | ||||||
| 		[ -n "$internet" ] && append bss_conf "internet=$internet" "$N" | 		[ "$internet" -gt 0 ] && append bss_conf "internet=$internet" "$N" | ||||||
| 		[ -n "$access_network_type" ] && append bss_conf "access_network_type=$access_network_type" "$N" | 		[ "$access_network_type" -gt 0 ] && append bss_conf "access_network_type=$access_network_type" "$N" | ||||||
| 		[ -n "$asra" ] && append bss_conf "asra=$asra" "$N" | 		[ "$asra" -gt 0 ] && append bss_conf "asra=$asra" "$N" | ||||||
| 		[ -n "$esr" ] && append bss_conf "esr=$esr" "$N" | 		[ "$esr" -gt 0 ] && append bss_conf "esr=$esr" "$N" | ||||||
| 		[ -n "$uesa" ] && append bss_conf "uesa=$uesa" "$N" | 		[ "$uesa" -gt 0 ] && append bss_conf "uesa=$uesa" "$N" | ||||||
| 		[ -n "$venue_group" ] && append bss_conf "venue_group=$venue_group" "$N" | 		[ "$venue_group" -gt 0 ] && append bss_conf "venue_group=$venue_group" "$N" | ||||||
| 		[ -n "$venue_type" ] && append bss_conf "venue_type=$venue_type" "$N" | 		[ "$venue_type" -gt 0 ] && append bss_conf "venue_type=$venue_type" "$N" | ||||||
| 		[ -n "$ipaddr_type_availability" ] && append bss_conf "ipaddr_type_availability=$ipaddr_type_availability" "$N" | 		[ -n "$ipaddr_type_availability" ] && append bss_conf "ipaddr_type_availability=$ipaddr_type_availability" "$N" | ||||||
| 		[ -n "$gas_address3" ] && append bss_conf "gas_address3=$gas_address3" "$N" | 		[ "$gas_address3" -gt 0 ] && append bss_conf "gas_address3=$gas_address3" "$N" | ||||||
| 		[ -n "$hessid" ] && append bss_conf "hessid=$hessid" "$N" | 		[ -n "$hessid" ] && append bss_conf "hessid=$hessid" "$N" | ||||||
| 		[ -n "$network_auth_type" ] && append bss_conf "network_auth_type=$network_auth_type" "$N" | 		[ -n "$network_auth_type" ] && append bss_conf "network_auth_type=$network_auth_type" "$N" | ||||||
| 		[ -n "$anqp_3gpp_cell_net" ] && append bss_conf "anqp_3gpp_cell_net=$anqp_3gpp_cell_net" "$N" | 		[ -n "$anqp_3gpp_cell_net" ] && append bss_conf "anqp_3gpp_cell_net=$anqp_3gpp_cell_net" "$N" | ||||||
|   | |||||||
							
								
								
									
										881
									
								
								feeds/wifi-ax/hostapd/patches/900-hapd-netlink-ubus-bridge.patch
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										881
									
								
								feeds/wifi-ax/hostapd/patches/900-hapd-netlink-ubus-bridge.patch
									
									
									
									
									
										Normal file
									
								
							| @@ -0,0 +1,881 @@ | |||||||
|  | --- a/hostapd/main.c | ||||||
|  | +++ b/hostapd/main.c | ||||||
|  | @@ -41,7 +41,7 @@ struct hapd_global { | ||||||
|  |  static struct hapd_global global; | ||||||
|  |  static int daemonize = 0; | ||||||
|  |  static char *pid_file = NULL; | ||||||
|  | - | ||||||
|  | +uint32_t cached_events_nr = 0; | ||||||
|  |   | ||||||
|  |  #ifndef CONFIG_NO_HOSTAPD_LOGGER | ||||||
|  |  static void hostapd_logger_cb(void *ctx, const u8 *addr, unsigned int module, | ||||||
|  | --- a/src/ap/hostapd.h | ||||||
|  | +++ b/src/ap/hostapd.h | ||||||
|  | @@ -97,6 +97,10 @@ struct hostapd_probereq_cb { | ||||||
|  |  }; | ||||||
|  |   | ||||||
|  |  #define HOSTAPD_RATE_BASIC 0x00000001 | ||||||
|  | +/* max number of cached events */ | ||||||
|  | +#define HOSTAPD_MAX_CACHED_EVENTS 500 | ||||||
|  | +/* event counter */ | ||||||
|  | +uint32_t cached_events_nr; | ||||||
|  |   | ||||||
|  |  struct hostapd_rate_data { | ||||||
|  |  	int rate; /* rate in 100 kbps */ | ||||||
|  | --- a/src/ap/ieee802_11.c | ||||||
|  | +++ b/src/ap/ieee802_11.c | ||||||
|  | @@ -4908,6 +4908,7 @@ int ieee802_11_mgmt(struct hostapd_data | ||||||
|  |  	int ret = 0; | ||||||
|  |  	unsigned int freq; | ||||||
|  |  	int ssi_signal = fi ? fi->ssi_signal : 0; | ||||||
|  | +	int ubus_resp; | ||||||
|  |   | ||||||
|  |  	if (len < 24) | ||||||
|  |  		return 0; | ||||||
|  | @@ -4977,25 +4978,52 @@ int ieee802_11_mgmt(struct hostapd_data | ||||||
|  |  	if (hapd->iconf->track_sta_max_num) | ||||||
|  |  		sta_track_add(hapd->iface, mgmt->sa, ssi_signal); | ||||||
|  |   | ||||||
|  | +	/* ubus request */ | ||||||
|  | +	struct hostapd_ubus_request req = { | ||||||
|  | +		.type = HOSTAPD_UBUS_TYPE_MAX, | ||||||
|  | +		.mgmt_frame = mgmt, | ||||||
|  | +		.ssi_signal = ssi_signal | ||||||
|  | +	}; | ||||||
|  | + | ||||||
|  |  	switch (stype) { | ||||||
|  |  	case WLAN_FC_STYPE_AUTH: | ||||||
|  |  		wpa_printf(MSG_DEBUG, "mgmt::auth"); | ||||||
|  |  		handle_auth(hapd, mgmt, len, ssi_signal, 0); | ||||||
|  | +		hostapd_logger(hapd, NULL, HOSTAPD_MODULE_IEEE80211, | ||||||
|  | +			       HOSTAPD_LEVEL_DEBUG, "mgmt: [%d] [%s]", | ||||||
|  | +				   stype, | ||||||
|  | +			       "AUTH"); | ||||||
|  | +		req.type = HOSTAPD_UBUS_AUTH_REQ; | ||||||
|  |  		ret = 1; | ||||||
|  |  		break; | ||||||
|  |  	case WLAN_FC_STYPE_ASSOC_REQ: | ||||||
|  |  		wpa_printf(MSG_DEBUG, "mgmt::assoc_req"); | ||||||
|  |  		handle_assoc(hapd, mgmt, len, 0, ssi_signal); | ||||||
|  | +		hostapd_logger(hapd, NULL, HOSTAPD_MODULE_IEEE80211, | ||||||
|  | +			       HOSTAPD_LEVEL_DEBUG, "mgmt: [%d] [%s]", | ||||||
|  | +				   stype, | ||||||
|  | +			       "ASSOC"); | ||||||
|  | +		req.type = HOSTAPD_UBUS_ASSOC_REQ; | ||||||
|  |  		ret = 1; | ||||||
|  |  		break; | ||||||
|  |  	case WLAN_FC_STYPE_REASSOC_REQ: | ||||||
|  |  		wpa_printf(MSG_DEBUG, "mgmt::reassoc_req"); | ||||||
|  |  		handle_assoc(hapd, mgmt, len, 1, ssi_signal); | ||||||
|  | +		hostapd_logger(hapd, NULL, HOSTAPD_MODULE_IEEE80211, | ||||||
|  | +			       HOSTAPD_LEVEL_DEBUG, "mgmt: [%d] [%s]", | ||||||
|  | +				   stype, | ||||||
|  | +			       "RE-ASSOC"); | ||||||
|  | +		req.type = HOSTAPD_UBUS_REASSOC_REQ; | ||||||
|  |  		ret = 1; | ||||||
|  |  		break; | ||||||
|  |  	case WLAN_FC_STYPE_DISASSOC: | ||||||
|  |  		wpa_printf(MSG_DEBUG, "mgmt::disassoc"); | ||||||
|  |  		handle_disassoc(hapd, mgmt, len); | ||||||
|  | +		hostapd_logger(hapd, NULL, HOSTAPD_MODULE_IEEE80211, | ||||||
|  | +			       HOSTAPD_LEVEL_DEBUG, "mgmt: [%d] [%s]", | ||||||
|  | +				   stype, | ||||||
|  | +			       "DISASSOC"); | ||||||
|  | +		req.type = HOSTAPD_UBUS_DISASSOC_REQ; | ||||||
|  |  		ret = 1; | ||||||
|  |  		break; | ||||||
|  |  	case WLAN_FC_STYPE_DEAUTH: | ||||||
|  | @@ -5014,6 +5042,15 @@ int ieee802_11_mgmt(struct hostapd_data | ||||||
|  |  		break; | ||||||
|  |  	} | ||||||
|  |   | ||||||
|  | +	/* ubus send */ | ||||||
|  | +	if (req.type != HOSTAPD_UBUS_TYPE_MAX) { | ||||||
|  | +		ubus_resp = hostapd_ubus_handle_rt_event(hapd, &req); | ||||||
|  | +		if (ubus_resp) { | ||||||
|  | +			hostapd_logger(hapd, NULL, HOSTAPD_MODULE_IEEE80211, | ||||||
|  | +				       HOSTAPD_LEVEL_INFO, | ||||||
|  | +				       "hostapd_ubus_handle_rt_event: ERROR"); | ||||||
|  | +		} | ||||||
|  | +	} | ||||||
|  |  	return ret; | ||||||
|  |  } | ||||||
|  |   | ||||||
|  | --- a/src/ap/sta_info.c | ||||||
|  | +++ b/src/ap/sta_info.c | ||||||
|  | @@ -423,8 +423,14 @@ void ap_handle_timer(void *eloop_ctx, vo | ||||||
|  |  		hostapd_logger(hapd, sta->addr, HOSTAPD_MODULE_IEEE80211, | ||||||
|  |  			       HOSTAPD_LEVEL_INFO, "deauthenticated due to " | ||||||
|  |  			       "local deauth request"); | ||||||
|  | -		ap_free_sta(hapd, sta); | ||||||
|  |  		hostapd_ubus_notify(hapd, "local-deauth", sta->addr); | ||||||
|  | +		struct hostapd_ubus_request req = { | ||||||
|  | +			.type = HOSTAPD_UBUS_DISASSOC_REQ, | ||||||
|  | +			.sta = sta, | ||||||
|  | +			.reason = sta->deauth_reason | ||||||
|  | +		}; | ||||||
|  | +		hostapd_ubus_handle_rt_event(hapd, &req); | ||||||
|  | +		ap_free_sta(hapd, sta); | ||||||
|  |  		return; | ||||||
|  |  	} | ||||||
|  |   | ||||||
|  | @@ -530,6 +536,14 @@ skip_poll: | ||||||
|  |  				WLAN_REASON_DISASSOC_DUE_TO_INACTIVITY : | ||||||
|  |  				WLAN_REASON_PREV_AUTH_NOT_VALID; | ||||||
|  |   | ||||||
|  | +			/* sessions */ | ||||||
|  | +			struct hostapd_ubus_request req = { | ||||||
|  | +				.type = HOSTAPD_UBUS_DISASSOC_REQ, | ||||||
|  | +				.sta = sta, | ||||||
|  | +				.reason = reason | ||||||
|  | +			}; | ||||||
|  | +			hostapd_ubus_handle_rt_event(hapd, &req); | ||||||
|  | + | ||||||
|  |  			hostapd_drv_sta_disassoc(hapd, sta->addr, reason); | ||||||
|  |  		} | ||||||
|  |  	} | ||||||
|  | @@ -566,6 +580,15 @@ skip_poll: | ||||||
|  |  			   __func__, MAC2STR(sta->addr), AP_DEAUTH_DELAY); | ||||||
|  |  		eloop_register_timeout(AP_DEAUTH_DELAY, 0, ap_handle_timer, | ||||||
|  |  				       hapd, sta); | ||||||
|  | + | ||||||
|  | +		/* sessions */ | ||||||
|  | +		struct hostapd_ubus_request req = { | ||||||
|  | +			.type = HOSTAPD_UBUS_DISASSOC_REQ, | ||||||
|  | +			.sta = sta, | ||||||
|  | +			.reason = reason | ||||||
|  | +		}; | ||||||
|  | +		hostapd_ubus_handle_rt_event(hapd, &req); | ||||||
|  | + | ||||||
|  |  		mlme_disassociate_indication(hapd, sta, reason); | ||||||
|  |  		break; | ||||||
|  |  	case STA_DEAUTH: | ||||||
|  | --- a/src/ap/sta_info.h | ||||||
|  | +++ b/src/ap/sta_info.h | ||||||
|  | @@ -77,6 +77,9 @@ struct sta_info { | ||||||
|  |  	u8 supported_rates[WLAN_SUPP_RATES_MAX]; | ||||||
|  |  	int supported_rates_len; | ||||||
|  |  	u8 qosinfo; /* Valid when WLAN_STA_WMM is set */ | ||||||
|  | +	u64 cl_session_id; /* client fnv1a 64bit session id */ | ||||||
|  | +	u8 fdata; /* client first data flag */ | ||||||
|  | +	u8 first_ip; /* client first ip flag */ | ||||||
|  |   | ||||||
|  |  #ifdef CONFIG_MESH | ||||||
|  |  	enum mesh_plink_state plink_state; | ||||||
|  | --- a/src/ap/ubus.c | ||||||
|  | +++ b/src/ap/ubus.c | ||||||
|  | @@ -24,7 +24,10 @@ | ||||||
|  |   | ||||||
|  |  static struct ubus_context *ctx; | ||||||
|  |  static struct blob_buf b; | ||||||
|  | +static struct blob_buf b_ev; | ||||||
|  |  static int ctx_ref; | ||||||
|  | +static char** bss_lst = NULL; | ||||||
|  | +static size_t bss_nr = 0; | ||||||
|  |   | ||||||
|  |  static inline struct hapd_interfaces *get_hapd_interfaces_from_object(struct ubus_object *obj) | ||||||
|  |  { | ||||||
|  | @@ -63,6 +66,21 @@ static void hostapd_ubus_connection_lost | ||||||
|  |  	eloop_register_timeout(1, 0, ubus_reconnect_timeout, ctx, NULL); | ||||||
|  |  } | ||||||
|  |   | ||||||
|  | +static int avl_compare_sess_id(const void *k1, const void *k2, void *ptr) | ||||||
|  | +{ | ||||||
|  | +	const uint32_t *id1 = k1, *id2 = k2; | ||||||
|  | + | ||||||
|  | +	if (*id1 < *id2) | ||||||
|  | +		return -1; | ||||||
|  | +	else | ||||||
|  | +		return *id1 > *id2; | ||||||
|  | +} | ||||||
|  | + | ||||||
|  | +uint64_t get_time_in_ms(struct timespec *ts) | ||||||
|  | +{ | ||||||
|  | +    return (uint64_t) ts->tv_sec * 1000 + ts->tv_nsec / 1000000; | ||||||
|  | +} | ||||||
|  | + | ||||||
|  |  static bool hostapd_ubus_init(void) | ||||||
|  |  { | ||||||
|  |  	if (ctx) | ||||||
|  | @@ -525,6 +543,177 @@ static const struct blobmsg_policy csa_p | ||||||
|  |  }; | ||||||
|  |   | ||||||
|  |  #ifdef NEED_AP_MLME | ||||||
|  | +enum { CSESS_REQ_SESS_ID, | ||||||
|  | +       __CSESS_REQ_MAX, | ||||||
|  | +}; | ||||||
|  | + | ||||||
|  | +static const struct blobmsg_policy client_session_del_policy[__CSESS_REQ_MAX] = { | ||||||
|  | +	[CSESS_REQ_SESS_ID] = { .name = "session_id", .type = BLOBMSG_TYPE_INT64 }, | ||||||
|  | +}; | ||||||
|  | + | ||||||
|  | +static int hostapd_clear_session(struct ubus_context *ctx, | ||||||
|  | +				 struct ubus_object *obj, | ||||||
|  | +				 struct ubus_request_data *req, | ||||||
|  | +				 const char *method, | ||||||
|  | +				 struct blob_attr *msg) | ||||||
|  | +{ | ||||||
|  | +	struct blob_attr *tb[__CSESS_REQ_MAX]; | ||||||
|  | +	struct hostapd_data *hapd = container_of(obj, struct hostapd_data, ubus.obj); | ||||||
|  | +	struct hostapd_event_avl_rec *rec = NULL; | ||||||
|  | +	struct hostapd_event_avl_rec *rec_next = NULL; | ||||||
|  | +	uint64_t session_id = 0; | ||||||
|  | + | ||||||
|  | +	blobmsg_parse(client_session_del_policy, __CSESS_REQ_MAX, tb, | ||||||
|  | +		      blob_data(msg), blob_len(msg)); | ||||||
|  | + | ||||||
|  | +	if (!tb[CSESS_REQ_SESS_ID]) | ||||||
|  | +		return UBUS_STATUS_INVALID_ARGUMENT; | ||||||
|  | + | ||||||
|  | +	session_id = blobmsg_get_u64(tb[CSESS_REQ_SESS_ID]); | ||||||
|  | +	/* remove from AVL and ubus session object) */ | ||||||
|  | +	avl_for_each_element_safe(&hapd->ubus.rt_events, rec, avl, rec_next) | ||||||
|  | +	{ | ||||||
|  | +		if (session_id == rec->session_id) { | ||||||
|  | +			/* dec counter and delete */ | ||||||
|  | +			cached_events_nr -= rec->rec_nr; | ||||||
|  | +			avl_delete(&hapd->ubus.rt_events, &rec->avl); | ||||||
|  | +			os_free(rec->records); | ||||||
|  | +			os_free(rec); | ||||||
|  | +		} | ||||||
|  | +	} | ||||||
|  | +	return 0; | ||||||
|  | +} | ||||||
|  | + | ||||||
|  | +static int hostapd_clear_sessions(struct ubus_context *ctx, | ||||||
|  | +				  struct ubus_object *obj, | ||||||
|  | +				  struct ubus_request_data *req, | ||||||
|  | +				  const char *method, | ||||||
|  | +				  struct blob_attr *msg) | ||||||
|  | +{ | ||||||
|  | +	struct hostapd_data *hapd = container_of(obj, struct hostapd_data, ubus.obj); | ||||||
|  | +	struct hostapd_event_avl_rec *rec = NULL; | ||||||
|  | +	struct hostapd_event_avl_rec *rec_n = NULL; | ||||||
|  | + | ||||||
|  | +	avl_remove_all_elements(&hapd->ubus.rt_events, rec, avl, rec_n) | ||||||
|  | +	{ | ||||||
|  | +		/* free events array */ | ||||||
|  | +		os_free(rec->records); | ||||||
|  | +		os_free(rec); | ||||||
|  | +	} | ||||||
|  | +	/* reset counter */ | ||||||
|  | +	cached_events_nr = 0; | ||||||
|  | +	return 0; | ||||||
|  | +} | ||||||
|  | + | ||||||
|  | +static int hostapd_sessions(struct ubus_context *ctx, | ||||||
|  | +			struct ubus_object *obj, | ||||||
|  | +		        struct ubus_request_data *req, | ||||||
|  | +			const char *method, | ||||||
|  | +                        struct blob_attr *msg) | ||||||
|  | +{ | ||||||
|  | +	struct hostapd_data *hapd = container_of(obj, struct hostapd_data, ubus.obj); | ||||||
|  | +	void *a = NULL; | ||||||
|  | +	void *t = NULL; | ||||||
|  | +	void *t_msg = NULL; | ||||||
|  | +	struct hostapd_event_avl_rec *rec = NULL; | ||||||
|  | +	struct client_session_record *c_rec = NULL; | ||||||
|  | + | ||||||
|  | +	blob_buf_init(&b_ev, 0); | ||||||
|  | +	a = blobmsg_open_table(&b_ev, "sessions"); | ||||||
|  | +	avl_for_each_element(&hapd->ubus.rt_events, rec, avl) | ||||||
|  | +	{ | ||||||
|  | +		/* open session */ | ||||||
|  | +		t = blobmsg_open_table(&b_ev, "ClientSession"); | ||||||
|  | +		blobmsg_add_u64(&b_ev, "session_id", rec->session_id); | ||||||
|  | +		/* messages for current session */ | ||||||
|  | +		for (size_t i = 0; i < rec->rec_nr; i++) { | ||||||
|  | +			c_rec = &rec->records[i]; | ||||||
|  | +			/* check message type */ | ||||||
|  | +			switch (c_rec->type) { | ||||||
|  | +			/* ClientAuthEvent */ | ||||||
|  | +			case CST_AUTH: { | ||||||
|  | +				struct client_auth_event *p = &c_rec->u.auth; | ||||||
|  | +				t_msg = blobmsg_open_table(&b_ev, "ClientAuthEvent"); | ||||||
|  | +				blobmsg_add_u64(&b_ev, "session_id", rec->session_id); | ||||||
|  | +				blobmsg_add_u64(&b_ev, "timestamp", c_rec->timestamp); | ||||||
|  | +				blobmsg_add_string(&b_ev, "sta_mac", p->sta_mac); | ||||||
|  | +				blobmsg_add_u32(&b_ev, "band", p->band); | ||||||
|  | +				blobmsg_add_u32(&b_ev, "auth_status", p->auth_status); | ||||||
|  | +				blobmsg_add_string(&b_ev, "ssid", p->ssid); | ||||||
|  | +				blobmsg_close_table(&b_ev, t_msg); | ||||||
|  | +				break; | ||||||
|  | +			} | ||||||
|  | + | ||||||
|  | +			/* ClientAssocEvent */ | ||||||
|  | +			case CST_ASSOC: { | ||||||
|  | +				struct client_assoc_event *p = &c_rec->u.assoc; | ||||||
|  | +				t_msg = blobmsg_open_table(&b_ev, "ClientAssocEvent"); | ||||||
|  | +				blobmsg_add_u64(&b_ev, "session_id", rec->session_id); | ||||||
|  | +				blobmsg_add_u64(&b_ev, "timestamp", c_rec->timestamp); | ||||||
|  | +				blobmsg_add_string(&b_ev, "sta_mac", p->sta_mac); | ||||||
|  | +				blobmsg_add_u32(&b_ev, "band", p->band); | ||||||
|  | +				blobmsg_add_u32(&b_ev, "assoc_type", 0); | ||||||
|  | +				blobmsg_add_u32(&b_ev, "rssi", p->rssi); | ||||||
|  | +				blobmsg_add_u32(&b_ev, "internal_sc", 0); | ||||||
|  | +				blobmsg_add_u8(&b_ev, "using11k", p->using11k); | ||||||
|  | +				blobmsg_add_u8(&b_ev, "using11r", p->using11r); | ||||||
|  | +				blobmsg_add_u8(&b_ev, "using11v", p->using11v); | ||||||
|  | +				blobmsg_add_string(&b_ev, "ssid", p->ssid); | ||||||
|  | +				blobmsg_close_table(&b_ev, t_msg); | ||||||
|  | +				break; | ||||||
|  | +			} | ||||||
|  | + | ||||||
|  | +			/* ClientDisconnectEvent */ | ||||||
|  | +			case CST_DISASSOC: { | ||||||
|  | +				struct client_disassoc_event *p = &c_rec->u.disassoc; | ||||||
|  | +				t_msg = blobmsg_open_table(&b_ev, "ClientDisconnectEvent"); | ||||||
|  | +				blobmsg_add_u64(&b_ev, "session_id", rec->session_id); | ||||||
|  | +				blobmsg_add_u64(&b_ev, "timestamp", c_rec->timestamp); | ||||||
|  | +				blobmsg_add_string(&b_ev, "sta_mac", p->sta_mac); | ||||||
|  | +				blobmsg_add_u32(&b_ev, "band", p->band); | ||||||
|  | +				blobmsg_add_u32(&b_ev, "rssi", p->rssi); | ||||||
|  | +				blobmsg_add_u32(&b_ev, "internal_rc", p->internal_rc); | ||||||
|  | +				blobmsg_add_string(&b_ev, "ssid", p->ssid); | ||||||
|  | +				blobmsg_close_table(&b_ev, t_msg); | ||||||
|  | +				break; | ||||||
|  | +			} | ||||||
|  | + | ||||||
|  | +			/* ClientFirstDataEvent */ | ||||||
|  | +			case CST_FDATA: { | ||||||
|  | +				struct client_fdata_event *p = &c_rec->u.fdata; | ||||||
|  | +				t_msg = blobmsg_open_table(&b_ev, "ClientFirstDataEvent"); | ||||||
|  | +				blobmsg_add_u64(&b_ev, "session_id", rec->session_id); | ||||||
|  | +				blobmsg_add_u64(&b_ev, "timestamp", c_rec->timestamp); | ||||||
|  | +				blobmsg_add_string(&b_ev, "sta_mac", p->sta_mac); | ||||||
|  | +				blobmsg_add_u64(&b_ev, "fdata_tx_up_ts_in_us", p->tx_ts.tv_sec * (uint64_t)1000000); | ||||||
|  | +				blobmsg_add_u64(&b_ev, "fdata_rx_up_ts_in_us", p->rx_ts.tv_sec * (uint64_t)1000000); | ||||||
|  | +				blobmsg_close_table(&b_ev, t_msg); | ||||||
|  | +				break; | ||||||
|  | +			} | ||||||
|  | + | ||||||
|  | +			/* ClientIpEvent */ | ||||||
|  | +			case CST_IP: { | ||||||
|  | +				struct client_ip_event *p = &c_rec->u.ip; | ||||||
|  | +				t_msg = blobmsg_open_table(&b_ev, "ClientIpEvent"); | ||||||
|  | +				blobmsg_add_u64(&b_ev, "session_id", rec->session_id); | ||||||
|  | +				blobmsg_add_u64(&b_ev, "timestamp", c_rec->timestamp); | ||||||
|  | +				blobmsg_add_string(&b_ev, "sta_mac", p->sta_mac); | ||||||
|  | +				blobmsg_add_string(&b_ev, "ip_address", p->ip_addr); | ||||||
|  | +				blobmsg_close_table(&b_ev, t_msg); | ||||||
|  | +				break; | ||||||
|  | +			} | ||||||
|  | + | ||||||
|  | +			default: | ||||||
|  | +				break; | ||||||
|  | +			} | ||||||
|  | +		} | ||||||
|  | +		blobmsg_close_table(&b_ev, t); | ||||||
|  | +	} | ||||||
|  | +	blobmsg_close_table(&b_ev, a); | ||||||
|  | +	ubus_send_reply(ctx, req, b_ev.head); | ||||||
|  | +	return 0; | ||||||
|  | +} | ||||||
|  | + | ||||||
|  |  static int | ||||||
|  |  hostapd_switch_chan(struct ubus_context *ctx, struct ubus_object *obj, | ||||||
|  |  		    struct ubus_request_data *req, const char *method, | ||||||
|  | @@ -1148,6 +1337,9 @@ static const struct ubus_method bss_meth | ||||||
|  |  	UBUS_METHOD_NOARG("get_features", hostapd_bss_get_features), | ||||||
|  |  #ifdef NEED_AP_MLME | ||||||
|  |  	UBUS_METHOD("switch_chan", hostapd_switch_chan, csa_policy), | ||||||
|  | +	UBUS_METHOD_NOARG("get_sessions", hostapd_sessions), | ||||||
|  | +	UBUS_METHOD_NOARG("clear_sessions", hostapd_clear_sessions), | ||||||
|  | +	UBUS_METHOD("clear_session", hostapd_clear_session, client_session_del_policy), | ||||||
|  |  #endif | ||||||
|  |  	UBUS_METHOD("set_vendor_elements", hostapd_vendor_elements, ve_policy), | ||||||
|  |  	UBUS_METHOD("notify_response", hostapd_notify_response, notify_policy), | ||||||
|  | @@ -1187,6 +1379,7 @@ void hostapd_ubus_add_bss(struct hostapd | ||||||
|  |  	if (asprintf(&name, "hostapd.%s", hapd->conf->iface) < 0) | ||||||
|  |  		return; | ||||||
|  |   | ||||||
|  | +	avl_init(&hapd->ubus.rt_events, avl_compare_sess_id, false, NULL); | ||||||
|  |  	avl_init(&hapd->ubus.banned, avl_compare_macaddr, false, NULL); | ||||||
|  |  	obj->name = name; | ||||||
|  |  	obj->type = &bss_object_type; | ||||||
|  | @@ -1194,6 +1387,9 @@ void hostapd_ubus_add_bss(struct hostapd | ||||||
|  |  	obj->n_methods = bss_object_type.n_methods; | ||||||
|  |  	ret = ubus_add_object(ctx, obj); | ||||||
|  |  	hostapd_ubus_ref_inc(); | ||||||
|  | +	bss_nr++; | ||||||
|  | +	bss_lst = os_realloc(bss_lst, sizeof(char *) * bss_nr); | ||||||
|  | +	bss_lst[bss_nr - 1] = strdup(name); | ||||||
|  |  	if (hapd->conf->signal_stay_min > -128) | ||||||
|  |  		eloop_register_timeout(3, 0, hostapd_bss_signal_check, NULL, hapd);  /* Start up the poll timer. */ | ||||||
|  |  } | ||||||
|  | @@ -1212,11 +1408,42 @@ void hostapd_ubus_free_bss(struct hostap | ||||||
|  |  	} | ||||||
|  |   | ||||||
|  |  	free(name); | ||||||
|  | +	for (size_t i = 0; i < bss_nr; i++) | ||||||
|  | +		os_free(bss_lst[i]); | ||||||
|  | +	free(bss_lst); | ||||||
|  | +	bss_lst = NULL; | ||||||
|  | +} | ||||||
|  | + | ||||||
|  | +static int hostapd_get_bss_list(struct ubus_context *ctx, | ||||||
|  | +				struct ubus_object *obj, | ||||||
|  | +				struct ubus_request_data *req, | ||||||
|  | +				const char *method, | ||||||
|  | +				struct blob_attr *msg) | ||||||
|  | +{ | ||||||
|  | +	if (!bss_lst) | ||||||
|  | +		return 0; | ||||||
|  | + | ||||||
|  | +	void *a = NULL; | ||||||
|  | +	void *b = NULL; | ||||||
|  | + | ||||||
|  | +	/* create reply */ | ||||||
|  | +	blob_buf_init(&b_ev, 0); | ||||||
|  | +	a = blobmsg_open_array(&b_ev, "bss_list"); | ||||||
|  | +	/* check bss list from hapd */ | ||||||
|  | +	for (size_t i = 0; i < bss_nr; i++) { | ||||||
|  | +		b = blobmsg_open_table(&b_ev, NULL); | ||||||
|  | +		blobmsg_add_string(&b_ev, "name", bss_lst[i]); | ||||||
|  | +		blobmsg_close_table(&b_ev, b); | ||||||
|  | +	} | ||||||
|  | +	blobmsg_close_array(&b_ev, a); | ||||||
|  | +	ubus_send_reply(ctx, req, b_ev.head); | ||||||
|  | +	return 0; | ||||||
|  |  } | ||||||
|  |   | ||||||
|  |  static const struct ubus_method daemon_methods[] = { | ||||||
|  |  	UBUS_METHOD("config_add", hostapd_config_add, config_add_policy), | ||||||
|  |  	UBUS_METHOD("config_remove", hostapd_config_remove, config_remove_policy), | ||||||
|  | +	UBUS_METHOD_NOARG("get_bss_list", hostapd_get_bss_list), | ||||||
|  |  }; | ||||||
|  |   | ||||||
|  |  static struct ubus_object_type daemon_object_type = | ||||||
|  | @@ -1260,6 +1487,18 @@ struct ubus_event_req { | ||||||
|  |  	int resp; | ||||||
|  |  }; | ||||||
|  |   | ||||||
|  | +static uint64_t hash_fnv1a_64bit(const void *key, int len) | ||||||
|  | +{ | ||||||
|  | +	if (key == NULL) | ||||||
|  | +		return 0; | ||||||
|  | +	unsigned char *p = (unsigned char *)key; | ||||||
|  | +	uint64_t h = 14695981039346656037UL; | ||||||
|  | +	int i; | ||||||
|  | +	for (i = 0; i < len; i++) | ||||||
|  | +		h = (h ^ p[i]) * 1099511628211UL; | ||||||
|  | +	return h; | ||||||
|  | +} | ||||||
|  | + | ||||||
|  |  static void | ||||||
|  |  ubus_event_cb(struct ubus_notify_request *req, int idx, int ret) | ||||||
|  |  { | ||||||
|  | @@ -1268,6 +1507,224 @@ ubus_event_cb(struct ubus_notify_request | ||||||
|  |  	ureq->resp = ret; | ||||||
|  |  } | ||||||
|  |   | ||||||
|  | +int hostapd_ubus_handle_rt_event(struct hostapd_data *hapd, | ||||||
|  | +				 struct hostapd_ubus_request *req) | ||||||
|  | +{ | ||||||
|  | +	/* check event counter */ | ||||||
|  | +	if (cached_events_nr > HOSTAPD_MAX_CACHED_EVENTS) { | ||||||
|  | +		hostapd_logger( | ||||||
|  | +			hapd, NULL, HOSTAPD_MODULE_IEEE80211, | ||||||
|  | +			HOSTAPD_LEVEL_WARNING, | ||||||
|  | +			"hostapd_ubus_handle_rt_event: HOSTAPD_MAX_CACHED_EVENTS [%d] exceeded", | ||||||
|  | +			HOSTAPD_MAX_CACHED_EVENTS); | ||||||
|  | +		return WLAN_STATUS_SUCCESS; | ||||||
|  | +	} | ||||||
|  | +	struct hostapd_event_avl_rec *rec = NULL; | ||||||
|  | +	struct timespec ts; | ||||||
|  | +	uint64_t timestamp = 0; | ||||||
|  | +	clock_gettime(CLOCK_REALTIME, &ts); | ||||||
|  | +	timestamp = get_time_in_ms(&ts); | ||||||
|  | +	uint64_t session_id = 0; | ||||||
|  | +	uint8_t new_rec = 0; | ||||||
|  | +	const struct ieee80211_mgmt *mgmt = req->mgmt_frame; | ||||||
|  | +	struct sta_info *sta = req->sta ? (void *)req->sta : ap_get_sta(hapd, mgmt->sa); | ||||||
|  | +	/* null pointer check */ | ||||||
|  | +	if (!sta) return WLAN_STATUS_AP_UNABLE_TO_HANDLE_NEW_STA; | ||||||
|  | + | ||||||
|  | +	struct hostapd_bss_config *bss_conf = hapd->conf; | ||||||
|  | +	session_id = sta->cl_session_id; | ||||||
|  | + | ||||||
|  | +	/* find by session id */ | ||||||
|  | +	rec = avl_find_element(&hapd->ubus.rt_events, &session_id, rec, avl); | ||||||
|  | + | ||||||
|  | +	/* prepare rec if not found */ | ||||||
|  | +	if (!rec) { | ||||||
|  | +		new_rec = 1; | ||||||
|  | +		rec = os_zalloc(sizeof(struct hostapd_event_avl_rec)); | ||||||
|  | +		session_id = hash_fnv1a_64bit(&ts, sizeof(struct timespec)); | ||||||
|  | +	} | ||||||
|  | +	hostapd_logger(hapd, NULL, HOSTAPD_MODULE_IEEE80211, | ||||||
|  | +		       HOSTAPD_LEVEL_DEBUG, | ||||||
|  | +		       "hostapd_ubus_handle_rt_event: REQ TYPE [%d]", | ||||||
|  | +		       req->type); | ||||||
|  | + | ||||||
|  | +	switch (req->type) { | ||||||
|  | +	case HOSTAPD_UBUS_AUTH_REQ: { | ||||||
|  | +		/* session id */ | ||||||
|  | +		rec->session_id = session_id; | ||||||
|  | +		rec->rec_nr++; | ||||||
|  | +		rec->records = os_realloc(rec->records, | ||||||
|  | +					  sizeof(struct client_session_record) * rec->rec_nr); | ||||||
|  | +		struct client_session_record *rp = &rec->records[rec->rec_nr - 1]; | ||||||
|  | +		rp->type = CST_AUTH; | ||||||
|  | +		rp->u.auth.session_id = rec->session_id; | ||||||
|  | + | ||||||
|  | +		/* timestamp */ | ||||||
|  | +		rp->timestamp = timestamp; | ||||||
|  | +		/* frequency */ | ||||||
|  | +		rp->u.auth.band = hapd->iface->freq; | ||||||
|  | +		/* STA MAC */ | ||||||
|  | +		sprintf(rp->u.auth.sta_mac, MACSTR, MAC2STR(sta->addr)); | ||||||
|  | +		/* ssid */ | ||||||
|  | +		rp->u.auth.ssid[0] = 0; | ||||||
|  | +		printf_encode(rp->u.auth.ssid, sizeof(rp->u.auth.ssid), | ||||||
|  | +			      bss_conf->ssid.ssid, bss_conf->ssid.ssid_len); | ||||||
|  | +		/* auth status */ | ||||||
|  | +		rp->u.auth.auth_status = le_to_host16(mgmt->u.auth.status_code); | ||||||
|  | +		hostapd_logger( | ||||||
|  | +			hapd, NULL, HOSTAPD_MODULE_IEEE80211, | ||||||
|  | +			HOSTAPD_LEVEL_DEBUG, | ||||||
|  | +			"hostapd_ubus_handle_rt_event:HOSTAPD_UBUS_AUTH_REQ"); | ||||||
|  | +		/* inc counter */ | ||||||
|  | +		cached_events_nr++; | ||||||
|  | +		break; | ||||||
|  | +	} | ||||||
|  | +	case HOSTAPD_UBUS_ASSOC_REQ: { | ||||||
|  | +		/* session id */ | ||||||
|  | +		rec->session_id = session_id; | ||||||
|  | +		rec->rec_nr++; | ||||||
|  | +		rec->records = os_realloc(rec->records, | ||||||
|  | +					  sizeof(struct client_session_record) * rec->rec_nr); | ||||||
|  | +		struct client_session_record *rp = &rec->records[rec->rec_nr - 1]; | ||||||
|  | +		rp->type = CST_ASSOC; | ||||||
|  | +		rp->u.assoc.session_id = rec->session_id; | ||||||
|  | +		/* timestamp */ | ||||||
|  | +		rp->timestamp = timestamp; | ||||||
|  | +		/* frequency */ | ||||||
|  | +		rp->u.assoc.band = hapd->iface->freq; | ||||||
|  | +		/* STA MAC */ | ||||||
|  | +		sprintf(rp->u.assoc.sta_mac, MACSTR, MAC2STR(sta->addr)); | ||||||
|  | +		/* ssid */ | ||||||
|  | +		rp->u.assoc.ssid[0] = 0; | ||||||
|  | +		printf_encode(rp->u.assoc.ssid, sizeof(rp->u.assoc.ssid), | ||||||
|  | +			      bss_conf->ssid.ssid, bss_conf->ssid.ssid_len); | ||||||
|  | +		/* rssi */ | ||||||
|  | +		rp->u.assoc.rssi = req->ssi_signal; | ||||||
|  | +		/* using 11r */ | ||||||
|  | +		rp->u.assoc.using11r = (sta->auth_alg & WPA_AUTH_ALG_FT); | ||||||
|  | +		/* using 11k */ | ||||||
|  | +		if (sta->rrm_enabled_capa[0] || sta->rrm_enabled_capa[1] || | ||||||
|  | +		    sta->rrm_enabled_capa[2] || sta->rrm_enabled_capa[3] || | ||||||
|  | +		    sta->rrm_enabled_capa[4]) | ||||||
|  | +			rp->u.assoc.using11k = 1; | ||||||
|  | +		else | ||||||
|  | +			rp->u.assoc.using11k = 0; | ||||||
|  | +		/* using 11v */ | ||||||
|  | +		if (bss_conf->time_advertisement || bss_conf->wnm_sleep_mode || | ||||||
|  | +		    bss_conf->bss_transition) | ||||||
|  | +			rp->u.assoc.using11v = 1; | ||||||
|  | +		else | ||||||
|  | +			rp->u.assoc.using11v = 0; | ||||||
|  | +		hostapd_logger( | ||||||
|  | +			hapd, NULL, HOSTAPD_MODULE_IEEE80211, | ||||||
|  | +			HOSTAPD_LEVEL_DEBUG, | ||||||
|  | +			"hostapd_ubus_handle_rt_event:HOSTAPD_UBUS_ASSOC_REQ"); | ||||||
|  | +		/* inc counter */ | ||||||
|  | +		cached_events_nr++; | ||||||
|  | +		break; | ||||||
|  | +	} | ||||||
|  | +	case HOSTAPD_UBUS_DISASSOC_REQ: { | ||||||
|  | +		/* session id */ | ||||||
|  | +		rec->session_id = session_id; | ||||||
|  | +		rec->rec_nr++; | ||||||
|  | +		rec->records = os_realloc(rec->records, | ||||||
|  | +					  sizeof(struct client_session_record) * rec->rec_nr); | ||||||
|  | +		struct client_session_record *rp = &rec->records[rec->rec_nr - 1]; | ||||||
|  | +		rp->type = CST_DISASSOC; | ||||||
|  | +		rp->u.disassoc.session_id = rec->session_id; | ||||||
|  | +		/* timestamp */ | ||||||
|  | +		rp->timestamp = timestamp; | ||||||
|  | +		/* frequency */ | ||||||
|  | +		rp->u.disassoc.band = hapd->iface->freq; | ||||||
|  | +		/* STA MAC */ | ||||||
|  | +		sprintf(rp->u.disassoc.sta_mac, MACSTR, MAC2STR(sta->addr)); | ||||||
|  | +		/* ssid */ | ||||||
|  | +		rp->u.disassoc.ssid[0] = 0; | ||||||
|  | +		printf_encode(rp->u.disassoc.ssid, sizeof(rp->u.disassoc.ssid), | ||||||
|  | +			      bss_conf->ssid.ssid, bss_conf->ssid.ssid_len); | ||||||
|  | +		/* rssi */ | ||||||
|  | +		rp->u.disassoc.rssi = req->ssi_signal; | ||||||
|  | +		/* internal_rc */ | ||||||
|  | +		rp->u.disassoc.internal_rc = req->reason; | ||||||
|  | +		hostapd_logger( | ||||||
|  | +			hapd, NULL, HOSTAPD_MODULE_IEEE80211, | ||||||
|  | +			HOSTAPD_LEVEL_DEBUG, | ||||||
|  | +			"hostapd_ubus_handle_rt_event:HOSTAPD_UBUS_DISASSOC_REQ"); | ||||||
|  | +		/* inc counter */ | ||||||
|  | +		cached_events_nr++; | ||||||
|  | +		break; | ||||||
|  | +	} | ||||||
|  | +	case HOSTAPD_UBUS_FDATA_REQ: { | ||||||
|  | +		/* session id */ | ||||||
|  | +		rec->session_id = session_id; | ||||||
|  | +		rec->rec_nr++; | ||||||
|  | +		rec->records = os_realloc(rec->records, | ||||||
|  | +					  sizeof(struct client_session_record) * rec->rec_nr); | ||||||
|  | +		struct client_session_record *rp = &rec->records[rec->rec_nr - 1]; | ||||||
|  | +		rp->type = CST_FDATA; | ||||||
|  | +		rp->u.fdata.session_id = rec->session_id; | ||||||
|  | +		/* timestamp */ | ||||||
|  | +		rp->timestamp = timestamp; | ||||||
|  | +		/* STA MAC */ | ||||||
|  | +		sprintf(rp->u.fdata.sta_mac, MACSTR, MAC2STR(sta->addr)); | ||||||
|  | +		/* rx ts */ | ||||||
|  | +		rp->u.fdata.rx_ts = ts; | ||||||
|  | +		/* tx ts */ | ||||||
|  | +		rp->u.fdata.tx_ts = ts; | ||||||
|  | +		/* single event only */ | ||||||
|  | +		sta->fdata = 1; | ||||||
|  | +		hostapd_logger( | ||||||
|  | +			hapd, NULL, HOSTAPD_MODULE_IEEE80211, | ||||||
|  | +			HOSTAPD_LEVEL_DEBUG, | ||||||
|  | +			"hostapd_ubus_handle_rt_event:HOSTAPD_UBUS_FDATA_REQ"); | ||||||
|  | +		/* inc counter */ | ||||||
|  | +		cached_events_nr++; | ||||||
|  | +		break; | ||||||
|  | +	} | ||||||
|  | +	case HOSTAPD_UBUS_IP_REQ: { | ||||||
|  | +		if(sta->first_ip) break; | ||||||
|  | +		/* session id */ | ||||||
|  | +		rec->session_id = session_id; | ||||||
|  | +		rec->rec_nr++; | ||||||
|  | +		rec->records = os_realloc(rec->records, | ||||||
|  | +					  sizeof(struct client_session_record) * rec->rec_nr); | ||||||
|  | +		struct client_session_record *rp = &rec->records[rec->rec_nr - 1]; | ||||||
|  | +		rp->type = CST_IP; | ||||||
|  | +		rp->u.ip.session_id = rec->session_id; | ||||||
|  | +		/* timestamp */ | ||||||
|  | +		rp->timestamp = timestamp; | ||||||
|  | +		/* STA MAC */ | ||||||
|  | +		sprintf(rp->u.ip.sta_mac, MACSTR, MAC2STR(sta->addr)); | ||||||
|  | +		/* ip address */ | ||||||
|  | +		snprintf(rp->u.ip.ip_addr, 20, "%u.%u.%u.%u", | ||||||
|  | +			 (req->ipaddr >> 24) & 0xFF, | ||||||
|  | +			 (req->ipaddr >> 16) & 0xFF, | ||||||
|  | +			 (req->ipaddr >> 8) & 0xFF, | ||||||
|  | +			 req->ipaddr & 0xFF); | ||||||
|  | +		/* single event only */ | ||||||
|  | +		sta->first_ip = 1; | ||||||
|  | +		/* inc counter */ | ||||||
|  | +		cached_events_nr++; | ||||||
|  | +		break; | ||||||
|  | +	} | ||||||
|  | +	default: | ||||||
|  | +		hostapd_logger(hapd, NULL, HOSTAPD_MODULE_IEEE80211, | ||||||
|  | +			       HOSTAPD_LEVEL_DEBUG, | ||||||
|  | +			       "hostapd_ubus_handle_rt_event:UNKNOWN"); | ||||||
|  | +		new_rec = 0; | ||||||
|  | +		break; | ||||||
|  | +	} | ||||||
|  | +	if (new_rec) { | ||||||
|  | +		/* insert new client session */ | ||||||
|  | +		rec->avl.key = &rec->session_id; | ||||||
|  | +		sta->cl_session_id = session_id; | ||||||
|  | +		if (avl_insert(&hapd->ubus.rt_events, &rec->avl)) | ||||||
|  | +			return WLAN_STATUS_UNSPECIFIED_FAILURE; | ||||||
|  | +	} | ||||||
|  | + | ||||||
|  | +	return WLAN_STATUS_SUCCESS; | ||||||
|  | +} | ||||||
|  | + | ||||||
|  |  int hostapd_ubus_handle_event(struct hostapd_data *hapd, struct hostapd_ubus_request *req) | ||||||
|  |  { | ||||||
|  |  	struct ubus_banned_client *ban; | ||||||
|  | --- a/src/ap/ubus.h | ||||||
|  | +++ b/src/ap/ubus.h | ||||||
|  | @@ -12,6 +12,11 @@ enum hostapd_ubus_event_type { | ||||||
|  |  	HOSTAPD_UBUS_PROBE_REQ, | ||||||
|  |  	HOSTAPD_UBUS_AUTH_REQ, | ||||||
|  |  	HOSTAPD_UBUS_ASSOC_REQ, | ||||||
|  | +	HOSTAPD_UBUS_REASSOC_REQ, | ||||||
|  | +	HOSTAPD_UBUS_DISASSOC_REQ, | ||||||
|  | +	HOSTAPD_UBUS_DEAUTH_REQ, | ||||||
|  | +	HOSTAPD_UBUS_FDATA_REQ, | ||||||
|  | +	HOSTAPD_UBUS_IP_REQ, | ||||||
|  |  	HOSTAPD_UBUS_TYPE_MAX | ||||||
|  |  }; | ||||||
|  |   | ||||||
|  | @@ -19,8 +24,11 @@ struct hostapd_ubus_request { | ||||||
|  |  	enum hostapd_ubus_event_type type; | ||||||
|  |  	const struct ieee80211_mgmt *mgmt_frame; | ||||||
|  |  	const struct ieee802_11_elems *elems; | ||||||
|  | +	const struct sta_info *sta; | ||||||
|  |  	int ssi_signal; /* dBm */ | ||||||
|  | +	int reason; | ||||||
|  |  	const u8 *addr; | ||||||
|  | +	be32 ipaddr; | ||||||
|  |  }; | ||||||
|  |   | ||||||
|  |  struct hostapd_iface; | ||||||
|  | @@ -37,6 +45,80 @@ struct hostapd_ubus_bss { | ||||||
|  |  	struct ubus_object obj; | ||||||
|  |  	struct avl_tree banned; | ||||||
|  |  	int notify_response; | ||||||
|  | +	struct avl_tree rt_events; | ||||||
|  | +}; | ||||||
|  | + | ||||||
|  | +enum client_sess_type { | ||||||
|  | +	CST_ASSOC, | ||||||
|  | +	CST_AUTH, | ||||||
|  | +	CST_DISASSOC, | ||||||
|  | +	CST_FDATA, | ||||||
|  | +	CST_IP | ||||||
|  | +}; | ||||||
|  | + | ||||||
|  | +struct client_assoc_event { | ||||||
|  | +	unsigned char sta_mac[20]; | ||||||
|  | +	uint64_t session_id; | ||||||
|  | +	char ssid[SSID_MAX_LEN]; | ||||||
|  | +	int band; | ||||||
|  | +	int assoc_type; | ||||||
|  | +	int status; | ||||||
|  | +	int rssi; | ||||||
|  | +	int internal_sc; | ||||||
|  | +	uint8_t using11k; | ||||||
|  | +	uint8_t using11r; | ||||||
|  | +	uint8_t using11v; | ||||||
|  | +}; | ||||||
|  | + | ||||||
|  | +struct client_disassoc_event { | ||||||
|  | +	unsigned char sta_mac[20]; | ||||||
|  | +	uint64_t session_id; | ||||||
|  | +	char ssid[SSID_MAX_LEN]; | ||||||
|  | +	int band; | ||||||
|  | +	int assoc_type; | ||||||
|  | +	int status; | ||||||
|  | +	int rssi; | ||||||
|  | +	int internal_rc; | ||||||
|  | +}; | ||||||
|  | + | ||||||
|  | +struct client_auth_event { | ||||||
|  | +	unsigned char sta_mac[20]; | ||||||
|  | +	uint64_t session_id; | ||||||
|  | +	char ssid[SSID_MAX_LEN]; | ||||||
|  | +	int band; | ||||||
|  | +	uint32_t auth_status; | ||||||
|  | +}; | ||||||
|  | + | ||||||
|  | +struct client_fdata_event { | ||||||
|  | +	unsigned char sta_mac[20]; | ||||||
|  | +	uint64_t session_id; | ||||||
|  | +	struct timespec rx_ts; | ||||||
|  | +	struct timespec tx_ts; | ||||||
|  | +}; | ||||||
|  | + | ||||||
|  | +struct client_ip_event { | ||||||
|  | +	unsigned char sta_mac[20]; | ||||||
|  | +	uint64_t session_id; | ||||||
|  | +	unsigned char ip_addr[16]; | ||||||
|  | +}; | ||||||
|  | + | ||||||
|  | +struct client_session_record { | ||||||
|  | +	int type; | ||||||
|  | +	uint64_t timestamp; | ||||||
|  | +	union { | ||||||
|  | +		struct client_assoc_event assoc; | ||||||
|  | +		struct client_disassoc_event disassoc; | ||||||
|  | +		struct client_auth_event auth; | ||||||
|  | +		struct client_fdata_event fdata; | ||||||
|  | +		struct client_ip_event ip; | ||||||
|  | +	} u; | ||||||
|  | +}; | ||||||
|  | + | ||||||
|  | +struct hostapd_event_avl_rec { | ||||||
|  | +	uint64_t session_id; | ||||||
|  | +	struct client_session_record *records; | ||||||
|  | +	size_t rec_nr; | ||||||
|  | +	struct avl_node avl; | ||||||
|  |  }; | ||||||
|  |   | ||||||
|  |  void hostapd_ubus_add_iface(struct hostapd_iface *iface); | ||||||
|  | @@ -45,6 +127,7 @@ void hostapd_ubus_add_bss(struct hostapd | ||||||
|  |  void hostapd_ubus_free_bss(struct hostapd_data *hapd); | ||||||
|  |   | ||||||
|  |  int hostapd_ubus_handle_event(struct hostapd_data *hapd, struct hostapd_ubus_request *req); | ||||||
|  | +int hostapd_ubus_handle_rt_event(struct hostapd_data *hapd, struct hostapd_ubus_request *req); | ||||||
|  |  void hostapd_ubus_notify(struct hostapd_data *hapd, const char *type, const u8 *mac); | ||||||
|  |  void hostapd_ubus_notify_beacon_report(struct hostapd_data *hapd, | ||||||
|  |  				       const u8 *addr, u8 token, u8 rep_mode, | ||||||
|  | @@ -78,6 +161,11 @@ static inline int hostapd_ubus_handle_ev | ||||||
|  |  { | ||||||
|  |  	return 0; | ||||||
|  |  } | ||||||
|  | + | ||||||
|  | +static inline int hostapd_ubus_handle_rt_event(struct hostapd_data *hapd, struct hostapd_ubus_request *req) | ||||||
|  | +{ | ||||||
|  | +	return 0; | ||||||
|  | +} | ||||||
|  |   | ||||||
|  |  static inline void hostapd_ubus_notify(struct hostapd_data *hapd, const char *type, const u8 *mac) | ||||||
|  |  { | ||||||
|  | --- a/src/ap/hostapd.c | ||||||
|  | +++ b/src/ap/hostapd.c | ||||||
|  | @@ -1406,19 +1406,22 @@ static int hostapd_setup_bss(struct host | ||||||
|  |  				   "Generic snooping infrastructure initialization failed"); | ||||||
|  |  			return -1; | ||||||
|  |  		} | ||||||
|  | - | ||||||
|  | -		if (dhcp_snoop_init(hapd)) { | ||||||
|  | -			wpa_printf(MSG_ERROR, | ||||||
|  | -				   "DHCP snooping initialization failed"); | ||||||
|  | -			return -1; | ||||||
|  | -		} | ||||||
|  | - | ||||||
|  |  		if (ndisc_snoop_init(hapd)) { | ||||||
|  |  			wpa_printf(MSG_ERROR, | ||||||
|  |  				   "Neighbor Discovery snooping initialization failed"); | ||||||
|  |  			return -1; | ||||||
|  |  		} | ||||||
|  |  	} | ||||||
|  | +	if (dhcp_snoop_init(hapd)) { | ||||||
|  | +		wpa_printf(MSG_ERROR, | ||||||
|  | +			   "DHCP snooping initialization failed"); | ||||||
|  | +		hostapd_logger( | ||||||
|  | +			hapd, NULL, HOSTAPD_MODULE_IEEE80211, | ||||||
|  | +			HOSTAPD_LEVEL_DEBUG, | ||||||
|  | +			"dfranusic:DHCP snooping initialization failed"); | ||||||
|  | + | ||||||
|  | +		return -1; | ||||||
|  | +	} | ||||||
|  |   | ||||||
|  |  	if (!hostapd_drv_none(hapd) && vlan_init(hapd)) { | ||||||
|  |  		wpa_printf(MSG_ERROR, "VLAN initialization failed."); | ||||||
|  | --- a/src/ap/dhcp_snoop.c | ||||||
|  | +++ b/src/ap/dhcp_snoop.c | ||||||
|  | @@ -40,6 +40,7 @@ static void handle_dhcp(void *ctx, const | ||||||
|  |  	int res, msgtype = 0, prefixlen = 32; | ||||||
|  |  	u32 subnet_mask = 0; | ||||||
|  |  	u16 ip_len; | ||||||
|  | +	int ubus_resp; | ||||||
|  |   | ||||||
|  |  	exten_len = len - ETH_HLEN - (sizeof(*b) - sizeof(b->exten)); | ||||||
|  |  	if (exten_len < 4) | ||||||
|  | @@ -112,6 +113,19 @@ static void handle_dhcp(void *ctx, const | ||||||
|  |  			   ipaddr_str(be_to_host32(b->your_ip)), | ||||||
|  |  			   prefixlen); | ||||||
|  |   | ||||||
|  | +			struct hostapd_ubus_request req = { | ||||||
|  | +				.type = HOSTAPD_UBUS_IP_REQ, | ||||||
|  | +				.sta = sta, | ||||||
|  | +				.ipaddr = be_to_host32(b->your_ip) | ||||||
|  | +			}; | ||||||
|  | +			ubus_resp = hostapd_ubus_handle_rt_event(hapd, &req); | ||||||
|  | +			if (ubus_resp) { | ||||||
|  | +				hostapd_logger( | ||||||
|  | +					hapd, NULL, HOSTAPD_MODULE_IEEE80211, | ||||||
|  | +					HOSTAPD_LEVEL_DEBUG, | ||||||
|  | +					"hostapd_ubus_handle_rt_event: ERROR"); | ||||||
|  | +			} | ||||||
|  | + | ||||||
|  |  		if (sta->ipaddr == b->your_ip) | ||||||
|  |  			return; | ||||||
|  |   | ||||||
| @@ -0,0 +1,24 @@ | |||||||
|  | --- a/src/ap/ubus.c | ||||||
|  | +++ b/src/ap/ubus.c | ||||||
|  | @@ -722,6 +722,7 @@ hostapd_switch_chan(struct ubus_context | ||||||
|  |  	struct blob_attr *tb[__CSA_MAX]; | ||||||
|  |  	struct hostapd_data *hapd = get_hapd_from_object(obj); | ||||||
|  |  	struct csa_settings css; | ||||||
|  | +	int i; | ||||||
|  |   | ||||||
|  |  	blobmsg_parse(csa_policy, __CSA_MAX, tb, blob_data(msg), blob_len(msg)); | ||||||
|  |   | ||||||
|  | @@ -746,9 +747,10 @@ hostapd_switch_chan(struct ubus_context | ||||||
|  |  	SET_CSA_SETTING(CSA_VHT, freq_params.vht_enabled, bool); | ||||||
|  |  	SET_CSA_SETTING(CSA_BLOCK_TX, block_tx, bool); | ||||||
|  |   | ||||||
|  | - | ||||||
|  | -	if (hostapd_switch_channel(hapd, &css) != 0) | ||||||
|  | -		return UBUS_STATUS_NOT_SUPPORTED; | ||||||
|  | +	for (i = 0; i < hapd->iface->num_bss; i++) { | ||||||
|  | +		if (hostapd_switch_channel(hapd->iface->bss[i], &css) != 0) | ||||||
|  | +			return UBUS_STATUS_NOT_SUPPORTED; | ||||||
|  | +	} | ||||||
|  |  	return UBUS_STATUS_OK; | ||||||
|  |  #undef SET_CSA_SETTING | ||||||
|  |  } | ||||||
| @@ -0,0 +1,186 @@ | |||||||
|  | --- a/src/ap/dfs.c | ||||||
|  | +++ b/src/ap/dfs.c | ||||||
|  | @@ -19,7 +19,7 @@ | ||||||
|  |  #include "dfs.h" | ||||||
|  |  #include "beacon.h" | ||||||
|  |  #include "eloop.h" | ||||||
|  | - | ||||||
|  | +#include "ubus.h" | ||||||
|  |   | ||||||
|  |  static int dfs_get_used_n_chans(struct hostapd_iface *iface, int *seg1) | ||||||
|  |  { | ||||||
|  | @@ -1207,6 +1207,11 @@ static int hostapd_dfs_start_channel_swi | ||||||
|  |  			break; | ||||||
|  |  	} | ||||||
|  |   | ||||||
|  | +	if (!err) { | ||||||
|  | +		wpa_printf(MSG_DEBUG, "Reporting DFS event to ubus"); | ||||||
|  | +		hostapd_ubus_handle_channel_switch_event(iface, HOSTAPD_UBUS_DFS_SWITCH,  channel->freq); | ||||||
|  | +	} | ||||||
|  | + | ||||||
|  |  	if (err) { | ||||||
|  |  		wpa_printf(MSG_WARNING, "DFS failed to schedule CSA (%d) - trying fallback", | ||||||
|  |  			   err); | ||||||
|  | --- a/src/ap/ubus.c | ||||||
|  | +++ b/src/ap/ubus.c | ||||||
|  | @@ -29,6 +29,8 @@ static int ctx_ref; | ||||||
|  |  static char** bss_lst = NULL; | ||||||
|  |  static size_t bss_nr = 0; | ||||||
|  |   | ||||||
|  | +static LIST_HEAD(chan_events); | ||||||
|  | + | ||||||
|  |  static inline struct hapd_interfaces *get_hapd_interfaces_from_object(struct ubus_object *obj) | ||||||
|  |  { | ||||||
|  |  	return container_of(obj, struct hapd_interfaces, ubus); | ||||||
|  | @@ -714,6 +716,42 @@ static int hostapd_sessions(struct ubus_ | ||||||
|  |  	return 0; | ||||||
|  |  } | ||||||
|  |   | ||||||
|  | +static int hostapd_get_chan_switch_events(struct ubus_context *ctx, | ||||||
|  | +					  struct ubus_object *obj, | ||||||
|  | +					  struct ubus_request_data *req, | ||||||
|  | +					  const char *method, | ||||||
|  | +					  struct blob_attr *msg) | ||||||
|  | +{ | ||||||
|  | +	void *a = NULL; | ||||||
|  | +	void *t = NULL; | ||||||
|  | +	struct hostapd_chan_event_list *entry, *tmp; | ||||||
|  | + | ||||||
|  | +	blob_buf_init(&b_ev, 0); | ||||||
|  | +	a = blobmsg_open_table(&b_ev, "chan_switch_event"); | ||||||
|  | +	list_for_each_entry(entry, &chan_events, list) { | ||||||
|  | +		t = blobmsg_open_table(&b_ev, "event"); | ||||||
|  | +		blobmsg_add_u32(&b_ev, "radio_name", entry->records.band); | ||||||
|  | +		blobmsg_add_u32(&b_ev, "reason", entry->records.reason); | ||||||
|  | +		blobmsg_add_u64(&b_ev, "timestamp", entry->records.ts); | ||||||
|  | +		blobmsg_add_u32(&b_ev, "frequency", entry->records.freq); | ||||||
|  | +		blobmsg_close_table(&b_ev, t); | ||||||
|  | +	} | ||||||
|  | + | ||||||
|  | +	blobmsg_close_table(&b_ev, a); | ||||||
|  | +	ubus_send_reply(ctx, req, b_ev.head); | ||||||
|  | + | ||||||
|  | +	/*delete list*/ | ||||||
|  | + | ||||||
|  | +	if (!list_empty(&chan_events)) { | ||||||
|  | +		list_for_each_entry_safe(entry, tmp, &chan_events, list) { | ||||||
|  | +			list_del(&entry->list); | ||||||
|  | +			free(entry); | ||||||
|  | +		} | ||||||
|  | +	} | ||||||
|  | + | ||||||
|  | +	return 0; | ||||||
|  | +} | ||||||
|  | + | ||||||
|  |  static int | ||||||
|  |  hostapd_switch_chan(struct ubus_context *ctx, struct ubus_object *obj, | ||||||
|  |  		    struct ubus_request_data *req, const char *method, | ||||||
|  | @@ -751,6 +789,9 @@ hostapd_switch_chan(struct ubus_context | ||||||
|  |  		if (hostapd_switch_channel(hapd->iface->bss[i], &css) != 0) | ||||||
|  |  			return UBUS_STATUS_NOT_SUPPORTED; | ||||||
|  |  	} | ||||||
|  | + | ||||||
|  | +	hostapd_ubus_handle_channel_switch_event(hapd->iface, HOSTAPD_UBUS_HIGH_INTERFERENCE, css.freq_params.freq); | ||||||
|  | + | ||||||
|  |  	return UBUS_STATUS_OK; | ||||||
|  |  #undef SET_CSA_SETTING | ||||||
|  |  } | ||||||
|  | @@ -1446,6 +1487,7 @@ static const struct ubus_method daemon_m | ||||||
|  |  	UBUS_METHOD("config_add", hostapd_config_add, config_add_policy), | ||||||
|  |  	UBUS_METHOD("config_remove", hostapd_config_remove, config_remove_policy), | ||||||
|  |  	UBUS_METHOD_NOARG("get_bss_list", hostapd_get_bss_list), | ||||||
|  | +	UBUS_METHOD_NOARG("get_chan_switch_events", hostapd_get_chan_switch_events), | ||||||
|  |  }; | ||||||
|  |   | ||||||
|  |  static struct ubus_object_type daemon_object_type = | ||||||
|  | @@ -1509,6 +1551,26 @@ ubus_event_cb(struct ubus_notify_request | ||||||
|  |  	ureq->resp = ret; | ||||||
|  |  } | ||||||
|  |   | ||||||
|  | +void hostapd_ubus_handle_channel_switch_event(struct hostapd_iface *iface, int reason, | ||||||
|  | +					      int freq) | ||||||
|  | +{ | ||||||
|  | +	struct hostapd_chan_event_list *rec = NULL; | ||||||
|  | +	struct timespec ts; | ||||||
|  | +	uint64_t timestamp = 0; | ||||||
|  | + | ||||||
|  | +	clock_gettime(CLOCK_REALTIME, &ts); | ||||||
|  | +	timestamp = get_time_in_ms(&ts); | ||||||
|  | + | ||||||
|  | +	rec = os_zalloc(sizeof(struct hostapd_chan_event_list)); | ||||||
|  | + | ||||||
|  | +	rec->records.reason = reason; | ||||||
|  | +	rec->records.band = iface->freq; | ||||||
|  | +	rec->records.ts = timestamp; | ||||||
|  | +	rec->records.freq = freq; | ||||||
|  | + | ||||||
|  | +	list_add_tail(&rec->list, &chan_events); | ||||||
|  | +} | ||||||
|  | + | ||||||
|  |  int hostapd_ubus_handle_rt_event(struct hostapd_data *hapd, | ||||||
|  |  				 struct hostapd_ubus_request *req) | ||||||
|  |  { | ||||||
|  | --- a/src/ap/ubus.h | ||||||
|  | +++ b/src/ap/ubus.h | ||||||
|  | @@ -17,9 +17,15 @@ enum hostapd_ubus_event_type { | ||||||
|  |  	HOSTAPD_UBUS_DEAUTH_REQ, | ||||||
|  |  	HOSTAPD_UBUS_FDATA_REQ, | ||||||
|  |  	HOSTAPD_UBUS_IP_REQ, | ||||||
|  | +	HOSTAPD_UBUS_CHAN_SWITCH, | ||||||
|  |  	HOSTAPD_UBUS_TYPE_MAX | ||||||
|  |  }; | ||||||
|  |   | ||||||
|  | +enum hostapd_ubus_chan_event_reason { | ||||||
|  | +	HOSTAPD_UBUS_DFS_SWITCH, | ||||||
|  | +	HOSTAPD_UBUS_HIGH_INTERFERENCE | ||||||
|  | +}; | ||||||
|  | + | ||||||
|  |  struct hostapd_ubus_request { | ||||||
|  |  	enum hostapd_ubus_event_type type; | ||||||
|  |  	const struct ieee80211_mgmt *mgmt_frame; | ||||||
|  | @@ -40,6 +46,7 @@ struct rrm_measurement_beacon_report; | ||||||
|  |   | ||||||
|  |  #include <libubox/avl.h> | ||||||
|  |  #include <libubus.h> | ||||||
|  | +#include <libubox/list.h> | ||||||
|  |   | ||||||
|  |  struct hostapd_ubus_bss { | ||||||
|  |  	struct ubus_object obj; | ||||||
|  | @@ -121,11 +128,24 @@ struct hostapd_event_avl_rec { | ||||||
|  |  	struct avl_node avl; | ||||||
|  |  }; | ||||||
|  |   | ||||||
|  | +struct channel_switch_event { | ||||||
|  | +	int band; /* Radio name*/ | ||||||
|  | +	uint8_t reason; | ||||||
|  | +	uint64_t ts; | ||||||
|  | +	uint32_t freq; | ||||||
|  | +}; | ||||||
|  | + | ||||||
|  | +struct hostapd_chan_event_list { | ||||||
|  | +	struct channel_switch_event records; | ||||||
|  | +	struct list_head list; | ||||||
|  | +}; | ||||||
|  | + | ||||||
|  |  void hostapd_ubus_add_iface(struct hostapd_iface *iface); | ||||||
|  |  void hostapd_ubus_free_iface(struct hostapd_iface *iface); | ||||||
|  |  void hostapd_ubus_add_bss(struct hostapd_data *hapd); | ||||||
|  |  void hostapd_ubus_free_bss(struct hostapd_data *hapd); | ||||||
|  | - | ||||||
|  | +void hostapd_ubus_handle_channel_switch_event(struct hostapd_iface *iface, | ||||||
|  | +					      int reason, int channel); | ||||||
|  |  int hostapd_ubus_handle_event(struct hostapd_data *hapd, struct hostapd_ubus_request *req); | ||||||
|  |  int hostapd_ubus_handle_rt_event(struct hostapd_data *hapd, struct hostapd_ubus_request *req); | ||||||
|  |  void hostapd_ubus_notify(struct hostapd_data *hapd, const char *type, const u8 *mac); | ||||||
|  | @@ -157,6 +177,11 @@ static inline void hostapd_ubus_free_bss | ||||||
|  |  { | ||||||
|  |  } | ||||||
|  |   | ||||||
|  | +static inline void hostapd_ubus_handle_channel_switch_event(struct hostapd_iface *iface, | ||||||
|  | +							    int reason, int channel) | ||||||
|  | +{ | ||||||
|  | +} | ||||||
|  | + | ||||||
|  |  static inline int hostapd_ubus_handle_event(struct hostapd_data *hapd, struct hostapd_ubus_request *req) | ||||||
|  |  { | ||||||
|  |  	return 0; | ||||||
| @@ -0,0 +1,28 @@ | |||||||
|  | Index: hostapd-2020-06-08-5a8b3662/src/ap/ieee802_11.c | ||||||
|  | =================================================================== | ||||||
|  | --- hostapd-2020-06-08-5a8b3662.orig/src/ap/ieee802_11.c | ||||||
|  | +++ hostapd-2020-06-08-5a8b3662/src/ap/ieee802_11.c | ||||||
|  | @@ -3675,6 +3675,13 @@ static int add_associated_sta(struct hos | ||||||
|  |  	 * drivers to accept the STA parameter configuration. Since this is | ||||||
|  |  	 * after a new FT-over-DS exchange, a new TK has been derived, so key | ||||||
|  |  	 * reinstallation is not a concern for this case. | ||||||
|  | +	 * | ||||||
|  | +	 * If the STA was associated and authorized earlier, but came for a new | ||||||
|  | +	 * connection (!added_unassoc + !reassoc), remove the existing STA entry | ||||||
|  | +	 * so that it can be re-added. This case is rarely seen when the AP could | ||||||
|  | +	 * not receive the deauth/disassoc frame from the STA. And the STA comes | ||||||
|  | +	 * back with new connection within a short period or before the inactive | ||||||
|  | +	 * STA entry is removed from the list. | ||||||
|  |  	 */ | ||||||
|  |  	wpa_printf(MSG_DEBUG, "Add associated STA " MACSTR | ||||||
|  |  		   " (added_unassoc=%d auth_alg=%u ft_over_ds=%u reassoc=%d authorized=%d ft_tk=%d fils_tk=%d)", | ||||||
|  | @@ -3688,7 +3695,8 @@ static int add_associated_sta(struct hos | ||||||
|  |  	    (!(sta->flags & WLAN_STA_AUTHORIZED) || | ||||||
|  |  	     (reassoc && sta->ft_over_ds && sta->auth_alg == WLAN_AUTH_FT) || | ||||||
|  |  	     (!wpa_auth_sta_ft_tk_already_set(sta->wpa_sm) && | ||||||
|  | -	      !wpa_auth_sta_fils_tk_already_set(sta->wpa_sm)))) { | ||||||
|  | +	      !wpa_auth_sta_fils_tk_already_set(sta->wpa_sm)) || | ||||||
|  | +	     (!reassoc && (sta->flags & WLAN_STA_AUTHORIZED)))) { | ||||||
|  |  		hostapd_drv_sta_remove(hapd, sta->addr); | ||||||
|  |  		wpa_auth_sm_event(sta->wpa_sm, WPA_DRV_STA_REMOVED); | ||||||
|  |  		set = 0; | ||||||
							
								
								
									
										32
									
								
								feeds/wifi-ax/hostapd/patches/f00-014-fix-ubus-assoc.patch
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										32
									
								
								feeds/wifi-ax/hostapd/patches/f00-014-fix-ubus-assoc.patch
									
									
									
									
									
										Normal file
									
								
							| @@ -0,0 +1,32 @@ | |||||||
|  | --- a/src/ap/ieee802_11.c | ||||||
|  | +++ b/src/ap/ieee802_11.c | ||||||
|  | @@ -4463,6 +4463,14 @@ static void handle_assoc(struct hostapd_ | ||||||
|  |  			ieee802_11_set_beacons(hapd->iface); | ||||||
|  |  	} | ||||||
|  |   | ||||||
|  | +	ubus_resp = hostapd_ubus_handle_event(hapd, &req); | ||||||
|  | +	if (ubus_resp) { | ||||||
|  | +		wpa_printf(MSG_DEBUG, "Station " MACSTR " assoc rejected by ubus handler.\n", | ||||||
|  | +		       MAC2STR(mgmt->sa)); | ||||||
|  | +		resp = ubus_resp > 0 ? (u16) ubus_resp : WLAN_STATUS_UNSPECIFIED_FAILURE; | ||||||
|  | +		goto fail; | ||||||
|  | +	} | ||||||
|  | + | ||||||
|  |  	update_ht_state(hapd, sta); | ||||||
|  |   | ||||||
|  |  	hostapd_logger(hapd, sta->addr, HOSTAPD_MODULE_IEEE80211, | ||||||
|  | @@ -4568,14 +4576,6 @@ static void handle_assoc(struct hostapd_ | ||||||
|  |  					    pos, left, rssi, omit_rsnxe); | ||||||
|  |  	os_free(tmp); | ||||||
|  |   | ||||||
|  | -	ubus_resp = hostapd_ubus_handle_event(hapd, &req); | ||||||
|  | -	if (ubus_resp) { | ||||||
|  | -		wpa_printf(MSG_DEBUG, "Station " MACSTR " assoc rejected by ubus handler.\n", | ||||||
|  | -		       MAC2STR(mgmt->sa)); | ||||||
|  | -		resp = ubus_resp > 0 ? (u16) ubus_resp : WLAN_STATUS_UNSPECIFIED_FAILURE; | ||||||
|  | -		goto fail; | ||||||
|  | -	} | ||||||
|  | - | ||||||
|  |  	/* | ||||||
|  |  	 * Remove the station in case tranmission of a success response fails | ||||||
|  |  	 * (the STA was added associated to the driver) or if the station was | ||||||
| @@ -0,0 +1,68 @@ | |||||||
|  | Index: hostapd-2020-07-02-58b384f4/src/ap/ubus.c | ||||||
|  | =================================================================== | ||||||
|  | --- hostapd-2020-07-02-58b384f4.orig/src/ap/ubus.c | ||||||
|  | +++ hostapd-2020-07-02-58b384f4/src/ap/ubus.c | ||||||
|  | @@ -1483,7 +1483,63 @@ static int hostapd_get_bss_list(struct u | ||||||
|  |  	return 0; | ||||||
|  |  } | ||||||
|  |   | ||||||
|  | +enum { | ||||||
|  | +	MOD_IFACE, | ||||||
|  | +	MOD_PARAM, | ||||||
|  | +	MOD_PARAM_VAL, | ||||||
|  | +	__PARAM_MAX | ||||||
|  | +}; | ||||||
|  | + | ||||||
|  | +static const struct blobmsg_policy mod_param_policy[__PARAM_MAX] = { | ||||||
|  | +	[MOD_IFACE] = { "iface", BLOBMSG_TYPE_STRING }, | ||||||
|  | +	[MOD_PARAM] = { "param", BLOBMSG_TYPE_STRING }, | ||||||
|  | +	[MOD_PARAM_VAL] = { "param_val", BLOBMSG_TYPE_STRING }, | ||||||
|  | +}; | ||||||
|  | + | ||||||
|  | + | ||||||
|  | +static int | ||||||
|  | +hostapd_param_modify(struct ubus_context *ctx, struct ubus_object *obj, | ||||||
|  | +		   struct ubus_request_data *req, const char *method, | ||||||
|  | +		   struct blob_attr *msg) | ||||||
|  | +{ | ||||||
|  | +	struct blob_attr *tb[__PARAM_MAX]; | ||||||
|  | +	struct hapd_interfaces *interfaces = NULL; | ||||||
|  | +	struct hostapd_data *hapd_bss = NULL; | ||||||
|  | +	struct hostapd_config *iconf = NULL; | ||||||
|  | +	struct hostapd_iface *iface = NULL; | ||||||
|  | +	size_t i = 0; | ||||||
|  | + | ||||||
|  | +	interfaces = get_hapd_interfaces_from_object(obj); | ||||||
|  | +	blobmsg_parse(mod_param_policy, __PARAM_MAX, tb, blob_data(msg), | ||||||
|  | +		      blob_len(msg)); | ||||||
|  | + | ||||||
|  | +	if (!tb[MOD_PARAM] || !tb[MOD_IFACE] || !tb[MOD_PARAM_VAL]) | ||||||
|  | +		return UBUS_STATUS_INVALID_ARGUMENT; | ||||||
|  | + | ||||||
|  | +	wpa_printf(MSG_DEBUG, "Modifyint %s=%s for %s", | ||||||
|  | +		blobmsg_get_string(tb[MOD_PARAM]), | ||||||
|  | +		blobmsg_get_string(tb[MOD_PARAM_VAL]), | ||||||
|  | +		blobmsg_get_string(tb[MOD_IFACE])); | ||||||
|  | +	 | ||||||
|  | +	hapd_bss = hostapd_get_iface(interfaces, | ||||||
|  | +				     blobmsg_get_string(tb[MOD_IFACE])); | ||||||
|  | + | ||||||
|  | +	if (hapd_bss) { | ||||||
|  | +		iconf = hapd_bss->iconf; | ||||||
|  | +		if (os_strcmp(blobmsg_get_string(tb[MOD_PARAM]), | ||||||
|  | +			      "rssi_ignore_probe_request") == 0) { | ||||||
|  | +			iconf->rssi_ignore_probe_request = atoi(blobmsg_get_string(tb[MOD_PARAM_VAL])); | ||||||
|  | + | ||||||
|  | +		} | ||||||
|  | +	} | ||||||
|  | + | ||||||
|  | +	return UBUS_STATUS_OK; | ||||||
|  | +} | ||||||
|  | + | ||||||
|  | + | ||||||
|  | + | ||||||
|  |  static const struct ubus_method daemon_methods[] = { | ||||||
|  | +	UBUS_METHOD("param_mod", hostapd_param_modify, mod_param_policy), | ||||||
|  |  	UBUS_METHOD("config_add", hostapd_config_add, config_add_policy), | ||||||
|  |  	UBUS_METHOD("config_remove", hostapd_config_remove, config_remove_policy), | ||||||
|  |  	UBUS_METHOD_NOARG("get_bss_list", hostapd_get_bss_list), | ||||||
| @@ -0,0 +1,14 @@ | |||||||
|  | Index: hostapd-2020-07-02-58b384f4/src/ap/ubus.c | ||||||
|  | =================================================================== | ||||||
|  | --- hostapd-2020-07-02-58b384f4.orig/src/ap/ubus.c | ||||||
|  | +++ hostapd-2020-07-02-58b384f4/src/ap/ubus.c | ||||||
|  | @@ -1655,7 +1655,8 @@ int hostapd_ubus_handle_rt_event(struct | ||||||
|  |  	session_id = sta->cl_session_id; | ||||||
|  |   | ||||||
|  |  	/* find by session id */ | ||||||
|  | -	rec = avl_find_element(&hapd->ubus.rt_events, &session_id, rec, avl); | ||||||
|  | +	if (session_id) | ||||||
|  | +		rec = avl_find_element(&hapd->ubus.rt_events, &session_id, rec, avl); | ||||||
|  |   | ||||||
|  |  	/* prepare rec if not found */ | ||||||
|  |  	if (!rec) { | ||||||
| @@ -0,0 +1,28 @@ | |||||||
|  | Index: hostapd-2020-07-02-58b384f4/src/ap/ubus.c | ||||||
|  | =================================================================== | ||||||
|  | --- hostapd-2020-07-02-58b384f4.orig/src/ap/ubus.c | ||||||
|  | +++ hostapd-2020-07-02-58b384f4/src/ap/ubus.c | ||||||
|  | @@ -528,6 +528,7 @@ enum { | ||||||
|  |  	CSA_SEC_CHANNEL_OFFSET, | ||||||
|  |  	CSA_HT, | ||||||
|  |  	CSA_VHT, | ||||||
|  | +	CSA_HE, | ||||||
|  |  	CSA_BLOCK_TX, | ||||||
|  |  	__CSA_MAX | ||||||
|  |  }; | ||||||
|  | @@ -541,6 +542,7 @@ static const struct blobmsg_policy csa_p | ||||||
|  |  	[CSA_SEC_CHANNEL_OFFSET] = { "sec_channel_offset", BLOBMSG_TYPE_INT32 }, | ||||||
|  |  	[CSA_HT] = { "ht", BLOBMSG_TYPE_BOOL }, | ||||||
|  |  	[CSA_VHT] = { "vht", BLOBMSG_TYPE_BOOL }, | ||||||
|  | +	[CSA_HE] = { "he", BLOBMSG_TYPE_BOOL }, | ||||||
|  |  	[CSA_BLOCK_TX] = { "block_tx", BLOBMSG_TYPE_BOOL }, | ||||||
|  |  }; | ||||||
|  |   | ||||||
|  | @@ -783,6 +785,7 @@ hostapd_switch_chan(struct ubus_context | ||||||
|  |  	SET_CSA_SETTING(CSA_SEC_CHANNEL_OFFSET, freq_params.sec_channel_offset, u32); | ||||||
|  |  	SET_CSA_SETTING(CSA_HT, freq_params.ht_enabled, bool); | ||||||
|  |  	SET_CSA_SETTING(CSA_VHT, freq_params.vht_enabled, bool); | ||||||
|  | +	SET_CSA_SETTING(CSA_HE, freq_params.he_enabled, bool); | ||||||
|  |  	SET_CSA_SETTING(CSA_BLOCK_TX, block_tx, bool); | ||||||
|  |   | ||||||
|  |  	for (i = 0; i < hapd->iface->num_bss; i++) { | ||||||
| @@ -0,0 +1,299 @@ | |||||||
|  | Index: hostapd-2020-07-02-58b384f4/src/ap/ubus.c | ||||||
|  | =================================================================== | ||||||
|  | --- hostapd-2020-07-02-58b384f4.orig/src/ap/ubus.c | ||||||
|  | +++ hostapd-2020-07-02-58b384f4/src/ap/ubus.c | ||||||
|  | @@ -21,6 +21,7 @@ | ||||||
|  |  #include "rrm.h" | ||||||
|  |  #include "wnm_ap.h" | ||||||
|  |  #include "taxonomy.h" | ||||||
|  | +#include "common/hw_features_common.h" | ||||||
|  |   | ||||||
|  |  static struct ubus_context *ctx; | ||||||
|  |  static struct blob_buf b; | ||||||
|  | @@ -754,6 +755,207 @@ static int hostapd_get_chan_switch_event | ||||||
|  |  	return 0; | ||||||
|  |  } | ||||||
|  |   | ||||||
|  | +#define HOSTAPD_DFS_CSA_DUR 1 | ||||||
|  | +int csa_ch_id, csa_cf0_id, csa_cf1_id = 0; | ||||||
|  | +int csa_bw = CHANWIDTH_USE_HT; | ||||||
|  | +struct csa_settings css; | ||||||
|  | + | ||||||
|  | +struct hostapd_channel_data *freq_to_chan(struct hostapd_iface *iface, int freq) | ||||||
|  | +{ | ||||||
|  | +	struct hostapd_hw_modes *mode; | ||||||
|  | +	struct hostapd_channel_data *chan; | ||||||
|  | +	int i; | ||||||
|  | + | ||||||
|  | +	mode = iface->current_mode; | ||||||
|  | +	if (mode == NULL || freq == 0) { | ||||||
|  | +		wpa_printf(MSG_INFO, "%s: mode is NULL", __func__); | ||||||
|  | +		return NULL; | ||||||
|  | +	} | ||||||
|  | + | ||||||
|  | +	for (i = 0; i < iface->current_mode->num_channels; i++) { | ||||||
|  | +		chan = &iface->current_mode->channels[i]; | ||||||
|  | +		if (chan->freq == freq) { | ||||||
|  | +			return chan; /* Channel found */ | ||||||
|  | +		} | ||||||
|  | +	} | ||||||
|  | +	return NULL; | ||||||
|  | +} | ||||||
|  | + | ||||||
|  | +void hostapd_dfs_csa_timeout(void *eloop_data, void *user_data) | ||||||
|  | +{ | ||||||
|  | +	struct hostapd_data *hapd = eloop_data; | ||||||
|  | +	struct hostapd_iface *iface = hapd->iface; | ||||||
|  | +	struct csa_settings *css = user_data;	 | ||||||
|  | +	int ret = 0; | ||||||
|  | + | ||||||
|  | +	wpa_printf(MSG_DEBUG, "%s Stopping CSA in dfs ", __func__); | ||||||
|  | + | ||||||
|  | +	hapd->csa_in_progress = 0; | ||||||
|  | + | ||||||
|  | +	hostapd_disable_iface(iface); | ||||||
|  | + | ||||||
|  | +	iface->freq = css->freq_params.freq; | ||||||
|  | +	iface->conf->channel = csa_ch_id; | ||||||
|  | +	iface->conf->secondary_channel = css->freq_params.sec_channel_offset; | ||||||
|  | +	hostapd_set_oper_centr_freq_seg0_idx(iface->conf, csa_cf0_id); | ||||||
|  | +	hostapd_set_oper_centr_freq_seg1_idx(iface->conf, csa_cf1_id); | ||||||
|  | +	hostapd_set_oper_chwidth(iface->conf, csa_bw); | ||||||
|  | +	iface->conf->ieee80211n = css->freq_params.ht_enabled; | ||||||
|  | +	iface->conf->ieee80211ac = css->freq_params.vht_enabled; | ||||||
|  | +	iface->conf->ieee80211ax = css->freq_params.he_enabled; | ||||||
|  | +	wpa_printf(MSG_INFO, "%s: freq=%d chan=%d sec_ch=%d cf0=%d cf1=%d bw=%d 11n=%d, ac=%d, ax=%d", | ||||||
|  | + 		   __func__, iface->freq, iface->conf->channel, | ||||||
|  | +		   iface->conf->secondary_channel, csa_cf0_id, csa_cf1_id,  | ||||||
|  | +		   css->freq_params.bandwidth, iface->conf->ieee80211n, | ||||||
|  | +		   iface->conf->ieee80211ac, iface->conf->ieee80211ax); | ||||||
|  | + | ||||||
|  | +	ret = hostapd_enable_iface(iface); | ||||||
|  | +	if (ret == 0) | ||||||
|  | +		hostapd_ubus_handle_channel_switch_event(iface, | ||||||
|  | +						HOSTAPD_UBUS_HIGH_INTERFERENCE, | ||||||
|  | +						iface->freq); | ||||||
|  | +} | ||||||
|  | + | ||||||
|  | +int hostapd_dfs_set_beacon_csa(struct hostapd_iface *iface, struct csa_settings *css) | ||||||
|  | +{ | ||||||
|  | +	struct hostapd_data *hapd = iface->bss[0]; | ||||||
|  | +	struct hostapd_data *hapd_bss = NULL; | ||||||
|  | +	struct csa_settings csa_settings; | ||||||
|  | +	int secondary_channel = 0; | ||||||
|  | +	u8 vht_oper_centr_freq_seg0_idx; | ||||||
|  | +	u8 vht_oper_centr_freq_seg1_idx; | ||||||
|  | +	int err = 0, i = 0; | ||||||
|  | + | ||||||
|  | +	if (hapd->csa_in_progress == 1) { | ||||||
|  | +		wpa_printf(MSG_ERROR, "CSA in progress, cannot switch channel"); | ||||||
|  | +		return -1; | ||||||
|  | +	} | ||||||
|  | + | ||||||
|  | +	eloop_cancel_timeout(hostapd_dfs_csa_timeout, hapd, NULL); | ||||||
|  | + | ||||||
|  | +	/* Setup Beacon CSA request */ | ||||||
|  | +	secondary_channel = iface->conf->secondary_channel; | ||||||
|  | +	vht_oper_centr_freq_seg0_idx = | ||||||
|  | +			iface->conf->vht_oper_centr_freq_seg0_idx; | ||||||
|  | +	vht_oper_centr_freq_seg1_idx = | ||||||
|  | +			iface->conf->vht_oper_centr_freq_seg1_idx; | ||||||
|  | + | ||||||
|  | +	os_memset(&csa_settings, 0, sizeof(csa_settings)); | ||||||
|  | +	err = hostapd_set_freq_params(&csa_settings.freq_params, | ||||||
|  | +				      iface->conf->hw_mode, | ||||||
|  | +				      iface->freq, | ||||||
|  | +				      iface->conf->channel, | ||||||
|  | +				      iface->conf->enable_edmg, | ||||||
|  | +				      iface->conf->edmg_channel, | ||||||
|  | +				      iface->conf->ieee80211n, | ||||||
|  | +				      iface->conf->ieee80211ac, | ||||||
|  | +				      iface->conf->ieee80211ax, | ||||||
|  | +				      secondary_channel, | ||||||
|  | +				      hostapd_get_oper_chwidth(iface->conf), | ||||||
|  | +				      vht_oper_centr_freq_seg0_idx, | ||||||
|  | +				      vht_oper_centr_freq_seg1_idx, | ||||||
|  | +				      iface->current_mode->vht_capab, | ||||||
|  | +				      &iface->current_mode->he_capab[IEEE80211_MODE_AP]); | ||||||
|  | +	if (err) { | ||||||
|  | +		wpa_printf(MSG_ERROR, "DFS failed to calculate CSA freq params"); | ||||||
|  | +		return -1; | ||||||
|  | +	} | ||||||
|  | + | ||||||
|  | +	if (!(hapd->iface->drv_flags & WPA_DRIVER_FLAGS_AP_CSA)) { | ||||||
|  | +		wpa_printf(MSG_ERROR, "CSA is not supported"); | ||||||
|  | +		return -1; | ||||||
|  | +	} | ||||||
|  | + | ||||||
|  | +	/* Set Beacon */ | ||||||
|  | +	for (i = 0; i < hapd->iface->num_bss; i++) { | ||||||
|  | +		hapd_bss = iface->bss[i]; | ||||||
|  | +		hapd_bss->cs_freq_params = csa_settings.freq_params; | ||||||
|  | +		hapd_bss->cs_count = css->cs_count; | ||||||
|  | +		hapd_bss->cs_block_tx = css->block_tx; | ||||||
|  | +		err = ieee802_11_set_beacon(hapd_bss); | ||||||
|  | +		if (err) | ||||||
|  | +			wpa_printf(MSG_ERROR, "CSA beacon set failed, changing channel without an Announcement"); | ||||||
|  | +	} | ||||||
|  | + | ||||||
|  | +	hapd->csa_in_progress = 1; | ||||||
|  | + | ||||||
|  | +	/* Switch Channel after a timeout */ | ||||||
|  | +	eloop_register_timeout(HOSTAPD_DFS_CSA_DUR, 0, | ||||||
|  | +			       hostapd_dfs_csa_timeout, hapd, css); | ||||||
|  | + | ||||||
|  | +	return 0; | ||||||
|  | +} | ||||||
|  | + | ||||||
|  | +int hostapd_switch_chan_dfs(struct hostapd_iface *iface, | ||||||
|  | +			     struct csa_settings *css) | ||||||
|  | +{ | ||||||
|  | +	struct hostapd_channel_data *ch, *cf1, *cf2 = NULL; | ||||||
|  | +	int res = 0; | ||||||
|  | + | ||||||
|  | +	if (iface == NULL) | ||||||
|  | +		return -1; | ||||||
|  | + | ||||||
|  | +	/* Set channel id and center frequecies id */ | ||||||
|  | +	if (css->freq_params.freq > 0) { | ||||||
|  | +		ch = freq_to_chan(iface, css->freq_params.freq); | ||||||
|  | +		csa_ch_id = ch->chan; | ||||||
|  | +	} | ||||||
|  | + | ||||||
|  | +	if (css->freq_params.center_freq1 > 0) { | ||||||
|  | +		csa_cf0_id = 36 + (css->freq_params.center_freq1 - 5180) / 5; | ||||||
|  | +	} | ||||||
|  | + | ||||||
|  | +	if (css->freq_params.center_freq2 > 0) { | ||||||
|  | +		csa_cf1_id = 36 + (css->freq_params.center_freq2 - 5180) / 5; | ||||||
|  | +	} | ||||||
|  | + | ||||||
|  | +	wpa_printf(MSG_DEBUG, "%s freq=%d chan=%d sec_chan=%d, width=%d, seg0=%d, seg1=%d, cac_time=%ds, ieee80211n=%d, ieee80211ac=%d, ieee80211ax=%d ", __func__, | ||||||
|  | +		css->freq_params.freq, | ||||||
|  | +		csa_ch_id, css->freq_params.sec_channel_offset, | ||||||
|  | +		css->freq_params.bandwidth, csa_cf0_id, csa_cf1_id, | ||||||
|  | +		iface->dfs_cac_ms / 1000, iface->conf->ieee80211n, | ||||||
|  | +		iface->conf->ieee80211ac, iface->conf->ieee80211ax); | ||||||
|  | + | ||||||
|  | +	/* Set bandwidth */ | ||||||
|  | +	switch (css->freq_params.bandwidth) { | ||||||
|  | +	case 0: | ||||||
|  | +	case 20: | ||||||
|  | +	case 40: | ||||||
|  | +		csa_bw = CHANWIDTH_USE_HT; | ||||||
|  | +		break; | ||||||
|  | +	case 80: | ||||||
|  | +		if (css->freq_params.center_freq2) | ||||||
|  | +			csa_bw = CHANWIDTH_80P80MHZ; | ||||||
|  | +		else | ||||||
|  | +			csa_bw = CHANWIDTH_80MHZ; | ||||||
|  | +		break; | ||||||
|  | +	case 160: | ||||||
|  | +		csa_bw = CHANWIDTH_160MHZ; | ||||||
|  | +		break; | ||||||
|  | +	default: | ||||||
|  | +		wpa_printf(MSG_WARNING, "Unknown CSA bandwidth: %d", | ||||||
|  | +			   css->freq_params.bandwidth); | ||||||
|  | +		break; | ||||||
|  | +	} | ||||||
|  | + | ||||||
|  | +	/* Set new frequency info */ | ||||||
|  | +	iface->freq = css->freq_params.freq; | ||||||
|  | +	iface->conf->channel = csa_ch_id; | ||||||
|  | +	iface->conf->secondary_channel = css->freq_params.sec_channel_offset; | ||||||
|  | +	hostapd_set_oper_centr_freq_seg0_idx(iface->conf, csa_cf0_id); | ||||||
|  | +	hostapd_set_oper_centr_freq_seg1_idx(iface->conf, csa_cf1_id); | ||||||
|  | +	hostapd_set_oper_chwidth(iface->conf, csa_bw); | ||||||
|  | +	iface->conf->ieee80211n = css->freq_params.ht_enabled; | ||||||
|  | +	iface->conf->ieee80211ac = css->freq_params.vht_enabled; | ||||||
|  | +	iface->conf->ieee80211ax = css->freq_params.he_enabled; | ||||||
|  | + | ||||||
|  | +	/*Set beacon for CSA*/ | ||||||
|  | +	hostapd_dfs_set_beacon_csa(iface, css); | ||||||
|  | + | ||||||
|  | +	return 0; | ||||||
|  | + | ||||||
|  | +} | ||||||
|  | + | ||||||
|  |  static int | ||||||
|  |  hostapd_switch_chan(struct ubus_context *ctx, struct ubus_object *obj, | ||||||
|  |  		    struct ubus_request_data *req, const char *method, | ||||||
|  | @@ -761,14 +963,19 @@ hostapd_switch_chan(struct ubus_context | ||||||
|  |  { | ||||||
|  |  	struct blob_attr *tb[__CSA_MAX]; | ||||||
|  |  	struct hostapd_data *hapd = get_hapd_from_object(obj); | ||||||
|  | -	struct csa_settings css; | ||||||
|  | +	struct hostapd_iface *iface = hapd->iface; | ||||||
|  | +	struct hostapd_channel_data *chan =NULL; | ||||||
|  |  	int i; | ||||||
|  | +	int freq = 0; | ||||||
|  |   | ||||||
|  |  	blobmsg_parse(csa_policy, __CSA_MAX, tb, blob_data(msg), blob_len(msg)); | ||||||
|  |   | ||||||
|  |  	if (!tb[CSA_FREQ]) | ||||||
|  |  		return UBUS_STATUS_INVALID_ARGUMENT; | ||||||
|  |   | ||||||
|  | +	freq = blobmsg_get_u32(tb[CSA_FREQ]); | ||||||
|  | +	chan = freq_to_chan(iface, freq); | ||||||
|  | + | ||||||
|  |  	memset(&css, 0, sizeof(css)); | ||||||
|  |  	css.freq_params.freq = blobmsg_get_u32(tb[CSA_FREQ]); | ||||||
|  |   | ||||||
|  | @@ -788,6 +995,21 @@ hostapd_switch_chan(struct ubus_context | ||||||
|  |  	SET_CSA_SETTING(CSA_HE, freq_params.he_enabled, bool); | ||||||
|  |  	SET_CSA_SETTING(CSA_BLOCK_TX, block_tx, bool); | ||||||
|  |   | ||||||
|  | +	wpa_printf(MSG_INFO, "%s: CSS freq=%d chan=%d sec_chan_off=%d, width=%d, seg0=%d, seg1=%d", __func__, | ||||||
|  | +		css.freq_params.freq, | ||||||
|  | +		chan->chan, css.freq_params.sec_channel_offset, | ||||||
|  | +		css.freq_params.bandwidth, | ||||||
|  | +		css.freq_params.center_freq1, | ||||||
|  | +		css.freq_params.center_freq2); | ||||||
|  | + | ||||||
|  | +	if ((chan->flag & HOSTAPD_CHAN_RADAR) && | ||||||
|  | +	    ((chan->flag & HOSTAPD_CHAN_DFS_MASK) | ||||||
|  | +	     != HOSTAPD_CHAN_DFS_AVAILABLE)) { | ||||||
|  | +		wpa_printf(MSG_INFO, "%s: DFS chan need CAC", __func__); | ||||||
|  | +		hostapd_switch_chan_dfs(iface, &css); | ||||||
|  | +		return UBUS_STATUS_OK; | ||||||
|  | +	} | ||||||
|  | + | ||||||
|  |  	for (i = 0; i < hapd->iface->num_bss; i++) { | ||||||
|  |  		if (hostapd_switch_channel(hapd->iface->bss[i], &css) != 0) | ||||||
|  |  			return UBUS_STATUS_NOT_SUPPORTED; | ||||||
|  | @@ -1454,10 +1676,16 @@ void hostapd_ubus_free_bss(struct hostap | ||||||
|  |  	} | ||||||
|  |   | ||||||
|  |  	free(name); | ||||||
|  | -	for (size_t i = 0; i < bss_nr; i++) | ||||||
|  | -		os_free(bss_lst[i]); | ||||||
|  | -	free(bss_lst); | ||||||
|  | -	bss_lst = NULL; | ||||||
|  | + | ||||||
|  | +	if (bss_lst != NULL) { | ||||||
|  | +		for (size_t i = 0; i < bss_nr; i++) { | ||||||
|  | +			os_free(bss_lst[i]); | ||||||
|  | +			bss_lst[i] = NULL; | ||||||
|  | +		} | ||||||
|  | +		free(bss_lst); | ||||||
|  | +		bss_lst = NULL; | ||||||
|  | +		bss_nr = 0; | ||||||
|  | +	} | ||||||
|  |  } | ||||||
|  |   | ||||||
|  |  static int hostapd_get_bss_list(struct ubus_context *ctx, | ||||||
|  | @@ -1477,9 +1705,11 @@ static int hostapd_get_bss_list(struct u | ||||||
|  |  	a = blobmsg_open_array(&b_ev, "bss_list"); | ||||||
|  |  	/* check bss list from hapd */ | ||||||
|  |  	for (size_t i = 0; i < bss_nr; i++) { | ||||||
|  | -		b = blobmsg_open_table(&b_ev, NULL); | ||||||
|  | -		blobmsg_add_string(&b_ev, "name", bss_lst[i]); | ||||||
|  | -		blobmsg_close_table(&b_ev, b); | ||||||
|  | +		if (bss_lst[i] != NULL) { | ||||||
|  | +			b = blobmsg_open_table(&b_ev, NULL); | ||||||
|  | +			blobmsg_add_string(&b_ev, "name", bss_lst[i]); | ||||||
|  | +			blobmsg_close_table(&b_ev, b); | ||||||
|  | +		} | ||||||
|  |  	} | ||||||
|  |  	blobmsg_close_array(&b_ev, a); | ||||||
|  |  	ubus_send_reply(ctx, req, b_ev.head); | ||||||
| @@ -0,0 +1,64 @@ | |||||||
|  | --- a/src/ap/ubus.c | ||||||
|  | +++ b/src/ap/ubus.c | ||||||
|  | @@ -531,6 +531,7 @@ enum { | ||||||
|  |  	CSA_VHT, | ||||||
|  |  	CSA_HE, | ||||||
|  |  	CSA_BLOCK_TX, | ||||||
|  | +	CSA_REASON, | ||||||
|  |  	__CSA_MAX | ||||||
|  |  }; | ||||||
|  |   | ||||||
|  | @@ -545,6 +546,7 @@ static const struct blobmsg_policy csa_p | ||||||
|  |  	[CSA_VHT] = { "vht", BLOBMSG_TYPE_BOOL }, | ||||||
|  |  	[CSA_HE] = { "he", BLOBMSG_TYPE_BOOL }, | ||||||
|  |  	[CSA_BLOCK_TX] = { "block_tx", BLOBMSG_TYPE_BOOL }, | ||||||
|  | +	[CSA_REASON] = { "reason", BLOBMSG_TYPE_INT32 }, | ||||||
|  |  }; | ||||||
|  |   | ||||||
|  |  #ifdef NEED_AP_MLME | ||||||
|  | @@ -810,7 +812,7 @@ void hostapd_dfs_csa_timeout(void *eloop | ||||||
|  |  		   iface->conf->ieee80211ac, iface->conf->ieee80211ax); | ||||||
|  |   | ||||||
|  |  	ret = hostapd_enable_iface(iface); | ||||||
|  | -	if (ret == 0) | ||||||
|  | +	if (ret == 0 && css->reason == 0) | ||||||
|  |  		hostapd_ubus_handle_channel_switch_event(iface, | ||||||
|  |  						HOSTAPD_UBUS_HIGH_INTERFERENCE, | ||||||
|  |  						iface->freq); | ||||||
|  | @@ -994,6 +996,7 @@ hostapd_switch_chan(struct ubus_context | ||||||
|  |  	SET_CSA_SETTING(CSA_VHT, freq_params.vht_enabled, bool); | ||||||
|  |  	SET_CSA_SETTING(CSA_HE, freq_params.he_enabled, bool); | ||||||
|  |  	SET_CSA_SETTING(CSA_BLOCK_TX, block_tx, bool); | ||||||
|  | +	SET_CSA_SETTING(CSA_REASON, reason, u32); | ||||||
|  |   | ||||||
|  |  	wpa_printf(MSG_INFO, "%s: CSS freq=%d chan=%d sec_chan_off=%d, width=%d, seg0=%d, seg1=%d", __func__, | ||||||
|  |  		css.freq_params.freq, | ||||||
|  | @@ -1015,7 +1018,9 @@ hostapd_switch_chan(struct ubus_context | ||||||
|  |  			return UBUS_STATUS_NOT_SUPPORTED; | ||||||
|  |  	} | ||||||
|  |   | ||||||
|  | -	hostapd_ubus_handle_channel_switch_event(hapd->iface, HOSTAPD_UBUS_HIGH_INTERFERENCE, css.freq_params.freq); | ||||||
|  | +	if (css.reason == 0) { | ||||||
|  | +		hostapd_ubus_handle_channel_switch_event(hapd->iface, HOSTAPD_UBUS_HIGH_INTERFERENCE, css.freq_params.freq); | ||||||
|  | +	} | ||||||
|  |   | ||||||
|  |  	return UBUS_STATUS_OK; | ||||||
|  |  #undef SET_CSA_SETTING | ||||||
|  | --- a/src/drivers/driver.h | ||||||
|  | +++ b/src/drivers/driver.h | ||||||
|  | @@ -2404,6 +2404,7 @@ struct beacon_data { | ||||||
|  |   * @freq_params: Next channel frequency parameter | ||||||
|  |   * @beacon_csa: Beacon/probe resp/asooc resp info for CSA period | ||||||
|  |   * @beacon_after: Next beacon/probe resp/asooc resp info | ||||||
|  | + * @reason: The reason why we are switching the channel | ||||||
|  |   * @counter_offset_beacon: Offset to the count field in beacon's tail | ||||||
|  |   * @counter_offset_presp: Offset to the count field in probe resp. | ||||||
|  |   */ | ||||||
|  | @@ -2414,6 +2415,7 @@ struct csa_settings { | ||||||
|  |  	struct hostapd_freq_params freq_params; | ||||||
|  |  	struct beacon_data beacon_csa; | ||||||
|  |  	struct beacon_data beacon_after; | ||||||
|  | +	u32 reason; | ||||||
|  |   | ||||||
|  |  	u16 counter_offset_beacon[2]; | ||||||
|  |  	u16 counter_offset_presp[2]; | ||||||
| @@ -0,0 +1,112 @@ | |||||||
|  | --- a/src/ap/ubus.c | ||||||
|  | +++ b/src/ap/ubus.c | ||||||
|  | @@ -580,6 +580,7 @@ static int hostapd_clear_session(struct | ||||||
|  |  	{ | ||||||
|  |  		if (session_id == rec->session_id) { | ||||||
|  |  			/* dec counter and delete */ | ||||||
|  | +			wpa_printf(MSG_INFO, "%s Deleting client session with session id %llu", __func__, session_id); | ||||||
|  |  			cached_events_nr -= rec->rec_nr; | ||||||
|  |  			avl_delete(&hapd->ubus.rt_events, &rec->avl); | ||||||
|  |  			os_free(rec->records); | ||||||
|  | @@ -633,6 +634,11 @@ static int hostapd_sessions(struct ubus_ | ||||||
|  |  		/* messages for current session */ | ||||||
|  |  		for (size_t i = 0; i < rec->rec_nr; i++) { | ||||||
|  |  			c_rec = &rec->records[i]; | ||||||
|  | +			if (c_rec->processed) { | ||||||
|  | +				/* Record is already reported, continue */ | ||||||
|  | +				continue; | ||||||
|  | +			} | ||||||
|  | + | ||||||
|  |  			/* check message type */ | ||||||
|  |  			switch (c_rec->type) { | ||||||
|  |  			/* ClientAuthEvent */ | ||||||
|  | @@ -646,6 +652,7 @@ static int hostapd_sessions(struct ubus_ | ||||||
|  |  				blobmsg_add_u32(&b_ev, "auth_status", p->auth_status); | ||||||
|  |  				blobmsg_add_string(&b_ev, "ssid", p->ssid); | ||||||
|  |  				blobmsg_close_table(&b_ev, t_msg); | ||||||
|  | +				c_rec->processed = true; | ||||||
|  |  				break; | ||||||
|  |  			} | ||||||
|  |   | ||||||
|  | @@ -665,6 +672,7 @@ static int hostapd_sessions(struct ubus_ | ||||||
|  |  				blobmsg_add_u8(&b_ev, "using11v", p->using11v); | ||||||
|  |  				blobmsg_add_string(&b_ev, "ssid", p->ssid); | ||||||
|  |  				blobmsg_close_table(&b_ev, t_msg); | ||||||
|  | +				c_rec->processed = true; | ||||||
|  |  				break; | ||||||
|  |  			} | ||||||
|  |   | ||||||
|  | @@ -680,6 +688,7 @@ static int hostapd_sessions(struct ubus_ | ||||||
|  |  				blobmsg_add_u32(&b_ev, "internal_rc", p->internal_rc); | ||||||
|  |  				blobmsg_add_string(&b_ev, "ssid", p->ssid); | ||||||
|  |  				blobmsg_close_table(&b_ev, t_msg); | ||||||
|  | +				c_rec->processed = true; | ||||||
|  |  				break; | ||||||
|  |  			} | ||||||
|  |   | ||||||
|  | @@ -693,6 +702,7 @@ static int hostapd_sessions(struct ubus_ | ||||||
|  |  				blobmsg_add_u64(&b_ev, "fdata_tx_up_ts_in_us", p->tx_ts.tv_sec * (uint64_t)1000000); | ||||||
|  |  				blobmsg_add_u64(&b_ev, "fdata_rx_up_ts_in_us", p->rx_ts.tv_sec * (uint64_t)1000000); | ||||||
|  |  				blobmsg_close_table(&b_ev, t_msg); | ||||||
|  | +				c_rec->processed = true; | ||||||
|  |  				break; | ||||||
|  |  			} | ||||||
|  |   | ||||||
|  | @@ -705,6 +715,7 @@ static int hostapd_sessions(struct ubus_ | ||||||
|  |  				blobmsg_add_string(&b_ev, "sta_mac", p->sta_mac); | ||||||
|  |  				blobmsg_add_string(&b_ev, "ip_address", p->ip_addr); | ||||||
|  |  				blobmsg_close_table(&b_ev, t_msg); | ||||||
|  | +				c_rec->processed = true; | ||||||
|  |  				break; | ||||||
|  |  			} | ||||||
|  |   | ||||||
|  | @@ -1912,6 +1923,7 @@ int hostapd_ubus_handle_rt_event(struct | ||||||
|  |  		struct client_session_record *rp = &rec->records[rec->rec_nr - 1]; | ||||||
|  |  		rp->type = CST_AUTH; | ||||||
|  |  		rp->u.auth.session_id = rec->session_id; | ||||||
|  | +		rp->processed = false; | ||||||
|  |   | ||||||
|  |  		/* timestamp */ | ||||||
|  |  		rp->timestamp = timestamp; | ||||||
|  | @@ -1942,6 +1954,7 @@ int hostapd_ubus_handle_rt_event(struct | ||||||
|  |  		struct client_session_record *rp = &rec->records[rec->rec_nr - 1]; | ||||||
|  |  		rp->type = CST_ASSOC; | ||||||
|  |  		rp->u.assoc.session_id = rec->session_id; | ||||||
|  | +		rp->processed = false; | ||||||
|  |  		/* timestamp */ | ||||||
|  |  		rp->timestamp = timestamp; | ||||||
|  |  		/* frequency */ | ||||||
|  | @@ -1986,6 +1999,7 @@ int hostapd_ubus_handle_rt_event(struct | ||||||
|  |  		struct client_session_record *rp = &rec->records[rec->rec_nr - 1]; | ||||||
|  |  		rp->type = CST_DISASSOC; | ||||||
|  |  		rp->u.disassoc.session_id = rec->session_id; | ||||||
|  | +		rp->processed = false; | ||||||
|  |  		/* timestamp */ | ||||||
|  |  		rp->timestamp = timestamp; | ||||||
|  |  		/* frequency */ | ||||||
|  | @@ -2017,6 +2031,7 @@ int hostapd_ubus_handle_rt_event(struct | ||||||
|  |  		struct client_session_record *rp = &rec->records[rec->rec_nr - 1]; | ||||||
|  |  		rp->type = CST_FDATA; | ||||||
|  |  		rp->u.fdata.session_id = rec->session_id; | ||||||
|  | +		rp->processed = false; | ||||||
|  |  		/* timestamp */ | ||||||
|  |  		rp->timestamp = timestamp; | ||||||
|  |  		/* STA MAC */ | ||||||
|  | @@ -2045,6 +2060,7 @@ int hostapd_ubus_handle_rt_event(struct | ||||||
|  |  		struct client_session_record *rp = &rec->records[rec->rec_nr - 1]; | ||||||
|  |  		rp->type = CST_IP; | ||||||
|  |  		rp->u.ip.session_id = rec->session_id; | ||||||
|  | +		rp->processed = false; | ||||||
|  |  		/* timestamp */ | ||||||
|  |  		rp->timestamp = timestamp; | ||||||
|  |  		/* STA MAC */ | ||||||
|  | --- a/src/ap/ubus.h | ||||||
|  | +++ b/src/ap/ubus.h | ||||||
|  | @@ -110,6 +110,7 @@ struct client_ip_event { | ||||||
|  |  }; | ||||||
|  |   | ||||||
|  |  struct client_session_record { | ||||||
|  | +	bool processed; | ||||||
|  |  	int type; | ||||||
|  |  	uint64_t timestamp; | ||||||
|  |  	union { | ||||||
| @@ -54,9 +54,13 @@ config-$(CONFIG_ATH10K_THERMAL) += ATH10K_THERMAL | |||||||
|  |  | ||||||
| config-$(call config_package,ath9k-htc) += ATH9K_HTC | config-$(call config_package,ath9k-htc) += ATH9K_HTC | ||||||
| config-$(call config_package,ath10k) += ATH10K ATH10K_PCI | config-$(call config_package,ath10k) += ATH10K ATH10K_PCI | ||||||
| config-$(call config_package,ath11k) += ATH11K ATH11K_AHB | config-$(call config_package,ath11k) += ATH11K ATH11K_AHB ATH11K_SPECTRAL | ||||||
| config-$(call config_package,ath11k-pci) += ATH11K_PCI | config-$(call config_package,ath11k-pci) += ATH11K_PCI | ||||||
|  |  | ||||||
|  | ifeq ($(CONFIG_KERNEL_IPQ_MEM_PROFILE),512) | ||||||
|  | config-y += ATH11K_MEM_PROFILE_512M | ||||||
|  | endif | ||||||
|  |  | ||||||
| config-$(call config_package,ath5k) += ATH5K | config-$(call config_package,ath5k) += ATH5K | ||||||
| ifdef CONFIG_TARGET_ath25 | ifdef CONFIG_TARGET_ath25 | ||||||
|   config-y += ATH5K_AHB |   config-y += ATH5K_AHB | ||||||
|   | |||||||
| @@ -254,6 +254,11 @@ mac80211_hostapd_setup_base() { | |||||||
| 		[ "$rx_stbc" -lt "$cap_rx_stbc" ] && cap_rx_stbc="$rx_stbc" | 		[ "$rx_stbc" -lt "$cap_rx_stbc" ] && cap_rx_stbc="$rx_stbc" | ||||||
| 		ht_cap_mask="$(( ($ht_cap_mask & ~(0x300)) | ($cap_rx_stbc << 8) ))" | 		ht_cap_mask="$(( ($ht_cap_mask & ~(0x300)) | ($cap_rx_stbc << 8) ))" | ||||||
|  |  | ||||||
|  | 		conf_tx_ant=$(iw phy "$phy" info | grep 'Configured Antennas:' | cut -d: -f2) | ||||||
|  | 		set -- $conf_tx_ant | ||||||
|  | 		if [ "$2" == "0x1" -o "$2" == "0x10" ]; then | ||||||
|  | 			tx_stbc=0 | ||||||
|  | 		fi | ||||||
| 		mac80211_add_capabilities ht_capab_flags $ht_cap_mask \ | 		mac80211_add_capabilities ht_capab_flags $ht_cap_mask \ | ||||||
| 			LDPC:0x1::$ldpc \ | 			LDPC:0x1::$ldpc \ | ||||||
| 			GF:0x10::$greenfield \ | 			GF:0x10::$greenfield \ | ||||||
| @@ -343,6 +348,11 @@ mac80211_hostapd_setup_base() { | |||||||
| 		[ "$rx_stbc" -lt "$cap_rx_stbc" ] && cap_rx_stbc="$rx_stbc" | 		[ "$rx_stbc" -lt "$cap_rx_stbc" ] && cap_rx_stbc="$rx_stbc" | ||||||
| 		vht_cap="$(( ($vht_cap & ~(0x700)) | ($cap_rx_stbc << 8) ))" | 		vht_cap="$(( ($vht_cap & ~(0x700)) | ($cap_rx_stbc << 8) ))" | ||||||
|  |  | ||||||
|  | 		conf_tx_ant=$(iw phy "$phy" info | grep 'Configured Antennas:' | cut -d: -f2) | ||||||
|  | 		set -- $conf_tx_ant | ||||||
|  | 		if [ "$2" == "0x1" -o "$2" == "0x10" ]; then | ||||||
|  | 			tx_stbc_2by1=0 | ||||||
|  | 		fi | ||||||
| 		mac80211_add_capabilities vht_capab $vht_cap \ | 		mac80211_add_capabilities vht_capab $vht_cap \ | ||||||
| 			RXLDPC:0x10::$rxldpc \ | 			RXLDPC:0x10::$rxldpc \ | ||||||
| 			SHORT-GI-80:0x20::$short_gi_80 \ | 			SHORT-GI-80:0x20::$short_gi_80 \ | ||||||
|   | |||||||
| @@ -0,0 +1,26 @@ | |||||||
|  | Index: backports-20200902_001-4.4.60-931c337125/drivers/net/wireless/ath/ath11k/dp.h | ||||||
|  | =================================================================== | ||||||
|  | --- backports-20200902_001-4.4.60-931c337125.orig/drivers/net/wireless/ath/ath11k/dp.h | ||||||
|  | +++ backports-20200902_001-4.4.60-931c337125/drivers/net/wireless/ath/ath11k/dp.h | ||||||
|  | @@ -209,7 +209,7 @@ struct ath11k_pdev_dp { | ||||||
|  |   | ||||||
|  |  #define DP_WBM_RELEASE_RING_SIZE	64 | ||||||
|  |  #define DP_TCL_DATA_RING_SIZE		512 | ||||||
|  | -#define DP_TX_COMP_RING_SIZE		32768 | ||||||
|  | +#define DP_TX_COMP_RING_SIZE		4096 | ||||||
|  |  #define DP_TX_IDR_SIZE			DP_TX_COMP_RING_SIZE | ||||||
|  |  #define DP_TCL_CMD_RING_SIZE		32 | ||||||
|  |  #define DP_TCL_STATUS_RING_SIZE		32 | ||||||
|  | @@ -224,9 +224,9 @@ struct ath11k_pdev_dp { | ||||||
|  |  #define DP_RXDMA_REFILL_RING_SIZE	2048 | ||||||
|  |  #define DP_RXDMA_ERR_DST_RING_SIZE	1024 | ||||||
|  |  #define DP_RXDMA_MON_STATUS_RING_SIZE	1024 | ||||||
|  | -#define DP_RXDMA_MONITOR_BUF_RING_SIZE	4096 | ||||||
|  | -#define DP_RXDMA_MONITOR_DST_RING_SIZE	2048 | ||||||
|  | -#define DP_RXDMA_MONITOR_DESC_RING_SIZE	4096 | ||||||
|  | +#define DP_RXDMA_MONITOR_BUF_RING_SIZE	512 | ||||||
|  | +#define DP_RXDMA_MONITOR_DST_RING_SIZE	128 | ||||||
|  | +#define DP_RXDMA_MONITOR_DESC_RING_SIZE	128 | ||||||
|  |   | ||||||
|  |  #define DP_RX_BUFFER_SIZE	2048 | ||||||
|  |  #define	DP_RX_BUFFER_SIZE_LITE  1024 | ||||||
							
								
								
									
										13
									
								
								feeds/wifi-ax/mac80211/patches/pending/211-coldboot.patch
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										13
									
								
								feeds/wifi-ax/mac80211/patches/pending/211-coldboot.patch
									
									
									
									
									
										Normal file
									
								
							| @@ -0,0 +1,13 @@ | |||||||
|  | Index: backports-20200902_001-4.4.60-931c337125/drivers/net/wireless/ath/ath11k/qmi.c | ||||||
|  | =================================================================== | ||||||
|  | --- backports-20200902_001-4.4.60-931c337125.orig/drivers/net/wireless/ath/ath11k/qmi.c | ||||||
|  | +++ backports-20200902_001-4.4.60-931c337125/drivers/net/wireless/ath/ath11k/qmi.c | ||||||
|  | @@ -16,7 +16,7 @@ | ||||||
|  |  #define HOST_CSTATE_BIT			0x04 | ||||||
|  |   | ||||||
|  |  /* set the default max assoc sta to max supported by driver */ | ||||||
|  | -bool enable_cold_boot_cal = 1; | ||||||
|  | +bool enable_cold_boot_cal = 0; | ||||||
|  |  EXPORT_SYMBOL(enable_cold_boot_cal); | ||||||
|  |  module_param(enable_cold_boot_cal, bool, 0644); | ||||||
|  |  MODULE_PARM_DESC(enable_cold_boot_cal, "cold boot calibration enable:1 disable:0"); | ||||||
| @@ -0,0 +1,31 @@ | |||||||
|  | --- a/drivers/net/wireless/ath/ath11k/wmi.c | ||||||
|  | +++ b/drivers/net/wireless/ath/ath11k/wmi.c | ||||||
|  | @@ -7339,16 +7339,18 @@ | ||||||
|  |   | ||||||
|  |  	survey = &ar->survey[idx]; | ||||||
|  |   | ||||||
|  | -	survey->noise     = bss_ch_info_ev.noise_floor; | ||||||
|  | -	survey->time      = div_u64(total, cc_freq_hz); | ||||||
|  | -	survey->time_busy = div_u64(busy, cc_freq_hz); | ||||||
|  | -	survey->time_rx   = div_u64(rx_bss, cc_freq_hz); | ||||||
|  | -	survey->time_tx   = div_u64(tx, cc_freq_hz); | ||||||
|  | -	survey->filled   |= (SURVEY_INFO_NOISE_DBM | | ||||||
|  | -			     SURVEY_INFO_TIME | | ||||||
|  | -			     SURVEY_INFO_TIME_BUSY | | ||||||
|  | -			     SURVEY_INFO_TIME_RX | | ||||||
|  | -			     SURVEY_INFO_TIME_TX); | ||||||
|  | +	survey->noise       = bss_ch_info_ev.noise_floor; | ||||||
|  | +	survey->time        = div_u64(total, cc_freq_hz); | ||||||
|  | +	survey->time_busy   = div_u64(busy, cc_freq_hz); | ||||||
|  | +	survey->time_rx     = div_u64(rx, cc_freq_hz); | ||||||
|  | +	survey->time_bss_rx = div_u64(rx_bss, cc_freq_hz); | ||||||
|  | +	survey->time_tx     = div_u64(tx, cc_freq_hz); | ||||||
|  | +	survey->filled     |= (SURVEY_INFO_NOISE_DBM | | ||||||
|  | +			       SURVEY_INFO_TIME | | ||||||
|  | +			       SURVEY_INFO_TIME_BUSY | | ||||||
|  | +			       SURVEY_INFO_TIME_RX | | ||||||
|  | +			       SURVEY_INFO_TIME_TX | | ||||||
|  | +			       SURVEY_INFO_TIME_BSS_RX); | ||||||
|  |  exit: | ||||||
|  |  	spin_unlock_bh(&ar->data_lock); | ||||||
|  |  	complete(&ar->bss_survey_done); | ||||||
| @@ -0,0 +1,84 @@ | |||||||
|  | From 0e23a88c63d6abbeaef8ec90bd29584b7c5068bd Mon Sep 17 00:00:00 2001 | ||||||
|  | From: Sriram R <srirrama@codeaurora.org> | ||||||
|  | Date: Thu, 10 Dec 2020 14:20:50 +0530 | ||||||
|  | Subject: [PATCH] ath11k: Clear the fragment cache during key install | ||||||
|  |  | ||||||
|  | Currently the fragment cache setup during peer assoc is | ||||||
|  | cleared during peer delete. In case a key reinstallation | ||||||
|  | happens with the same peer, possibilitites are same fragment cache | ||||||
|  | where some fragments were added before key installation could be clubbed | ||||||
|  | with fragments received after. In ideal cases where | ||||||
|  | this could result in wrong PN since we expect all fragments to | ||||||
|  | have incrementing PN, this behavior could be explioted | ||||||
|  | to mix fragments of different data resulting in a proper | ||||||
|  | unintended reassembled packet to be passed up the stack. | ||||||
|  |  | ||||||
|  | Signed-off-by: Sriram R <srirrama@codeaurora.org> | ||||||
|  | --- | ||||||
|  |  drivers/net/wireless/ath/ath11k/dp_rx.c | 19 +++++++++++++++++++ | ||||||
|  |  drivers/net/wireless/ath/ath11k/dp_rx.h |  1 + | ||||||
|  |  drivers/net/wireless/ath/ath11k/mac.c   |  6 ++++++ | ||||||
|  |  3 files changed, 26 insertions(+) | ||||||
|  |  | ||||||
|  | diff --git a/drivers/net/wireless/ath/ath11k/dp_rx.c b/drivers/net/wireless/ath/ath11k/dp_rx.c | ||||||
|  | index 0fa25c1..06bbd6e 100644 | ||||||
|  | --- a/drivers/net/wireless/ath/ath11k/dp_rx.c | ||||||
|  | +++ b/drivers/net/wireless/ath/ath11k/dp_rx.c | ||||||
|  | @@ -844,6 +844,25 @@ static void ath11k_dp_rx_frags_cleanup(struct dp_rx_tid *rx_tid, bool rel_link_d | ||||||
|  |  	__skb_queue_purge(&rx_tid->rx_frags); | ||||||
|  |  } | ||||||
|  |   | ||||||
|  | +void ath11k_peer_frags_flush(struct ath11k *ar, struct ath11k_peer *peer) | ||||||
|  | +{ | ||||||
|  | +	struct dp_rx_tid *rx_tid; | ||||||
|  | +	int i; | ||||||
|  | + | ||||||
|  | +	lockdep_assert_held(&ar->ab->base_lock); | ||||||
|  | + | ||||||
|  | +	for (i = 0; i <= IEEE80211_NUM_TIDS; i++) { | ||||||
|  | +		rx_tid = &peer->rx_tid[i]; | ||||||
|  | + | ||||||
|  | +		spin_unlock_bh(&ar->ab->base_lock); | ||||||
|  | +		del_timer_sync(&rx_tid->frag_timer); | ||||||
|  | +		spin_lock_bh(&ar->ab->base_lock); | ||||||
|  | + | ||||||
|  | +		ath11k_dp_rx_frags_cleanup(rx_tid, true); | ||||||
|  | + | ||||||
|  | +	} | ||||||
|  | +} | ||||||
|  | + | ||||||
|  |  void ath11k_peer_rx_tid_cleanup(struct ath11k *ar, struct ath11k_peer *peer) | ||||||
|  |  { | ||||||
|  |  	struct dp_rx_tid *rx_tid; | ||||||
|  | diff --git a/drivers/net/wireless/ath/ath11k/dp_rx.h b/drivers/net/wireless/ath/ath11k/dp_rx.h | ||||||
|  | index f005ded..732f9a7 100644 | ||||||
|  | --- a/drivers/net/wireless/ath/ath11k/dp_rx.h | ||||||
|  | +++ b/drivers/net/wireless/ath/ath11k/dp_rx.h | ||||||
|  | @@ -68,6 +68,7 @@ int ath11k_dp_peer_rx_pn_replay_config(struct ath11k_vif *arvif, | ||||||
|  |  				       const u8 *peer_addr, | ||||||
|  |  				       enum set_key_cmd key_cmd, | ||||||
|  |  				       struct ieee80211_key_conf *key); | ||||||
|  | +void ath11k_peer_frags_flush(struct ath11k *ar, struct ath11k_peer *peer); | ||||||
|  |  void ath11k_peer_rx_tid_cleanup(struct ath11k *ar, struct ath11k_peer *peer); | ||||||
|  |  void ath11k_peer_rx_tid_delete(struct ath11k *ar, | ||||||
|  |  			       struct ath11k_peer *peer, u8 tid); | ||||||
|  | diff --git a/drivers/net/wireless/ath/ath11k/mac.c b/drivers/net/wireless/ath/ath11k/mac.c | ||||||
|  | index 4c88eab..91d645e 100644 | ||||||
|  | --- a/drivers/net/wireless/ath/ath11k/mac.c | ||||||
|  | +++ b/drivers/net/wireless/ath/ath11k/mac.c | ||||||
|  | @@ -3707,6 +3707,12 @@ static int ath11k_mac_op_set_key(struct ieee80211_hw *hw, enum set_key_cmd cmd, | ||||||
|  |  	 */ | ||||||
|  |  	spin_lock_bh(&ab->base_lock); | ||||||
|  |  	peer = ath11k_peer_find(ab, arvif->vdev_id, peer_addr); | ||||||
|  | + | ||||||
|  | +	/* flush the fragments cache during key (re)install to | ||||||
|  | +	 * ensure all frags in the new frag list  belong to the same key. | ||||||
|  | +	 */ | ||||||
|  | +	if (peer && cmd == SET_KEY) | ||||||
|  | +		ath11k_peer_frags_flush(ar, peer); | ||||||
|  |  	spin_unlock_bh(&ab->base_lock); | ||||||
|  |   | ||||||
|  |  	if (!peer) { | ||||||
|  | --  | ||||||
|  | 2.7.4 | ||||||
|  |  | ||||||
							
								
								
									
										242
									
								
								feeds/wifi-ax/mac80211/patches/pending/213-mac80211-frag.patch
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										242
									
								
								feeds/wifi-ax/mac80211/patches/pending/213-mac80211-frag.patch
									
									
									
									
									
										Normal file
									
								
							| @@ -0,0 +1,242 @@ | |||||||
|  | From patchwork Tue May 11 18:02:44 2021 | ||||||
|  | Content-Type: text/plain; charset="utf-8" | ||||||
|  | MIME-Version: 1.0 | ||||||
|  | Content-Transfer-Encoding: 7bit | ||||||
|  | X-Patchwork-Submitter: Johannes Berg <johannes@sipsolutions.net> | ||||||
|  | X-Patchwork-Id: 12251641 | ||||||
|  | X-Patchwork-Delegate: johannes@sipsolutions.net | ||||||
|  | Return-Path: <linux-wireless-owner@kernel.org> | ||||||
|  | X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on | ||||||
|  | 	aws-us-west-2-korg-lkml-1.web.codeaurora.org | ||||||
|  | X-Spam-Level:  | ||||||
|  | X-Spam-Status: No, score=-16.8 required=3.0 tests=BAYES_00, | ||||||
|  | 	HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_CR_TRAILER,INCLUDES_PATCH, | ||||||
|  | 	MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS,URIBL_BLOCKED,USER_AGENT_GIT | ||||||
|  | 	autolearn=unavailable autolearn_force=no version=3.4.0 | ||||||
|  | Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) | ||||||
|  | 	by smtp.lore.kernel.org (Postfix) with ESMTP id 5E0C4C43617 | ||||||
|  | 	for <linux-wireless@archiver.kernel.org>; | ||||||
|  |  Tue, 11 May 2021 18:03:20 +0000 (UTC) | ||||||
|  | Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) | ||||||
|  | 	by mail.kernel.org (Postfix) with ESMTP id 2E1D461625 | ||||||
|  | 	for <linux-wireless@archiver.kernel.org>; | ||||||
|  |  Tue, 11 May 2021 18:03:20 +0000 (UTC) | ||||||
|  | Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand | ||||||
|  |         id S231693AbhEKSEZ (ORCPT | ||||||
|  |         <rfc822;linux-wireless@archiver.kernel.org>); | ||||||
|  |         Tue, 11 May 2021 14:04:25 -0400 | ||||||
|  | Received: from lindbergh.monkeyblade.net ([23.128.96.19]:41156 "EHLO | ||||||
|  |         lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org | ||||||
|  |         with ESMTP id S231561AbhEKSEV (ORCPT | ||||||
|  |         <rfc822;linux-wireless@vger.kernel.org>); | ||||||
|  |         Tue, 11 May 2021 14:04:21 -0400 | ||||||
|  | Received: from sipsolutions.net (s3.sipsolutions.net | ||||||
|  |  [IPv6:2a01:4f8:191:4433::2]) | ||||||
|  |         by lindbergh.monkeyblade.net (Postfix) with ESMTPS id D055CC06175F; | ||||||
|  |         Tue, 11 May 2021 11:03:10 -0700 (PDT) | ||||||
|  | Received: by sipsolutions.net with esmtpsa | ||||||
|  |  (TLS1.3:ECDHE_X25519__RSA_PSS_RSAE_SHA256__AES_256_GCM:256) | ||||||
|  |         (Exim 4.94.2) | ||||||
|  |         (envelope-from <johannes@sipsolutions.net>) | ||||||
|  |         id 1lgWir-007aAS-9o; Tue, 11 May 2021 20:03:09 +0200 | ||||||
|  | From: Johannes Berg <johannes@sipsolutions.net> | ||||||
|  | To: linux-wireless@vger.kernel.org | ||||||
|  | Cc: Mathy Vanhoef <Mathy.Vanhoef@kuleuven.be>, stable@vger.kernel.org | ||||||
|  | Subject: [PATCH 03/18] mac80211: properly handle A-MSDUs that start with an | ||||||
|  |  RFC 1042 header | ||||||
|  | Date: Tue, 11 May 2021 20:02:44 +0200 | ||||||
|  | Message-Id:  | ||||||
|  |  <20210511200110.0b2b886492f0.I23dd5d685fe16d3b0ec8106e8f01b59f499dffed@changeid> | ||||||
|  | X-Mailer: git-send-email 2.30.2 | ||||||
|  | In-Reply-To: <20210511180259.159598-1-johannes@sipsolutions.net> | ||||||
|  | References: <20210511180259.159598-1-johannes@sipsolutions.net> | ||||||
|  | MIME-Version: 1.0 | ||||||
|  | Precedence: bulk | ||||||
|  | List-ID: <linux-wireless.vger.kernel.org> | ||||||
|  | X-Mailing-List: linux-wireless@vger.kernel.org | ||||||
|  |  | ||||||
|  | From: Mathy Vanhoef <Mathy.Vanhoef@kuleuven.be> | ||||||
|  |  | ||||||
|  | Properly parse A-MSDUs whose first 6 bytes happen to equal a rfc1042 | ||||||
|  | header. This can occur in practice when the destination MAC address | ||||||
|  | equals AA:AA:03:00:00:00. More importantly, this simplifies the next | ||||||
|  | patch to mitigate A-MSDU injection attacks. | ||||||
|  |  | ||||||
|  | Cc: stable@vger.kernel.org | ||||||
|  | Signed-off-by: Mathy Vanhoef <Mathy.Vanhoef@kuleuven.be> | ||||||
|  | Signed-off-by: Johannes Berg <johannes.berg@intel.com> | ||||||
|  | --- | ||||||
|  |  include/net/cfg80211.h | 4 ++-- | ||||||
|  |  net/mac80211/rx.c      | 2 +- | ||||||
|  |  net/wireless/util.c    | 4 ++-- | ||||||
|  |  3 files changed, 5 insertions(+), 5 deletions(-) | ||||||
|  |  | ||||||
|  | Index: backports-20200902_001-4.4.60-931c337125/include/net/cfg80211.h | ||||||
|  | =================================================================== | ||||||
|  | --- backports-20200902_001-4.4.60-931c337125.orig/include/net/cfg80211.h | ||||||
|  | +++ backports-20200902_001-4.4.60-931c337125/include/net/cfg80211.h | ||||||
|  | @@ -5631,7 +5631,7 @@ unsigned int ieee80211_get_mesh_hdrlen(s | ||||||
|  |   */ | ||||||
|  |  int ieee80211_data_to_8023_exthdr(struct sk_buff *skb, struct ethhdr *ehdr, | ||||||
|  |  				  const u8 *addr, enum nl80211_iftype iftype, | ||||||
|  | -				  u8 data_offset); | ||||||
|  | +				  u8 data_offset, bool is_amsdu); | ||||||
|  |   | ||||||
|  |  /** | ||||||
|  |   * ieee80211_data_to_8023 - convert an 802.11 data frame to 802.3 | ||||||
|  | @@ -5643,7 +5643,7 @@ int ieee80211_data_to_8023_exthdr(struct | ||||||
|  |  static inline int ieee80211_data_to_8023(struct sk_buff *skb, const u8 *addr, | ||||||
|  |  					 enum nl80211_iftype iftype) | ||||||
|  |  { | ||||||
|  | -	return ieee80211_data_to_8023_exthdr(skb, NULL, addr, iftype, 0); | ||||||
|  | +	return ieee80211_data_to_8023_exthdr(skb, NULL, addr, iftype, 0, false); | ||||||
|  |  } | ||||||
|  |   | ||||||
|  |  /** | ||||||
|  | Index: backports-20200902_001-4.4.60-931c337125/net/mac80211/rx.c | ||||||
|  | =================================================================== | ||||||
|  | --- backports-20200902_001-4.4.60-931c337125.orig/net/mac80211/rx.c | ||||||
|  | +++ backports-20200902_001-4.4.60-931c337125/net/mac80211/rx.c | ||||||
|  | @@ -6,7 +6,7 @@ | ||||||
|  |   * Copyright 2007-2010	Johannes Berg <johannes@sipsolutions.net> | ||||||
|  |   * Copyright 2013-2014  Intel Mobile Communications GmbH | ||||||
|  |   * Copyright(c) 2015 - 2017 Intel Deutschland GmbH | ||||||
|  | - * Copyright (C) 2018-2020 Intel Corporation | ||||||
|  | + * Copyright (C) 2018-2021 Intel Corporation | ||||||
|  |   */ | ||||||
|  |   | ||||||
|  |  #include <linux/jiffies.h> | ||||||
|  | @@ -2555,13 +2555,13 @@ static bool ieee80211_frame_allowed(stru | ||||||
|  |  	struct ethhdr *ehdr = (struct ethhdr *) rx->skb->data; | ||||||
|  |   | ||||||
|  |  	/* | ||||||
|  | -	 * Allow EAPOL frames to us/the PAE group address regardless | ||||||
|  | -	 * of whether the frame was encrypted or not. | ||||||
|  | -	 */ | ||||||
|  | -	if (ehdr->h_proto == rx->sdata->control_port_protocol && | ||||||
|  | -	    (ether_addr_equal(ehdr->h_dest, rx->sdata->vif.addr) || | ||||||
|  | -	     ether_addr_equal(ehdr->h_dest, pae_group_addr))) | ||||||
|  | -		return true; | ||||||
|  | +	 * Allow EAPOL frames to us/the PAE group address regardless of | ||||||
|  | +	 * whether the frame was encrypted or not, and always disallow | ||||||
|  | +	 * all other destination addresses for them. | ||||||
|  | +	 */ | ||||||
|  | +	if (unlikely(ehdr->h_proto == rx->sdata->control_port_protocol)) | ||||||
|  | +		return ether_addr_equal(ehdr->h_dest, rx->sdata->vif.addr) || | ||||||
|  | +		       ether_addr_equal(ehdr->h_dest, pae_group_addr); | ||||||
|  |   | ||||||
|  |  	if (ieee80211_802_1x_port_control(rx) || | ||||||
|  |  	    ieee80211_drop_unencrypted(rx, fc)) | ||||||
|  | @@ -2632,7 +2632,26 @@ static void ieee80211_deliver_skb_to_loc | ||||||
|  |  		cfg80211_rx_control_port(dev, skb, noencrypt); | ||||||
|  |  		dev_kfree_skb(skb); | ||||||
|  |  	} else { | ||||||
|  | +		struct ethhdr *ehdr = (void *)skb_mac_header(skb); | ||||||
|  |  		memset(skb->cb, 0, sizeof(skb->cb)); | ||||||
|  | +		/* | ||||||
|  | +		 * 802.1X over 802.11 requires that the authenticator address | ||||||
|  | +		 * be used for EAPOL frames. However, 802.1X allows the use of | ||||||
|  | +		 * the PAE group address instead. If the interface is part of | ||||||
|  | +		 * a bridge and we pass the frame with the PAE group address, | ||||||
|  | +		 * then the bridge will forward it to the network (even if the | ||||||
|  | +		 * client was not associated yet), which isn't supposed to | ||||||
|  | +		 * happen. | ||||||
|  | +		 * To avoid that, rewrite the destination address to our own | ||||||
|  | +		 * address, so that the authenticator (e.g. hostapd) will see | ||||||
|  | +		 * the frame, but bridge won't forward it anywhere else. Note | ||||||
|  | +		 * that due to earlier filtering, the only other address can | ||||||
|  | +		 * be the PAE group address. | ||||||
|  | +		 */ | ||||||
|  | +		if (unlikely(skb->protocol == sdata->control_port_protocol && | ||||||
|  | +			     !ether_addr_equal(ehdr->h_dest, sdata->vif.addr))) | ||||||
|  | +			ether_addr_copy(ehdr->h_dest, sdata->vif.addr); | ||||||
|  | + | ||||||
|  |  		netif_rx_nss(rx, skb); | ||||||
|  |  	} | ||||||
|  |  } | ||||||
|  | @@ -2672,6 +2691,7 @@ ieee80211_deliver_skb(struct ieee80211_r | ||||||
|  |  	if ((sdata->vif.type == NL80211_IFTYPE_AP || | ||||||
|  |  	     sdata->vif.type == NL80211_IFTYPE_AP_VLAN) && | ||||||
|  |  	    !(sdata->flags & IEEE80211_SDATA_DONT_BRIDGE_PACKETS) && | ||||||
|  | +	    ehdr->h_proto != rx->sdata->control_port_protocol && | ||||||
|  |  	    (sdata->vif.type != NL80211_IFTYPE_AP_VLAN || !sdata->u.vlan.sta)) { | ||||||
|  |  		if (is_multicast_ether_addr(ehdr->h_dest) && | ||||||
|  |  		    ieee80211_vif_get_num_mcast_if(sdata) != 0) { | ||||||
|  | @@ -2781,7 +2801,7 @@ __ieee80211_rx_h_amsdu(struct ieee80211_ | ||||||
|  |  	if (ieee80211_data_to_8023_exthdr(skb, ðhdr, | ||||||
|  |  					  rx->sdata->vif.addr, | ||||||
|  |  					  rx->sdata->vif.type, | ||||||
|  | -					  data_offset)) | ||||||
|  | +					  data_offset, true)) | ||||||
|  |  		return RX_DROP_UNUSABLE; | ||||||
|  |   | ||||||
|  |  	ieee80211_amsdu_to_8023s(skb, &frame_list, dev->dev_addr, | ||||||
|  | @@ -2838,6 +2858,23 @@ ieee80211_rx_h_amsdu(struct ieee80211_rx | ||||||
|  |  	if (is_multicast_ether_addr(hdr->addr1)) | ||||||
|  |  		return RX_DROP_UNUSABLE; | ||||||
|  |   | ||||||
|  | +	if (rx->key) { | ||||||
|  | +		/* | ||||||
|  | +		 * We should not receive A-MSDUs on pre-HT connections, | ||||||
|  | +		 * and HT connections cannot use old ciphers. Thus drop | ||||||
|  | +		 * them, as in those cases we couldn't even have SPP | ||||||
|  | +		 * A-MSDUs or such. | ||||||
|  | +		 */ | ||||||
|  | +		switch (rx->key->conf.cipher) { | ||||||
|  | +		case WLAN_CIPHER_SUITE_WEP40: | ||||||
|  | +		case WLAN_CIPHER_SUITE_WEP104: | ||||||
|  | +		case WLAN_CIPHER_SUITE_TKIP: | ||||||
|  | +			return RX_DROP_UNUSABLE; | ||||||
|  | +		default: | ||||||
|  | +			break; | ||||||
|  | +		} | ||||||
|  | +	} | ||||||
|  | + | ||||||
|  |  	return __ieee80211_rx_h_amsdu(rx, 0); | ||||||
|  |  } | ||||||
|  |   | ||||||
|  | Index: backports-20200902_001-4.4.60-931c337125/net/wireless/util.c | ||||||
|  | =================================================================== | ||||||
|  | --- backports-20200902_001-4.4.60-931c337125.orig/net/wireless/util.c | ||||||
|  | +++ backports-20200902_001-4.4.60-931c337125/net/wireless/util.c | ||||||
|  | @@ -474,7 +474,7 @@ EXPORT_SYMBOL(ieee80211_get_mesh_hdrlen) | ||||||
|  |   | ||||||
|  |  int ieee80211_data_to_8023_exthdr(struct sk_buff *skb, struct ethhdr *ehdr, | ||||||
|  |  				  const u8 *addr, enum nl80211_iftype iftype, | ||||||
|  | -				  u8 data_offset) | ||||||
|  | +				  u8 data_offset, bool is_amsdu) | ||||||
|  |  { | ||||||
|  |  	struct ieee80211_hdr *hdr = (struct ieee80211_hdr *) skb->data; | ||||||
|  |  	struct { | ||||||
|  | @@ -562,7 +562,7 @@ int ieee80211_data_to_8023_exthdr(struct | ||||||
|  |  	skb_copy_bits(skb, hdrlen, &payload, sizeof(payload)); | ||||||
|  |  	tmp.h_proto = payload.proto; | ||||||
|  |   | ||||||
|  | -	if (likely((ether_addr_equal(payload.hdr, rfc1042_header) && | ||||||
|  | +	if (likely((!is_amsdu && ether_addr_equal(payload.hdr, rfc1042_header) && | ||||||
|  |  		    tmp.h_proto != htons(ETH_P_AARP) && | ||||||
|  |  		    tmp.h_proto != htons(ETH_P_IPX)) || | ||||||
|  |  		   ether_addr_equal(payload.hdr, bridge_tunnel_header))) | ||||||
|  | @@ -708,6 +708,9 @@ void ieee80211_amsdu_to_8023s(struct sk_ | ||||||
|  |  		remaining = skb->len - offset; | ||||||
|  |  		if (subframe_len > remaining) | ||||||
|  |  			goto purge; | ||||||
|  | +		/* mitigate A-MSDU aggregation injection attacks */ | ||||||
|  | +		if (ether_addr_equal(eth.h_dest, rfc1042_header)) | ||||||
|  | +			goto purge; | ||||||
|  |   | ||||||
|  |  		offset += sizeof(struct ethhdr); | ||||||
|  |  		last = remaining <= subframe_len + padding; | ||||||
|  | Index: backports-20200902_001-4.4.60-931c337125/drivers/net/wireless/ath/ath11k/nss.c | ||||||
|  | =================================================================== | ||||||
|  | --- backports-20200902_001-4.4.60-931c337125.orig/drivers/net/wireless/ath/ath11k/nss.c | ||||||
|  | +++ backports-20200902_001-4.4.60-931c337125/drivers/net/wireless/ath/ath11k/nss.c | ||||||
|  | @@ -477,7 +477,7 @@ static int ath11k_nss_deliver_rx(struct | ||||||
|  |  	} | ||||||
|  |   | ||||||
|  |  	if (ieee80211_data_to_8023_exthdr(skb, NULL, vif->addr, vif->type, | ||||||
|  | -					  data_offs - hdr_len)) { | ||||||
|  | +					  data_offs - hdr_len, false)) { | ||||||
|  |  		dev_kfree_skb_any(skb); | ||||||
|  |  		return -EINVAL; | ||||||
|  |  	} | ||||||
| @@ -0,0 +1,392 @@ | |||||||
|  | Index: backports-20200902_001-4.4.60-931c337125/drivers/net/wireless/ath/ath11k/debug.c | ||||||
|  | =================================================================== | ||||||
|  | --- backports-20200902_001-4.4.60-931c337125.orig/drivers/net/wireless/ath/ath11k/debug.c | ||||||
|  | +++ backports-20200902_001-4.4.60-931c337125/drivers/net/wireless/ath/ath11k/debug.c | ||||||
|  | @@ -1838,6 +1838,230 @@ static const struct file_operations fops | ||||||
|  |  	.open = simple_open | ||||||
|  |  }; | ||||||
|  |   | ||||||
|  | +static ssize_t ath11k_read_set_rates(struct file *file, | ||||||
|  | +				     char __user *user_buf, | ||||||
|  | +				     size_t count, loff_t *ppos) | ||||||
|  | +{ | ||||||
|  | +	const char buf[] = | ||||||
|  | +		"This is to set fixed bcast, mcast, and beacon rates.  Normal rate-ctrl\n" | ||||||
|  | +		"is handled through normal API using 'iw', etc.\n" | ||||||
|  | +		"To set a value, you specify the dev-name, type, band and rate-code:\n" | ||||||
|  | +		"types: bcast, mcast, beacon, mgmt\n" | ||||||
|  | +		"bands: 2, 5\n" | ||||||
|  | +		"rate-codes: 1M (0x10000103), 2M (0x10000102), 5.5M (0x10000101),\n 11M (0x10000100), 6M (0x10000003),9M (0x10000007),\n 12M (0x10000002), 18M (0x10000006),\n 24M (0x10000001), 36M (0x10000005), 48M (0x10000000),\n 54M (0x10000004) , 0xFF default\n" | ||||||
|  | +		"Example, set beacon to 18Mbps on wlan0(2.4G):\n  echo \"wlan0 beacon 2 0x10000006\" > /sys/kernel/debug/ieee80211/phy0/ath11k/set_rates\n"; | ||||||
|  | + | ||||||
|  | +	return simple_read_from_buffer(user_buf, count, ppos, buf, strlen(buf)); | ||||||
|  | +} | ||||||
|  | + | ||||||
|  | +bool check_band_rate_compat(struct ath11k *ar, long rc, int band) | ||||||
|  | +{ | ||||||
|  | +	struct ieee80211_supported_band *sband = NULL; | ||||||
|  | +	int br, i = 0; | ||||||
|  | +	long rcode = 0; | ||||||
|  | + | ||||||
|  | +	sband = ar->hw->wiphy->bands[band]; | ||||||
|  | +	if (sband == NULL) { | ||||||
|  | +		ath11k_err(ar->ab, "band not valid\n"); | ||||||
|  | +		return false; | ||||||
|  | +	} | ||||||
|  | + | ||||||
|  | +	for (i = 0; i < sband->n_bitrates; i++) { | ||||||
|  | +		br = sband->bitrates[i].bitrate; | ||||||
|  | +		rcode = ath11k_mac_get_rate_hw_value(sband->bitrates[i].bitrate); | ||||||
|  | +		if (rcode == rc){ | ||||||
|  | +			return true; | ||||||
|  | +		} | ||||||
|  | +	} | ||||||
|  | +	ath11k_err(ar->ab, "rate-code not found rc=%ld(0x%lx)", rc, rc); | ||||||
|  | +	return false; | ||||||
|  | +} | ||||||
|  | + | ||||||
|  | +/* Set the rates for specific types of traffic. */ | ||||||
|  | +static ssize_t ath11k_write_set_rates(struct file *file, | ||||||
|  | +				      const char __user *user_buf, | ||||||
|  | +				      size_t count, loff_t *ppos) | ||||||
|  | +{ | ||||||
|  | +	struct ath11k *ar = file->private_data; | ||||||
|  | +	char buf[80]; | ||||||
|  | +	int ret; | ||||||
|  | +	struct ath11k_vif *arvif; | ||||||
|  | +	struct ieee80211_vif *vif; | ||||||
|  | +	unsigned int vdev_id = 0xFFFF; | ||||||
|  | +	char* bufptr = buf; | ||||||
|  | +	long rc; | ||||||
|  | +	int cfg_band; | ||||||
|  | +	struct cfg80211_chan_def def; | ||||||
|  | +	char dev_name_match[IFNAMSIZ + 2]; | ||||||
|  | +	struct wireless_dev *wdev; | ||||||
|  | +	int set_rate_type; | ||||||
|  | + | ||||||
|  | +	memset(buf, 0, sizeof(buf)); | ||||||
|  | + | ||||||
|  | +	simple_write_to_buffer(buf, sizeof(buf) - 1, ppos, user_buf, count); | ||||||
|  | + | ||||||
|  | +	/* make sure that buf is null terminated */ | ||||||
|  | +	buf[sizeof(buf) - 1] = 0; | ||||||
|  | + | ||||||
|  | +	/* drop the possible '\n' from the end */ | ||||||
|  | +	if (buf[count - 1] == '\n') | ||||||
|  | +		buf[count - 1] = 0; | ||||||
|  | + | ||||||
|  | +	mutex_lock(&ar->conf_mutex); | ||||||
|  | + | ||||||
|  | +	/* Ignore empty lines, 'echo' appends them sometimes at least. */ | ||||||
|  | +	if (buf[0] == 0) { | ||||||
|  | +		ret = count; | ||||||
|  | +		goto exit; | ||||||
|  | +	} | ||||||
|  | + | ||||||
|  | +	/* String starts with vdev name, ie 'wlan0'  Find the proper vif that | ||||||
|  | +	 * matches the name. | ||||||
|  | +	 */ | ||||||
|  | +	list_for_each_entry(arvif, &ar->arvifs, list) { | ||||||
|  | +		vif = arvif->vif; | ||||||
|  | +		wdev = ieee80211_vif_to_wdev(vif); | ||||||
|  | + | ||||||
|  | +		if (!wdev) | ||||||
|  | +			continue; | ||||||
|  | +		snprintf(dev_name_match, sizeof(dev_name_match) - 1, "%s ", | ||||||
|  | +			 wdev->netdev->name); | ||||||
|  | +		if (strncmp(dev_name_match, buf, strlen(dev_name_match)) == 0) { | ||||||
|  | +			vdev_id = arvif->vdev_id; | ||||||
|  | +			bufptr = buf + strlen(dev_name_match); | ||||||
|  | +			break; | ||||||
|  | +		} | ||||||
|  | +	} | ||||||
|  | + | ||||||
|  | +	if (vdev_id == 0xFFFF) { | ||||||
|  | +		ath11k_warn(ar->ab, "set-rate, unknown netdev name: %s\n", buf); | ||||||
|  | +		ret = -EINVAL; | ||||||
|  | +		goto exit; | ||||||
|  | +	} | ||||||
|  | + | ||||||
|  | +	/* Now, check the type. */ | ||||||
|  | +	if (strncmp(bufptr, "beacon ", strlen("beacon ")) == 0) { | ||||||
|  | +		set_rate_type = WMI_VDEV_PARAM_BEACON_RATE; | ||||||
|  | +		bufptr += strlen("beacon "); | ||||||
|  | +	} | ||||||
|  | +	else if (strncmp(bufptr, "mgmt ", strlen("mgmt ")) == 0) { | ||||||
|  | +		set_rate_type = WMI_VDEV_PARAM_MGMT_RATE; | ||||||
|  | +		bufptr += strlen("mgmt "); | ||||||
|  | +	} | ||||||
|  | +	else if (strncmp(bufptr, "bcast ", strlen("bcast ")) == 0) { | ||||||
|  | +		set_rate_type = WMI_VDEV_PARAM_BCAST_DATA_RATE; | ||||||
|  | +		bufptr += strlen("bcast "); | ||||||
|  | +	} | ||||||
|  | +	else if (strncmp(bufptr, "mcast ", strlen("mcast ")) == 0) { | ||||||
|  | +		set_rate_type = WMI_VDEV_PARAM_MCAST_DATA_RATE; | ||||||
|  | +		bufptr += strlen("mcast "); | ||||||
|  | +	} | ||||||
|  | +	else { | ||||||
|  | +		ath11k_warn(ar->ab, "set-rate, invalid rate type: %s\n", | ||||||
|  | +			    bufptr); | ||||||
|  | +		ret = -EINVAL; | ||||||
|  | +		goto exit; | ||||||
|  | +	} | ||||||
|  | + | ||||||
|  | +	/* And the band */ | ||||||
|  | +	if (strncmp(bufptr, "2 ", 2) == 0) { | ||||||
|  | +		cfg_band = NL80211_BAND_2GHZ; | ||||||
|  | +		bufptr += 2; | ||||||
|  | +	} | ||||||
|  | +	else if (strncmp(bufptr, "5 ", 2) == 0) { | ||||||
|  | +		cfg_band = NL80211_BAND_5GHZ; | ||||||
|  | +		bufptr += 2; | ||||||
|  | +	} | ||||||
|  | +	else if (strncmp(bufptr, "60 ", 3) == 0) { | ||||||
|  | +		cfg_band = NL80211_BAND_60GHZ; | ||||||
|  | +		bufptr += 3; | ||||||
|  | +	} | ||||||
|  | +	else { | ||||||
|  | +		ath11k_warn(ar->ab, "set-rate, invalid band: %s\n", | ||||||
|  | +			    bufptr); | ||||||
|  | +		ret = -EINVAL; | ||||||
|  | +		goto exit; | ||||||
|  | +	} | ||||||
|  | + | ||||||
|  | +	/* Parse the rate-code. */ | ||||||
|  | +	ret = kstrtol(bufptr, 0, &rc); | ||||||
|  | +	if (ret != 0) { | ||||||
|  | +		ath11k_warn(ar->ab, "set-rate, invalid rate-code: %s\n", | ||||||
|  | +			    bufptr); | ||||||
|  | +		goto exit; | ||||||
|  | +	} | ||||||
|  | + | ||||||
|  | +	/* Store the value so we can re-apply it if firmware is restarted. */ | ||||||
|  | +	if (set_rate_type == WMI_VDEV_PARAM_MGMT_RATE) { | ||||||
|  | +		arvif->mgt_rate[cfg_band] = rc; | ||||||
|  | +		arvif->mgt_rate_set[cfg_band] = true; | ||||||
|  | +	} | ||||||
|  | +	else if (set_rate_type == WMI_VDEV_PARAM_BCAST_DATA_RATE) { | ||||||
|  | +		arvif->bcast_rate[cfg_band] = rc; | ||||||
|  | +		arvif->bcast_rate_set[cfg_band] = true; | ||||||
|  | +	} | ||||||
|  | +	else if (set_rate_type == WMI_VDEV_PARAM_MCAST_DATA_RATE) { | ||||||
|  | +		arvif->mcast_rate[cfg_band] = rc; | ||||||
|  | +		arvif->mcast_rate_set[cfg_band] = true; | ||||||
|  | +	} | ||||||
|  | +	else if (set_rate_type == WMI_VDEV_PARAM_BEACON_RATE) { | ||||||
|  | +		arvif->bcn_rate[cfg_band] = rc; | ||||||
|  | +		arvif->bcn_rate_set[cfg_band] = true; | ||||||
|  | +	} | ||||||
|  | + | ||||||
|  | +	if (ar->state != ATH11K_STATE_ON && | ||||||
|  | +	    ar->state != ATH11K_STATE_RESTARTED) { | ||||||
|  | +		/* OK, we will set it when vdev comes up */ | ||||||
|  | +		ath11k_warn(ar->ab, "set-rates, deferred-state is down, vdev %i type: 0x%x rc: 0x%lx band: %d\n", | ||||||
|  | +			    arvif->vdev_id, set_rate_type, rc, cfg_band); | ||||||
|  | +		goto exit; | ||||||
|  | +	} | ||||||
|  | + | ||||||
|  | +	if (ath11k_mac_vif_chan(vif, &def) == 0) { | ||||||
|  | +		if (def.chan->band != cfg_band) { | ||||||
|  | +			/* We stored value, will apply it later if we move to | ||||||
|  | +			 * the different band. | ||||||
|  | +			 */ | ||||||
|  | +			ath11k_warn(ar->ab, "set-rates, deferred-other-band, vdev %i type: 0x%x rc: 0x%lx band: %d\n", | ||||||
|  | +				    arvif->vdev_id, set_rate_type, | ||||||
|  | +				    rc, cfg_band); | ||||||
|  | +			goto exit; | ||||||
|  | +		} | ||||||
|  | + | ||||||
|  | +		if (check_band_rate_compat(ar, rc, def.chan->band) == false) { | ||||||
|  | +			ath11k_warn(ar->ab, "set-rate, wrong rate code\n"); | ||||||
|  | +			ret = -EINVAL; | ||||||
|  | +			goto exit; | ||||||
|  | +		} | ||||||
|  | +	} | ||||||
|  | + | ||||||
|  | +	/* finally, send results to the firmware */ | ||||||
|  | +	ret = ath11k_wmi_vdev_set_param_cmd(ar, arvif->vdev_id, | ||||||
|  | +					    set_rate_type, rc); | ||||||
|  | +	if (ret) { | ||||||
|  | +		ath11k_warn(ar->ab, "set-rates: vdev %i failed to set fixed rate, param 0x%x rate-code 0x%02lx\n", | ||||||
|  | +			    arvif->vdev_id, set_rate_type, rc); | ||||||
|  | +		goto exit; | ||||||
|  | +	} | ||||||
|  | + | ||||||
|  | +	ath11k_warn(ar->ab, "set-rates, vdev %i type: 0x%x rc: 0x%lx band: %d\n", | ||||||
|  | +		    arvif->vdev_id, set_rate_type, rc, cfg_band); | ||||||
|  | + | ||||||
|  | +	ret = count; | ||||||
|  | + | ||||||
|  | +exit: | ||||||
|  | +	mutex_unlock(&ar->conf_mutex); | ||||||
|  | +	return ret; | ||||||
|  | +} | ||||||
|  | + | ||||||
|  | +static const struct file_operations fops_set_rates = { | ||||||
|  | +	.read = ath11k_read_set_rates, | ||||||
|  | +	.write = ath11k_write_set_rates, | ||||||
|  | +	.open = simple_open, | ||||||
|  | +	.owner = THIS_MODULE, | ||||||
|  | +	.llseek = default_llseek, | ||||||
|  | +}; | ||||||
|  | + | ||||||
|  |  static ssize_t ath11k_write_enable_m3_dump(struct file *file, | ||||||
|  |  					   const char __user *ubuf, | ||||||
|  |  					   size_t count, loff_t *ppos) | ||||||
|  | @@ -2532,6 +2756,9 @@ int ath11k_debug_register(struct ath11k | ||||||
|  |  	                    &fops__btcoex_duty_cycle); | ||||||
|  |  	debugfs_create_file("dump_mgmt_stats", 0644, ar->debug.debugfs_pdev, | ||||||
|  |  			    ar, &fops_dump_mgmt_stats); | ||||||
|  | +	debugfs_create_file("set_rates", 0600, ar->debug.debugfs_pdev, | ||||||
|  | +			    ar, &fops_set_rates); | ||||||
|  | + | ||||||
|  |   | ||||||
|  |  	if (ar->hw->wiphy->bands[NL80211_BAND_5GHZ]) { | ||||||
|  |  		debugfs_create_file("dfs_simulate_radar", 0200, | ||||||
|  | Index: backports-20200902_001-4.4.60-931c337125/drivers/net/wireless/ath/ath11k/mac.c | ||||||
|  | =================================================================== | ||||||
|  | --- backports-20200902_001-4.4.60-931c337125.orig/drivers/net/wireless/ath/ath11k/mac.c | ||||||
|  | +++ backports-20200902_001-4.4.60-931c337125/drivers/net/wireless/ath/ath11k/mac.c | ||||||
|  | @@ -414,8 +414,8 @@ static u8 ath11k_parse_mpdudensity(u8 mp | ||||||
|  |  	} | ||||||
|  |  } | ||||||
|  |   | ||||||
|  | -static int ath11k_mac_vif_chan(struct ieee80211_vif *vif, | ||||||
|  | -			       struct cfg80211_chan_def *def) | ||||||
|  | +int ath11k_mac_vif_chan(struct ieee80211_vif *vif, | ||||||
|  | +			struct cfg80211_chan_def *def) | ||||||
|  |  { | ||||||
|  |  	struct ieee80211_chanctx_conf *conf; | ||||||
|  |   | ||||||
|  | @@ -2633,7 +2633,7 @@ static void ath11k_bss_disassoc(struct i | ||||||
|  |  	/* TODO: cancel connection_loss_work */ | ||||||
|  |  } | ||||||
|  |   | ||||||
|  | -static u32 ath11k_mac_get_rate_hw_value(int bitrate) | ||||||
|  | +u32 ath11k_mac_get_rate_hw_value(int bitrate) | ||||||
|  |  { | ||||||
|  |  	u32 preamble; | ||||||
|  |  	u16 hw_value; | ||||||
|  | @@ -2672,6 +2672,11 @@ static void ath11k_recalculate_mgmt_rate | ||||||
|  |   | ||||||
|  |  	lockdep_assert_held(&ar->conf_mutex); | ||||||
|  |   | ||||||
|  | +	/* If user has over-ridden the mgt rate, don't muck with it here. */ | ||||||
|  | +	if (arvif->mgt_rate_set[def->chan->band] || | ||||||
|  | +	    arvif->bcn_rate_set[def->chan->band]) | ||||||
|  | +		return; | ||||||
|  | + | ||||||
|  |  	sband = ar->hw->wiphy->bands[def->chan->band]; | ||||||
|  |  	basic_rate_idx = ffs(vif->bss_conf.basic_rates) - 1; | ||||||
|  |  	bitrate = sband->bitrates[basic_rate_idx].bitrate; | ||||||
|  | @@ -2682,12 +2687,14 @@ static void ath11k_recalculate_mgmt_rate | ||||||
|  |  		return; | ||||||
|  |  	} | ||||||
|  |   | ||||||
|  | +	arvif->mgt_rate[def->chan->band] = hw_rate_code; | ||||||
|  |  	vdev_param = WMI_VDEV_PARAM_MGMT_RATE; | ||||||
|  |  	ret = ath11k_wmi_vdev_set_param_cmd(ar, arvif->vdev_id, vdev_param, | ||||||
|  |  					    hw_rate_code); | ||||||
|  |  	if (ret) | ||||||
|  |  		ath11k_warn(ar->ab, "failed to set mgmt tx rate %d\n", ret); | ||||||
|  |   | ||||||
|  | +	arvif->bcn_rate[def->chan->band] = hw_rate_code; | ||||||
|  |  	vdev_param = WMI_VDEV_PARAM_BEACON_RATE; | ||||||
|  |  	ret = ath11k_wmi_vdev_set_param_cmd(ar, arvif->vdev_id, vdev_param, | ||||||
|  |  					    hw_rate_code); | ||||||
|  | @@ -3116,17 +3123,23 @@ static void ath11k_mac_op_bss_info_chang | ||||||
|  |  		rate = ATH11K_HW_RATE_CODE(hw_value, 0, preamble); | ||||||
|  |   | ||||||
|  |  		ath11k_dbg(ar->ab, ATH11K_DBG_MAC, | ||||||
|  | -			   "mac vdev %d mcast_rate %x\n", | ||||||
|  | -			   arvif->vdev_id, rate); | ||||||
|  | - | ||||||
|  | -		vdev_param = WMI_VDEV_PARAM_MCAST_DATA_RATE; | ||||||
|  | -		ret = ath11k_wmi_vdev_set_param_cmd(ar, arvif->vdev_id, | ||||||
|  | -						    vdev_param, rate); | ||||||
|  | -		if (ret) | ||||||
|  | -			ath11k_warn(ar->ab, | ||||||
|  | -				    "failed to set mcast rate on vdev %i: %d\n", | ||||||
|  | -				    arvif->vdev_id,  ret); | ||||||
|  | +			   "mac vdev %d mcast_rate %x  override-set-mcast: %d  override-set-bcast: %d\n", | ||||||
|  | +			   arvif->vdev_id, rate, arvif->mcast_rate_set[band], | ||||||
|  | +			   arvif->bcast_rate_set[band]); | ||||||
|  | + | ||||||
|  | +		if (!arvif->mcast_rate_set[band]) { | ||||||
|  | +			arvif->mcast_rate[band] = rate; | ||||||
|  | +			vdev_param = WMI_VDEV_PARAM_MCAST_DATA_RATE; | ||||||
|  | +			ret = ath11k_wmi_vdev_set_param_cmd(ar, arvif->vdev_id, | ||||||
|  | +							    vdev_param, rate); | ||||||
|  | +			if (ret) | ||||||
|  | +				ath11k_warn(ar->ab, | ||||||
|  | +					    "failed to set mcast rate on vdev %i: %d\n", | ||||||
|  | +					    arvif->vdev_id,  ret); | ||||||
|  | +		} | ||||||
|  |   | ||||||
|  | +		if (!arvif->bcast_rate_set[band]) { | ||||||
|  | +			arvif->bcast_rate[band] = rate; | ||||||
|  |  		vdev_param = WMI_VDEV_PARAM_BCAST_DATA_RATE; | ||||||
|  |  		ret = ath11k_wmi_vdev_set_param_cmd(ar, arvif->vdev_id, | ||||||
|  |  						    vdev_param, rate); | ||||||
|  | @@ -3134,6 +3147,7 @@ static void ath11k_mac_op_bss_info_chang | ||||||
|  |  			ath11k_warn(ar->ab, | ||||||
|  |  				    "failed to set bcast rate on vdev %i: %d\n", | ||||||
|  |  				    arvif->vdev_id,  ret); | ||||||
|  | +		} | ||||||
|  |  	} | ||||||
|  |   | ||||||
|  |  	if (changed & BSS_CHANGED_BASIC_RATES && | ||||||
|  | @@ -5832,6 +5846,12 @@ static int ath11k_mac_op_add_interface(s | ||||||
|  |   | ||||||
|  |  	memset(arvif, 0, sizeof(*arvif)); | ||||||
|  |   | ||||||
|  | +	memset(&arvif->bcast_rate, WMI_FIXED_RATE_NONE, | ||||||
|  | +	       sizeof(arvif->bcast_rate)); | ||||||
|  | +	memset(&arvif->mcast_rate, WMI_FIXED_RATE_NONE, | ||||||
|  | +	       sizeof(arvif->mcast_rate)); | ||||||
|  | +	memset(&arvif->mgt_rate, WMI_FIXED_RATE_NONE, sizeof(arvif->mgt_rate)); | ||||||
|  | + | ||||||
|  |  	arvif->ar = ar; | ||||||
|  |  	arvif->vif = vif; | ||||||
|  |   | ||||||
|  | Index: backports-20200902_001-4.4.60-931c337125/drivers/net/wireless/ath/ath11k/mac.h | ||||||
|  | =================================================================== | ||||||
|  | --- backports-20200902_001-4.4.60-931c337125.orig/drivers/net/wireless/ath/ath11k/mac.h | ||||||
|  | +++ backports-20200902_001-4.4.60-931c337125/drivers/net/wireless/ath/ath11k/mac.h | ||||||
|  | @@ -164,4 +164,8 @@ u8 ath11k_mac_bw_to_mac80211_bw(u8 bw); | ||||||
|  |  enum ath11k_supported_bw ath11k_mac_mac80211_bw_to_ath11k_bw(enum rate_info_bw bw); | ||||||
|  |  enum hal_encrypt_type ath11k_dp_tx_get_encrypt_type(u32 cipher); | ||||||
|  |  void ath11k_mac_bcn_tx_event(struct ath11k_vif *arvif); | ||||||
|  | +int ath11k_mac_vif_chan(struct ieee80211_vif *vif, | ||||||
|  | +			struct cfg80211_chan_def *def); | ||||||
|  | + | ||||||
|  | +u32 ath11k_mac_get_rate_hw_value(int bitrate); | ||||||
|  |  #endif | ||||||
|  | Index: backports-20200902_001-4.4.60-931c337125/drivers/net/wireless/ath/ath11k/core.h | ||||||
|  | =================================================================== | ||||||
|  | --- backports-20200902_001-4.4.60-931c337125.orig/drivers/net/wireless/ath/ath11k/core.h | ||||||
|  | +++ backports-20200902_001-4.4.60-931c337125/drivers/net/wireless/ath/ath11k/core.h | ||||||
|  | @@ -265,6 +265,23 @@ struct ath11k_vif { | ||||||
|  |  #ifdef CPTCFG_ATH11K_NSS_SUPPORT | ||||||
|  |  	struct arvif_nss nss; | ||||||
|  |  #endif | ||||||
|  | +	/* Firmware allows configuring rate of each of these traffic types. | ||||||
|  | +	 * 0xFF will mean value has not been set by user, and in that case, | ||||||
|  | +	 * we will auto-adjust the rates based on the legacy rate mask. | ||||||
|  | +	 **/ | ||||||
|  | +	/* TODO-BEN:  This may conflict with upstream code? */ | ||||||
|  | +	u8 mcast_rate[NUM_NL80211_BANDS]; | ||||||
|  | +	u8 bcast_rate[NUM_NL80211_BANDS]; | ||||||
|  | +	u8 mgt_rate[NUM_NL80211_BANDS]; | ||||||
|  | +	u8 bcn_rate[NUM_NL80211_BANDS]; | ||||||
|  | + | ||||||
|  | +	/* Flag if these rates are set through debugfs, in that case, ignore | ||||||
|  | +	 * setting from farther up the stack. | ||||||
|  | +	 */ | ||||||
|  | +	bool mcast_rate_set[NUM_NL80211_BANDS]; | ||||||
|  | +	bool bcast_rate_set[NUM_NL80211_BANDS]; | ||||||
|  | +	bool mgt_rate_set[NUM_NL80211_BANDS]; | ||||||
|  | +	bool bcn_rate_set[NUM_NL80211_BANDS]; | ||||||
|  |  }; | ||||||
|  |   | ||||||
|  |  struct ath11k_vif_iter { | ||||||
| @@ -0,0 +1,55 @@ | |||||||
|  | --- a/drivers/net/wireless/ath/ath11k/mac.c | ||||||
|  | +++ b/drivers/net/wireless/ath/ath11k/mac.c | ||||||
|  | @@ -4693,7 +4693,8 @@ | ||||||
|  |  } | ||||||
|  |   | ||||||
|  |  static struct ieee80211_sta_ht_cap | ||||||
|  | -ath11k_create_ht_cap(struct ath11k *ar, u32 ar_ht_cap, u32 rate_cap_rx_chainmask) | ||||||
|  | +ath11k_create_ht_cap(struct ath11k *ar, u32 ar_ht_cap, | ||||||
|  | +		     u32 rate_cap_tx_chainmask, u32 rate_cap_rx_chainmask) | ||||||
|  |  { | ||||||
|  |  	int i; | ||||||
|  |  	struct ieee80211_sta_ht_cap ht_cap = {0}; | ||||||
|  | @@ -4724,7 +4725,7 @@ | ||||||
|  |  		ht_cap.cap |= smps; | ||||||
|  |  	} | ||||||
|  |   | ||||||
|  | -	if (ar_ht_cap & WMI_HT_CAP_TX_STBC) | ||||||
|  | +	if ((ar_ht_cap & WMI_HT_CAP_TX_STBC) && (rate_cap_tx_chainmask > 1)) | ||||||
|  |  		ht_cap.cap |= IEEE80211_HT_CAP_TX_STBC; | ||||||
|  |   | ||||||
|  |  	if (ar_ht_cap & WMI_HT_CAP_RX_STBC) { | ||||||
|  | @@ -4903,6 +4904,7 @@ | ||||||
|  |  		if (ht_cap_info) | ||||||
|  |  			*ht_cap_info = ht_cap; | ||||||
|  |  		band->ht_cap = ath11k_create_ht_cap(ar, ht_cap, | ||||||
|  | +						    rate_cap_tx_chainmask, | ||||||
|  |  						    rate_cap_rx_chainmask); | ||||||
|  |   | ||||||
|  |  		band->vht_cap = ath11k_create_vht_cap(ar, rate_cap_tx_chainmask, | ||||||
|  | @@ -4915,10 +4917,25 @@ | ||||||
|  |  		if (ht_cap_info) | ||||||
|  |  			*ht_cap_info = ht_cap; | ||||||
|  |  		band->ht_cap = ath11k_create_ht_cap(ar, ht_cap, | ||||||
|  | +						    rate_cap_tx_chainmask, | ||||||
|  |  						    rate_cap_rx_chainmask); | ||||||
|  |  		band->vht_cap = ath11k_create_vht_cap(ar, rate_cap_tx_chainmask, | ||||||
|  |  						      rate_cap_rx_chainmask); | ||||||
|  |  	} | ||||||
|  | + | ||||||
|  | +	if (ar->hw->wiphy->bands[NL80211_BAND_5GHZ]) { | ||||||
|  | +		ar->hw->wiphy->bands[NL80211_BAND_5GHZ]->ht_cap.cap = | ||||||
|  | +			ar->mac.sbands[NL80211_BAND_5GHZ].ht_cap.cap; | ||||||
|  | +		ar->hw->wiphy->bands[NL80211_BAND_5GHZ]->vht_cap.cap = | ||||||
|  | +			ar->mac.sbands[NL80211_BAND_5GHZ].vht_cap.cap; | ||||||
|  | +	} | ||||||
|  | +	if (ar->hw->wiphy->bands[NL80211_BAND_2GHZ]) { | ||||||
|  | +		ar->hw->wiphy->bands[NL80211_BAND_2GHZ]->ht_cap.cap = | ||||||
|  | +			ar->mac.sbands[NL80211_BAND_2GHZ].ht_cap.cap; | ||||||
|  | +		ar->hw->wiphy->bands[NL80211_BAND_2GHZ]->vht_cap.cap = | ||||||
|  | +			ar->mac.sbands[NL80211_BAND_2GHZ].vht_cap.cap; | ||||||
|  | +	} | ||||||
|  | + | ||||||
|  |  } | ||||||
|  |   | ||||||
|  |  static int ath11k_check_chain_mask(struct ath11k *ar, u32 ant, bool is_tx_ant) | ||||||
| @@ -0,0 +1,22 @@ | |||||||
|  | diff -Naur a/drivers/net/wireless/ath/ath11k/mac.c b/drivers/net/wireless/ath/ath11k/mac.c | ||||||
|  | --- a/drivers/net/wireless/ath/ath11k/mac.c	2021-06-09 10:02:12.040840722 -0400 | ||||||
|  | +++ b/drivers/net/wireless/ath/ath11k/mac.c	2021-06-10 10:40:12.094003411 -0400 | ||||||
|  | @@ -3472,13 +3472,14 @@ | ||||||
|  |  		scan_timeout = min_t(u32, arg->max_rest_time * | ||||||
|  |  				    (arg->chan_list.num_chan - 1) + (req->duration + | ||||||
|  |  				     ATH11K_SCAN_CHANNEL_SWITCH_WMI_EVT_OVERHEAD) * | ||||||
|  | -				     arg->chan_list.num_chan, arg->max_scan_time + | ||||||
|  | -				     ATH11K_MAC_SCAN_TIMEOUT_MSECS); | ||||||
|  | +				     arg->chan_list.num_chan, arg->max_scan_time); | ||||||
|  |  	} else { | ||||||
|  | -		/* Add a 200ms margin to account for event/command processing */ | ||||||
|  | -		scan_timeout = arg->max_scan_time + ATH11K_MAC_SCAN_TIMEOUT_MSECS; | ||||||
|  | +		scan_timeout = arg->max_scan_time; | ||||||
|  |  	} | ||||||
|  |   | ||||||
|  | +	/* Add a 200ms margin to account for event/command processing */ | ||||||
|  | +	scan_timeout += ATH11K_MAC_SCAN_TIMEOUT_MSECS; | ||||||
|  | + | ||||||
|  |  	ret = ath11k_start_scan(ar, arg); | ||||||
|  |  	if (ret) { | ||||||
|  |  		ath11k_warn(ar->ab, "failed to start hw scan: %d\n", ret); | ||||||
| @@ -8,8 +8,8 @@ PKG_LICENSE_FILES:= | |||||||
|  |  | ||||||
| PKG_SOURCE_URL:=https://github.com/greearb/ath10k-ct.git | PKG_SOURCE_URL:=https://github.com/greearb/ath10k-ct.git | ||||||
| PKG_SOURCE_PROTO:=git | PKG_SOURCE_PROTO:=git | ||||||
| PKG_SOURCE_DATE:=2020-08-26 | PKG_SOURCE_DATE:=2021-05-22b | ||||||
| PKG_SOURCE_VERSION:=13319ff0b5dc3c86e8313f49fca583b829878736 | PKG_SOURCE_VERSION:=54a9ac02f1139596ea4361ebbc3e444955d86cfd | ||||||
| #PKG_MIRROR_HASH:=97cf22a4a57381c7eb7a9b8a8b1e347e9711ce51c89db971b4ab9a35af476ece | #PKG_MIRROR_HASH:=97cf22a4a57381c7eb7a9b8a8b1e347e9711ce51c89db971b4ab9a35af476ece | ||||||
|  |  | ||||||
| # Build the 5.4 ath10k-ct driver version.  Other option is "-4.19". | # Build the 5.4 ath10k-ct driver version.  Other option is "-4.19". | ||||||
|   | |||||||
| @@ -0,0 +1,22 @@ | |||||||
|  | diff -Naur a/ath10k-5.7/mac.c b/ath10k-5.7/mac.c | ||||||
|  | --- a/ath10k-5.7/mac.c	2021-06-09 16:30:17.793556032 -0400 | ||||||
|  | +++ b/ath10k-5.7/mac.c	2021-06-09 17:38:08.587733979 -0400 | ||||||
|  | @@ -7103,13 +7103,15 @@ | ||||||
|  |  		scan_timeout = min_t(u32, arg.max_rest_time * | ||||||
|  |  				(arg.n_channels - 1) + (req->duration + | ||||||
|  |  				ATH10K_SCAN_CHANNEL_SWITCH_WMI_EVT_OVERHEAD) * | ||||||
|  | -				arg.n_channels, arg.max_scan_time + 200); | ||||||
|  | +				arg.n_channels, arg.max_scan_time); | ||||||
|  |   | ||||||
|  |  	} else { | ||||||
|  | -		/* Add a 200ms margin to account for event/command processing */ | ||||||
|  | -		scan_timeout = arg.max_scan_time + 200; | ||||||
|  | +		scan_timeout = arg.max_scan_time; | ||||||
|  |  	} | ||||||
|  |   | ||||||
|  | +	/* Add a 200ms margin to account for event/command processing */ | ||||||
|  | +	scan_timeout += 200; | ||||||
|  | + | ||||||
|  |  	ret = ath10k_start_scan(ar, &arg); | ||||||
|  |  	if (ret) { | ||||||
|  |  		ath10k_warn(ar, "failed to start hw scan: %d\n", ret); | ||||||
| @@ -0,0 +1,11 @@ | |||||||
|  | --- a/ath10k-5.7/mac.c	2021-07-06 11:12:56.022146449 -0700 | ||||||
|  | +++ b/ath10k-5.7/mac.c	2021-07-06 19:37:52.352753693 -0700 | ||||||
|  | @@ -8286,7 +8286,7 @@ | ||||||
|  |  				  struct ieee80211_channel *channel) | ||||||
|  |  { | ||||||
|  |  	int ret; | ||||||
|  | -	enum wmi_bss_survey_req_type type = WMI_BSS_SURVEY_REQ_TYPE_READ_CLEAR; | ||||||
|  | +	enum wmi_bss_survey_req_type type = WMI_BSS_SURVEY_REQ_TYPE_READ; | ||||||
|  |   | ||||||
|  |  	lockdep_assert_held(&ar->conf_mutex); | ||||||
|  |   | ||||||
| @@ -0,0 +1,31 @@ | |||||||
|  | --- a/ath10k-5.7/wmi.c | ||||||
|  | +++ b/ath10k-5.7/wmi.c | ||||||
|  | @@ -6347,16 +6347,18 @@ | ||||||
|  |   | ||||||
|  |  	survey = &ar->survey[idx]; | ||||||
|  |   | ||||||
|  | -	survey->noise     = noise_floor; | ||||||
|  | -	survey->time      = div_u64(total, cc_freq_hz); | ||||||
|  | -	survey->time_busy = div_u64(busy, cc_freq_hz); | ||||||
|  | -	survey->time_rx   = div_u64(rx_bss, cc_freq_hz); | ||||||
|  | -	survey->time_tx   = div_u64(tx, cc_freq_hz); | ||||||
|  | -	survey->filled   |= (SURVEY_INFO_NOISE_DBM | | ||||||
|  | -			     SURVEY_INFO_TIME | | ||||||
|  | -			     SURVEY_INFO_TIME_BUSY | | ||||||
|  | -			     SURVEY_INFO_TIME_RX | | ||||||
|  | -			     SURVEY_INFO_TIME_TX); | ||||||
|  | +	survey->noise       = noise_floor; | ||||||
|  | +	survey->time        = div_u64(total, cc_freq_hz); | ||||||
|  | +	survey->time_busy   = div_u64(busy, cc_freq_hz); | ||||||
|  | +	survey->time_rx     = div_u64(rx, cc_freq_hz); | ||||||
|  | +	survey->time_bss_rx = div_u64(rx_bss, cc_freq_hz); | ||||||
|  | +	survey->time_tx     = div_u64(tx, cc_freq_hz); | ||||||
|  | +	survey->filled     |= (SURVEY_INFO_NOISE_DBM | | ||||||
|  | +			       SURVEY_INFO_TIME | | ||||||
|  | +			       SURVEY_INFO_TIME_BUSY | | ||||||
|  | +			       SURVEY_INFO_TIME_RX | | ||||||
|  | +			       SURVEY_INFO_TIME_TX | | ||||||
|  | +			       SURVEY_INFO_TIME_BSS_RX); | ||||||
|  |  exit: | ||||||
|  |  	spin_unlock_bh(&ar->data_lock); | ||||||
|  |  	complete(&ar->bss_survey_done); | ||||||
| @@ -47,8 +47,18 @@ hostapd_append_wpa_key_mgmt() { | |||||||
| 			[ "${ieee80211w:-0}" -gt 0 ] && append wpa_key_mgmt "WPA-${auth_type_l}-SHA256" | 			[ "${ieee80211w:-0}" -gt 0 ] && append wpa_key_mgmt "WPA-${auth_type_l}-SHA256" | ||||||
| 			[ "${ieee80211ai:-0}" -gt 0 ] && append wpa_key_mgmt "FILS-SHA256" | 			[ "${ieee80211ai:-0}" -gt 0 ] && append wpa_key_mgmt "FILS-SHA256" | ||||||
| 		;; | 		;; | ||||||
|  | 		eap-only) | ||||||
|  | 			append wpa_key_mgmt "WPA-EAP-SHA256" | ||||||
|  | 			[ "${ieee80211r:-0}" -gt 0 ] && append wpa_key_mgmt "FT-EAP" | ||||||
|  | 		;; | ||||||
|  | 		eap-transition) | ||||||
|  | 			append wpa_key_mgmt "WPA-EAP" | ||||||
|  | 			append wpa_key_mgmt "WPA-EAP-SHA256" | ||||||
|  | 			[ "${ieee80211r:-0}" -gt 0 ] && append wpa_key_mgmt "FT-EAP" | ||||||
|  | 		;; | ||||||
| 		eap192) | 		eap192) | ||||||
| 			append wpa_key_mgmt "WPA-EAP-SUITE-B-192" | 			append wpa_key_mgmt "WPA-EAP-SUITE-B-192" | ||||||
|  | 			[ "${ieee80211w:-0}" -gt 0 ] && append wpa_key_mgmt "WPA-EAP-SHA256" | ||||||
| 			[ "${ieee80211r:-0}" -gt 0 ] && append wpa_key_mgmt "FT-EAP" | 			[ "${ieee80211r:-0}" -gt 0 ] && append wpa_key_mgmt "FT-EAP" | ||||||
| 		;; | 		;; | ||||||
| 		eap-eap192) | 		eap-eap192) | ||||||
| @@ -294,15 +304,17 @@ hostapd_common_add_bss_config() { | |||||||
| 	config_add_string osu_ssid hs20_wan_metrics hs20_operating_class hs20_t_c_filename hs20_t_c_timestamp | 	config_add_string osu_ssid hs20_wan_metrics hs20_operating_class hs20_t_c_filename hs20_t_c_timestamp | ||||||
|  |  | ||||||
| 	config_add_boolean interworking internet | 	config_add_boolean interworking internet | ||||||
| 	config_add_int access_network_type asra esr uesa venue_group venue_type ipaddr_type_availability \ | 	config_add_int access_network_type asra esr uesa venue_group venue_type \ | ||||||
| 		gas_address3 | 		gas_address3 | ||||||
| 	config_add_string hessid network_auth_type \ | 	config_add_string hessid network_auth_type ipaddr_type_availability \ | ||||||
| 		anqp_3gpp_cell_net anqp_elem domain_name qos_map_set hs20_t_c_server_url | 		anqp_3gpp_cell_net anqp_elem domain_name qos_map_set hs20_t_c_server_url | ||||||
|  |  | ||||||
| 	config_add_int airtime_bss_weight airtime_bss_limit | 	config_add_int airtime_bss_weight airtime_bss_limit | ||||||
| 	config_add_int rts_threshold | 	config_add_int rts_threshold | ||||||
| 	config_add_array radius_auth_req_attr | 	config_add_array radius_auth_req_attr | ||||||
| 	config_add_array radius_acct_req_attr | 	config_add_array radius_acct_req_attr | ||||||
|  |  | ||||||
|  | 	config_add_boolean multicast_to_unicast proxy_arp | ||||||
| } | } | ||||||
|  |  | ||||||
| hostapd_set_vlan_file() { | hostapd_set_vlan_file() { | ||||||
| @@ -446,7 +458,8 @@ hostapd_set_bss_options() { | |||||||
| 		bss_load_update_period chan_util_avg_period sae_require_mfp \ | 		bss_load_update_period chan_util_avg_period sae_require_mfp \ | ||||||
| 		multi_ap multi_ap_backhaul_ssid multi_ap_backhaul_key \ | 		multi_ap multi_ap_backhaul_ssid multi_ap_backhaul_key \ | ||||||
| 		airtime_bss_weight airtime_bss_limit \ | 		airtime_bss_weight airtime_bss_limit \ | ||||||
| 		rssi_reject_assoc_rssi rssi_ignore_probe_request rts_threshold  | 		rssi_reject_assoc_rssi rssi_ignore_probe_request rts_threshold \ | ||||||
|  | 		proxy_arp multicast_to_unicast | ||||||
|  |  | ||||||
| 	set_default isolate 0 | 	set_default isolate 0 | ||||||
| 	set_default maxassoc 0 | 	set_default maxassoc 0 | ||||||
| @@ -474,6 +487,9 @@ hostapd_set_bss_options() { | |||||||
| 	set_default signal_poll_time 5 | 	set_default signal_poll_time 5 | ||||||
| 	set_default signal_drop_reason 3 | 	set_default signal_drop_reason 3 | ||||||
| 	set_default signal_strikes 3 | 	set_default signal_strikes 3 | ||||||
|  | 	set_default proxy_arp 0 | ||||||
|  | 	set_default multicast_to_unicast 0 | ||||||
|  |  | ||||||
|  |  | ||||||
| 	append bss_conf "ctrl_interface=/var/run/hostapd" | 	append bss_conf "ctrl_interface=/var/run/hostapd" | ||||||
| 	if [ "$isolate" -gt 0 ]; then | 	if [ "$isolate" -gt 0 ]; then | ||||||
| @@ -507,6 +523,9 @@ hostapd_set_bss_options() { | |||||||
| 	append bss_conf "signal_strikes=$signal_strikes" "$N" | 	append bss_conf "signal_strikes=$signal_strikes" "$N" | ||||||
| 	append bss_conf "signal_drop_reason=$signal_drop_reason" "$N" | 	append bss_conf "signal_drop_reason=$signal_drop_reason" "$N" | ||||||
|  |  | ||||||
|  | 	[ -n "$proxy_arp" ] && append bss_conf "proxy_arp=$proxy_arp" "$N" | ||||||
|  | 	[ -n "$multicast_to_unicast" ] && append bss_conf "multicast_to_unicast=$multicast_to_unicast" "$N" | ||||||
|  |  | ||||||
| 	[ "$tdls_prohibit" -gt 0 ] && append bss_conf "tdls_prohibit=$tdls_prohibit" "$N" | 	[ "$tdls_prohibit" -gt 0 ] && append bss_conf "tdls_prohibit=$tdls_prohibit" "$N" | ||||||
|  |  | ||||||
| 	[ "$wpa" -gt 0 ] && { | 	[ "$wpa" -gt 0 ] && { | ||||||
| @@ -529,11 +548,11 @@ hostapd_set_bss_options() { | |||||||
| 	} | 	} | ||||||
|  |  | ||||||
| 	case "$auth_type" in | 	case "$auth_type" in | ||||||
| 		sae|owe|eap192|eap-eap192) | 		sae|owe|eap192|eap-eap192|eap-only) | ||||||
| 			set_default ieee80211w 2 | 			set_default ieee80211w 2 | ||||||
| 			set_default sae_require_mfp 1 | 			set_default sae_require_mfp 1 | ||||||
| 		;; | 		;; | ||||||
| 		psk-sae) | 		psk-sae|eap-transition) | ||||||
| 			set_default ieee80211w 1 | 			set_default ieee80211w 1 | ||||||
| 			set_default sae_require_mfp 1 | 			set_default sae_require_mfp 1 | ||||||
| 		;; | 		;; | ||||||
| @@ -575,7 +594,7 @@ hostapd_set_bss_options() { | |||||||
| 			vlan_possible=1 | 			vlan_possible=1 | ||||||
| 			wps_possible=1 | 			wps_possible=1 | ||||||
| 		;; | 		;; | ||||||
| 		eap|eap192|eap-eap192) | 		eap|eap192|eap-eap192|eap-only|eap-transition) | ||||||
| 			json_get_vars \ | 			json_get_vars \ | ||||||
| 				auth_server auth_secret auth_port \ | 				auth_server auth_secret auth_port \ | ||||||
| 				dae_client dae_secret dae_port \ | 				dae_client dae_secret dae_port \ | ||||||
| @@ -791,7 +810,15 @@ hostapd_set_bss_options() { | |||||||
| 				json_get_vars ieee80211w_mgmt_cipher ieee80211w_max_timeout ieee80211w_retry_timeout | 				json_get_vars ieee80211w_mgmt_cipher ieee80211w_max_timeout ieee80211w_retry_timeout | ||||||
| 				append bss_conf "ieee80211w=$ieee80211w" "$N" | 				append bss_conf "ieee80211w=$ieee80211w" "$N" | ||||||
| 				[ "$ieee80211w" -gt "0" ] && { | 				[ "$ieee80211w" -gt "0" ] && { | ||||||
| 					append bss_conf "group_mgmt_cipher=${ieee80211w_mgmt_cipher:-AES-128-CMAC}" "$N" | 					case "$auth_type" in | ||||||
|  | 						eap192) | ||||||
|  | 							append bss_conf "group_mgmt_cipher=BIP-GMAC-256" "$N" | ||||||
|  | 							append bss_conf "group_cipher=GCMP-256" "$N" | ||||||
|  | 						;; | ||||||
|  | 						*) | ||||||
|  | 							append bss_conf "group_mgmt_cipher=${ieee80211w_mgmt_cipher:-AES-128-CMAC}" "$N" | ||||||
|  | 						;; | ||||||
|  | 					esac | ||||||
| 					[ -n "$ieee80211w_max_timeout" ] && \ | 					[ -n "$ieee80211w_max_timeout" ] && \ | ||||||
| 						append bss_conf "assoc_sa_query_max_timeout=$ieee80211w_max_timeout" "$N" | 						append bss_conf "assoc_sa_query_max_timeout=$ieee80211w_max_timeout" "$N" | ||||||
| 					[ -n "$ieee80211w_retry_timeout" ] && \ | 					[ -n "$ieee80211w_retry_timeout" ] && \ | ||||||
| @@ -863,15 +890,23 @@ hostapd_set_bss_options() { | |||||||
| 	set_default hs20 0 | 	set_default hs20 0 | ||||||
| 	set_default disable_dgaf $hs20 | 	set_default disable_dgaf $hs20 | ||||||
| 	set_default osen 0 | 	set_default osen 0 | ||||||
|  | 	set_default internet 0 | ||||||
|  | 	set_default asra 0 | ||||||
|  | 	set_default esr 0 | ||||||
|  | 	set_default uesa 0 | ||||||
| 	set_default anqp_domain_id 0 | 	set_default anqp_domain_id 0 | ||||||
|  | 	set_default access_network_type 0 | ||||||
|  | 	set_default venue_group 0 | ||||||
|  | 	set_default venue_type 0 | ||||||
|  | 	set_default gas_address3 0 | ||||||
| 	set_default hs20_deauth_req_timeout 60 | 	set_default hs20_deauth_req_timeout 60 | ||||||
| 	if [ "$hs20" = "1" ]; then | 	if [ "$hs20" = "1" ]; then | ||||||
| 		append bss_conf "hs20=1" "$N" | 		append bss_conf "hs20=1" "$N" | ||||||
| 		append_hs20_icons | 		append_hs20_icons | ||||||
| 		[ -n "$disable_dgaf"] && append bss_conf "disable_dgaf=$disable_dgaf" "$N" | 		[ -n "$disable_dgaf" ] && append bss_conf "disable_dgaf=$disable_dgaf" "$N" | ||||||
| 		[ -n "$osen"] && append bss_conf "osen=$osen" "$N" | 		[ -n "$osen" ] && append bss_conf "osen=$osen" "$N" | ||||||
| 		[ -n "$anqp_domain_id"] && append bss_conf "anqp_domain_id=$anqp_domain_id" "$N" | 		[ "$anqp_domain_id" -gt 0 ] && append bss_conf "anqp_domain_id=$anqp_domain_id" "$N" | ||||||
| 		[ -n "$hs20_deauth_req_timeout"] && append bss_conf "hs20_deauth_req_timeout=$hs20_deauth_req_timeout" "$N" | 		[ -n "$hs20_deauth_req_timeout" ] && append bss_conf "hs20_deauth_req_timeout=$hs20_deauth_req_timeout" "$N" | ||||||
| 		[ -n "$osu_ssid" ] && append bss_conf "osu_ssid=$osu_ssid" "$N" | 		[ -n "$osu_ssid" ] && append bss_conf "osu_ssid=$osu_ssid" "$N" | ||||||
| 		[ -n "$hs20_wan_metrics" ] && append bss_conf "hs20_wan_metrics=$hs20_wan_metrics" "$N" | 		[ -n "$hs20_wan_metrics" ] && append bss_conf "hs20_wan_metrics=$hs20_wan_metrics" "$N" | ||||||
| 		[ -n "$hs20_operating_class" ] && append bss_conf "hs20_operating_class=$hs20_operating_class" "$N" | 		[ -n "$hs20_operating_class" ] && append bss_conf "hs20_operating_class=$hs20_operating_class" "$N" | ||||||
| @@ -883,19 +918,18 @@ hostapd_set_bss_options() { | |||||||
| 		json_for_each_item append_venue_url venue_url | 		json_for_each_item append_venue_url venue_url | ||||||
| 		json_for_each_item append_nai_realm nai_realm | 		json_for_each_item append_nai_realm nai_realm | ||||||
| 		json_for_each_item append_hs20_conn_capab hs20_conn_capab | 		json_for_each_item append_hs20_conn_capab hs20_conn_capab | ||||||
| 		json_for_each_item append_hs20_oper_friendly_name hs20_oper_friendly_name |  | ||||||
| 		json_for_each_item append_osu_provider osu_provider | 		json_for_each_item append_osu_provider osu_provider | ||||||
| 		json_for_each_item append_operator_icon operator_icon | 		json_for_each_item append_operator_icon operator_icon | ||||||
| 		[ -n "$interworking" ] && append bss_conf "interworking=$interworking" "$N" | 		[ -n "$interworking" ] && append bss_conf "interworking=$interworking" "$N" | ||||||
| 		[ -n "$internet" ] && append bss_conf "internet=$internet" "$N" | 		[ "$internet" -gt 0 ] && append bss_conf "internet=$internet" "$N" | ||||||
| 		[ -n "$access_network_type" ] && append bss_conf "access_network_type=$access_network_type" "$N" | 		[ "$access_network_type" -gt 0 ] && append bss_conf "access_network_type=$access_network_type" "$N" | ||||||
| 		[ -n "$asra" ] && append bss_conf "asra=$asra" "$N" | 		[ "$asra" -gt 0 ] && append bss_conf "asra=$asra" "$N" | ||||||
| 		[ -n "$esr" ] && append bss_conf "esr=$esr" "$N" | 		[ "$esr" -gt 0 ] && append bss_conf "esr=$esr" "$N" | ||||||
| 		[ -n "$uesa" ] && append bss_conf "uesa=$uesa" "$N" | 		[ "$uesa" -gt 0 ] && append bss_conf "uesa=$uesa" "$N" | ||||||
| 		[ -n "$venue_group" ] && append bss_conf "venue_group=$venue_group" "$N" | 		[ "$venue_group" -gt 0 ] && append bss_conf "venue_group=$venue_group" "$N" | ||||||
| 		[ -n "$venue_type" ] && append bss_conf "venue_type=$venue_type" "$N" | 		[ "$venue_type" -gt 0 ] && append bss_conf "venue_type=$venue_type" "$N" | ||||||
| 		[ -n "$ipaddr_type_availability" ] && append bss_conf "ipaddr_type_availability=$ipaddr_type_availability" "$N" | 		[ -n "$ipaddr_type_availability" ] && append bss_conf "ipaddr_type_availability=$ipaddr_type_availability" "$N" | ||||||
| 		[ -n "$gas_address3" ] && append bss_conf "gas_address3=$gas_address3" "$N" | 		[ "$gas_address3" -gt 0 ] && append bss_conf "gas_address3=$gas_address3" "$N" | ||||||
| 		[ -n "$hessid" ] && append bss_conf "hessid=$hessid" "$N" | 		[ -n "$hessid" ] && append bss_conf "hessid=$hessid" "$N" | ||||||
| 		[ -n "$network_auth_type" ] && append bss_conf "network_auth_type=$network_auth_type" "$N" | 		[ -n "$network_auth_type" ] && append bss_conf "network_auth_type=$network_auth_type" "$N" | ||||||
| 		[ -n "$anqp_3gpp_cell_net" ] && append bss_conf "anqp_3gpp_cell_net=$anqp_3gpp_cell_net" "$N" | 		[ -n "$anqp_3gpp_cell_net" ] && append bss_conf "anqp_3gpp_cell_net=$anqp_3gpp_cell_net" "$N" | ||||||
|   | |||||||
| @@ -1,7 +1,5 @@ | |||||||
| Index: hostapd-2020-06-08-5a8b3662/src/ap/dfs.c | --- a/src/ap/dfs.c | ||||||
| =================================================================== | +++ b/src/ap/dfs.c | ||||||
| --- hostapd-2020-06-08-5a8b3662.orig/src/ap/dfs.c |  | ||||||
| +++ hostapd-2020-06-08-5a8b3662/src/ap/dfs.c |  | ||||||
| @@ -18,7 +18,7 @@ | @@ -18,7 +18,7 @@ | ||||||
|  #include "drivers/driver.h" |  #include "drivers/driver.h" | ||||||
|  #include "dfs.h" |  #include "dfs.h" | ||||||
| @@ -23,10 +21,8 @@ Index: hostapd-2020-06-08-5a8b3662/src/ap/dfs.c | |||||||
|  	if (err) { |  	if (err) { | ||||||
|  		wpa_printf(MSG_WARNING, "DFS failed to schedule CSA (%d) - trying fallback", |  		wpa_printf(MSG_WARNING, "DFS failed to schedule CSA (%d) - trying fallback", | ||||||
|  			   err); |  			   err); | ||||||
| Index: hostapd-2020-06-08-5a8b3662/src/ap/ubus.c | --- a/src/ap/ubus.c | ||||||
| =================================================================== | +++ b/src/ap/ubus.c | ||||||
| --- hostapd-2020-06-08-5a8b3662.orig/src/ap/ubus.c |  | ||||||
| +++ hostapd-2020-06-08-5a8b3662/src/ap/ubus.c |  | ||||||
| @@ -29,6 +29,8 @@ static int ctx_ref; | @@ -29,6 +29,8 @@ static int ctx_ref; | ||||||
|  static char** bss_lst = NULL; |  static char** bss_lst = NULL; | ||||||
|  static size_t bss_nr = 0; |  static size_t bss_nr = 0; | ||||||
| @@ -36,7 +32,7 @@ Index: hostapd-2020-06-08-5a8b3662/src/ap/ubus.c | |||||||
|  static inline struct hapd_interfaces *get_hapd_interfaces_from_object(struct ubus_object *obj) |  static inline struct hapd_interfaces *get_hapd_interfaces_from_object(struct ubus_object *obj) | ||||||
|  { |  { | ||||||
|  	return container_of(obj, struct hapd_interfaces, ubus); |  	return container_of(obj, struct hapd_interfaces, ubus); | ||||||
| @@ -714,6 +716,43 @@ static int hostapd_sessions(struct ubus_ | @@ -714,6 +716,44 @@ static int hostapd_sessions(struct ubus_ | ||||||
|  	return 0; |  	return 0; | ||||||
|  } |  } | ||||||
|   |   | ||||||
| @@ -48,7 +44,7 @@ Index: hostapd-2020-06-08-5a8b3662/src/ap/ubus.c | |||||||
| +{ | +{ | ||||||
| +	void *a = NULL; | +	void *a = NULL; | ||||||
| +	void *t = NULL; | +	void *t = NULL; | ||||||
| +	struct hostapd_chan_event_list *entry; | +	struct hostapd_chan_event_list *entry, *tmp; | ||||||
| + | + | ||||||
| +	blob_buf_init(&b_ev, 0); | +	blob_buf_init(&b_ev, 0); | ||||||
| +	a = blobmsg_open_table(&b_ev, "chan_switch_event"); | +	a = blobmsg_open_table(&b_ev, "chan_switch_event"); | ||||||
| @@ -68,9 +64,10 @@ Index: hostapd-2020-06-08-5a8b3662/src/ap/ubus.c | |||||||
| +	/*delete list*/ | +	/*delete list*/ | ||||||
| + | + | ||||||
| +	if (!list_empty(&chan_events)) { | +	if (!list_empty(&chan_events)) { | ||||||
| +	list_for_each_entry(entry, &chan_events, list) | +	list_for_each_entry_safe(entry, tmp, &chan_events, list) | ||||||
| +		{ | +		{ | ||||||
| +			list_del(&entry->list); | +			list_del(&entry->list); | ||||||
|  | +			free(entry); | ||||||
| +		} | +		} | ||||||
| +	} | +	} | ||||||
| + | + | ||||||
| @@ -80,7 +77,7 @@ Index: hostapd-2020-06-08-5a8b3662/src/ap/ubus.c | |||||||
|  static int |  static int | ||||||
|  hostapd_switch_chan(struct ubus_context *ctx, struct ubus_object *obj, |  hostapd_switch_chan(struct ubus_context *ctx, struct ubus_object *obj, | ||||||
|  		    struct ubus_request_data *req, const char *method, |  		    struct ubus_request_data *req, const char *method, | ||||||
| @@ -749,6 +788,9 @@ hostapd_switch_chan(struct ubus_context | @@ -749,6 +789,9 @@ hostapd_switch_chan(struct ubus_context | ||||||
|   |   | ||||||
|  	if (hostapd_switch_channel(hapd, &css) != 0) |  	if (hostapd_switch_channel(hapd, &css) != 0) | ||||||
|  		return UBUS_STATUS_NOT_SUPPORTED; |  		return UBUS_STATUS_NOT_SUPPORTED; | ||||||
| @@ -90,7 +87,7 @@ Index: hostapd-2020-06-08-5a8b3662/src/ap/ubus.c | |||||||
|  	return UBUS_STATUS_OK; |  	return UBUS_STATUS_OK; | ||||||
|  #undef SET_CSA_SETTING |  #undef SET_CSA_SETTING | ||||||
|  } |  } | ||||||
| @@ -1444,6 +1486,7 @@ static const struct ubus_method daemon_m | @@ -1444,6 +1487,7 @@ static const struct ubus_method daemon_m | ||||||
|  	UBUS_METHOD("config_add", hostapd_config_add, config_add_policy), |  	UBUS_METHOD("config_add", hostapd_config_add, config_add_policy), | ||||||
|  	UBUS_METHOD("config_remove", hostapd_config_remove, config_remove_policy), |  	UBUS_METHOD("config_remove", hostapd_config_remove, config_remove_policy), | ||||||
|  	UBUS_METHOD_NOARG("get_bss_list", hostapd_get_bss_list), |  	UBUS_METHOD_NOARG("get_bss_list", hostapd_get_bss_list), | ||||||
| @@ -98,7 +95,7 @@ Index: hostapd-2020-06-08-5a8b3662/src/ap/ubus.c | |||||||
|  }; |  }; | ||||||
|   |   | ||||||
|  static struct ubus_object_type daemon_object_type = |  static struct ubus_object_type daemon_object_type = | ||||||
| @@ -1507,6 +1550,28 @@ ubus_event_cb(struct ubus_notify_request | @@ -1507,6 +1551,28 @@ ubus_event_cb(struct ubus_notify_request | ||||||
|  	ureq->resp = ret; |  	ureq->resp = ret; | ||||||
|  } |  } | ||||||
|   |   | ||||||
| @@ -127,10 +124,8 @@ Index: hostapd-2020-06-08-5a8b3662/src/ap/ubus.c | |||||||
|  int hostapd_ubus_handle_rt_event(struct hostapd_data *hapd, |  int hostapd_ubus_handle_rt_event(struct hostapd_data *hapd, | ||||||
|  				 struct hostapd_ubus_request *req) |  				 struct hostapd_ubus_request *req) | ||||||
|  { |  { | ||||||
| Index: hostapd-2020-06-08-5a8b3662/src/ap/ubus.h | --- a/src/ap/ubus.h | ||||||
| =================================================================== | +++ b/src/ap/ubus.h | ||||||
| --- hostapd-2020-06-08-5a8b3662.orig/src/ap/ubus.h |  | ||||||
| +++ hostapd-2020-06-08-5a8b3662/src/ap/ubus.h |  | ||||||
| @@ -17,9 +17,15 @@ enum hostapd_ubus_event_type { | @@ -17,9 +17,15 @@ enum hostapd_ubus_event_type { | ||||||
|  	HOSTAPD_UBUS_DEAUTH_REQ, |  	HOSTAPD_UBUS_DEAUTH_REQ, | ||||||
|  	HOSTAPD_UBUS_FDATA_REQ, |  	HOSTAPD_UBUS_FDATA_REQ, | ||||||
| @@ -140,8 +135,8 @@ Index: hostapd-2020-06-08-5a8b3662/src/ap/ubus.h | |||||||
|  }; |  }; | ||||||
|   |   | ||||||
| +enum hostapd_ubus_chan_event_reason { | +enum hostapd_ubus_chan_event_reason { | ||||||
| +	HOSTAPD_UBUS_HIGH_INTERFERENCE, | +	HOSTAPD_UBUS_DFS_SWITCH, | ||||||
| +	HOSTAPD_UBUS_DFS_SWITCH | +	HOSTAPD_UBUS_HIGH_INTERFERENCE | ||||||
| +}; | +}; | ||||||
| + | + | ||||||
|  struct hostapd_ubus_request { |  struct hostapd_ubus_request { | ||||||
|   | |||||||
| @@ -0,0 +1,23 @@ | |||||||
|  | --- a/src/ap/ubus.c | ||||||
|  | +++ b/src/ap/ubus.c | ||||||
|  | @@ -762,6 +762,7 @@ hostapd_switch_chan(struct ubus_context | ||||||
|  |  	struct blob_attr *tb[__CSA_MAX]; | ||||||
|  |  	struct hostapd_data *hapd = get_hapd_from_object(obj); | ||||||
|  |  	struct csa_settings css; | ||||||
|  | +	int i; | ||||||
|  |   | ||||||
|  |  	blobmsg_parse(csa_policy, __CSA_MAX, tb, blob_data(msg), blob_len(msg)); | ||||||
|  |   | ||||||
|  | @@ -787,8 +788,10 @@ hostapd_switch_chan(struct ubus_context | ||||||
|  |  	SET_CSA_SETTING(CSA_BLOCK_TX, block_tx, bool); | ||||||
|  |   | ||||||
|  |   | ||||||
|  | -	if (hostapd_switch_channel(hapd, &css) != 0) | ||||||
|  | -		return UBUS_STATUS_NOT_SUPPORTED; | ||||||
|  | +	for (i = 0; i < hapd->iface->num_bss; i++) { | ||||||
|  | +		if (hostapd_switch_channel(hapd->iface->bss[i], &css) != 0) | ||||||
|  | +			return UBUS_STATUS_NOT_SUPPORTED; | ||||||
|  | +	} | ||||||
|  |   | ||||||
|  |  	hostapd_ubus_handle_channel_switch_event(hapd->iface,HOSTAPD_UBUS_HIGH_INTERFERENCE,  css.freq_params.freq); | ||||||
|  |   | ||||||
| @@ -0,0 +1,28 @@ | |||||||
|  | Index: hostapd-2020-06-08-5a8b3662/src/ap/ieee802_11.c | ||||||
|  | =================================================================== | ||||||
|  | --- hostapd-2020-06-08-5a8b3662.orig/src/ap/ieee802_11.c | ||||||
|  | +++ hostapd-2020-06-08-5a8b3662/src/ap/ieee802_11.c | ||||||
|  | @@ -3675,6 +3675,13 @@ static int add_associated_sta(struct hos | ||||||
|  |  	 * drivers to accept the STA parameter configuration. Since this is | ||||||
|  |  	 * after a new FT-over-DS exchange, a new TK has been derived, so key | ||||||
|  |  	 * reinstallation is not a concern for this case. | ||||||
|  | +	 * | ||||||
|  | +	 * If the STA was associated and authorized earlier, but came for a new | ||||||
|  | +	 * connection (!added_unassoc + !reassoc), remove the existing STA entry | ||||||
|  | +	 * so that it can be re-added. This case is rarely seen when the AP could | ||||||
|  | +	 * not receive the deauth/disassoc frame from the STA. And the STA comes | ||||||
|  | +	 * back with new connection within a short period or before the inactive | ||||||
|  | +	 * STA entry is removed from the list. | ||||||
|  |  	 */ | ||||||
|  |  	wpa_printf(MSG_DEBUG, "Add associated STA " MACSTR | ||||||
|  |  		   " (added_unassoc=%d auth_alg=%u ft_over_ds=%u reassoc=%d authorized=%d ft_tk=%d fils_tk=%d)", | ||||||
|  | @@ -3688,7 +3695,8 @@ static int add_associated_sta(struct hos | ||||||
|  |  	    (!(sta->flags & WLAN_STA_AUTHORIZED) || | ||||||
|  |  	     (reassoc && sta->ft_over_ds && sta->auth_alg == WLAN_AUTH_FT) || | ||||||
|  |  	     (!wpa_auth_sta_ft_tk_already_set(sta->wpa_sm) && | ||||||
|  | -	      !wpa_auth_sta_fils_tk_already_set(sta->wpa_sm)))) { | ||||||
|  | +	      !wpa_auth_sta_fils_tk_already_set(sta->wpa_sm)) || | ||||||
|  | +	     (!reassoc && (sta->flags & WLAN_STA_AUTHORIZED)))) { | ||||||
|  |  		hostapd_drv_sta_remove(hapd, sta->addr); | ||||||
|  |  		wpa_auth_sm_event(sta->wpa_sm, WPA_DRV_STA_REMOVED); | ||||||
|  |  		set = 0; | ||||||
							
								
								
									
										32
									
								
								feeds/wifi-trunk/hostapd/patches/904-fix-ubus-assoc.patch
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										32
									
								
								feeds/wifi-trunk/hostapd/patches/904-fix-ubus-assoc.patch
									
									
									
									
									
										Normal file
									
								
							| @@ -0,0 +1,32 @@ | |||||||
|  | --- a/src/ap/ieee802_11.c | ||||||
|  | +++ b/src/ap/ieee802_11.c | ||||||
|  | @@ -4463,6 +4463,14 @@ static void handle_assoc(struct hostapd_ | ||||||
|  |  			ieee802_11_set_beacons(hapd->iface); | ||||||
|  |  	} | ||||||
|  |   | ||||||
|  | +	ubus_resp = hostapd_ubus_handle_event(hapd, &req); | ||||||
|  | +	if (ubus_resp) { | ||||||
|  | +		wpa_printf(MSG_DEBUG, "Station " MACSTR " assoc rejected by ubus handler.\n", | ||||||
|  | +		       MAC2STR(mgmt->sa)); | ||||||
|  | +		resp = ubus_resp > 0 ? (u16) ubus_resp : WLAN_STATUS_UNSPECIFIED_FAILURE; | ||||||
|  | +		goto fail; | ||||||
|  | +	} | ||||||
|  | + | ||||||
|  |  	update_ht_state(hapd, sta); | ||||||
|  |   | ||||||
|  |  	hostapd_logger(hapd, sta->addr, HOSTAPD_MODULE_IEEE80211, | ||||||
|  | @@ -4568,14 +4576,6 @@ static void handle_assoc(struct hostapd_ | ||||||
|  |  					    pos, left, rssi, omit_rsnxe); | ||||||
|  |  	os_free(tmp); | ||||||
|  |   | ||||||
|  | -	ubus_resp = hostapd_ubus_handle_event(hapd, &req); | ||||||
|  | -	if (ubus_resp) { | ||||||
|  | -		wpa_printf(MSG_DEBUG, "Station " MACSTR " assoc rejected by ubus handler.\n", | ||||||
|  | -		       MAC2STR(mgmt->sa)); | ||||||
|  | -		resp = ubus_resp > 0 ? (u16) ubus_resp : WLAN_STATUS_UNSPECIFIED_FAILURE; | ||||||
|  | -		goto fail; | ||||||
|  | -	} | ||||||
|  | - | ||||||
|  |  	/* | ||||||
|  |  	 * Remove the station in case tranmission of a success response fails | ||||||
|  |  	 * (the STA was added associated to the driver) or if the station was | ||||||
| @@ -0,0 +1,65 @@ | |||||||
|  | Index: hostapd-2020-06-08-5a8b3662/src/ap/ubus.c | ||||||
|  | =================================================================== | ||||||
|  | --- hostapd-2020-06-08-5a8b3662.orig/src/ap/ubus.c | ||||||
|  | +++ hostapd-2020-06-08-5a8b3662/src/ap/ubus.c | ||||||
|  | @@ -1486,7 +1486,60 @@ static int hostapd_get_bss_list(struct u | ||||||
|  |  	return 0; | ||||||
|  |  } | ||||||
|  |   | ||||||
|  | +enum { | ||||||
|  | +	MOD_IFACE, | ||||||
|  | +	MOD_PARAM, | ||||||
|  | +	MOD_PARAM_VAL, | ||||||
|  | +	__PARAM_MAX | ||||||
|  | +}; | ||||||
|  | + | ||||||
|  | +static const struct blobmsg_policy mod_param_policy[__PARAM_MAX] = { | ||||||
|  | +	[MOD_IFACE] = { "iface", BLOBMSG_TYPE_STRING }, | ||||||
|  | +	[MOD_PARAM] = { "param", BLOBMSG_TYPE_STRING }, | ||||||
|  | +	[MOD_PARAM_VAL] = { "param_val", BLOBMSG_TYPE_STRING }, | ||||||
|  | +}; | ||||||
|  | + | ||||||
|  | +static int | ||||||
|  | +hostapd_param_modify(struct ubus_context *ctx, struct ubus_object *obj, | ||||||
|  | +		   struct ubus_request_data *req, const char *method, | ||||||
|  | +		   struct blob_attr *msg) | ||||||
|  | +{ | ||||||
|  | +	struct blob_attr *tb[__PARAM_MAX]; | ||||||
|  | +	struct hapd_interfaces *interfaces = NULL; | ||||||
|  | +	struct hostapd_data *hapd_bss = NULL; | ||||||
|  | +	struct hostapd_config *iconf = NULL; | ||||||
|  | +	struct hostapd_iface *iface = NULL; | ||||||
|  | +	size_t i = 0; | ||||||
|  | + | ||||||
|  | +	interfaces = get_hapd_interfaces_from_object(obj); | ||||||
|  | +	blobmsg_parse(mod_param_policy, __PARAM_MAX, tb, blob_data(msg), | ||||||
|  | +		      blob_len(msg)); | ||||||
|  | +	if (!tb[MOD_PARAM] || !tb[MOD_IFACE] || !tb[MOD_PARAM_VAL]) | ||||||
|  | +		return UBUS_STATUS_INVALID_ARGUMENT; | ||||||
|  | + | ||||||
|  | +	wpa_printf(MSG_DEBUG, "Modifyint %s=%s for %s", | ||||||
|  | +		blobmsg_get_string(tb[MOD_PARAM]), | ||||||
|  | +		blobmsg_get_string(tb[MOD_PARAM_VAL]), | ||||||
|  | +		blobmsg_get_string(tb[MOD_IFACE])); | ||||||
|  | +	 | ||||||
|  | +	hapd_bss = hostapd_get_iface(interfaces, | ||||||
|  | +				     blobmsg_get_string(tb[MOD_IFACE])); | ||||||
|  | + | ||||||
|  | +	if (hapd_bss) { | ||||||
|  | +		iconf = hapd_bss->iconf; | ||||||
|  | +		if (os_strcmp(blobmsg_get_string(tb[MOD_PARAM]), | ||||||
|  | +			      "rssi_ignore_probe_request") == 0) { | ||||||
|  | +			iconf->rssi_ignore_probe_request = atoi(blobmsg_get_string(tb[MOD_PARAM_VAL])); | ||||||
|  | + | ||||||
|  | +		} | ||||||
|  | +	} | ||||||
|  | + | ||||||
|  | +	return UBUS_STATUS_OK; | ||||||
|  | +} | ||||||
|  | + | ||||||
|  | + | ||||||
|  |  static const struct ubus_method daemon_methods[] = { | ||||||
|  | +	UBUS_METHOD("param_mod", hostapd_param_modify, mod_param_policy), | ||||||
|  |  	UBUS_METHOD("config_add", hostapd_config_add, config_add_policy), | ||||||
|  |  	UBUS_METHOD("config_remove", hostapd_config_remove, config_remove_policy), | ||||||
|  |  	UBUS_METHOD_NOARG("get_bss_list", hostapd_get_bss_list), | ||||||
| @@ -0,0 +1,14 @@ | |||||||
|  | Index: hostapd-2020-06-08-5a8b3662/src/ap/ubus.c | ||||||
|  | =================================================================== | ||||||
|  | --- hostapd-2020-06-08-5a8b3662.orig/src/ap/ubus.c | ||||||
|  | +++ hostapd-2020-06-08-5a8b3662/src/ap/ubus.c | ||||||
|  | @@ -1657,7 +1657,8 @@ int hostapd_ubus_handle_rt_event(struct | ||||||
|  |  	session_id = sta->cl_session_id; | ||||||
|  |   | ||||||
|  |  	/* find by session id */ | ||||||
|  | -	rec = avl_find_element(&hapd->ubus.rt_events, &session_id, rec, avl); | ||||||
|  | +	if (session_id) | ||||||
|  | +		rec = avl_find_element(&hapd->ubus.rt_events, &session_id, rec, avl); | ||||||
|  |   | ||||||
|  |  	/* prepare rec if not found */ | ||||||
|  |  	if (!rec) { | ||||||
| @@ -0,0 +1,299 @@ | |||||||
|  | Index: hostapd-2020-06-08-5a8b3662/src/ap/ubus.c | ||||||
|  | =================================================================== | ||||||
|  | --- hostapd-2020-06-08-5a8b3662.orig/src/ap/ubus.c | ||||||
|  | +++ hostapd-2020-06-08-5a8b3662/src/ap/ubus.c | ||||||
|  | @@ -21,6 +21,7 @@ | ||||||
|  |  #include "rrm.h" | ||||||
|  |  #include "wnm_ap.h" | ||||||
|  |  #include "taxonomy.h" | ||||||
|  | +#include "common/hw_features_common.h" | ||||||
|  |   | ||||||
|  |  static struct ubus_context *ctx; | ||||||
|  |  static struct blob_buf b; | ||||||
|  | @@ -754,6 +755,208 @@ static int hostapd_get_chan_switch_event | ||||||
|  |  	return 0; | ||||||
|  |  } | ||||||
|  |   | ||||||
|  | +#define HOSTAPD_DFS_CSA_DUR 1 | ||||||
|  | +int csa_ch_id, csa_cf0_id, csa_cf1_id = 0; | ||||||
|  | +int csa_bw = CHANWIDTH_USE_HT; | ||||||
|  | +struct csa_settings css; | ||||||
|  | + | ||||||
|  | +struct hostapd_channel_data *freq_to_chan(struct hostapd_iface *iface, int freq) | ||||||
|  | +{ | ||||||
|  | +	struct hostapd_hw_modes *mode; | ||||||
|  | +	struct hostapd_channel_data *chan; | ||||||
|  | +	int i; | ||||||
|  | + | ||||||
|  | +	mode = iface->current_mode; | ||||||
|  | +	if (mode == NULL || freq == 0) { | ||||||
|  | +		wpa_printf(MSG_INFO, "%s: mode is NULL", __func__); | ||||||
|  | +		return NULL; | ||||||
|  | +	} | ||||||
|  | + | ||||||
|  | +	for (i = 0; i < iface->current_mode->num_channels; i++) { | ||||||
|  | +		chan = &iface->current_mode->channels[i]; | ||||||
|  | +		if (chan->freq == freq) { | ||||||
|  | +			return chan; /* Channel found */ | ||||||
|  | +		} | ||||||
|  | +	} | ||||||
|  | +	return NULL; | ||||||
|  | +} | ||||||
|  | + | ||||||
|  | +void hostapd_dfs_csa_timeout(void *eloop_data, void *user_data) | ||||||
|  | +{ | ||||||
|  | +	struct hostapd_data *hapd = eloop_data; | ||||||
|  | +	struct hostapd_iface *iface = hapd->iface; | ||||||
|  | +	struct csa_settings *css = user_data; | ||||||
|  | +	int ret = 0; | ||||||
|  | + | ||||||
|  | +	wpa_printf(MSG_DEBUG, "%s Stopping CSA in dfs ", __func__); | ||||||
|  | + | ||||||
|  | +	hapd->csa_in_progress = 0; | ||||||
|  | + | ||||||
|  | +	hostapd_disable_iface(iface); | ||||||
|  | + | ||||||
|  | +	iface->freq = css->freq_params.freq; | ||||||
|  | +	iface->conf->channel = csa_ch_id; | ||||||
|  | +	iface->conf->secondary_channel = css->freq_params.sec_channel_offset; | ||||||
|  | +	hostapd_set_oper_centr_freq_seg0_idx(iface->conf, csa_cf0_id); | ||||||
|  | +	hostapd_set_oper_centr_freq_seg1_idx(iface->conf, csa_cf1_id); | ||||||
|  | +	hostapd_set_oper_chwidth(iface->conf, csa_bw); | ||||||
|  | +	iface->conf->ieee80211n = css->freq_params.ht_enabled; | ||||||
|  | +	iface->conf->ieee80211ac = css->freq_params.vht_enabled; | ||||||
|  | +	iface->conf->ieee80211ax = css->freq_params.he_enabled; | ||||||
|  | +	wpa_printf(MSG_INFO, "%s: freq=%d chan=%d sec_ch=%d cf0=%d cf1=%d bw=%d 11n=%d, ac=%d, ax=%d", | ||||||
|  | + 		   __func__, iface->freq, iface->conf->channel, | ||||||
|  | +		   iface->conf->secondary_channel, csa_cf0_id, csa_cf1_id,  | ||||||
|  | +		   css->freq_params.bandwidth, iface->conf->ieee80211n, | ||||||
|  | +		   iface->conf->ieee80211ac, iface->conf->ieee80211ax); | ||||||
|  | + | ||||||
|  | +	ret = hostapd_enable_iface(iface); | ||||||
|  | +	if (ret == 0) | ||||||
|  | +		hostapd_ubus_handle_channel_switch_event(iface, | ||||||
|  | +						HOSTAPD_UBUS_HIGH_INTERFERENCE, | ||||||
|  | +						iface->freq); | ||||||
|  | +  | ||||||
|  | +} | ||||||
|  | + | ||||||
|  | +int hostapd_dfs_set_beacon_csa(struct hostapd_iface *iface, struct csa_settings *css) | ||||||
|  | +{ | ||||||
|  | +	struct hostapd_data *hapd = iface->bss[0]; | ||||||
|  | +	struct hostapd_data *hapd_bss = NULL; | ||||||
|  | +	struct csa_settings csa_settings; | ||||||
|  | +	int secondary_channel = 0; | ||||||
|  | +	u8 vht_oper_centr_freq_seg0_idx; | ||||||
|  | +	u8 vht_oper_centr_freq_seg1_idx; | ||||||
|  | +	int err = 0, i = 0; | ||||||
|  | + | ||||||
|  | +	if (hapd->csa_in_progress == 1) { | ||||||
|  | +		wpa_printf(MSG_ERROR, "CSA in progress, cannot switch channel"); | ||||||
|  | +		return -1; | ||||||
|  | +	} | ||||||
|  | + | ||||||
|  | +	eloop_cancel_timeout(hostapd_dfs_csa_timeout, hapd, NULL); | ||||||
|  | + | ||||||
|  | +	/* Setup Beacon CSA request */ | ||||||
|  | +	secondary_channel = iface->conf->secondary_channel; | ||||||
|  | +	vht_oper_centr_freq_seg0_idx = | ||||||
|  | +			iface->conf->vht_oper_centr_freq_seg0_idx; | ||||||
|  | +	vht_oper_centr_freq_seg1_idx = | ||||||
|  | +			iface->conf->vht_oper_centr_freq_seg1_idx; | ||||||
|  | + | ||||||
|  | +	os_memset(&csa_settings, 0, sizeof(csa_settings)); | ||||||
|  | +	err = hostapd_set_freq_params(&csa_settings.freq_params, | ||||||
|  | +				      iface->conf->hw_mode, | ||||||
|  | +				      iface->freq, | ||||||
|  | +				      iface->conf->channel, | ||||||
|  | +				      iface->conf->enable_edmg, | ||||||
|  | +				      iface->conf->edmg_channel, | ||||||
|  | +				      iface->conf->ieee80211n, | ||||||
|  | +				      iface->conf->ieee80211ac, | ||||||
|  | +				      iface->conf->ieee80211ax, | ||||||
|  | +				      secondary_channel, | ||||||
|  | +				      hostapd_get_oper_chwidth(iface->conf), | ||||||
|  | +				      vht_oper_centr_freq_seg0_idx, | ||||||
|  | +				      vht_oper_centr_freq_seg1_idx, | ||||||
|  | +				      iface->current_mode->vht_capab, | ||||||
|  | +				      &iface->current_mode->he_capab[IEEE80211_MODE_AP]); | ||||||
|  | +	if (err) { | ||||||
|  | +		wpa_printf(MSG_ERROR, "DFS failed to calculate CSA freq params"); | ||||||
|  | +		return -1; | ||||||
|  | +	} | ||||||
|  | + | ||||||
|  | + | ||||||
|  | +	if (!(hapd->iface->drv_flags & WPA_DRIVER_FLAGS_AP_CSA)) { | ||||||
|  | +		wpa_printf(MSG_ERROR, "CSA is not supported"); | ||||||
|  | +		return -1; | ||||||
|  | +	} | ||||||
|  | + | ||||||
|  | +	/* Set Beacon */ | ||||||
|  | +	for (i = 0; i < hapd->iface->num_bss; i++) { | ||||||
|  | +		hapd_bss = iface->bss[i]; | ||||||
|  | +		hapd_bss->cs_freq_params = csa_settings.freq_params; | ||||||
|  | +		hapd_bss->cs_count = css->cs_count; | ||||||
|  | +		hapd_bss->cs_block_tx = css->block_tx; | ||||||
|  | +		err = ieee802_11_set_beacon(hapd_bss); | ||||||
|  | +		if (err) | ||||||
|  | +			wpa_printf(MSG_ERROR, "CSA beacon set failed, changing channel without an Announcement"); | ||||||
|  | +	} | ||||||
|  | + | ||||||
|  | +	hapd->csa_in_progress = 1; | ||||||
|  | + | ||||||
|  | +	/* Switch Channel after a timeout */ | ||||||
|  | +	eloop_register_timeout(HOSTAPD_DFS_CSA_DUR, 0, | ||||||
|  | +			       hostapd_dfs_csa_timeout, hapd, css); | ||||||
|  | + | ||||||
|  | +	return 0; | ||||||
|  | +} | ||||||
|  | + | ||||||
|  | +int hostapd_switch_chan_dfs(struct hostapd_iface *iface, | ||||||
|  | +			     struct csa_settings *css) | ||||||
|  | +{ | ||||||
|  | +	struct hostapd_channel_data *ch, *cf1, *cf2 = NULL; | ||||||
|  | +	int res = 0; | ||||||
|  | + | ||||||
|  | +	if (iface == NULL) | ||||||
|  | +		return -1; | ||||||
|  | + | ||||||
|  | +	/* Set channel id and center frequecies id */ | ||||||
|  | +	if (css->freq_params.freq > 0) { | ||||||
|  | +		ch = freq_to_chan(iface, css->freq_params.freq); | ||||||
|  | +		csa_ch_id = ch->chan; | ||||||
|  | +	} | ||||||
|  | + | ||||||
|  | +	if (css->freq_params.center_freq1 > 0) { | ||||||
|  | +		csa_cf0_id = 36 + (css->freq_params.center_freq1 - 5180) / 5; | ||||||
|  | +	} | ||||||
|  | + | ||||||
|  | +	if (css->freq_params.center_freq2 > 0) { | ||||||
|  | +		csa_cf1_id = 36 + (css->freq_params.center_freq2 - 5180) / 5; | ||||||
|  | +	} | ||||||
|  | + | ||||||
|  | +	wpa_printf(MSG_DEBUG, "%s freq=%d chan=%d sec_chan=%d, width=%d, seg0=%d, seg1=%d, cac_time=%ds, ieee80211n=%d, ieee80211ac=%d, ieee80211ax=%d ", __func__, | ||||||
|  | +		css->freq_params.freq, | ||||||
|  | +		csa_ch_id, css->freq_params.sec_channel_offset, | ||||||
|  | +		css->freq_params.bandwidth, csa_cf0_id, csa_cf1_id, | ||||||
|  | +		iface->dfs_cac_ms / 1000, iface->conf->ieee80211n, | ||||||
|  | +		iface->conf->ieee80211ac, iface->conf->ieee80211ax); | ||||||
|  | + | ||||||
|  | +	/* Set bandwidth */ | ||||||
|  | +	switch (css->freq_params.bandwidth) { | ||||||
|  | +	case 0: | ||||||
|  | +	case 20: | ||||||
|  | +	case 40: | ||||||
|  | +		csa_bw = CHANWIDTH_USE_HT; | ||||||
|  | +		break; | ||||||
|  | +	case 80: | ||||||
|  | +		if (css->freq_params.center_freq2) | ||||||
|  | +			csa_bw = CHANWIDTH_80P80MHZ; | ||||||
|  | +		else | ||||||
|  | +			csa_bw = CHANWIDTH_80MHZ; | ||||||
|  | +		break; | ||||||
|  | +	case 160: | ||||||
|  | +		csa_bw = CHANWIDTH_160MHZ; | ||||||
|  | +		break; | ||||||
|  | +	default: | ||||||
|  | +		wpa_printf(MSG_WARNING, "Unknown CSA bandwidth: %d", | ||||||
|  | +			   css->freq_params.bandwidth); | ||||||
|  | +		break; | ||||||
|  | +	} | ||||||
|  | + | ||||||
|  | +	/* Set new frequency info */ | ||||||
|  | +	iface->freq = css->freq_params.freq; | ||||||
|  | +	iface->conf->channel = csa_ch_id; | ||||||
|  | +	iface->conf->secondary_channel = css->freq_params.sec_channel_offset; | ||||||
|  | +	hostapd_set_oper_centr_freq_seg0_idx(iface->conf, csa_cf0_id); | ||||||
|  | +	hostapd_set_oper_centr_freq_seg1_idx(iface->conf, csa_cf1_id); | ||||||
|  | +	hostapd_set_oper_chwidth(iface->conf, csa_bw); | ||||||
|  | +	iface->conf->ieee80211n = css->freq_params.ht_enabled; | ||||||
|  | +	iface->conf->ieee80211ac = css->freq_params.vht_enabled; | ||||||
|  | +	iface->conf->ieee80211ax = css->freq_params.he_enabled; | ||||||
|  | + | ||||||
|  | +	/*Set beacon for CSA*/ | ||||||
|  | +	hostapd_dfs_set_beacon_csa(iface, css); | ||||||
|  | + | ||||||
|  | +	return 0; | ||||||
|  | +} | ||||||
|  | + | ||||||
|  |  static int | ||||||
|  |  hostapd_switch_chan(struct ubus_context *ctx, struct ubus_object *obj, | ||||||
|  |  		    struct ubus_request_data *req, const char *method, | ||||||
|  | @@ -761,14 +964,19 @@ hostapd_switch_chan(struct ubus_context | ||||||
|  |  { | ||||||
|  |  	struct blob_attr *tb[__CSA_MAX]; | ||||||
|  |  	struct hostapd_data *hapd = get_hapd_from_object(obj); | ||||||
|  | -	struct csa_settings css; | ||||||
|  | +	struct hostapd_iface *iface = hapd->iface; | ||||||
|  | +	struct hostapd_channel_data *chan =NULL; | ||||||
|  |  	int i; | ||||||
|  | +	int freq = 0; | ||||||
|  |   | ||||||
|  |  	blobmsg_parse(csa_policy, __CSA_MAX, tb, blob_data(msg), blob_len(msg)); | ||||||
|  |   | ||||||
|  |  	if (!tb[CSA_FREQ]) | ||||||
|  |  		return UBUS_STATUS_INVALID_ARGUMENT; | ||||||
|  |   | ||||||
|  | +	freq = blobmsg_get_u32(tb[CSA_FREQ]); | ||||||
|  | +	chan = freq_to_chan(iface, freq); | ||||||
|  | + | ||||||
|  |  	memset(&css, 0, sizeof(css)); | ||||||
|  |  	css.freq_params.freq = blobmsg_get_u32(tb[CSA_FREQ]); | ||||||
|  |   | ||||||
|  | @@ -787,6 +995,20 @@ hostapd_switch_chan(struct ubus_context | ||||||
|  |  	SET_CSA_SETTING(CSA_VHT, freq_params.vht_enabled, bool); | ||||||
|  |  	SET_CSA_SETTING(CSA_BLOCK_TX, block_tx, bool); | ||||||
|  |   | ||||||
|  | +	wpa_printf(MSG_INFO, "%s: CSS freq=%d chan=%d sec_chan_off=%d, width=%d, seg0=%d, seg1=%d", __func__, | ||||||
|  | +		css.freq_params.freq, | ||||||
|  | +		chan->chan, css.freq_params.sec_channel_offset, | ||||||
|  | +		css.freq_params.bandwidth, | ||||||
|  | +		css.freq_params.center_freq1, | ||||||
|  | +		css.freq_params.center_freq2); | ||||||
|  | + | ||||||
|  | +	if ((chan->flag & HOSTAPD_CHAN_RADAR) && | ||||||
|  | +	    ((chan->flag & HOSTAPD_CHAN_DFS_MASK) | ||||||
|  | +	     != HOSTAPD_CHAN_DFS_AVAILABLE)) { | ||||||
|  | +		wpa_printf(MSG_INFO, "%s: DFS chan need CAC", __func__); | ||||||
|  | +		hostapd_switch_chan_dfs(iface, &css); | ||||||
|  | +		return UBUS_STATUS_OK; | ||||||
|  | +	} | ||||||
|  |   | ||||||
|  |  	for (i = 0; i < hapd->iface->num_bss; i++) { | ||||||
|  |  		if (hostapd_switch_channel(hapd->iface->bss[i], &css) != 0) | ||||||
|  | @@ -1454,10 +1676,16 @@ void hostapd_ubus_free_bss(struct hostap | ||||||
|  |  	} | ||||||
|  |   | ||||||
|  |  	free(name); | ||||||
|  | -	for (size_t i = 0; i < bss_nr; i++) | ||||||
|  | -		os_free(bss_lst[i]); | ||||||
|  | -	free(bss_lst); | ||||||
|  | -	bss_lst = NULL; | ||||||
|  | + | ||||||
|  | +	if (bss_lst != NULL) { | ||||||
|  | +		for (size_t i = 0; i < bss_nr; i++) { | ||||||
|  | +			os_free(bss_lst[i]); | ||||||
|  | +			bss_lst[i] = NULL; | ||||||
|  | +		} | ||||||
|  | +		free(bss_lst); | ||||||
|  | +		bss_lst = NULL; | ||||||
|  | +		bss_nr = 0; | ||||||
|  | +	} | ||||||
|  |  } | ||||||
|  |   | ||||||
|  |  static int hostapd_get_bss_list(struct ubus_context *ctx, | ||||||
|  | @@ -1477,9 +1705,11 @@ static int hostapd_get_bss_list(struct u | ||||||
|  |  	a = blobmsg_open_array(&b_ev, "bss_list"); | ||||||
|  |  	/* check bss list from hapd */ | ||||||
|  |  	for (size_t i = 0; i < bss_nr; i++) { | ||||||
|  | -		b = blobmsg_open_table(&b_ev, NULL); | ||||||
|  | -		blobmsg_add_string(&b_ev, "name", bss_lst[i]); | ||||||
|  | -		blobmsg_close_table(&b_ev, b); | ||||||
|  | +		if (bss_lst[i] != NULL) { | ||||||
|  | +			b = blobmsg_open_table(&b_ev, NULL); | ||||||
|  | +			blobmsg_add_string(&b_ev, "name", bss_lst[i]); | ||||||
|  | +			blobmsg_close_table(&b_ev, b); | ||||||
|  | +		} | ||||||
|  |  	} | ||||||
|  |  	blobmsg_close_array(&b_ev, a); | ||||||
|  |  	ubus_send_reply(ctx, req, b_ev.head); | ||||||
| @@ -0,0 +1,64 @@ | |||||||
|  | --- a/src/ap/ubus.c | ||||||
|  | +++ b/src/ap/ubus.c | ||||||
|  | @@ -530,6 +530,7 @@ enum { | ||||||
|  |  	CSA_HT, | ||||||
|  |  	CSA_VHT, | ||||||
|  |  	CSA_BLOCK_TX, | ||||||
|  | +	CSA_REASON, | ||||||
|  |  	__CSA_MAX | ||||||
|  |  }; | ||||||
|  |   | ||||||
|  | @@ -543,6 +544,7 @@ static const struct blobmsg_policy csa_p | ||||||
|  |  	[CSA_HT] = { "ht", BLOBMSG_TYPE_BOOL }, | ||||||
|  |  	[CSA_VHT] = { "vht", BLOBMSG_TYPE_BOOL }, | ||||||
|  |  	[CSA_BLOCK_TX] = { "block_tx", BLOBMSG_TYPE_BOOL }, | ||||||
|  | +	[CSA_REASON] = { "reason", BLOBMSG_TYPE_INT32 }, | ||||||
|  |  }; | ||||||
|  |   | ||||||
|  |  #ifdef NEED_AP_MLME | ||||||
|  | @@ -810,7 +812,7 @@ void hostapd_dfs_csa_timeout(void *eloop | ||||||
|  |  		   iface->conf->ieee80211ac, iface->conf->ieee80211ax); | ||||||
|  |   | ||||||
|  |  	ret = hostapd_enable_iface(iface); | ||||||
|  | -	if (ret == 0) | ||||||
|  | +	if (ret == 0 && css->reason == 0) | ||||||
|  |  		hostapd_ubus_handle_channel_switch_event(iface, | ||||||
|  |  						HOSTAPD_UBUS_HIGH_INTERFERENCE, | ||||||
|  |  						iface->freq); | ||||||
|  | @@ -994,6 +996,7 @@ hostapd_switch_chan(struct ubus_context | ||||||
|  |  	SET_CSA_SETTING(CSA_HT, freq_params.ht_enabled, bool); | ||||||
|  |  	SET_CSA_SETTING(CSA_VHT, freq_params.vht_enabled, bool); | ||||||
|  |  	SET_CSA_SETTING(CSA_BLOCK_TX, block_tx, bool); | ||||||
|  | +	SET_CSA_SETTING(CSA_REASON, reason, u32); | ||||||
|  |   | ||||||
|  |  	wpa_printf(MSG_INFO, "%s: CSS freq=%d chan=%d sec_chan_off=%d, width=%d, seg0=%d, seg1=%d", __func__, | ||||||
|  |  		css.freq_params.freq, | ||||||
|  | @@ -1015,7 +1018,9 @@ hostapd_switch_chan(struct ubus_context | ||||||
|  |  			return UBUS_STATUS_NOT_SUPPORTED; | ||||||
|  |  	} | ||||||
|  |   | ||||||
|  | -	hostapd_ubus_handle_channel_switch_event(hapd->iface,HOSTAPD_UBUS_HIGH_INTERFERENCE,  css.freq_params.freq); | ||||||
|  | +	if (css.reason == 0) { | ||||||
|  | +		hostapd_ubus_handle_channel_switch_event(hapd->iface, HOSTAPD_UBUS_HIGH_INTERFERENCE, css.freq_params.freq); | ||||||
|  | +	} | ||||||
|  |   | ||||||
|  |  	return UBUS_STATUS_OK; | ||||||
|  |  #undef SET_CSA_SETTING | ||||||
|  | --- a/src/drivers/driver.h | ||||||
|  | +++ b/src/drivers/driver.h | ||||||
|  | @@ -2291,6 +2291,7 @@ struct beacon_data { | ||||||
|  |   * @freq_params: Next channel frequency parameter | ||||||
|  |   * @beacon_csa: Beacon/probe resp/asooc resp info for CSA period | ||||||
|  |   * @beacon_after: Next beacon/probe resp/asooc resp info | ||||||
|  | + * @reason: The reason why we are switching the channel | ||||||
|  |   * @counter_offset_beacon: Offset to the count field in beacon's tail | ||||||
|  |   * @counter_offset_presp: Offset to the count field in probe resp. | ||||||
|  |   */ | ||||||
|  | @@ -2301,6 +2302,7 @@ struct csa_settings { | ||||||
|  |  	struct hostapd_freq_params freq_params; | ||||||
|  |  	struct beacon_data beacon_csa; | ||||||
|  |  	struct beacon_data beacon_after; | ||||||
|  | +	u32 reason; | ||||||
|  |   | ||||||
|  |  	u16 counter_offset_beacon[2]; | ||||||
|  |  	u16 counter_offset_presp[2]; | ||||||
| @@ -0,0 +1,111 @@ | |||||||
|  | --- a/src/ap/ubus.c | ||||||
|  | +++ b/src/ap/ubus.c | ||||||
|  | @@ -578,6 +578,7 @@ static int hostapd_clear_session(struct | ||||||
|  |  	{ | ||||||
|  |  		if (session_id == rec->session_id) { | ||||||
|  |  			/* dec counter and delete */ | ||||||
|  | +			wpa_printf(MSG_INFO, "%s Deleting client session with session id %llu", __func__, session_id); | ||||||
|  |  			cached_events_nr -= rec->rec_nr; | ||||||
|  |  			avl_delete(&hapd->ubus.rt_events, &rec->avl); | ||||||
|  |  			os_free(rec->records); | ||||||
|  | @@ -631,6 +632,10 @@ static int hostapd_sessions(struct ubus_ | ||||||
|  |  		/* messages for current session */ | ||||||
|  |  		for (size_t i = 0; i < rec->rec_nr; i++) { | ||||||
|  |  			c_rec = &rec->records[i]; | ||||||
|  | +			if (c_rec->processed) { | ||||||
|  | +				/* Record is already reported, continue */ | ||||||
|  | +				continue; | ||||||
|  | +			} | ||||||
|  |  			/* check message type */ | ||||||
|  |  			switch (c_rec->type) { | ||||||
|  |  			/* ClientAuthEvent */ | ||||||
|  | @@ -644,6 +649,7 @@ static int hostapd_sessions(struct ubus_ | ||||||
|  |  				blobmsg_add_u32(&b_ev, "auth_status", p->auth_status); | ||||||
|  |  				blobmsg_add_string(&b_ev, "ssid", p->ssid); | ||||||
|  |  				blobmsg_close_table(&b_ev, t_msg); | ||||||
|  | +				c_rec->processed = true; | ||||||
|  |  				break; | ||||||
|  |  			} | ||||||
|  |   | ||||||
|  | @@ -663,6 +669,7 @@ static int hostapd_sessions(struct ubus_ | ||||||
|  |  				blobmsg_add_u8(&b_ev, "using11v", p->using11v); | ||||||
|  |  				blobmsg_add_string(&b_ev, "ssid", p->ssid); | ||||||
|  |  				blobmsg_close_table(&b_ev, t_msg); | ||||||
|  | +				c_rec->processed = true; | ||||||
|  |  				break; | ||||||
|  |  			} | ||||||
|  |   | ||||||
|  | @@ -678,6 +685,7 @@ static int hostapd_sessions(struct ubus_ | ||||||
|  |  				blobmsg_add_u32(&b_ev, "internal_rc", p->internal_rc); | ||||||
|  |  				blobmsg_add_string(&b_ev, "ssid", p->ssid); | ||||||
|  |  				blobmsg_close_table(&b_ev, t_msg); | ||||||
|  | +				c_rec->processed = true; | ||||||
|  |  				break; | ||||||
|  |  			} | ||||||
|  |   | ||||||
|  | @@ -691,6 +699,7 @@ static int hostapd_sessions(struct ubus_ | ||||||
|  |  				blobmsg_add_u64(&b_ev, "fdata_tx_up_ts_in_us", p->tx_ts.tv_sec * (uint64_t)1000000); | ||||||
|  |  				blobmsg_add_u64(&b_ev, "fdata_rx_up_ts_in_us", p->rx_ts.tv_sec * (uint64_t)1000000); | ||||||
|  |  				blobmsg_close_table(&b_ev, t_msg); | ||||||
|  | +				c_rec->processed = true; | ||||||
|  |  				break; | ||||||
|  |  			} | ||||||
|  |   | ||||||
|  | @@ -703,6 +712,7 @@ static int hostapd_sessions(struct ubus_ | ||||||
|  |  				blobmsg_add_string(&b_ev, "sta_mac", p->sta_mac); | ||||||
|  |  				blobmsg_add_string(&b_ev, "ip_address", p->ip_addr); | ||||||
|  |  				blobmsg_close_table(&b_ev, t_msg); | ||||||
|  | +				c_rec->processed = true; | ||||||
|  |  				break; | ||||||
|  |  			} | ||||||
|  |   | ||||||
|  | @@ -1911,6 +1921,7 @@ int hostapd_ubus_handle_rt_event(struct | ||||||
|  |  		struct client_session_record *rp = &rec->records[rec->rec_nr - 1]; | ||||||
|  |  		rp->type = CST_AUTH; | ||||||
|  |  		rp->u.auth.session_id = rec->session_id; | ||||||
|  | +		rp->processed = false; | ||||||
|  |   | ||||||
|  |  		/* timestamp */ | ||||||
|  |  		rp->timestamp = timestamp; | ||||||
|  | @@ -1941,6 +1952,7 @@ int hostapd_ubus_handle_rt_event(struct | ||||||
|  |  		struct client_session_record *rp = &rec->records[rec->rec_nr - 1]; | ||||||
|  |  		rp->type = CST_ASSOC; | ||||||
|  |  		rp->u.assoc.session_id = rec->session_id; | ||||||
|  | +		rp->processed = false; | ||||||
|  |  		/* timestamp */ | ||||||
|  |  		rp->timestamp = timestamp; | ||||||
|  |  		/* frequency */ | ||||||
|  | @@ -1985,6 +1997,7 @@ int hostapd_ubus_handle_rt_event(struct | ||||||
|  |  		struct client_session_record *rp = &rec->records[rec->rec_nr - 1]; | ||||||
|  |  		rp->type = CST_DISASSOC; | ||||||
|  |  		rp->u.disassoc.session_id = rec->session_id; | ||||||
|  | +		rp->processed = false; | ||||||
|  |  		/* timestamp */ | ||||||
|  |  		rp->timestamp = timestamp; | ||||||
|  |  		/* frequency */ | ||||||
|  | @@ -2016,6 +2029,7 @@ int hostapd_ubus_handle_rt_event(struct | ||||||
|  |  		struct client_session_record *rp = &rec->records[rec->rec_nr - 1]; | ||||||
|  |  		rp->type = CST_FDATA; | ||||||
|  |  		rp->u.fdata.session_id = rec->session_id; | ||||||
|  | +		rp->processed = false; | ||||||
|  |  		/* timestamp */ | ||||||
|  |  		rp->timestamp = timestamp; | ||||||
|  |  		/* STA MAC */ | ||||||
|  | @@ -2044,6 +2058,7 @@ int hostapd_ubus_handle_rt_event(struct | ||||||
|  |  		struct client_session_record *rp = &rec->records[rec->rec_nr - 1]; | ||||||
|  |  		rp->type = CST_IP; | ||||||
|  |  		rp->u.ip.session_id = rec->session_id; | ||||||
|  | +		rp->processed = false; | ||||||
|  |  		/* timestamp */ | ||||||
|  |  		rp->timestamp = timestamp; | ||||||
|  |  		/* STA MAC */ | ||||||
|  | --- a/src/ap/ubus.h | ||||||
|  | +++ b/src/ap/ubus.h | ||||||
|  | @@ -110,6 +110,7 @@ struct client_ip_event { | ||||||
|  |  }; | ||||||
|  |   | ||||||
|  |  struct client_session_record { | ||||||
|  | +	bool processed; | ||||||
|  |  	int type; | ||||||
|  |  	uint64_t timestamp; | ||||||
|  |  	union { | ||||||
| @@ -174,6 +174,11 @@ mac80211_hostapd_setup_base() { | |||||||
| 		[ "$rx_stbc" -lt "$cap_rx_stbc" ] && cap_rx_stbc="$rx_stbc" | 		[ "$rx_stbc" -lt "$cap_rx_stbc" ] && cap_rx_stbc="$rx_stbc" | ||||||
| 		ht_cap_mask="$(( ($ht_cap_mask & ~(0x300)) | ($cap_rx_stbc << 8) ))" | 		ht_cap_mask="$(( ($ht_cap_mask & ~(0x300)) | ($cap_rx_stbc << 8) ))" | ||||||
|  |  | ||||||
|  | 		conf_tx_ant=$(iw phy "$phy" info | grep 'Configured Antennas:' | cut -d: -f2) | ||||||
|  | 		set -- $conf_tx_ant | ||||||
|  | 		if [ "$2" == "0x1" -o "$2" == "0x10" ]; then | ||||||
|  | 			tx_stbc=0 | ||||||
|  | 		fi | ||||||
| 		mac80211_add_capabilities ht_capab_flags $ht_cap_mask \ | 		mac80211_add_capabilities ht_capab_flags $ht_cap_mask \ | ||||||
| 			LDPC:0x1::$ldpc \ | 			LDPC:0x1::$ldpc \ | ||||||
| 			GF:0x10::$greenfield \ | 			GF:0x10::$greenfield \ | ||||||
| @@ -263,6 +268,11 @@ mac80211_hostapd_setup_base() { | |||||||
| 		[ "$rx_stbc" -lt "$cap_rx_stbc" ] && cap_rx_stbc="$rx_stbc" | 		[ "$rx_stbc" -lt "$cap_rx_stbc" ] && cap_rx_stbc="$rx_stbc" | ||||||
| 		vht_cap="$(( ($vht_cap & ~(0x700)) | ($cap_rx_stbc << 8) ))" | 		vht_cap="$(( ($vht_cap & ~(0x700)) | ($cap_rx_stbc << 8) ))" | ||||||
|  |  | ||||||
|  | 		conf_tx_ant=$(iw phy "$phy" info | grep 'Configured Antennas:' | cut -d: -f2) | ||||||
|  | 		set -- $conf_tx_ant | ||||||
|  | 		if [ "$2" == "0x1" -o "$2" == "0x10" ]; then | ||||||
|  | 			tx_stbc_2by1=0 | ||||||
|  | 		fi | ||||||
| 		mac80211_add_capabilities vht_capab $vht_cap \ | 		mac80211_add_capabilities vht_capab $vht_cap \ | ||||||
| 			RXLDPC:0x10::$rxldpc \ | 			RXLDPC:0x10::$rxldpc \ | ||||||
| 			SHORT-GI-80:0x20::$short_gi_80 \ | 			SHORT-GI-80:0x20::$short_gi_80 \ | ||||||
|   | |||||||
| @@ -11,7 +11,7 @@ include $(INCLUDE_DIR)/package.mk | |||||||
|  |  | ||||||
| define Package/apc | define Package/apc | ||||||
|   SECTION:=base |   SECTION:=base | ||||||
|   DEPENDS:=+libev +libinterapcomm |   DEPENDS:=+libev +libinterapcomm +libubus +libubox | ||||||
|   CATEGORY:=Base system |   CATEGORY:=Base system | ||||||
|   TITLE:=Access Point Coordinator |   TITLE:=Access Point Coordinator | ||||||
| endef | endef | ||||||
| @@ -33,5 +33,11 @@ endef | |||||||
| define Package/apc/install | define Package/apc/install | ||||||
| 	$(INSTALL_DIR) $(1)/usr/bin | 	$(INSTALL_DIR) $(1)/usr/bin | ||||||
| 	$(INSTALL_DATA) $(PKG_BUILD_DIR)/apc $(1)/usr/bin | 	$(INSTALL_DATA) $(PKG_BUILD_DIR)/apc $(1)/usr/bin | ||||||
|  | 	chmod 0700 $(1)/usr/bin/apc | ||||||
|  | 	$(INSTALL_DIR) $(1)/etc/init.d | ||||||
|  | 	$(INSTALL_BIN) ./files/apc.init $(1)/etc/init.d/apc | ||||||
|  | 	$(INSTALL_DIR) $(1)/etc/config | ||||||
|  | 	$(INSTALL_BIN) ./files/apc.config $(1)/etc/config/apc | ||||||
|  |  | ||||||
| endef | endef | ||||||
| $(eval $(call BuildPackage,apc)) | $(eval $(call BuildPackage,apc)) | ||||||
|   | |||||||
							
								
								
									
										0
									
								
								feeds/wlan-ap/apc/files/apc.config
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										0
									
								
								feeds/wlan-ap/apc/files/apc.config
									
									
									
									
									
										Normal file
									
								
							
							
								
								
									
										20
									
								
								feeds/wlan-ap/apc/files/apc.init
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										20
									
								
								feeds/wlan-ap/apc/files/apc.init
									
									
									
									
									
										Normal file
									
								
							| @@ -0,0 +1,20 @@ | |||||||
|  | #!/bin/sh /etc/rc.common | ||||||
|  |  | ||||||
|  | USE_PROCD=1 | ||||||
|  | START=40 | ||||||
|  | STOP=40 | ||||||
|  |  | ||||||
|  | PROG="/usr/bin/apc" | ||||||
|  |  | ||||||
|  | start_service() { | ||||||
|  |     procd_open_instance | ||||||
|  |     echo "Starting APC" | ||||||
|  |     procd_set_param command ${PROG} | ||||||
|  |     procd_set_param respawn | ||||||
|  |     procd_close_instance | ||||||
|  | } | ||||||
|  |  | ||||||
|  | stop_service() { | ||||||
|  |     echo "Killing APC" | ||||||
|  |     killall -s SIGTERM apc | ||||||
|  | } | ||||||
| @@ -3,19 +3,21 @@ srcdir ?= . | |||||||
| VPATH ?= $(srcdir)/src | VPATH ?= $(srcdir)/src | ||||||
|  |  | ||||||
|  |  | ||||||
| LIBS = -lpthread -lrt -linterapcomm -lev | LIBS = -lpthread -lrt -linterapcomm -lev -lubus -lubox | ||||||
| $(call output,usr/sbin/wc-apc) | $(call output,usr/sbin/wc-apc) | ||||||
|  |  | ||||||
| CFLAGS += -I./include/ \ | CFLAGS += -I./include/ \ | ||||||
| 	-I../include/ | 	-I../include/ | ||||||
|  |  | ||||||
|  | CFLAGS += -DUBUS_SUPPORT | ||||||
|  |  | ||||||
| CFLAGS  += -Wall -g | CFLAGS  += -Wall -g | ||||||
| CFLAGS += -MMD -Wall -g -Wpointer-arith -Wcast-qual -Wshadow \ | CFLAGS += -MMD -Wall -g -Wpointer-arith -Wcast-qual -Wshadow \ | ||||||
| 				-Waggregate-return -Wnested-externs -Wstrict-prototypes \ | 				-Waggregate-return -Wnested-externs -Wstrict-prototypes \ | ||||||
| 				-fno-omit-frame-pointer -g -rdynamic -fexceptions -funwind-tables -funsigned-char | 				-fno-omit-frame-pointer -g -rdynamic -fexceptions -funwind-tables -funsigned-char | ||||||
|  |  | ||||||
| OBJS := apc_main.o \ | OBJS := apc_main.o \ | ||||||
|                hello.o iface.o neighbor.o apc.o |                hello.o iface.o neighbor.o apc.o ubus.o | ||||||
|  |  | ||||||
| all: apc | all: apc | ||||||
|  |  | ||||||
|   | |||||||
| @@ -262,6 +262,8 @@ struct apc_neighbor | |||||||
| #define APC_IS_DROTHER 4   /* I'm on BCAST or NBMA and I'm not DR */ | #define APC_IS_DROTHER 4   /* I'm on BCAST or NBMA and I'm not DR */ | ||||||
| #define APC_IS_BACKUP  5   /* I'm BDR */ | #define APC_IS_BACKUP  5   /* I'm BDR */ | ||||||
| #define APC_IS_DR      6   /* I'm DR */ | #define APC_IS_DR      6   /* I'm DR */ | ||||||
|  | #define APC_MAX_MODE   7 | ||||||
|  |  | ||||||
|  |  | ||||||
| /* Definitions for interface state machine */ | /* Definitions for interface state machine */ | ||||||
| #define ISM_UP      0   /* Interface Up */ | #define ISM_UP      0   /* Interface Up */ | ||||||
|   | |||||||
| @@ -30,4 +30,9 @@ static inline timer * tm_new_set( void (*hook)(struct _timer *), void *data, uns | |||||||
|     return t; |     return t; | ||||||
| } | } | ||||||
|  |  | ||||||
|  | static inline void tm_free(timer *t) | ||||||
|  | { | ||||||
|  |     free(t); | ||||||
|  | } | ||||||
|  |  | ||||||
| #endif | #endif | ||||||
|   | |||||||
							
								
								
									
										22
									
								
								feeds/wlan-ap/apc/src/include/ubus.h
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										22
									
								
								feeds/wlan-ap/apc/src/include/ubus.h
									
									
									
									
									
										Normal file
									
								
							| @@ -0,0 +1,22 @@ | |||||||
|  | /* | ||||||
|  |  * netifd - network interface daemon | ||||||
|  |  * Copyright (C) 2012 Felix Fietkau <nbd@openwrt.org> | ||||||
|  |  * | ||||||
|  |  * This program is free software; you can redistribute it and/or modify | ||||||
|  |  * it under the terms of the GNU General Public License version 2 | ||||||
|  |  * as published by the Free Software Foundation | ||||||
|  |  * | ||||||
|  |  * This program is distributed in the hope that it will be useful, | ||||||
|  |  * but WITHOUT ANY WARRANTY; without even the implied warranty of | ||||||
|  |  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the | ||||||
|  |  * GNU General Public License for more details. | ||||||
|  |  */ | ||||||
|  | #ifndef __NETIFD_UBUS_H | ||||||
|  | #define __NETIFD_UBUS_H | ||||||
|  |  | ||||||
|  | extern struct ubus_context *ubus_ctx; | ||||||
|  |  | ||||||
|  | int ubus_init(); | ||||||
|  | void ubus_done(void); | ||||||
|  |  | ||||||
|  | #endif | ||||||
| @@ -26,7 +26,8 @@ static void apc_dump( struct proto * P ) | |||||||
| static struct proto * apc_init(struct proto_config * c) | static struct proto * apc_init(struct proto_config * c) | ||||||
| { | { | ||||||
| 	struct proto * P = mb_allocz(sizeof(struct apc_proto)); | 	struct proto * P = mb_allocz(sizeof(struct apc_proto)); | ||||||
| 	 |  | ||||||
|  | 	printf("apc_init\n"); | ||||||
| 	P->cf = c; | 	P->cf = c; | ||||||
| 	P->debug = c->debug; | 	P->debug = c->debug; | ||||||
| 	P->mrtdump = c->mrtdump; | 	P->mrtdump = c->mrtdump; | ||||||
|   | |||||||
| @@ -21,9 +21,11 @@ | |||||||
| #include <nest/apcn.h> | #include <nest/apcn.h> | ||||||
| #include <apc.h> | #include <apc.h> | ||||||
| #include <protocol.h> | #include <protocol.h> | ||||||
|  | #include <ubus.h> | ||||||
|  |  | ||||||
| static ev_io iac_io; | #include <libubus.h> | ||||||
| static ev_timer  check_timer; | static struct uloop_timeout check_timer; | ||||||
|  | static void check_timer_handler(struct uloop_timeout *timeout); | ||||||
| static unsigned int CheckIp; | static unsigned int CheckIp; | ||||||
| static int CheckCount; | static int CheckCount; | ||||||
|  |  | ||||||
| @@ -228,8 +230,7 @@ int set_socket(void) | |||||||
| /*************************************/ | /*************************************/ | ||||||
|  |  | ||||||
|  |  | ||||||
| static void check_timer_handler(struct ev_loop *loop, ev_timer *timer, | static void check_timer_handler(struct uloop_timeout *timeout) | ||||||
| 				 int revents)  |  | ||||||
| { | { | ||||||
| 	timers_go(); | 	timers_go(); | ||||||
| 	if (WaitingToReelect) | 	if (WaitingToReelect) | ||||||
| @@ -252,29 +253,56 @@ static void check_timer_handler(struct ev_loop *loop, ev_timer *timer, | |||||||
| 		if (CheckIp && (MyIpAddr != CheckIp)) | 		if (CheckIp && (MyIpAddr != CheckIp)) | ||||||
| 		{ | 		{ | ||||||
| 			printf("IP address changed from %x to %x - restart APC election\n", MyIpAddr, CheckIp); | 			printf("IP address changed from %x to %x - restart APC election\n", MyIpAddr, CheckIp); | ||||||
|  | 			system("/usr/opensync/bin/ovsh u APC_State dr_addr:=0.0.0.0 bdr_addr:=0.0.0.0 enabled:=false mode:=NC"); | ||||||
|  | 			uloop_done(); | ||||||
|  | 			ubus_done(); | ||||||
|  | 			interap_rcv_close(); | ||||||
| 			exit(0); | 			exit(0); | ||||||
| 		} | 		} | ||||||
| 		 | 		 | ||||||
| 		CheckCount = 0; | 		CheckCount = 0; | ||||||
| 		if (ApcSpecSaved.IsApc == I_AM_APC) |  | ||||||
| 		{ |  | ||||||
| 		//Radius stuff |  | ||||||
| 		} |  | ||||||
| 	} | 	} | ||||||
|  |  | ||||||
|  | 	uloop_timeout_set(&check_timer, 1000); | ||||||
|  | 	uloop_timeout_add(&check_timer); | ||||||
|  |  | ||||||
| } | } | ||||||
|  |  | ||||||
|  | static void handle_signal(int signo) | ||||||
|  | { | ||||||
|  | 	uloop_done(); | ||||||
|  | 	ubus_done(); | ||||||
|  | 	interap_rcv_close(); | ||||||
|  | 	system("/usr/opensync/bin/ovsh u APC_State dr_addr:=0.0.0.0 bdr_addr:=0.0.0.0 enabled:=false mode:=NC"); | ||||||
|  | } | ||||||
|  |  | ||||||
|  | static void set_signals(void) | ||||||
|  | { | ||||||
|  | 	struct sigaction s; | ||||||
|  |  | ||||||
|  | 	memset(&s, 0, sizeof(s)); | ||||||
|  | 	s.sa_handler = handle_signal; | ||||||
|  | 	s.sa_flags = 0; | ||||||
|  | 	sigaction(SIGINT, &s, NULL); | ||||||
|  | 	sigaction(SIGTERM, &s, NULL); | ||||||
|  | 	sigaction(SIGPIPE, &s, NULL); | ||||||
|  | } | ||||||
|  |  | ||||||
|  | extern struct ubus_context *ubus_ctx; | ||||||
|  |  | ||||||
| int main(int argc, char *const* argv) | int main(int argc, char *const* argv) | ||||||
| { | { | ||||||
| 	struct proto_config c; | 	struct proto_config c; | ||||||
| 	struct proto * apc_proto; | 	struct proto * apc_proto; | ||||||
| 	struct ev_loop *loop = EV_DEFAULT; | 	uloop_init(); | ||||||
|  | 	/*init term signals*/ | ||||||
|  | 	set_signals(); | ||||||
|  |  | ||||||
| 	/*Socket*/ | 	/*Socket*/ | ||||||
| 	set_socket(); | 	set_socket(); | ||||||
|  |  | ||||||
| 	/*Radius stuff*/ | 	/*Radius stuff*/ | ||||||
|  |  | ||||||
| 	printf("Basic MAC\n"); |  | ||||||
| 	memset(MyBasicMac, 0, 6); | 	memset(MyBasicMac, 0, 6); | ||||||
| 	if (get_mac_addr("br-wan", MyBasicMac) == 0) { | 	if (get_mac_addr("br-wan", MyBasicMac) == 0) { | ||||||
| 		printf("APC: br-wan mac:%02X:%02X:%02X:%02X:%02X:%02X\n", | 		printf("APC: br-wan mac:%02X:%02X:%02X:%02X:%02X:%02X\n", | ||||||
| @@ -291,6 +319,7 @@ int main(int argc, char *const* argv) | |||||||
|  |  | ||||||
| 	/*get local ip of br-wan*/ | 	/*get local ip of br-wan*/ | ||||||
| 	MyIpAddr = 0; | 	MyIpAddr = 0; | ||||||
|  | 	printf("Getting br-wan IP\n"); | ||||||
| 	while(1) | 	while(1) | ||||||
| 	{ | 	{ | ||||||
| 		GetLocalIpv4Addr((unsigned char *)&MyIpAddr, "br-wan"); | 		GetLocalIpv4Addr((unsigned char *)&MyIpAddr, "br-wan"); | ||||||
| @@ -303,9 +332,13 @@ int main(int argc, char *const* argv) | |||||||
|  |  | ||||||
| 	/*listening interAP*/ | 	/*listening interAP*/ | ||||||
| 	callback cb = receive_from_socket; | 	callback cb = receive_from_socket; | ||||||
|  |  | ||||||
| 	if (interap_recv(IAC_APC_ELECTION_PORT, cb, 1000, | 	if (interap_recv(IAC_APC_ELECTION_PORT, cb, 1000, | ||||||
| 			 loop, &iac_io) < 0) | 			 NULL, NULL) < 0) { | ||||||
| 		printf("Error: Failed InterAP receive"); | 		printf("Error: Failed InterAP receive"); | ||||||
|  | 		return 1; | ||||||
|  | 	} | ||||||
|  |  | ||||||
|  |  | ||||||
| 	memset(Timers, 0, sizeof(Timers)); | 	memset(Timers, 0, sizeof(Timers)); | ||||||
| 	 | 	 | ||||||
| @@ -319,11 +352,15 @@ int main(int argc, char *const* argv) | |||||||
| 	ApcProto = (struct apc_proto *)apc_proto; | 	ApcProto = (struct apc_proto *)apc_proto; | ||||||
| 	proto_apc.start(apc_proto); | 	proto_apc.start(apc_proto); | ||||||
|  |  | ||||||
| 	ev_timer_init(&check_timer, check_timer_handler, 1, 1); | 	check_timer.cb = check_timer_handler; | ||||||
|  | 	uloop_timeout_set(&check_timer, 1000); | ||||||
|  | 	uloop_timeout_add(&check_timer); | ||||||
|  |  | ||||||
| 	ev_timer_start(loop, &check_timer); | 	ubus_init(); | ||||||
|  | 	uloop_run(); | ||||||
| 	ev_run(loop, 0); | 	uloop_done(); | ||||||
|  | 	ubus_done(); | ||||||
|  | 	interap_rcv_close(); | ||||||
|  |  | ||||||
| 	return(1); | 	return(1); | ||||||
| } | } | ||||||
|   | |||||||
| @@ -103,6 +103,7 @@ void apc_send_hello(struct apc_iface * ifa, int kind ) | |||||||
| 	struct apc_hello2_packet ps; | 	struct apc_hello2_packet ps; | ||||||
| 	unsigned int length, report = 0; | 	unsigned int length, report = 0; | ||||||
| 	struct apc_spec ApcSpec; | 	struct apc_spec ApcSpec; | ||||||
|  | 	char dst_ip[16]; | ||||||
| 	 | 	 | ||||||
| 	if (WaitingToReelect ) | 	if (WaitingToReelect ) | ||||||
| 		return; | 		return; | ||||||
| @@ -188,8 +189,11 @@ void apc_send_hello(struct apc_iface * ifa, int kind ) | |||||||
| 			else | 			else | ||||||
| 				ApcSpec.FloatIp = ApcSpecSaved.FloatIp; | 				ApcSpec.FloatIp = ApcSpecSaved.FloatIp; | ||||||
| 		} | 		} | ||||||
| 		else | 		else if (ApcSpec.IsApc == I_AM_BAPC ) | ||||||
| 		{ | 		{ | ||||||
|  | 			ifa->priority = 0x12; | ||||||
|  | 		} | ||||||
|  | 		else { | ||||||
| 			ifa->priority = 0x11; | 			ifa->priority = 0x11; | ||||||
| 			if ((ApcSpecSaved.IsApc == I_AM_APC) || BackingUpRadius ) | 			if ((ApcSpecSaved.IsApc == I_AM_APC) || BackingUpRadius ) | ||||||
| 			{ | 			{ | ||||||
| @@ -202,8 +206,7 @@ void apc_send_hello(struct apc_iface * ifa, int kind ) | |||||||
|  |  | ||||||
| 	length += i * sizeof(u32); | 	length += i * sizeof(u32); | ||||||
|  |  | ||||||
| 	printf("HELLO packet sent via %s\n", ifa->ifname ); | 	printf("HELLO packet sent via  %s\n", ifa->ifname ); | ||||||
| 	char *dst_ip = malloc(16); |  | ||||||
| 	memset(dst_ip, 0, 16); | 	memset(dst_ip, 0, 16); | ||||||
| 	if ((get_current_ip(dst_ip, IAC_IFACE)) < 0) { | 	if ((get_current_ip(dst_ip, IAC_IFACE)) < 0) { | ||||||
| 		printf("Error: Cannot get IP for %s", IAC_IFACE); | 		printf("Error: Cannot get IP for %s", IAC_IFACE); | ||||||
|   | |||||||
| @@ -65,7 +65,7 @@ void apc_iface_chstate(struct apc_iface * ifa, u8 state) | |||||||
| 	 | 	 | ||||||
| 	if (state == oldstate) | 	if (state == oldstate) | ||||||
| 		return; | 		return; | ||||||
| 	 |  | ||||||
| 	printf("Interface %s changed state from %s to %s\n", | 	printf("Interface %s changed state from %s to %s\n", | ||||||
| 		ifa->ifname, apc_is_names[oldstate], apc_is_names[state]); | 		ifa->ifname, apc_is_names[oldstate], apc_is_names[state]); | ||||||
| 	 | 	 | ||||||
| @@ -168,7 +168,7 @@ void apc_iface_new( void ) | |||||||
| 	ifa->priority = 0x11; | 	ifa->priority = 0x11; | ||||||
| 	ifa->drip = MyIpAddr; | 	ifa->drip = MyIpAddr; | ||||||
| 	ifa->helloint = 4; | 	ifa->helloint = 4; | ||||||
| 	ifa->deadint = 16; | 	ifa->deadint = 12; | ||||||
| 	ifa->waitint = 16; | 	ifa->waitint = 16; | ||||||
| 	 | 	 | ||||||
| 	ifa->type = APC_IT_BCAST; | 	ifa->type = APC_IT_BCAST; | ||||||
|   | |||||||
| @@ -33,11 +33,10 @@ reset_lists(struct apc_proto *p, struct apc_neighbor *n) | |||||||
| { | { | ||||||
| } | } | ||||||
|  |  | ||||||
|  |  | ||||||
| struct apc_neighbor * apc_neighbor_new(struct apc_iface * ifa) | struct apc_neighbor * apc_neighbor_new(struct apc_iface * ifa) | ||||||
| { | { | ||||||
| 	struct apc_neighbor * n = mb_allocz(sizeof(struct apc_neighbor)); | 	struct apc_neighbor * n = mb_allocz(sizeof(struct apc_neighbor)); | ||||||
| 	 | 	printf("apc_new_neighbor\n");	 | ||||||
| 	n->ifa = ifa; | 	n->ifa = ifa; | ||||||
| 	add_tail(&ifa->neigh_list, NODE n); | 	add_tail(&ifa->neigh_list, NODE n); | ||||||
| 	n->adj = 0; | 	n->adj = 0; | ||||||
| @@ -52,7 +51,6 @@ struct apc_neighbor * apc_neighbor_new(struct apc_iface * ifa) | |||||||
| 	return(n); | 	return(n); | ||||||
| } | } | ||||||
|  |  | ||||||
|  |  | ||||||
| static void apc_neigh_down(struct apc_neighbor * n) | static void apc_neigh_down(struct apc_neighbor * n) | ||||||
| { | { | ||||||
| 	struct apc_iface * ifa = n->ifa; | 	struct apc_iface * ifa = n->ifa; | ||||||
| @@ -60,9 +58,10 @@ static void apc_neigh_down(struct apc_neighbor * n) | |||||||
| 	rem_node(NODE n); | 	rem_node(NODE n); | ||||||
| 	 | 	 | ||||||
| 	printf("Neighbor %x on %s removed", n->rid, ifa->ifname ); | 	printf("Neighbor %x on %s removed", n->rid, ifa->ifname ); | ||||||
|  | 	tm_free(n->inactim); | ||||||
|  | 	mb_free(n); | ||||||
| } | } | ||||||
|  |  | ||||||
|  |  | ||||||
| /** | /** | ||||||
|  * apc_neigh_chstate - handles changes related to new or lod state of neighbor |  * apc_neigh_chstate - handles changes related to new or lod state of neighbor | ||||||
|  * @n: APC neighbor |  * @n: APC neighbor | ||||||
| @@ -81,7 +80,8 @@ static void apc_neigh_chstate(struct apc_neighbor * n, u8 state) | |||||||
| 		return; | 		return; | ||||||
| 	 | 	 | ||||||
| 	printf("Neighbor %x on %s changed state from %s to %s\n", | 	printf("Neighbor %x on %s changed state from %s to %s\n", | ||||||
| 	                n->rid, ifa->ifname, apc_ns_names[old_state], apc_ns_names[state] ); | 	                n->rid, ifa->ifname, apc_ns_names[old_state], | ||||||
|  | 			apc_ns_names[state]); | ||||||
| 	 | 	 | ||||||
| 	n->state = state; | 	n->state = state; | ||||||
|  |  | ||||||
| @@ -121,7 +121,6 @@ static void apc_neigh_chstate(struct apc_neighbor * n, u8 state) | |||||||
| 		apc_iface_sm(ifa, ISM_NEICH); | 		apc_iface_sm(ifa, ISM_NEICH); | ||||||
| } | } | ||||||
|  |  | ||||||
|  |  | ||||||
| /** | /** | ||||||
|  * apc_neigh_sm - apc neighbor state machine |  * apc_neigh_sm - apc neighbor state machine | ||||||
|  * @n: neighor |  * @n: neighor | ||||||
| @@ -218,7 +217,6 @@ void apc_neigh_sm(struct apc_neighbor * n, int event) | |||||||
| 	} | 	} | ||||||
| } | } | ||||||
|  |  | ||||||
|  |  | ||||||
| static int can_do_adj(struct apc_neighbor * n) | static int can_do_adj(struct apc_neighbor * n) | ||||||
| { | { | ||||||
| 	struct apc_iface * ifa = n->ifa; | 	struct apc_iface * ifa = n->ifa; | ||||||
| @@ -257,13 +255,11 @@ static int can_do_adj(struct apc_neighbor * n) | |||||||
| 	return i; | 	return i; | ||||||
| } | } | ||||||
|  |  | ||||||
|  |  | ||||||
| static inline u32 neigh_get_id(struct apc_proto *p, struct apc_neighbor *n) | static inline u32 neigh_get_id(struct apc_proto *p, struct apc_neighbor *n) | ||||||
| { | { | ||||||
| 	return ipa_to_u32(n->ip); | 	return ipa_to_u32(n->ip); | ||||||
| } | } | ||||||
|  |  | ||||||
|  |  | ||||||
| static struct apc_neighbor * elect_bdr( struct apc_proto * p, list nl) | static struct apc_neighbor * elect_bdr( struct apc_proto * p, list nl) | ||||||
| { | { | ||||||
|     struct apc_neighbor *neigh, *n1, *n2; |     struct apc_neighbor *neigh, *n1, *n2; | ||||||
| @@ -271,7 +267,7 @@ static struct apc_neighbor * elect_bdr( struct apc_proto * p, list nl) | |||||||
|  |  | ||||||
|     n1 = NULL; |     n1 = NULL; | ||||||
|     n2 = NULL; |     n2 = NULL; | ||||||
|     WALK_LIST( neigh, nl )                      /* First try those decl. themselves */ |     WALK_LIST( neigh, nl )                /* First try those decl. themselves */ | ||||||
|     { |     { | ||||||
|         nid = neigh_get_id( p, neigh ); |         nid = neigh_get_id( p, neigh ); | ||||||
|  |  | ||||||
| @@ -317,7 +313,6 @@ static struct apc_neighbor * elect_bdr( struct apc_proto * p, list nl) | |||||||
|     return( n1 ); |     return( n1 ); | ||||||
| } | } | ||||||
|  |  | ||||||
|  |  | ||||||
| static struct apc_neighbor * elect_dr( struct apc_proto * p, list nl ) | static struct apc_neighbor * elect_dr( struct apc_proto * p, list nl ) | ||||||
| { | { | ||||||
|     struct apc_neighbor *neigh, *n; |     struct apc_neighbor *neigh, *n; | ||||||
| @@ -351,7 +346,6 @@ static struct apc_neighbor * elect_dr( struct apc_proto * p, list nl ) | |||||||
|     return( n ); |     return( n ); | ||||||
| } | } | ||||||
|  |  | ||||||
|  |  | ||||||
| /** | /** | ||||||
|  * apc_dr_election - (Backup) Designed Router election |  * apc_dr_election - (Backup) Designed Router election | ||||||
|  * @ifa: actual interface |  * @ifa: actual interface | ||||||
| @@ -450,7 +444,6 @@ void apc_dr_election(struct apc_iface * ifa) | |||||||
| 	} | 	} | ||||||
| } | } | ||||||
|  |  | ||||||
|  |  | ||||||
| struct apc_neighbor * find_neigh_by_ip(struct apc_iface * ifa, ip_addr ip) | struct apc_neighbor * find_neigh_by_ip(struct apc_iface * ifa, ip_addr ip) | ||||||
| { | { | ||||||
| 	struct apc_neighbor * n; | 	struct apc_neighbor * n; | ||||||
| @@ -463,7 +456,6 @@ struct apc_neighbor * find_neigh_by_ip(struct apc_iface * ifa, ip_addr ip) | |||||||
| 	return NULL; | 	return NULL; | ||||||
| } | } | ||||||
|  |  | ||||||
|  |  | ||||||
| static void inactivity_timer_hook(struct _timer * tmr) | static void inactivity_timer_hook(struct _timer * tmr) | ||||||
| { | { | ||||||
| 	struct apc_neighbor * n = (struct apc_neighbor *) tmr->data; | 	struct apc_neighbor * n = (struct apc_neighbor *) tmr->data; | ||||||
| @@ -490,13 +482,17 @@ static void inactivity_timer_hook(struct _timer * tmr) | |||||||
| 			n_neigh += 1; | 			n_neigh += 1; | ||||||
| 			//Radius stuff | 			//Radius stuff | ||||||
| 			BackingUpRadius = 1; | 			BackingUpRadius = 1; | ||||||
|  | 			apc_ifa->priority = 0x33; | ||||||
| 		} | 		} | ||||||
|  | 		else | ||||||
|  | 			apc_ifa->priority = 0x11; | ||||||
|  |  | ||||||
|  |  | ||||||
| 		apc_ifa->drip = MyIpAddr; | 		apc_ifa->drip = MyIpAddr; | ||||||
| 		apc_ifa->priority = 0x11; |  | ||||||
| 		apc_ifa->bdrip = 0; | 		apc_ifa->bdrip = 0; | ||||||
| 		memset(&ApcSpec, 0, sizeof(struct apc_spec)); | 		memset(&ApcSpec, 0, sizeof(struct apc_spec)); | ||||||
| 		WaitingToReelect = 12; | 		WaitingToReelect = 3; | ||||||
|  |  | ||||||
| 		return; | 		return; | ||||||
| 	} | 	} | ||||||
| 	printf("Inactivity timer expired for nbr %x on %s", n->rid,  | 	printf("Inactivity timer expired for nbr %x on %s", n->rid,  | ||||||
|   | |||||||
							
								
								
									
										211
									
								
								feeds/wlan-ap/apc/src/src/ubus.c
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										211
									
								
								feeds/wlan-ap/apc/src/src/ubus.c
									
									
									
									
									
										Normal file
									
								
							| @@ -0,0 +1,211 @@ | |||||||
|  | /* SPDX-License-Identifier: BSD-3-Clause */ | ||||||
|  | #define _GNU_SOURCE | ||||||
|  |  | ||||||
|  | #include <arpa/inet.h> | ||||||
|  | #include <string.h> | ||||||
|  | #include <stdio.h> | ||||||
|  | #include <ev.h> | ||||||
|  | #include "ubus.h" | ||||||
|  | #include <libubus.h> | ||||||
|  | #include <libubox/blobmsg.h> | ||||||
|  | #include <apc.h> | ||||||
|  | #include <libubox/uloop.h> | ||||||
|  |  | ||||||
|  | struct ubus_context *ubus_ctx = NULL; | ||||||
|  | static struct blob_buf b; | ||||||
|  | static struct blob_buf nb; | ||||||
|  | timer *notify_timer; | ||||||
|  | extern struct apc_iface * apc_ifa; | ||||||
|  | /* Mandatorily Notify APC_State period */ | ||||||
|  | #define APC_NOTIFY_INTERVAL 10 | ||||||
|  | /* Check if any change in APC State and notify period */ | ||||||
|  | #define APC_NOTIFY_CHECK 1 | ||||||
|  | static ip_addr old_drip; | ||||||
|  | static ip_addr old_bdrip; | ||||||
|  | static u8 old_state; | ||||||
|  | static unsigned int ucount = 0; | ||||||
|  |  | ||||||
|  | struct apc_state { | ||||||
|  | 	char mode[4]; | ||||||
|  | 	char dr_addr[17]; | ||||||
|  | 	char bdr_addr[17]; | ||||||
|  | 	bool enabled; | ||||||
|  | } state; | ||||||
|  |  | ||||||
|  | static int | ||||||
|  | apc_info_handle(struct ubus_context *ctx, struct ubus_object *obj, | ||||||
|  | 			  struct ubus_request_data *req, const char *method, | ||||||
|  | 			  struct blob_attr *msg); | ||||||
|  |  | ||||||
|  | static void ubus_reconnect_timer(struct uloop_timeout *timeout); | ||||||
|  | static struct uloop_timeout reconnect = { | ||||||
|  | 	.cb = ubus_reconnect_timer, | ||||||
|  | }; | ||||||
|  |  | ||||||
|  | static void ubus_reconnect_timer(struct uloop_timeout *timeout) | ||||||
|  | { | ||||||
|  |         if (ubus_reconnect(ubus_ctx, NULL) != 0) { | ||||||
|  |                 printf("APC ubus failed to reconnect\n"); | ||||||
|  |                 uloop_timeout_set(&reconnect, 2000); | ||||||
|  |                 return; | ||||||
|  |         } | ||||||
|  |  | ||||||
|  |         printf("APC ubus reconnected\n"); | ||||||
|  | #ifdef FD_CLOEXEC | ||||||
|  | 	fcntl(ubus_ctx->sock.fd, F_SETFD, | ||||||
|  | 	      fcntl(ubus_ctx->sock.fd, F_GETFD) | FD_CLOEXEC); | ||||||
|  | #endif | ||||||
|  | } | ||||||
|  |  | ||||||
|  | static void ubus_connection_lost(struct ubus_context *ctx) | ||||||
|  | { | ||||||
|  | 	printf("APC ubus connection lost\n"); | ||||||
|  |         ubus_reconnect_timer(NULL); | ||||||
|  | } | ||||||
|  |  | ||||||
|  | static const struct blobmsg_policy apc_policy = { | ||||||
|  | 	.name = "info", | ||||||
|  | 	.type = BLOBMSG_TYPE_STRING, | ||||||
|  | }; | ||||||
|  |  | ||||||
|  | static struct ubus_method apc_object_methods[] = { | ||||||
|  | 	UBUS_METHOD_NOARG("info", apc_info_handle), | ||||||
|  | }; | ||||||
|  |  | ||||||
|  | static struct ubus_object_type apc_object_type = | ||||||
|  | 	UBUS_OBJECT_TYPE("apc", apc_object_methods); | ||||||
|  |  | ||||||
|  | static struct ubus_object apc_object = { | ||||||
|  | 	.name = "apc", | ||||||
|  | 	.type = &apc_object_type, | ||||||
|  | 	.methods = apc_object_methods, | ||||||
|  | 	.n_methods = ARRAY_SIZE(apc_object_methods), | ||||||
|  | }; | ||||||
|  |  | ||||||
|  | static int | ||||||
|  | apc_info_handle(struct ubus_context *ctx, struct ubus_object *obj, | ||||||
|  | 			  struct ubus_request_data *req, const char *method, | ||||||
|  | 			  struct blob_attr *msg) | ||||||
|  | { | ||||||
|  | 	blob_buf_init(&b, 0); | ||||||
|  | 	blobmsg_add_string(&b, "mode", state.mode); | ||||||
|  | 	blobmsg_add_string(&b, "dr_addr", state.dr_addr); | ||||||
|  | 	blobmsg_add_string(&b, "bdr_addr", state.bdr_addr); | ||||||
|  | 	blobmsg_add_u8(&b, "enabled", state.enabled); | ||||||
|  |  | ||||||
|  | 	ubus_notify(ctx, &apc_object, "apc", b.head, -1); | ||||||
|  | 	ubus_send_event(ctx, "apc", b.head); | ||||||
|  | 	ubus_send_reply(ctx, req, b.head); | ||||||
|  |  | ||||||
|  | 	return 0; | ||||||
|  | } | ||||||
|  |  | ||||||
|  | static char apc_mode[APC_MAX_MODE][8] = {"DOWN", "LOOP", "WT", "PTP", "OR", "BDR", "DR"}; | ||||||
|  | int apc_update_state(void) | ||||||
|  | { | ||||||
|  | 	struct in_addr dr_addr; | ||||||
|  | 	struct in_addr bdr_addr; | ||||||
|  | 	ip_addr cur_drip; | ||||||
|  | 	ip_addr cur_bdrip; | ||||||
|  | 	u8 cur_state; | ||||||
|  |  | ||||||
|  | 	cur_drip = apc_ifa->drip; | ||||||
|  | 	cur_bdrip = apc_ifa->bdrip; | ||||||
|  | 	cur_state = apc_ifa->state; | ||||||
|  | 	ucount++; | ||||||
|  |  | ||||||
|  | 	if (cur_drip == old_drip && | ||||||
|  | 	    cur_bdrip == old_bdrip && | ||||||
|  | 	    cur_state == old_state && ucount < APC_NOTIFY_INTERVAL) { | ||||||
|  | 		return -1; | ||||||
|  | 	} | ||||||
|  |  | ||||||
|  | 	printf("APC State update %u", ucount); | ||||||
|  | 	ucount = 0; | ||||||
|  |  | ||||||
|  | 	dr_addr.s_addr = htonl(cur_drip); | ||||||
|  | 	bdr_addr.s_addr = htonl(cur_bdrip); | ||||||
|  |  | ||||||
|  | 	state.enabled = true; | ||||||
|  | 	if ((cur_state == APC_IS_DR) || | ||||||
|  | 	    (cur_state == APC_IS_BACKUP) || | ||||||
|  | 	    (cur_state == APC_IS_DROTHER)) { | ||||||
|  | 		snprintf(state.mode, sizeof(state.mode), "%s", | ||||||
|  | 			 &apc_mode[cur_state][0]); | ||||||
|  | 		snprintf(state.dr_addr, sizeof(state.dr_addr), | ||||||
|  | 			 "%s", inet_ntoa(dr_addr)); | ||||||
|  | 		snprintf(state.bdr_addr, sizeof(state.bdr_addr), | ||||||
|  | 			 "%s", inet_ntoa(bdr_addr)); | ||||||
|  | 	} else if (apc_ifa->state == APC_IS_WAITING) { | ||||||
|  | 		snprintf(state.mode, sizeof(state.mode), "%s", | ||||||
|  | 			 &apc_mode[cur_state][0]); | ||||||
|  | 		snprintf(state.dr_addr, sizeof(state.dr_addr), "0.0.0.0"); | ||||||
|  | 		snprintf(state.bdr_addr, sizeof(state.bdr_addr), "0.0.0.0"); | ||||||
|  | 	} else { | ||||||
|  | 		snprintf(state.mode, sizeof(state.mode), "NC"); | ||||||
|  | 		snprintf(state.dr_addr, sizeof(state.dr_addr), "0.0.0.0"); | ||||||
|  | 		snprintf(state.bdr_addr, sizeof(state.bdr_addr), "0.0.0.0"); | ||||||
|  | 	} | ||||||
|  |  | ||||||
|  | 	old_drip = cur_drip; | ||||||
|  | 	old_bdrip = cur_bdrip; | ||||||
|  | 	old_state = cur_state; | ||||||
|  |  | ||||||
|  | 	return 0; | ||||||
|  | } | ||||||
|  |  | ||||||
|  | void apc_send_notification(struct _timer * tmr) | ||||||
|  | { | ||||||
|  | 	int ustate = 0; | ||||||
|  |  | ||||||
|  | 	ustate = apc_update_state(); | ||||||
|  | 	if(ustate != 0) | ||||||
|  | 		return; | ||||||
|  |  | ||||||
|  | 	printf("APC send ubus notification\n"); | ||||||
|  | 	blob_buf_init(&nb, 0); | ||||||
|  | 	blobmsg_add_string(&nb, "mode", state.mode); | ||||||
|  | 	blobmsg_add_string(&nb, "dr_addr", state.dr_addr); | ||||||
|  | 	blobmsg_add_string(&nb, "bdr_addr", state.bdr_addr); | ||||||
|  | 	blobmsg_add_u8(&nb, "enabled", state.enabled); | ||||||
|  | 	ubus_notify(ubus_ctx, &apc_object, "apc", nb.head, -1); | ||||||
|  | } | ||||||
|  |  | ||||||
|  | static void add_object(struct ubus_object *obj) | ||||||
|  | { | ||||||
|  | 	int ret = ubus_add_object(ubus_ctx, obj); | ||||||
|  |  | ||||||
|  | 	if (ret != 0) | ||||||
|  | 		fprintf(stderr, "Add object fail '%s': %s\n", | ||||||
|  | 			obj->name, ubus_strerror(ret)); | ||||||
|  | } | ||||||
|  |  | ||||||
|  | int | ||||||
|  | ubus_init(void) { | ||||||
|  | 	ubus_ctx = ubus_connect(NULL); | ||||||
|  | 	if (!ubus_ctx) | ||||||
|  | 		return -EIO; | ||||||
|  |  | ||||||
|  | 	ubus_add_uloop(ubus_ctx); | ||||||
|  | #ifdef FD_CLOEXEC | ||||||
|  | 	fcntl(ubus_ctx->sock.fd, F_SETFD, | ||||||
|  | 	      fcntl(ubus_ctx->sock.fd, F_GETFD) | FD_CLOEXEC); | ||||||
|  | #endif | ||||||
|  | 	add_object(&apc_object); | ||||||
|  | 	notify_timer = tm_new_set(apc_send_notification, NULL, | ||||||
|  | 				  0, APC_NOTIFY_CHECK); | ||||||
|  | 	if (notify_timer) { | ||||||
|  | 		printf("APC Start state check and notify timer\n"); | ||||||
|  | 		tm_start(notify_timer, APC_NOTIFY_CHECK); | ||||||
|  | 	} | ||||||
|  |  | ||||||
|  | 	ubus_ctx->connection_lost = ubus_connection_lost; | ||||||
|  |  | ||||||
|  | 	return 0; | ||||||
|  | } | ||||||
|  |  | ||||||
|  | void | ||||||
|  | ubus_done(void) | ||||||
|  | { | ||||||
|  | 	ubus_free(ubus_ctx); | ||||||
|  | } | ||||||
| @@ -11,6 +11,7 @@ include $(INCLUDE_DIR)/package.mk | |||||||
|  |  | ||||||
| define Package/libinterapcomm | define Package/libinterapcomm | ||||||
|   SECTION:=libs |   SECTION:=libs | ||||||
|  |   DEPENDS:=+libev +libubox +libubus | ||||||
|   CATEGORY:=Libraries |   CATEGORY:=Libraries | ||||||
|   TITLE:=Inter AP communication library |   TITLE:=Inter AP communication library | ||||||
| endef | endef | ||||||
| @@ -29,5 +30,8 @@ endef | |||||||
| define Package/libinterapcomm/install | define Package/libinterapcomm/install | ||||||
| 	$(INSTALL_DIR) $(1)/usr/lib | 	$(INSTALL_DIR) $(1)/usr/lib | ||||||
| 	$(INSTALL_DATA) $(PKG_BUILD_DIR)/libinterapcomm.so $(1)/usr/lib/ | 	$(INSTALL_DATA) $(PKG_BUILD_DIR)/libinterapcomm.so $(1)/usr/lib/ | ||||||
|  | 	$(INSTALL_DIR) $(1)/etc/init.d | ||||||
|  | 	$(INSTALL_BIN) ./files/interap.init $(1)/etc/init.d/interap | ||||||
|  |  | ||||||
| endef | endef | ||||||
| $(eval $(call BuildPackage,libinterapcomm)) | $(eval $(call BuildPackage,libinterapcomm)) | ||||||
|   | |||||||
							
								
								
									
										35
									
								
								feeds/wlan-ap/interAPcomm/files/interap.init
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										35
									
								
								feeds/wlan-ap/interAPcomm/files/interap.init
									
									
									
									
									
										Normal file
									
								
							| @@ -0,0 +1,35 @@ | |||||||
|  | #!/bin/sh /etc/rc.common | ||||||
|  |  | ||||||
|  | START=12 | ||||||
|  | STOP=12 | ||||||
|  |  | ||||||
|  | start() { | ||||||
|  | 	apc=`cat /etc/config/firewall | grep Allow-APC` | ||||||
|  | 	ucc=`cat /etc/config/firewall | grep Allow-UCC` | ||||||
|  |  | ||||||
|  | 	if [ -z "$apc" ]; then | ||||||
|  | 		uci add firewall rule | ||||||
|  | 		uci set firewall.@rule[-1].name='Allow-APC' | ||||||
|  | 		uci set firewall.@rule[-1].src='wan' | ||||||
|  | 		uci set firewall.@rule[-1].proto='udp' | ||||||
|  | 		uci set firewall.@rule[-1].dst_port='50010' | ||||||
|  | 		uci set firewall.@rule[-1].target='ACCEPT' | ||||||
|  | 		uci set firewall.@rule[-1].family='ipv4' | ||||||
|  | 		uci commit firewall | ||||||
|  | 	fi | ||||||
|  |  | ||||||
|  | 	if [ -z "$ucc" ]; then | ||||||
|  | 		uci add firewall rule | ||||||
|  | 		uci set firewall.@rule[-1].name='Allow-UCC' | ||||||
|  | 		uci set firewall.@rule[-1].src='wan' | ||||||
|  | 		uci set firewall.@rule[-1].proto='udp' | ||||||
|  | 		uci set firewall.@rule[-1].dst_port='50000' | ||||||
|  | 		uci set firewall.@rule[-1].target='ACCEPT' | ||||||
|  | 		uci set firewall.@rule[-1].family='ipv4' | ||||||
|  | 		uci commit firewall | ||||||
|  | 	fi | ||||||
|  | } | ||||||
|  |  | ||||||
|  | stop() { | ||||||
|  | 	echo stop | ||||||
|  | } | ||||||
| @@ -6,7 +6,7 @@ subdirs=src/test | |||||||
|  |  | ||||||
| CFLAGS += -O -Wall -Werror -Wshadow | CFLAGS += -O -Wall -Werror -Wshadow | ||||||
| CFLAGS += -I./include/ | CFLAGS += -I./include/ | ||||||
| LIBS = -lev | LIBS = -lev -lubox -lubus | ||||||
|  |  | ||||||
| all: $(LIBNAME) $(subdirs) | all: $(LIBNAME) $(subdirs) | ||||||
|  |  | ||||||
|   | |||||||
| @@ -5,6 +5,7 @@ int interap_send(unsigned short port, char *dst_ip, | |||||||
| int interap_recv(unsigned short port, int (*recv_cb)(void *, ssize_t), | int interap_recv(unsigned short port, int (*recv_cb)(void *, ssize_t), | ||||||
| 		 unsigned int len, struct ev_loop *loop, | 		 unsigned int len, struct ev_loop *loop, | ||||||
| 		 ev_io *io); | 		 ev_io *io); | ||||||
|  | void interap_rcv_close(void); | ||||||
|  |  | ||||||
| typedef int (*callback)(void *, ssize_t); | typedef int (*callback)(void *, ssize_t); | ||||||
| typedef struct recv_arg { | typedef struct recv_arg { | ||||||
|   | |||||||
| @@ -7,12 +7,31 @@ | |||||||
| #include <string.h> | #include <string.h> | ||||||
| #include <unistd.h> | #include <unistd.h> | ||||||
| #include <interAPcomm.h> | #include <interAPcomm.h> | ||||||
|  | #include <libubox/uloop.h> | ||||||
|  |  | ||||||
| /*Receiver socket*/ | /*Receiver socket*/ | ||||||
| int recv_sock = -1; | int recv_sock = -1; | ||||||
|  |  | ||||||
| recv_arg ra; | recv_arg ra; | ||||||
|  |  | ||||||
|  | static void receive_data_uloop(struct uloop_fd *fd, unsigned int events) | ||||||
|  | { | ||||||
|  | 	void *recv_data; | ||||||
|  | 	ssize_t recv_data_len; | ||||||
|  |  | ||||||
|  | 	recv_data = malloc(ra.len); | ||||||
|  | 	memset(recv_data, 0, ra.len); | ||||||
|  | 	if ((recv_data_len = recvfrom(recv_sock, recv_data, ra.len, | ||||||
|  | 				      0, NULL, 0)) < 0) { | ||||||
|  | 		printf("recvfrom() failed"); | ||||||
|  | 		return; | ||||||
|  | 	} | ||||||
|  |  | ||||||
|  | 	ra.cb(recv_data, recv_data_len); | ||||||
|  | 	free(recv_data); | ||||||
|  |  | ||||||
|  | } | ||||||
|  |  | ||||||
| static void receive_data(struct ev_loop *ev, ev_io *io, int event) | static void receive_data(struct ev_loop *ev, ev_io *io, int event) | ||||||
| { | { | ||||||
| 	void *recv_data; | 	void *recv_data; | ||||||
| @@ -25,11 +44,14 @@ static void receive_data(struct ev_loop *ev, ev_io *io, int event) | |||||||
| 		printf("recvfrom() failed"); | 		printf("recvfrom() failed"); | ||||||
|  |  | ||||||
| 	ra.cb(recv_data, recv_data_len); | 	ra.cb(recv_data, recv_data_len); | ||||||
|  | 	free(recv_data); | ||||||
|  |  | ||||||
| } | } | ||||||
|  |  | ||||||
| int interap_recv(unsigned short port, int (*recv_cb)(void *, ssize_t), unsigned int len, | static struct uloop_fd server; | ||||||
| 		 struct ev_loop *loop, ev_io *io) |  | ||||||
|  | int interap_recv(unsigned short port, int (*recv_cb)(void *, ssize_t), | ||||||
|  | 		 unsigned int len, struct ev_loop *loop, ev_io *io) | ||||||
| { | { | ||||||
| 	struct sockaddr_in addr; | 	struct sockaddr_in addr; | ||||||
| 	int bcast_perm; | 	int bcast_perm; | ||||||
| @@ -65,12 +87,25 @@ int interap_recv(unsigned short port, int (*recv_cb)(void *, ssize_t), unsigned | |||||||
| 	} | 	} | ||||||
|  |  | ||||||
| 	printf("Interap recving: p:%d\n", port); | 	printf("Interap recving: p:%d\n", port); | ||||||
| 	ev_io_init(io, receive_data, recv_sock, EV_READ); |  | ||||||
| 	ev_io_start(loop, io); | 	if (io && loop) { | ||||||
|  | 		ev_io_init(io, receive_data, recv_sock, EV_READ); | ||||||
|  | 		ev_io_start(loop, io); | ||||||
|  | 	} else { | ||||||
|  |  | ||||||
|  | 		server.cb = receive_data_uloop; | ||||||
|  | 		server.fd = recv_sock; | ||||||
|  | 		uloop_fd_add(&server, ULOOP_READ); | ||||||
|  | 	} | ||||||
|  |  | ||||||
| 	return 0; | 	return 0; | ||||||
| } | } | ||||||
|  |  | ||||||
|  | void interap_rcv_close(void) | ||||||
|  | { | ||||||
|  | 	close(recv_sock); | ||||||
|  | } | ||||||
|  |  | ||||||
| int interap_send(unsigned short port, char *dst_ip, void *data, | int interap_send(unsigned short port, char *dst_ip, void *data, | ||||||
| 		 unsigned int len) | 		 unsigned int len) | ||||||
| { | { | ||||||
|   | |||||||
| @@ -3,7 +3,7 @@ OBJS = interapcommtest.o | |||||||
|  |  | ||||||
| CFLAGS += -Wall $(EXTRA_CFLAGS) $(extra_cflags-y) | CFLAGS += -Wall $(EXTRA_CFLAGS) $(extra_cflags-y) | ||||||
|  |  | ||||||
| LIBS =	-L ../../ -linterapcomm -lev | LIBS =	-L ../../ -linterapcomm -lev -lubox -lubus | ||||||
|  |  | ||||||
| CFLAGS += -I. \ | CFLAGS += -I. \ | ||||||
| 	-I../../include/ | 	-I../../include/ | ||||||
|   | |||||||
| @@ -6,6 +6,8 @@ | |||||||
| #include <ev.h> | #include <ev.h> | ||||||
| #include <interAPcomm.h> | #include <interAPcomm.h> | ||||||
|  |  | ||||||
|  | #include <libubus.h> | ||||||
|  |  | ||||||
| struct my_data { | struct my_data { | ||||||
| 	int x; | 	int x; | ||||||
| 	char y; | 	char y; | ||||||
| @@ -13,7 +15,8 @@ struct my_data { | |||||||
| }; | }; | ||||||
|  |  | ||||||
|  |  | ||||||
| int recv_process(void *data) { | int recv_process(void *data, ssize_t n) | ||||||
|  | { | ||||||
| 	struct my_data *dat = (struct my_data*) data; | 	struct my_data *dat = (struct my_data*) data; | ||||||
|  |  | ||||||
| 	printf("Recv process: %d, %c, %d\n", dat->x, dat->y, dat->z); | 	printf("Recv process: %d, %c, %d\n", dat->x, dat->y, dat->z); | ||||||
| @@ -22,34 +25,37 @@ int recv_process(void *data) { | |||||||
|  |  | ||||||
| int main (int argc, char *argv[ ]) | int main (int argc, char *argv[ ]) | ||||||
| { | { | ||||||
| 	unsigned int send = atoi(argv[1]);   /* First arg: broadcast port */ | 	unsigned int send = atoi(argv[1]); | ||||||
| 	unsigned short port = 50000; | 	unsigned short port = 50020; | ||||||
| //	char *dst_ip = "255.255.255.255"; | //	char *dst_ip = "255.255.255.255"; | ||||||
| 	char *dst_ip = "192.168.9.255"; | 	char *dst_ip = "10.42.0.255"; | ||||||
| //	char *data = "InterAP Hello"; | //	char *data = "InterAP Hello"; | ||||||
| 	struct my_data data; | 	struct my_data data; | ||||||
| 	data.x = 1001; | 	data.x = 1001; | ||||||
| 	data.y = 'H'; | 	data.y = 'H'; | ||||||
| 	data.z = 3003; | 	data.z = 3003; | ||||||
|  |  | ||||||
| //	callback cb = recv_process; | 	printf("send = %d\n", send); | ||||||
|  |  | ||||||
|  |  | ||||||
| 	printf("arg1 = %d\n", send); |  | ||||||
|  |  | ||||||
| 	if (send) { | 	if (send) { | ||||||
| 		printf("Send"); | 		printf("Send"); | ||||||
| 		interap_send(port, dst_ip, &data, sizeof(data)); | 		while (1) | ||||||
|  | 		{ | ||||||
|  | 			sleep(3); | ||||||
|  | 			printf("Sending...\n"); | ||||||
|  | 			interap_send(port, dst_ip, &data, sizeof(data)); | ||||||
|  | 		} | ||||||
| 	} | 	} | ||||||
| 	else { | 	else { | ||||||
| 		printf("Recieve"); | 		printf("Recieve"); | ||||||
| //		interap_recv(port, cb, sizeof(struct my_data)); | 		uloop_init(); | ||||||
|  | 		callback cb = recv_process; | ||||||
|  |  | ||||||
|  | 		interap_recv(port, cb, sizeof(struct my_data), NULL, NULL); | ||||||
|  | 		uloop_run(); | ||||||
|  | 		uloop_done(); | ||||||
|  |  | ||||||
| 	} | 	} | ||||||
|  |  | ||||||
| 	while (1) |  | ||||||
| 	{ |  | ||||||
| 		sleep(3); |  | ||||||
| 		printf("In while loop\n"); |  | ||||||
| 	} |  | ||||||
| 	return 1; | 	return 1; | ||||||
| } | } | ||||||
|   | |||||||
| @@ -444,6 +444,10 @@ return view.extend({ | |||||||
| 		o.datatype = 'ip4addr("nomask")'; | 		o.datatype = 'ip4addr("nomask")'; | ||||||
| 		o.depends('proto', 'static'); | 		o.depends('proto', 'static'); | ||||||
|  |  | ||||||
|  | 		o = s.option(form.Button, 'save', _('')); | ||||||
|  | 		o.inputtitle = _('Save Settings'); | ||||||
|  | 		o.onclick = ui.createHandlerFn(this, 'handleSettingsSave', m); | ||||||
|  |  | ||||||
| 		s = m.section(form.NamedSection, 'lan', 'lan', _('LAN')); | 		s = m.section(form.NamedSection, 'lan', 'lan', _('LAN')); | ||||||
|  |  | ||||||
| 		o = s.option(form.Value, 'addr', _('IP Address')); | 		o = s.option(form.Value, 'addr', _('IP Address')); | ||||||
| @@ -456,7 +460,7 @@ return view.extend({ | |||||||
|  |  | ||||||
| 		o = s.option(form.Button, 'save', _('')); | 		o = s.option(form.Button, 'save', _('')); | ||||||
| 		o.inputtitle = _('Save Settings'); | 		o.inputtitle = _('Save Settings'); | ||||||
| 		o.onclick = ui.createHandlerFn(this, 'handleSettingsSave', m); | 		o.onclick = ui.createHandlerFn(this, 'handleLANSettingsSave', m); | ||||||
|  |  | ||||||
| 		s = m.section(form.NamedSection, 'maintenance', 'maintenance', _('System Maintenance')); | 		s = m.section(form.NamedSection, 'maintenance', 'maintenance', _('System Maintenance')); | ||||||
|  |  | ||||||
|   | |||||||
										
											Binary file not shown.
										
									
								
							| @@ -1,4 +1,12 @@ | |||||||
| @import url('https://fonts.googleapis.com/css2?family=Montserrat&display=swap'); | /* latin */ | ||||||
|  | @font-face { | ||||||
|  | 	font-family: 'Montserrat'; | ||||||
|  | 	font-style: normal; | ||||||
|  | 	font-weight: 400; | ||||||
|  | 	font-display: swap; | ||||||
|  | 	src: url(Montserrat_latin.woff2) format('woff2'); | ||||||
|  | 	unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+2000-206F, U+2074, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD; | ||||||
|  | } | ||||||
|  |  | ||||||
| :root { | :root { | ||||||
| 	--main-bright-color: #1B465C; | 	--main-bright-color: #1B465C; | ||||||
|   | |||||||
| @@ -48,13 +48,8 @@ define Package/nft-qos/install | |||||||
| 	$(INSTALL_DIR) $(1)/lib/nft-qos | 	$(INSTALL_DIR) $(1)/lib/nft-qos | ||||||
| 	$(INSTALL_DATA) ./files/lib/* $(1)/lib/nft-qos/ | 	$(INSTALL_DATA) ./files/lib/* $(1)/lib/nft-qos/ | ||||||
| 	chmod 0700 $(1)/lib/nft-qos/mac-rate.sh | 	chmod 0700 $(1)/lib/nft-qos/mac-rate.sh | ||||||
| 	$(INSTALL_DIR) $(1)/etc/config |  | ||||||
| 	$(INSTALL_CONF) ./files/nft-qos.config $(1)/etc/config/nft-qos |  | ||||||
| 	$(INSTALL_DIR) $(1)/etc/init.d | 	$(INSTALL_DIR) $(1)/etc/init.d | ||||||
| 	$(INSTALL_BIN) ./files/nft-qos.init $(1)/etc/init.d/nft-qos | 	$(INSTALL_BIN) ./files/nft-qos.init $(1)/etc/init.d/nft-qos | ||||||
| 	$(INSTALL_DIR) $(1)/etc/hotplug.d/dhcp |  | ||||||
| 	$(INSTALL_BIN) ./files/nft-qos-monitor.hotplug $(1)/etc/hotplug.d/dhcp/00-nft-qos-monitor |  | ||||||
| 	$(INSTALL_BIN) ./files/nft-qos-dynamic.hotplug $(1)/etc/hotplug.d/dhcp/01-nft-qos-dynamic |  | ||||||
| endef | endef | ||||||
|  |  | ||||||
| $(eval $(call BuildPackage,nft-qos)) | $(eval $(call BuildPackage,nft-qos)) | ||||||
|   | |||||||
| @@ -27,23 +27,31 @@ if [ -z "$1" -o -z "$2" -o -z "$3" ]; then | |||||||
| 	exit 1 | 	exit 1 | ||||||
| fi | fi | ||||||
|  |  | ||||||
| logger -t "$1 $2 $3" | logger -t "mac-rate" "$1 $2 $3" | ||||||
|  |  | ||||||
|  | bridge=`uci get wireless.$iface.network` | ||||||
|  | if [ "$bridge" == "lan" ]; then | ||||||
|  | 	dlchain="download_nat" | ||||||
|  |         ulchain="upload_nat" | ||||||
|  | else | ||||||
|  |         dlchain="download" | ||||||
|  |         ulchain="upload" | ||||||
|  | fi | ||||||
|  |  | ||||||
| if [ "$1" == "add" ]; then | if [ "$1" == "add" ]; then | ||||||
| 	config_load wireless | 	config_load wireless | ||||||
|  |  | ||||||
| 	config_foreach handle_interface wifi-iface download | 	config_foreach handle_interface wifi-iface download | ||||||
|  | 	exists=`nft list chain bridge nft-qos-ssid-lan-bridge $dlchain  -a | grep -ic $3` | ||||||
| 	exists=`nft list chain bridge nft-qos-ssid-lan-bridge download  -a | grep -ic $3` |  | ||||||
| 	logger -t "mac-rate" "exists = $exists" | 	logger -t "mac-rate" "exists = $exists" | ||||||
| 	if [ "$exists" -ne 0 ]; then | 	if [ "$exists" -ne 0 ]; then | ||||||
| 		old_drate=`nft list chain bridge nft-qos-ssid-lan-bridge download -a | grep -i $3 |  awk -F'kbytes' '{print $1}' | awk '{print $NF}'` | 		old_drate=`nft list chain bridge nft-qos-ssid-lan-bridge $dlchain -a | grep -i $3 |  awk -F'kbytes' '{print $1}' | awk '{print $NF}'` | ||||||
| 		logger -t "mac-rate" "old_drate=$old_drate" | 		logger -t "mac-rate" "old_drate=$old_drate" | ||||||
| 		if [ "$old_drate" -ne "$rate" ]; then | 		if [ "$old_drate" -ne "$rate" ]; then | ||||||
| 			changed=1 | 			changed=1 | ||||||
| 			id=`nft list chain bridge nft-qos-ssid-lan-bridge download  -a | grep -i $3  | awk -F "handle " '{print $2;exit}'` | 			id=`nft list chain bridge nft-qos-ssid-lan-bridge $dlchain  -a | grep -i $3  | awk -F "handle " '{print $2;exit}'` | ||||||
| 			if [ -n "$id" ]; then | 			if [ -n "$id" ]; then | ||||||
| 				nft delete rule bridge nft-qos-ssid-lan-bridge download handle $id | 				nft delete rule bridge nft-qos-ssid-lan-bridge $dlchain handle $id | ||||||
| 			fi | 			fi | ||||||
| 			logger -t "mac-rate" "changed DL $old_drate to $rate, del $3" | 			logger -t "mac-rate" "changed DL $old_drate to $rate, del $3" | ||||||
| 		else | 		else | ||||||
| @@ -54,19 +62,19 @@ if [ "$1" == "add" ]; then | |||||||
|  |  | ||||||
|         if [ "$exists" == 0 -o "$changed" == 1 ]; then |         if [ "$exists" == 0 -o "$changed" == 1 ]; then | ||||||
| 	        if [ "$rate" -ne 0 ]; then | 	        if [ "$rate" -ne 0 ]; then | ||||||
| 			dok=`nft add rule bridge nft-qos-ssid-lan-bridge download ether daddr $3 limit rate over $rate kbytes/second drop` | 			dok=`nft add rule bridge nft-qos-ssid-lan-bridge $dlchain ether daddr $3 limit rate over $rate kbytes/second drop` | ||||||
| 	        fi | 	        fi | ||||||
|         fi |         fi | ||||||
|  |  | ||||||
| 	config_foreach handle_interface wifi-iface upload | 	config_foreach handle_interface wifi-iface upload | ||||||
| 	exists=`nft list chain bridge nft-qos-ssid-lan-bridge upload  -a | grep -ic $3` | 	exists=`nft list chain bridge nft-qos-ssid-lan-bridge $ulchain  -a | grep -ic $3` | ||||||
| 	if [ "$exists" -ne 0 ]; then | 	if [ "$exists" -ne 0 ]; then | ||||||
| 		old_urate=`nft list chain bridge nft-qos-ssid-lan-bridge upload -a | grep -i $3 |  awk -F'kbytes' '{print $1}' | awk '{print $NF}'` | 		old_urate=`nft list chain bridge nft-qos-ssid-lan-bridge $ulchain -a | grep -i $3 |  awk -F'kbytes' '{print $1}' | awk '{print $NF}'` | ||||||
| 		if [ "$old_urate" -ne "$rate" ]; then | 		if [ "$old_urate" -ne "$rate" ]; then | ||||||
| 			changed=1 | 			changed=1 | ||||||
| 			id=`nft list chain bridge nft-qos-ssid-lan-bridge upload  -a | grep -i $3  | awk -F "handle " '{print $2;exit}'` | 			id=`nft list chain bridge nft-qos-ssid-lan-bridge $ulchain  -a | grep -i $3  | awk -F "handle " '{print $2;exit}'` | ||||||
| 			if [ -n "$id" ]; then | 			if [ -n "$id" ]; then | ||||||
| 				nft delete rule bridge nft-qos-ssid-lan-bridge upload handle $id | 				nft delete rule bridge nft-qos-ssid-lan-bridge $ulchain handle $id | ||||||
| 			fi | 			fi | ||||||
|  |  | ||||||
| 			logger -t "mac-rate" "changed UL $old_urate to $rate del $3" | 			logger -t "mac-rate" "changed UL $old_urate to $rate del $3" | ||||||
| @@ -78,20 +86,20 @@ if [ "$1" == "add" ]; then | |||||||
|  |  | ||||||
|         if [ "$exists" == 0 -o "$changed" == 1 ]; then |         if [ "$exists" == 0 -o "$changed" == 1 ]; then | ||||||
|         	if [ "$rate" -ne 0 ]; then |         	if [ "$rate" -ne 0 ]; then | ||||||
| 			uok=`nft add rule bridge nft-qos-ssid-lan-bridge upload ether saddr $3 limit rate over $rate kbytes/second drop` | 			uok=`nft add rule bridge nft-qos-ssid-lan-bridge $ulchain ether saddr $3 limit rate over $rate kbytes/second drop` | ||||||
| 		fi | 		fi | ||||||
| 	fi | 	fi | ||||||
|  |  | ||||||
| elif [ "$1" == "del" ]; then | elif [ "$1" == "del" ]; then | ||||||
| 	id=`nft list chain bridge nft-qos-ssid-lan-bridge download  -a | grep -i $3  | awk -F "handle " '{print $2;exit}'` | 	id=`nft list chain bridge nft-qos-ssid-lan-bridge $dlchain  -a | grep -i $3  | awk -F "handle " '{print $2;exit}'` | ||||||
| 	logger -t "mac-rate" "$id $3" | 	logger -t "mac-rate" "$id $3" | ||||||
| 	if [ -n "$id" ]; then | 	if [ -n "$id" ]; then | ||||||
| 		nft delete rule bridge nft-qos-ssid-lan-bridge download handle $id | 		nft delete rule bridge nft-qos-ssid-lan-bridge $dlchain handle $id | ||||||
| 	fi | 	fi | ||||||
|  |  | ||||||
| 	id=`nft list chain bridge nft-qos-ssid-lan-bridge upload  -a | grep -i $3  | awk -F "handle " '{print $2;exit}'` | 	id=`nft list chain bridge nft-qos-ssid-lan-bridge $ulchain  -a | grep -i $3  | awk -F "handle " '{print $2;exit}'` | ||||||
| 	if [ -n "$id" ]; then | 	if [ -n "$id" ]; then | ||||||
| 		nft delete rule bridge nft-qos-ssid-lan-bridge upload handle $id | 		nft delete rule bridge nft-qos-ssid-lan-bridge $ulchain handle $id | ||||||
| 	fi | 	fi | ||||||
|  |  | ||||||
| fi | fi | ||||||
|   | |||||||
| @@ -42,8 +42,20 @@ qosdef_append_rule_ssid() { # <section> <operator> <bridge> | |||||||
| 		rate=$((rate/8)) | 		rate=$((rate/8)) | ||||||
| 	fi | 	fi | ||||||
|  |  | ||||||
| 	if [ -z "$iface" -o -z "$rate" -o $rate == 0 ]; then | 	if [ -z "$iface" ]; then | ||||||
| 		logger -t "nft-qos" "Error: No interface $iface or rate $rate present" | 		logger -t "nft-qos" "Error: No interface $iface present" | ||||||
|  | 		return | ||||||
|  | 	fi | ||||||
|  |  | ||||||
|  | 	if [ -z "$rate" -o $rate == 0 ]; then | ||||||
|  | 		logger -t "nft-qos" "ssid-rate disabled $iface, configure client-rate" | ||||||
|  | 	        maclist=`iwinfo $iface assoclist | grep dBm | cut -f 1 -s -d" "` | ||||||
|  |  | ||||||
|  | 		for mac in $maclist | ||||||
|  | 		do | ||||||
|  | 			logger -t "nft-qos" "Add $mac" | ||||||
|  | 			/lib/nft-qos/mac-rate.sh add $iface $mac | ||||||
|  | 		done | ||||||
| 		return | 		return | ||||||
| 	fi | 	fi | ||||||
|  |  | ||||||
|   | |||||||
| @@ -4,49 +4,26 @@ | |||||||
| # | # | ||||||
|  |  | ||||||
| . /lib/nft-qos/core.sh | . /lib/nft-qos/core.sh | ||||||
| . /lib/nft-qos/monitor.sh |  | ||||||
| . /lib/nft-qos/dynamic.sh |  | ||||||
| . /lib/nft-qos/static.sh |  | ||||||
| . /lib/nft-qos/priority.sh |  | ||||||
| . /lib/nft-qos/ssid_ratelimit.sh | . /lib/nft-qos/ssid_ratelimit.sh | ||||||
|  |  | ||||||
| START=99 | START=99 | ||||||
| USE_PROCD=1 | USE_PROCD=1 | ||||||
|  |  | ||||||
| service_triggers() { | service_triggers() { | ||||||
| #	procd_add_reload_trigger nft-qos wireless |  | ||||||
| #	procd_add_reload_trigger wireless |  | ||||||
|  |  | ||||||
| 	procd_open_validate | 	procd_open_validate | ||||||
| #	qosdef_validate_dynamic |  | ||||||
| #	qosdef_validate_static |  | ||||||
| #	qosdef_validate_priority |  | ||||||
| 	procd_close_validate | 	procd_close_validate | ||||||
| } | } | ||||||
|  |  | ||||||
| start_service() { | start_service() { | ||||||
| 	config_load nft-qos | 	config_load nft-qos | ||||||
|  |  | ||||||
| #	qosdef_init_env |  | ||||||
| #	qosdef_flush_static |  | ||||||
| #	qosdef_flush_dynamic |  | ||||||
| 	qosdef_flush_ssid_ratelimit | 	qosdef_flush_ssid_ratelimit | ||||||
| #	qosdef_remove_priority |  | ||||||
|  |  | ||||||
| #	qosdef_init_header |  | ||||||
| #	qosdef_init_monitor |  | ||||||
| #	qosdef_validate_dynamic default qosdef_init_dynamic |  | ||||||
| #	qosdef_validate_static default qosdef_init_static |  | ||||||
| #	qosdef_validate_priority default qosdef_init_priority |  | ||||||
| 	qosdef_init_ssid_ratelimit | 	qosdef_init_ssid_ratelimit | ||||||
| 	qosdef_init_done | 	qosdef_init_done | ||||||
| 	qosdef_start | 	qosdef_start | ||||||
| } | } | ||||||
|  |  | ||||||
| stop_service() { | stop_service() { | ||||||
| #	qosdef_flush_dynamic |  | ||||||
| #	qosdef_flush_static |  | ||||||
| #	qosdef_remove_priority |  | ||||||
| 	qosdef_flush_ssid_ratelimit | 	qosdef_flush_ssid_ratelimit | ||||||
| 	qosdef_clean_cache | 	qosdef_clean_cache | ||||||
| } | } | ||||||
|   | |||||||
| @@ -52,7 +52,6 @@ define Package/opennds/install | |||||||
| 	$(INSTALL_DIR) $(1)/usr/lib/opennds | 	$(INSTALL_DIR) $(1)/usr/lib/opennds | ||||||
|  |  | ||||||
| 	$(CP) ./files/lib/splash.css $(1)/etc/opennds/htdocs/ | 	$(CP) ./files/lib/splash.css $(1)/etc/opennds/htdocs/ | ||||||
| 	$(CP) ./files/lib/Tip.png $(1)/etc/opennds/htdocs/images/ |  | ||||||
| 	$(CP) ./files/lib/opennds $(1)/etc/config/ | 	$(CP) ./files/lib/opennds $(1)/etc/config/ | ||||||
| 	$(CP) ./files/etc/init.d/opennds $(1)/etc/init.d/ | 	$(CP) ./files/etc/init.d/opennds $(1)/etc/init.d/ | ||||||
| 	$(CP) ./files/lib/login.sh $(1)/usr/lib/opennds/ | 	$(CP) ./files/lib/login.sh $(1)/usr/lib/opennds/ | ||||||
|   | |||||||
										
											Binary file not shown.
										
									
								
							| Before Width: | Height: | Size: 21 KiB | 
| @@ -242,7 +242,7 @@ header="<!DOCTYPE html> | |||||||
| 	<meta http-equiv=\"Expires\" content=\"0\"> | 	<meta http-equiv=\"Expires\" content=\"0\"> | ||||||
| 	<meta charset=\"utf-8\"> | 	<meta charset=\"utf-8\"> | ||||||
| 	<meta name=\"viewport\" content=\"width=device-width, initial-scale=1.0\"> | 	<meta name=\"viewport\" content=\"width=device-width, initial-scale=1.0\"> | ||||||
| 	<link rel=\"shortcut icon\" href=\"/images/$client_zone/TipLogo.png\" type=\"image/x-icon\"> | 	<link rel=\"shortcut icon\" href=\"/images/TipLogo.png\" type=\"image/x-icon\"> | ||||||
| 	<link rel=\"stylesheet\" type=\"text/css\" href=\"/splash.css\"> | 	<link rel=\"stylesheet\" type=\"text/css\" href=\"/splash.css\"> | ||||||
| 	<title>$gatewaynamehtml</title> | 	<title>$gatewaynamehtml</title> | ||||||
| 	</head> | 	</head> | ||||||
| @@ -257,7 +257,7 @@ header="<!DOCTYPE html> | |||||||
| version="$(ndsctl status | grep Version)" | version="$(ndsctl status | grep Version)" | ||||||
| year="$(date | awk -F ' ' '{print $(6)}')" | year="$(date | awk -F ' ' '{print $(6)}')" | ||||||
| footer=" | footer=" | ||||||
| 	<img style=\"height:60px; width:100px; float:left;\" src=\"/images/$client_zone/TipLogo.png\" alt=\"Splash Page: For access to the Internet.\"> | 	<img style=\"height:60px; width:100px; float:left;\" src=\"/images/TipLogo.png\" alt=\"Splash Page: For access to the Internet.\"> | ||||||
|  |  | ||||||
| 	<copy-right> | 	<copy-right> | ||||||
| 		<br><br> | 		<br><br> | ||||||
|   | |||||||
| @@ -302,7 +302,7 @@ header="<!DOCTYPE html> | |||||||
| 	<meta http-equiv=\"Expires\" content=\"0\"> | 	<meta http-equiv=\"Expires\" content=\"0\"> | ||||||
| 	<meta charset=\"utf-8\"> | 	<meta charset=\"utf-8\"> | ||||||
| 	<meta name=\"viewport\" content=\"width=device-width, initial-scale=1.0\"> | 	<meta name=\"viewport\" content=\"width=device-width, initial-scale=1.0\"> | ||||||
| 	<link rel=\"shortcut icon\" href=\"/images/$client_zone/TipLogo.png\" type=\"image/x-icon\"> | 	<link rel=\"shortcut icon\" href=\"/images/TipLogo.png\" type=\"image/x-icon\"> | ||||||
| 	<link rel=\"stylesheet\" type=\"text/css\" href=\"/splash.css\"> | 	<link rel=\"stylesheet\" type=\"text/css\" href=\"/splash.css\"> | ||||||
| 	<title>$gatewaynamehtml</title> | 	<title>$gatewaynamehtml</title> | ||||||
| 	</head> | 	</head> | ||||||
| @@ -317,7 +317,7 @@ header="<!DOCTYPE html> | |||||||
| version="$(ndsctl status | grep Version)" | version="$(ndsctl status | grep Version)" | ||||||
| year="$(date | awk -F ' ' '{print $(6)}')" | year="$(date | awk -F ' ' '{print $(6)}')" | ||||||
| footer=" | footer=" | ||||||
| 	<img style=\"height:60px; width:60px; float:left;\" src=\"/images/$client_zone/TipLogo.png\" alt=\"Splash Page: For access to the Internet.\"> | 	<img style=\"height:60px; width:60px; float:left;\" src=\"/images/TipLogo.png\" alt=\"Splash Page: For access to the Internet.\"> | ||||||
| 	<copy-right> | 	<copy-right> | ||||||
| 		<br><br> | 		<br><br> | ||||||
| 		openNDS $version. | 		openNDS $version. | ||||||
|   | |||||||
| @@ -1,5 +1,5 @@ | |||||||
| body{ | body{ | ||||||
|         background-image:url('/images/wlan1/TipBackLogo.png'); |         background-image:url('/images/TipBackLogo.png'); | ||||||
|         background-attachment:fixed; |         background-attachment:fixed; | ||||||
|         background-repeat: no-repeat; |         background-repeat: no-repeat; | ||||||
|         background-size: contain; |         background-size: contain; | ||||||
|   | |||||||
| @@ -48,7 +48,7 @@ validate_client() { | |||||||
| 	# $username, $phone, $emailaddr, $addr, $code | 	# $username, $phone, $emailaddr, $addr, $code | ||||||
| 	# | 	# | ||||||
| 	# Return either 0 if validation successful or 1 if not | 	# Return either 0 if validation successful or 1 if not | ||||||
| 	userlist="/etc/opennds/htdocs/images/$client_zone/userpass.dat" | 	userlist="/etc/opennds/htdocs/images/userpass.dat" | ||||||
| 	varlist="username password firstname lastname" | 	varlist="username password firstname lastname" | ||||||
|  |  | ||||||
| 	while read user; do | 	while read user; do | ||||||
| @@ -282,7 +282,7 @@ header="<!DOCTYPE html> | |||||||
| 	<meta http-equiv=\"Expires\" content=\"0\"> | 	<meta http-equiv=\"Expires\" content=\"0\"> | ||||||
| 	<meta charset=\"utf-8\"> | 	<meta charset=\"utf-8\"> | ||||||
| 	<meta name=\"viewport\" content=\"width=device-width, initial-scale=1.0\"> | 	<meta name=\"viewport\" content=\"width=device-width, initial-scale=1.0\"> | ||||||
| 	<link rel=\"shortcut icon\" href=\"/images/$client_zone/TipLogo.png\" type=\"image/x-icon\"> | 	<link rel=\"shortcut icon\" href=\"/images/TipLogo.png\" type=\"image/x-icon\"> | ||||||
| 	<link rel=\"stylesheet\" type=\"text/css\" href=\"/splash.css\"> | 	<link rel=\"stylesheet\" type=\"text/css\" href=\"/splash.css\"> | ||||||
| 	<title>$gatewaynamehtml</title> | 	<title>$gatewaynamehtml</title> | ||||||
| 	</head> | 	</head> | ||||||
| @@ -297,7 +297,7 @@ header="<!DOCTYPE html> | |||||||
| version="$(ndsctl status | grep Version)" | version="$(ndsctl status | grep Version)" | ||||||
| year="$(date | awk -F ' ' '{print $(6)}')" | year="$(date | awk -F ' ' '{print $(6)}')" | ||||||
| footer=" | footer=" | ||||||
| 	<img style=\"height:60px; width:60px; float:left;\" src=\"/images/$client_zone/TipLogo.png\" alt=\"Splash Page: For access to the Internet.\"> | 	<img style=\"height:60px; width:60px; float:left;\" src=\"/images/TipLogo.png\" alt=\"Splash Page: For access to the Internet.\"> | ||||||
| 	<copy-right> | 	<copy-right> | ||||||
| 		<br><br> | 		<br><br> | ||||||
| 		openNDS $version. | 		openNDS $version. | ||||||
|   | |||||||
							
								
								
									
										17
									
								
								feeds/wlan-ap/opensync/files/bin/auto-conf
									
									
									
									
									
										Executable file
									
								
							
							
						
						
									
										17
									
								
								feeds/wlan-ap/opensync/files/bin/auto-conf
									
									
									
									
									
										Executable file
									
								
							| @@ -0,0 +1,17 @@ | |||||||
|  | #!/bin/sh | ||||||
|  | # Finds the highest settings an AP can support for various settings when set to "auto" in config | ||||||
|  |  | ||||||
|  | find_auto_hwmode() { | ||||||
|  | 	# This function finds the highest mode (hw_mode) that the AP can support | ||||||
|  |  | ||||||
|  | 	# Arguments | ||||||
|  | 	device=$1 | ||||||
|  |  | ||||||
|  | 	mode='11n' | ||||||
|  | 	iw phy "$device" info | grep -q 'VHT Capabilities*' && mode="11ac" | ||||||
|  | 	iw phy "$device" info | grep -q 'HE.*Capabilities' && mode="11ax" | ||||||
|  |  | ||||||
|  | 	echo "$mode" | ||||||
|  | } | ||||||
|  |  | ||||||
|  | find_auto_hwmode $1 | ||||||
							
								
								
									
										7
									
								
								feeds/wlan-ap/opensync/files/bin/check_wan_link.sh
									
									
									
									
									
										Executable file
									
								
							
							
						
						
									
										7
									
								
								feeds/wlan-ap/opensync/files/bin/check_wan_link.sh
									
									
									
									
									
										Executable file
									
								
							| @@ -0,0 +1,7 @@ | |||||||
|  | #!/bin/sh | ||||||
|  |  | ||||||
|  | if="$(uci get network.wan.ifname)" | ||||||
|  | [ "$(cat /sys/class/net/"${if}"/carrier)" = 0 ] && { | ||||||
|  | 	return 0 | ||||||
|  | } | ||||||
|  | return 1 | ||||||
							
								
								
									
										55
									
								
								feeds/wlan-ap/opensync/files/bin/dynamic_lookup.sh
									
									
									
									
									
										Executable file
									
								
							
							
						
						
									
										55
									
								
								feeds/wlan-ap/opensync/files/bin/dynamic_lookup.sh
									
									
									
									
									
										Executable file
									
								
							| @@ -0,0 +1,55 @@ | |||||||
|  | #! /bin/sh | ||||||
|  |  | ||||||
|  | usage() { | ||||||
|  |    echo "Usage: ${0} <realm>" | ||||||
|  |    exit 1 | ||||||
|  | } | ||||||
|  |  | ||||||
|  | test -n "${1}" || usage | ||||||
|  |  | ||||||
|  | REALM="${1}" | ||||||
|  | DIGCMD=$(command -v dig) | ||||||
|  | PRINTCMD=$(command -v printf) | ||||||
|  |  | ||||||
|  | validate_host() { | ||||||
|  |          echo ${@} | tr -d '\n\t\r' | grep -E '^[_0-9a-zA-Z][-._0-9a-zA-Z]*$' | ||||||
|  | } | ||||||
|  |  | ||||||
|  | validate_port() { | ||||||
|  |          echo ${@} | tr -d '\n\t\r' | grep -E '^[0-9]+$' | ||||||
|  | } | ||||||
|  |  | ||||||
|  | srv_lookup() { | ||||||
|  |    ${DIGCMD} +short srv $SRV_HOST | sort -n -k1 | | ||||||
|  |    while read line ; do | ||||||
|  |       set $line ; PORT=$(validate_port $3) ; HOST=$(validate_host $4) | ||||||
|  |       if [ -n "${HOST}" ] && [ -n "${PORT}" ]; then  | ||||||
|  |          $PRINTCMD "\thost ${HOST%.}:${PORT}\n" | ||||||
|  |       fi | ||||||
|  |    done | ||||||
|  | } | ||||||
|  |  | ||||||
|  | naptr_lookup() { | ||||||
|  |     ${DIGCMD} +short naptr ${REALM} | grep aaa+auth:radius.tls.tcp | sort -n -k1 | | ||||||
|  |     while read line; do | ||||||
|  |     set $line ; TYPE=$3 ; HOST=$6 | ||||||
|  |     if [ "$TYPE" = "\"s\"" -o "$TYPE" = "\"S\"" ]; then | ||||||
|  |         SRV_HOST=${HOST%.} | ||||||
|  |         srv_lookup | ||||||
|  |     fi | ||||||
|  |     done | ||||||
|  | } | ||||||
|  |  | ||||||
|  | if test -x "${DIGCMD}" ; then | ||||||
|  |    SERVERS=$(naptr_lookup) | ||||||
|  | else | ||||||
|  |    echo "${0} requires \"dig\" command." | ||||||
|  |    exit 1 | ||||||
|  | fi | ||||||
|  |  | ||||||
|  | if test -n "${SERVERS}" ; then | ||||||
|  |         $PRINTCMD "server dynamic_radsec.${REALM} {\n${SERVERS}\n\ttype TLS\n}\n" | ||||||
|  |         exit 0 | ||||||
|  | fi | ||||||
|  |  | ||||||
|  | exit 10				# No server found. | ||||||
| @@ -24,7 +24,8 @@ | |||||||
| # (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS | # (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS | ||||||
| # SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. | # SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. | ||||||
|  |  | ||||||
| IMGFILE="$(ls ${1}.*)" | # Get the most recent upgrade file available | ||||||
|  | IMGFILE="$(ls -t1 ${1}.* | head -n 1)" | ||||||
|  |  | ||||||
| if [ -z "$IMGFILE" ] || [ ! -f "$IMGFILE" ] ; then | if [ -z "$IMGFILE" ] || [ ! -f "$IMGFILE" ] ; then | ||||||
|   echo |   echo | ||||||
| @@ -34,11 +35,14 @@ fi | |||||||
|  |  | ||||||
| # Set the current version as inactive before the upgrade | # Set the current version as inactive before the upgrade | ||||||
| FW_VERSION=`sed -n 's/FW_IMAGE_ACTIVE:\(.*\)/\1/p' < /usr/opensync/.versions` | FW_VERSION=`sed -n 's/FW_IMAGE_ACTIVE:\(.*\)/\1/p' < /usr/opensync/.versions` | ||||||
|  | FW_BACKUP=$(uci get system.tip.inactivefw) | ||||||
| uci set system.tip.inactivefw="${FW_VERSION}" | uci set system.tip.inactivefw="${FW_VERSION}" | ||||||
| uci commit | uci commit system | ||||||
|  |  | ||||||
| /sbin/sysupgrade $IMGFILE | /sbin/sysupgrade $IMGFILE | ||||||
| if [ "$?" != "0" ] ; then | if [ "$?" != "0" ] ; then | ||||||
|  |   uci set system.tip.inactivefw="${FW_BACKUP}" | ||||||
|  |   uci commit system | ||||||
|   echo "$0: Sysupgrade failed." |   echo "$0: Sysupgrade failed." | ||||||
|   exit 1 |   exit 1 | ||||||
| fi | fi | ||||||
|   | |||||||
							
								
								
									
										15
									
								
								feeds/wlan-ap/opensync/files/bin/lan-ssh-firewall
									
									
									
									
									
										Executable file
									
								
							
							
						
						
									
										15
									
								
								feeds/wlan-ap/opensync/files/bin/lan-ssh-firewall
									
									
									
									
									
										Executable file
									
								
							| @@ -0,0 +1,15 @@ | |||||||
|  | #!/bin/sh | ||||||
|  |  | ||||||
|  | if [ "$#" -ne 1 ]; then | ||||||
|  |     echo "Illegal number of parameters" | ||||||
|  |     exit 1 | ||||||
|  | fi | ||||||
|  |  | ||||||
|  | action=$1 | ||||||
|  |  | ||||||
|  | [ "$action" = "enable" ] && [ ! -f /etc/ssh-flag ] && uci set firewall.lan_ssh_rule.target='REJECT' | ||||||
|  | [ "$action" = "disable" ] && uci set firewall.lan_ssh_rule.target='ACCEPT' | ||||||
|  | uci commit firewall | ||||||
|  | /etc/init.d/firewall restart | ||||||
|  |  | ||||||
|  | exit 0 | ||||||
							
								
								
									
										4
									
								
								feeds/wlan-ap/opensync/files/bin/wlan_ap_factory_reset.sh
									
									
									
									
									
										Executable file
									
								
							
							
						
						
									
										4
									
								
								feeds/wlan-ap/opensync/files/bin/wlan_ap_factory_reset.sh
									
									
									
									
									
										Executable file
									
								
							| @@ -0,0 +1,4 @@ | |||||||
|  | #!/bin/sh | ||||||
|  |  | ||||||
|  | tar czf /sysupgrade.tgz /usr/opensync/certs/ | ||||||
|  | jffs2reset -r -y -k | ||||||
							
								
								
									
										5
									
								
								feeds/wlan-ap/opensync/files/bin/wlan_ap_led_blink.sh
									
									
									
									
									
										Executable file
									
								
							
							
						
						
									
										5
									
								
								feeds/wlan-ap/opensync/files/bin/wlan_ap_led_blink.sh
									
									
									
									
									
										Executable file
									
								
							| @@ -0,0 +1,5 @@ | |||||||
|  | #!/bin/sh | ||||||
|  |  | ||||||
|  | #Blink AP's LED | ||||||
|  | /usr/opensync/tools/ovsh insert Node_Config module:="led" key:="led_blink" value:="on" | ||||||
|  |  | ||||||
							
								
								
									
										5
									
								
								feeds/wlan-ap/opensync/files/bin/wlan_ap_led_blink_off.sh
									
									
									
									
									
										Executable file
									
								
							
							
						
						
									
										5
									
								
								feeds/wlan-ap/opensync/files/bin/wlan_ap_led_blink_off.sh
									
									
									
									
									
										Executable file
									
								
							| @@ -0,0 +1,5 @@ | |||||||
|  | #!/bin/sh | ||||||
|  |  | ||||||
|  | #Turnoff blinking of AP's LED | ||||||
|  | /usr/opensync/tools/ovsh insert Node_Config module:="led" key:="led_off" value:="off" | ||||||
|  |  | ||||||
| @@ -1,11 +1,52 @@ | |||||||
| #!/bin/sh | #!/bin/sh | ||||||
|  |  | ||||||
| if [ $# -ne 1 ] ; then | AP_PRIVATE_KEY_FILE="/usr/opensync/certs/client_dec.key" | ||||||
| 	echo "Usage: $0 <redirector address>" >&2 | AP_CERTIFICATE_FILE="/usr/opensync/certs/client.pem" | ||||||
| 	exit 1 | AP_DEVICE_ID_FILE="/usr/opensync/certs/client_deviceid.txt" | ||||||
|  | DIGICERT_API_URI="clientauth.one.digicert.com" | ||||||
|  |  | ||||||
|  | if [ "$1" = "-h" ]; then | ||||||
|  |   echo "Usage: $0 [redirector address]" >&2 | ||||||
|  |   exit 1 | ||||||
| fi | fi | ||||||
|  |  | ||||||
| redirector_addr=$1 | # Query DigiCert's API if redirector wasn't specified | ||||||
|  | if [ -z "$1" ]; then | ||||||
|  |   if [ ! -f "$AP_DEVICE_ID_FILE" ]; then | ||||||
|  |       echo "Device ID file $AP_DEVICE_ID_FILE does not exist. Make sure to create it or specify the redirector address manually." | ||||||
|  |       exit 1 | ||||||
|  |   fi | ||||||
|  |  | ||||||
|  |   digicert_device_id=`cat ${AP_DEVICE_ID_FILE}` | ||||||
|  |   device_data=`curl -s \ | ||||||
|  |     --retry 5 \ | ||||||
|  |     --show-error \ | ||||||
|  |     --key "${AP_PRIVATE_KEY_FILE}" \ | ||||||
|  |     --cert "${AP_CERTIFICATE_FILE}" \ | ||||||
|  |     "https://${DIGICERT_API_URI}/iot/api/v2/device/${digicert_device_id}"` | ||||||
|  |  | ||||||
|  |   controller_url=`echo ${device_data} | jsonfilter -e '@.fields[@.name="Redirector"].value'` | ||||||
|  |   if [ -z "$controller_url" ]; then | ||||||
|  |     echo "No redirector found for this device" | ||||||
|  |     exit 1 | ||||||
|  |   fi | ||||||
|  |   controller_port=`echo ${controller_url} | cut -s -d ":" -f2)` | ||||||
|  |   if [ -z "$controller_port" ]; then | ||||||
|  |     redirector_addr="ssl:${controller_url}:6643" | ||||||
|  |   else | ||||||
|  |     redirector_addr="ssl:${controller_url}" | ||||||
|  |   fi | ||||||
|  | else | ||||||
|  |   redirector_addr=$1 | ||||||
|  | fi | ||||||
|  |  | ||||||
|  | # Enable lan ssh accsess | ||||||
|  | lan-ssh-firewall disable | ||||||
|  |  | ||||||
|  | echo "${redirector_addr}" > /usr/opensync/certs/redirector.txt | ||||||
|  | /etc/init.d/uhttpd enable | ||||||
|  | /etc/init.d/uhttpd start | ||||||
| uci set system.tip.redirector="${redirector_addr}" | uci set system.tip.redirector="${redirector_addr}" | ||||||
|  | uci set system.tip.deployed=0 | ||||||
|  | uci commit system | ||||||
| /etc/init.d/opensync restart | /etc/init.d/opensync restart | ||||||
|   | |||||||
| @@ -1,38 +0,0 @@ | |||||||
| #!/bin/sh |  | ||||||
|  |  | ||||||
| [ "${ACTION}" = "add" ] || exit 0 |  | ||||||
|  |  | ||||||
| phy=$(cat /sys/class/net/${DEVICENAME}/phy80211/name) |  | ||||||
| radio=$(uci get wireless.${DEVICENAME}.device) |  | ||||||
| hwmode=$(uci get wireless.${radio}.hwmode) |  | ||||||
|  |  | ||||||
| [ -z "$phy" -o -z "$radio" -o -z "$hwmode" ] && exit 0 |  | ||||||
|  |  | ||||||
| [ "${hwmode}" = "11a" ] && band=5 || band=2 |  | ||||||
|  |  | ||||||
| bcn_rate=$(uci get wireless.${DEVICENAME}.bcn_rate) |  | ||||||
| mcast_rate=$(uci get wireless.${DEVICENAME}.mcast_rate) |  | ||||||
|  |  | ||||||
| # ath10k rate-codes: 0x43 1M, 0x42 2M, 0x41 5.5M, 0x40 11M, 0x3 6M, 0x7 9M, 0x2 12M, 0x6 18M, 0x1 24M, 0x5 36M, 0x0 48M, 0x4 54M, 0xFF default |  | ||||||
| rate_codes="1:0x43 2:0x42 5.5:0x41 11:0x40 6:0x3 9:0x7 12:0x2 18:0x6 24:0x1 36:0x5 48:0x0 54:0x4" |  | ||||||
|  |  | ||||||
| # Default codes |  | ||||||
| beacon_code=0xFF |  | ||||||
| mcast_code=0xFF |  | ||||||
|  |  | ||||||
| for rate_code in $rate_codes ; do |  | ||||||
|         rate="${rate_code%%:*}" |  | ||||||
|         code="${rate_code##*:}" |  | ||||||
|         if [ "${rate_code%%:*}" == "$bcn_rate" ] ; then |  | ||||||
|                 beacon_code="${rate_code##*:}" |  | ||||||
|         fi |  | ||||||
|         if [ "${rate_code%%:*}" == "$mcast_rate" ] ; then |  | ||||||
|                 mcast_code="${rate_code##*:}" |  | ||||||
|         fi |  | ||||||
| done |  | ||||||
|  |  | ||||||
| # set rates |  | ||||||
| logger -t hotplug "Set Tx rates for device ${DEVICENAME}" |  | ||||||
| sleep 5 |  | ||||||
| echo "${DEVICENAME} beacon ${band} ${beacon_code}" > /sys/kernel/debug/ieee80211/${phy}/ath10k/set_rates |  | ||||||
| echo "${DEVICENAME} mcast ${band} ${mcast_code}" > /sys/kernel/debug/ieee80211/${phy}/ath10k/set_rates |  | ||||||
| @@ -0,0 +1,61 @@ | |||||||
|  | #!/bin/sh | ||||||
|  |  | ||||||
|  | [ "${ACTION}" = "add" ] || exit 0 | ||||||
|  |  | ||||||
|  | phy=$(cat /sys/class/net/${DEVICENAME}/phy80211/name) | ||||||
|  | radio=$(uci get wireless.${DEVICENAME}.device) | ||||||
|  | hwmode=$(uci get wireless.${radio}.hwmode) | ||||||
|  |  | ||||||
|  | [ -z "$phy" -o -z "$radio" -o -z "$hwmode" ] && exit 0 | ||||||
|  |  | ||||||
|  | [ "${hwmode}" = "11a" ] && band=5 || band=2 | ||||||
|  |  | ||||||
|  | bcn_rate=$(($(uci get wireless.${DEVICENAME}.bcn_rate)/10)) | ||||||
|  | mcast_rate=$(uci get wireless.${DEVICENAME}.mcast_rate) | ||||||
|  |  | ||||||
|  | ATH10K_FILE="/sys/kernel/debug/ieee80211/${phy}/ath10k/set_rates" | ||||||
|  | if [ -f "$ATH10K_FILE" ]; then | ||||||
|  | # ath10k rate-codes: 0x43 1M, 0x42 2M, 0x41 5.5M, 0x40 11M, 0x3 6M, 0x7 9M, 0x2 12M, 0x6 18M, 0x1 24M, 0x5 36M, 0x0 48M, 0x4 54M, 0xFF default | ||||||
|  |  | ||||||
|  | 	rate_codes="1:0x43 2:0x42 5:0x41 11:0x40 6:0x3 9:0x7 12:0x2 18:0x6 24:0x1 36:0x5 48:0x0 54:0x4" | ||||||
|  | 	SET_RATES_PATH=${ATH10K_FILE} | ||||||
|  | fi | ||||||
|  |  | ||||||
|  | ATH11K_FILE="/sys/kernel/debug/ieee80211/${phy}/ath11k/set_rates" | ||||||
|  | if [ -f "$ATH11K_FILE" ]; then | ||||||
|  | # ath11k rate-codes: 0x10000103 1M, 0x10000102 2M, 0x10000101 5.5M, 0x10000100 11M, 0x10000003 6M, 0x10000007 9M, 0x10000002 12M, 0x10000006 18M, 0x10000001 24M, 0x10000005 36M, 0x10000000 48M, 0x10000004 54M | ||||||
|  |  | ||||||
|  | 	rate_codes="1:0x10000103 2:0x10000102 5:0x10000101 11:0x10000100 6:0x10000003 9:0x10000007 12:0x10000002 18:0x10000006 24:0x10000001 36:0x10000005 48:0x10000000 54:0x10000004" | ||||||
|  | 	SET_RATES_PATH=${ATH11K_FILE} | ||||||
|  | fi | ||||||
|  |  | ||||||
|  | # Default codes | ||||||
|  | beacon_code=0xFF | ||||||
|  | mcast_code=0xFF | ||||||
|  |  | ||||||
|  | for rate_code in $rate_codes ; do | ||||||
|  |         rate="${rate_code%%:*}" | ||||||
|  |         code="${rate_code##*:}" | ||||||
|  |         if [ "${rate_code%%:*}" == "$bcn_rate" ] ; then | ||||||
|  |                 beacon_code="${rate_code##*:}" | ||||||
|  |         fi | ||||||
|  |         if [ "${rate_code%%:*}" == "$mcast_rate" ] ; then | ||||||
|  |                 mcast_code="${rate_code##*:}" | ||||||
|  |         fi | ||||||
|  | done | ||||||
|  |  | ||||||
|  | # set rates | ||||||
|  | logger -t hotplug "Set Tx rates for device ${DEVICENAME}" | ||||||
|  | sleep 20 | ||||||
|  |  | ||||||
|  | [ "${beacon_code}" = "0xFF" ] || { | ||||||
|  | 	echo "${DEVICENAME} beacon ${band} ${beacon_code}" > ${SET_RATES_PATH} | ||||||
|  |  | ||||||
|  | 	if [ -f "$ATH11K_FILE" ]; then | ||||||
|  | 		echo "${DEVICENAME} mgmt ${band} ${beacon_code}" > ${SET_RATES_PATH} | ||||||
|  | 	fi | ||||||
|  | } | ||||||
|  |  | ||||||
|  | [ "${mcast_code}" = "0xFF" ] || { | ||||||
|  | 	echo "${DEVICENAME} mcast ${band} ${mcast_code}" > ${SET_RATES_PATH} | ||||||
|  | } | ||||||
							
								
								
									
										10
									
								
								feeds/wlan-ap/opensync/files/etc/logrotate.d/ovsdb.conf
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										10
									
								
								feeds/wlan-ap/opensync/files/etc/logrotate.d/ovsdb.conf
									
									
									
									
									
										Normal file
									
								
							| @@ -0,0 +1,10 @@ | |||||||
|  | /tmp/log/openvswitch/*.log { | ||||||
|  |     daily | ||||||
|  |     rotate 5 | ||||||
|  |     size 1M | ||||||
|  |     compress | ||||||
|  |     delaycompress | ||||||
|  |     dateext | ||||||
|  |     dateformat -%s | ||||||
|  |     notifempty | ||||||
|  | } | ||||||
							
								
								
									
										75
									
								
								feeds/wlan-ap/opensync/files/usr/opensync/certs/ca.pem
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										75
									
								
								feeds/wlan-ap/opensync/files/usr/opensync/certs/ca.pem
									
									
									
									
									
										Normal file
									
								
							| @@ -0,0 +1,75 @@ | |||||||
|  | -----BEGIN CERTIFICATE----- | ||||||
|  | MIIEcTCCA1mgAwIBAgIUJFhIMlIJHJ7hW4gEzZuLBUaWjNcwDQYJKoZIhvcNAQEL | ||||||
|  | BQAwbDELMAkGA1UEBhMCVVMxJDAiBgNVBAoTG1RlbGVjb20gSW5mcmEgUHJvamVj | ||||||
|  | dCwgSW5jLjEMMAoGA1UECxMDVElQMSkwJwYDVQQDEyBUZWxlY29tIEluZnJhIFBy | ||||||
|  | b2plY3QgSXNzdWluZyBDQTAeFw0yMTA0MjUyMDMzNTRaFw0yNjA0MTMyMjM4NDZa | ||||||
|  | MCMxITAfBgNVBAMTGGNhY2VydHMub25lLmRpZ2ljZXJ0LmNvbTCCASIwDQYJKoZI | ||||||
|  | hvcNAQEBBQADggEPADCCAQoCggEBAJwKRHdkdEQkp32bNi9TdgN4FNRG0nRppguQ | ||||||
|  | mdCysJHA6/SuyAXNwKSbENysjFrcBkfYTlALjvIMqSu4d26ix6Mv4HnVxLjDzapV | ||||||
|  | TZhOhfxIbRQa3HNieNup2vMi8jJvgwLcK/4CwhBJsbEMkB5lbyL8UnCBxzW9GGbM | ||||||
|  | IvurvDFkUDUpUmiFg47nTpjub79KME6NqK38DxKzlUHvJge1TKFM73kZ3YkfWExQ | ||||||
|  | yRQPRiU5KxMi/Wkr30FOf/rMTx4XNacOgyTJvzcStGwrlr0iGr8eLC1/XVXoOQz3 | ||||||
|  | 0lyOeUzTB+HPU1Z2JrbPW5PnGxcQ0f7v/3qkWV1B2wuvFcQk+D0CAwEAAaOCAVIw | ||||||
|  | ggFOMAwGA1UdEwEB/wQCMAAwHQYDVR0OBBYEFIj2Mhdk10e46DeI+aEZKSSK8Hj+ | ||||||
|  | MB8GA1UdIwQYMBaAFLMbVLjgR6s98ziA5Dzl/QBhbdHoMA4GA1UdDwEB/wQEAwIE | ||||||
|  | 8DAWBgNVHSUBAf8EDDAKBggrBgEFBQcDAjCBhgYIKwYBBQUHAQEEejB4MCgGCCsG | ||||||
|  | AQUFBzABhhxodHRwOi8vb2NzcC5vbmUuZGlnaWNlcnQuY29tMEwGCCsGAQUFBzAC | ||||||
|  | hkBodHRwOi8vY2FjZXJ0cy5vbmUuZGlnaWNlcnQuY29tL1RlbGVjb21JbmZyYVBy | ||||||
|  | b2plY3RJc3N1aW5nQ0EuY3J0ME0GA1UdHwRGMEQwQqBAoD6GPGh0dHA6Ly9jcmwu | ||||||
|  | b25lLmRpZ2ljZXJ0LmNvbS9UZWxlY29tSW5mcmFQcm9qZWN0SXNzdWluZ0NBLmNy | ||||||
|  | bDANBgkqhkiG9w0BAQsFAAOCAQEADlFwshNPkeI2Gl6ooIauZL9d+6k+RWa5RTle | ||||||
|  | JWziYL23XVEBT11+dvp4IB9HwVw5dByl3XAfTd1r4qyncwgXQpc6j2X8e45E8izI | ||||||
|  | z2S1zhLMe1bA2lOiZz/sdpbonvxIHdiISyQI7q3mWQsvNkpkbjivjxLAJTcGPmOS | ||||||
|  | gc/95YL+2xqPV45XAnPcl5qkLThtmb57Xst1sLWiSS2fUId6HMVuCgZa5su+aAl9 | ||||||
|  | iMXv9YfHcvyfwXBaOtoBlItyMGl60uy0E/Fr5uEhEWi53EIqhty6KQckQBB7wdjQ | ||||||
|  | eiXNI5Ox5cf+TFdesuKPaoEn3WNpFL9PCA3S5nGegJlZQ4N9Eg== | ||||||
|  | -----END CERTIFICATE----- | ||||||
|  | -----BEGIN CERTIFICATE----- | ||||||
|  | MIIEnDCCA4SgAwIBAgIUVpyCUx1MUeUwxg+7I1BvGFTz7HkwDQYJKoZIhvcNAQEL | ||||||
|  | BQAwaTELMAkGA1UEBhMCVVMxJDAiBgNVBAoTG1RlbGVjb20gSW5mcmEgUHJvamVj | ||||||
|  | dCwgSW5jLjEMMAoGA1UECxMDVElQMSYwJAYDVQQDEx1UZWxlY29tIEluZnJhIFBy | ||||||
|  | b2plY3QgUm9vdCBDQTAeFw0yMTA0MTMyMjUxMjZaFw0yNjA0MTMyMjM4NDZaMGwx | ||||||
|  | CzAJBgNVBAYTAlVTMSQwIgYDVQQKExtUZWxlY29tIEluZnJhIFByb2plY3QsIElu | ||||||
|  | Yy4xDDAKBgNVBAsTA1RJUDEpMCcGA1UEAxMgVGVsZWNvbSBJbmZyYSBQcm9qZWN0 | ||||||
|  | IElzc3VpbmcgQ0EwggEiMA0GCSqGSIb3DQEBAQUAA4IBDwAwggEKAoIBAQDtKBrq | ||||||
|  | qd2aKVSk25KfL5xHu8X7/8rJrz3IvyPuVKWhk/N1zabot3suBcGaYNKjnRHxg78R | ||||||
|  | yKwKzajKYWtiQFqztu24g16LQeAnoUxZnF6a0z3JkkRPsz14A2y8TUhdEe1tx+UU | ||||||
|  | 4VGsk3n+FMmOQHL+79FO57zQC1LwylgfLSltrI6mF3jowVUQvnwzKhUzT87AJ6EO | ||||||
|  | ndK/q0T/Bgi+aI39zfVOjJjsTJwghvrmYW3iarP1THSKxeib2s02bZKrvvHa5HL4 | ||||||
|  | UI8+LvREpVZl4mzt1z6Nl344Y6f+UeJlYa/Ci0jJqaXJmyVnUbAz+c0i5JfwAVn3 | ||||||
|  | YQzfC4eLnZCmdF8zAgMBAAGjggE3MIIBMzAPBgNVHRMBAf8EBTADAQH/MB0GA1Ud | ||||||
|  | DgQWBBSzG1S44EerPfM4gOQ85f0AYW3R6DAfBgNVHSMEGDAWgBQCRpZgebFT9qny | ||||||
|  | 98WfIUDk6ZEB+jAOBgNVHQ8BAf8EBAMCAYYwgYMGCCsGAQUFBwEBBHcwdTAoBggr | ||||||
|  | BgEFBQcwAYYcaHR0cDovL29jc3Aub25lLmRpZ2ljZXJ0LmNvbTBJBggrBgEFBQcw | ||||||
|  | AoY9aHR0cDovL2NhY2VydHMub25lLmRpZ2ljZXJ0LmNvbS9UZWxlY29tSW5mcmFQ | ||||||
|  | cm9qZWN0Um9vdENBLmNydDBKBgNVHR8EQzBBMD+gPaA7hjlodHRwOi8vY3JsLm9u | ||||||
|  | ZS5kaWdpY2VydC5jb20vVGVsZWNvbUluZnJhUHJvamVjdFJvb3RDQS5jcmwwDQYJ | ||||||
|  | KoZIhvcNAQELBQADggEBAFbz+K94bHIkBMJqps0dApniUmOn0pO6Q6cGh47UP/kX | ||||||
|  | IiPIsnYgG+hqYD/qtsiqJhaWi0hixRWn38UmvZxMRk27aSTGE/TWx0JTC3qDGsSe | ||||||
|  | XkUagumbSfmS0ZyiTwMPeGAjXwyzGorqZWeA95eKfImntMiOf3E7//GK0K7HpCx8 | ||||||
|  | IPCnLZsZD2q/mLyBsduImFIRQJbLAhwIxpcd1qYJk+BlGFL+HtBpEbq6JxW2Xy+v | ||||||
|  | DpNWc2WIsUTle0rTc9JNJrLX4ChUJmKqf8obKHap3Xh3//qw/jDB9pOAinA33FLJ | ||||||
|  | EmCnwBvQr9mfNmPBGMYZVU8cPruDQJ57GjmmvdisbJY= | ||||||
|  | -----END CERTIFICATE----- | ||||||
|  | -----BEGIN CERTIFICATE----- | ||||||
|  | MIIDojCCAoqgAwIBAgIUPVYBpqNbcLYygF6Mx+qxSWwQyFowDQYJKoZIhvcNAQEL | ||||||
|  | BQAwaTELMAkGA1UEBhMCVVMxJDAiBgNVBAoTG1RlbGVjb20gSW5mcmEgUHJvamVj | ||||||
|  | dCwgSW5jLjEMMAoGA1UECxMDVElQMSYwJAYDVQQDEx1UZWxlY29tIEluZnJhIFBy | ||||||
|  | b2plY3QgUm9vdCBDQTAeFw0yMTA0MTMyMjQyNDRaFw0zMTA0MTMyMjM4NDZaMGkx | ||||||
|  | CzAJBgNVBAYTAlVTMSQwIgYDVQQKExtUZWxlY29tIEluZnJhIFByb2plY3QsIElu | ||||||
|  | Yy4xDDAKBgNVBAsTA1RJUDEmMCQGA1UEAxMdVGVsZWNvbSBJbmZyYSBQcm9qZWN0 | ||||||
|  | IFJvb3QgQ0EwggEiMA0GCSqGSIb3DQEBAQUAA4IBDwAwggEKAoIBAQDIGCibwf5u | ||||||
|  | AAwZ+1H8U0e3u2V+0d2gSctucoK86XwUmfe1V2a/qlCYZd29r80IuN1IIeB0naIm | ||||||
|  | KnK/MzXW87clF6tFd1+HzEvmlY/W4KyIXalVCTEzirFSvBEG2oZpM0yC3AefytAO | ||||||
|  | aOpA00LaM3xTfTqMKIRhJBuLy0I4ANUVG6ixVebbGuc78IodleqiLoWy2Q9QHyEO | ||||||
|  | t/7hZndJhiVogh0PveRhho45EbsACu7ymDY+JhlIleevqwlE3iQoq0YcmYADHno6 | ||||||
|  | Eq8vcwLpZFxihupUafkd1T3WJYQAJf9coCjBu2qIhNgrcrGD8R9fGswwNRzMRMpX | ||||||
|  | 720+GjcDW3bJAgMBAAGjQjBAMA8GA1UdEwEB/wQFMAMBAf8wHQYDVR0OBBYEFAJG | ||||||
|  | lmB5sVP2qfL3xZ8hQOTpkQH6MA4GA1UdDwEB/wQEAwIBhjANBgkqhkiG9w0BAQsF | ||||||
|  | AAOCAQEAVjl9dm4epG9NUYnagT9sg7scVQEPfz3Lt6w1NXJXgD8mAUlK0jXmEyvM | ||||||
|  | dCPD4514n+8+lM7US8fh+nxc7jO//LwK17Wm9FblgjNFR7+anv0Q99T9fP19DLlF | ||||||
|  | PSNHL2emogy1bl1lLTAoj8nxg2wVKPDSHBGviQ5LR9fsWUIJDv9Bs5k0qWugWYSj | ||||||
|  | 19S6qnHeskRDB8MqRLhKMG82oDVLerSnhD0P6HjySBHgTTU7/tYS/OZr1jI6MPbG | ||||||
|  | L+/DtiR5fDVMNdBSGU89UNTi0wHY9+RFuNlIuvZC+x/swF0V9R5mN+ywquTPtDLA | ||||||
|  | 5IOM7ItsRmen6u3qu+JXros54e4juQ== | ||||||
|  | -----END CERTIFICATE----- | ||||||
| @@ -1,6 +1,6 @@ | |||||||
| --- a/interfaces/opensync.ovsschema | --- a/interfaces/opensync.ovsschema | ||||||
| +++ b/interfaces/opensync.ovsschema | +++ b/interfaces/opensync.ovsschema | ||||||
| @@ -8828,6 +8828,442 @@ | @@ -8831,6 +8831,451 @@ | ||||||
|              } |              } | ||||||
|          }, |          }, | ||||||
|          "isRoot": true |          "isRoot": true | ||||||
| @@ -269,6 +269,15 @@ | |||||||
| +                    } | +                    } | ||||||
| +                } | +                } | ||||||
| +              }, | +              }, | ||||||
|  | +            "access_network_type": { | ||||||
|  | +              "type": { | ||||||
|  | +                "key": { | ||||||
|  | +                  "type": "integer" | ||||||
|  | +                }, | ||||||
|  | +                "min": 0, | ||||||
|  | +                "max": 1 | ||||||
|  | +              } | ||||||
|  | +            }, | ||||||
| +            "internet": { | +            "internet": { | ||||||
| +              "type": { | +              "type": { | ||||||
| +                "key": { | +                "key": { | ||||||
|   | |||||||
| @@ -117,7 +117,7 @@ Index: opensync-2.0.5.0/src/lib/datapipeline/src/dppline.c | |||||||
| +		assert(channel_switch); | +		assert(channel_switch); | ||||||
| +		sts__event_report__channel_switch_event__init(channel_switch); | +		sts__event_report__channel_switch_event__init(channel_switch); | ||||||
| + | + | ||||||
| +		channel_switch->band = channel_switch_rec->band; | +		channel_switch->band = dppline_to_proto_radio(channel_switch_rec->band); | ||||||
| +		channel_switch->reason = channel_switch_rec->reason; | +		channel_switch->reason = channel_switch_rec->reason; | ||||||
| +		channel_switch->channel = channel_switch_rec->freq; | +		channel_switch->channel = channel_switch_rec->freq; | ||||||
| +		channel_switch->timestamp_ms = channel_switch_rec->timestamp; | +		channel_switch->timestamp_ms = channel_switch_rec->timestamp; | ||||||
|   | |||||||
							
								
								
									
										11
									
								
								feeds/wlan-ap/opensync/patches/29-add-max-clients.patch
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										11
									
								
								feeds/wlan-ap/opensync/patches/29-add-max-clients.patch
									
									
									
									
									
										Normal file
									
								
							| @@ -0,0 +1,11 @@ | |||||||
|  | --- a/src/lib/schema/inc/schema_consts.h | ||||||
|  | +++ b/src/lib/schema/inc/schema_consts.h | ||||||
|  | @@ -176,4 +176,8 @@ typedef enum { | ||||||
|  |  #define SCHEMA_CONSTS_MESH_HOP_PENALTY     "hop_penalty" | ||||||
|  |  #define SCHEMA_CONSTS_MESH_MCAST_RATE      "mcast_rate" | ||||||
|  |  #define SCHEMA_CONSTS_MESH_MTU             "mtu" | ||||||
|  | + | ||||||
|  | +/* Max clients per radio */ | ||||||
|  | +#define SCHEMA_CONSTS_MAX_CLIENTS	"max_clients" | ||||||
|  | + | ||||||
|  |  #endif /* SCHEMA_CONSTS_H_INCLUDED */ | ||||||
| @@ -0,0 +1,33 @@ | |||||||
|  | --- a/src/lib/datapipeline/src/dppline.c | ||||||
|  | +++ b/src/lib/datapipeline/src/dppline.c | ||||||
|  | @@ -2147,9 +2147,11 @@ static void dppline_add_stat_events(Sts_ | ||||||
|  |  			ipe->timestamp_ms = cs_rec->ip_event->timestamp; | ||||||
|  |   | ||||||
|  |  			if (cs_rec->ip_event->ip_addr) { | ||||||
|  | -				ipe->ip_addr.data = malloc(16); | ||||||
|  | -				memcpy(ipe->ip_addr.data, cs_rec->ip_event->ip_addr,16); | ||||||
|  | -				ipe->ip_addr.len = 16; | ||||||
|  | +				uint8_t ip[IPV4_BYTES_LEN] = {0}; | ||||||
|  | +				sscanf(cs_rec->ip_event->ip_addr, "%hhu.%hhu.%hhu.%hhu", &ip[0], &ip[1], &ip[2], &ip[3]); | ||||||
|  | +				ipe->ip_addr.data = malloc(IPV4_BYTES_LEN); | ||||||
|  | +				memcpy(ipe->ip_addr.data, ip, IPV4_BYTES_LEN); | ||||||
|  | +				ipe->ip_addr.len = IPV4_BYTES_LEN; | ||||||
|  |  				ipe->has_ip_addr = true; | ||||||
|  |  			} | ||||||
|  |  		} | ||||||
|  | @@ -2224,10 +2226,11 @@ static void dppline_add_stat_events(Sts_ | ||||||
|  |  			} | ||||||
|  |   | ||||||
|  |  			if (cs_rec->connect_event->ip_addr) { | ||||||
|  | -				coe->ip_addr.data = malloc(16); | ||||||
|  | -				memcpy(coe->ip_addr.data, cs_rec->connect_event->ip_addr, | ||||||
|  | -				       16); | ||||||
|  | -				coe->ip_addr.len = 16; | ||||||
|  | +				uint8_t ip[IPV4_BYTES_LEN] = {0}; | ||||||
|  | +				sscanf(cs_rec->connect_event->ip_addr, "%hhu.%hhu.%hhu.%hhu", &ip[0], &ip[1], &ip[2], &ip[3]); | ||||||
|  | +				coe->ip_addr.data = malloc(IPV4_BYTES_LEN); | ||||||
|  | +				memcpy(coe->ip_addr.data, ip, IPV4_BYTES_LEN); | ||||||
|  | +				coe->ip_addr.len = IPV4_BYTES_LEN; | ||||||
|  |  				coe->has_ip_addr = true; | ||||||
|  |  			} | ||||||
|  |   | ||||||
							
								
								
									
										89
									
								
								feeds/wlan-ap/opensync/patches/31-adjust-log-levels.patch
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										89
									
								
								feeds/wlan-ap/opensync/patches/31-adjust-log-levels.patch
									
									
									
									
									
										Normal file
									
								
							| @@ -0,0 +1,89 @@ | |||||||
|  | --- a/src/lib/ovsdb/src/ovsdb_sync_api.c | ||||||
|  | +++ b/src/lib/ovsdb/src/ovsdb_sync_api.c | ||||||
|  | @@ -492,7 +492,7 @@ int ovsdb_sync_mutate_uuid_set(const cha | ||||||
|  |      json_t * js; | ||||||
|  |      json_t * js_mutations; | ||||||
|  |   | ||||||
|  | -    LOG(INFO, "Mutate: %s %s %d %s", table, column, op, uuid); | ||||||
|  | +    LOG(DEBUG, "Mutate: %s %s %d %s", table, column, op, uuid); | ||||||
|  |   | ||||||
|  |      js = ovsdb_mutation(column, | ||||||
|  |              ovsdb_tran_operation(op), | ||||||
|  | --- a/src/sm/src/sm_scan_schedule.c | ||||||
|  | +++ b/src/sm/src/sm_scan_schedule.c | ||||||
|  | @@ -230,7 +230,7 @@ bool sm_scan_schedule_process( | ||||||
|  |                  sm_scan_schedule_cb, | ||||||
|  |                  scan_ctx); | ||||||
|  |      if (true != rc) { | ||||||
|  | -        LOG(ERR, | ||||||
|  | +        LOG(DEBUG, | ||||||
|  |              "Scheduling %s %s %d scan", | ||||||
|  |              radio_get_name_from_type(request_ctx->radio_cfg->type), | ||||||
|  |              radio_get_scan_name_from_type(request_ctx->scan_type), | ||||||
|  | --- a/src/sm/src/sm_survey_report.c | ||||||
|  | +++ b/src/sm/src/sm_survey_report.c | ||||||
|  | @@ -1004,7 +1004,7 @@ bool sm_survey_threshold_util_cb ( | ||||||
|  |   | ||||||
|  |      rc = sm_scan_schedule(&scan_request); | ||||||
|  |      if (true != rc) { | ||||||
|  | -        LOGE("Processing %s %s %d survey (Failed to schedule scan)", | ||||||
|  | +        LOGD("Processing %s %s %d survey (Failed to schedule scan)", | ||||||
|  |               radio_get_name_from_cfg(radio_cfg_ctx), | ||||||
|  |               radio_get_scan_name_from_type(scan_type), | ||||||
|  |               *scan_chan); | ||||||
|  | @@ -1153,7 +1153,7 @@ bool sm_survey_stats_update ( | ||||||
|  |   | ||||||
|  |      rc = sm_scan_schedule(&scan_request); | ||||||
|  |      if (true != rc) { | ||||||
|  | -        LOG(ERR, | ||||||
|  | +        LOG(DEBUG, | ||||||
|  |              "Processing %s %s %d survey ", | ||||||
|  |              radio_get_name_from_cfg(radio_cfg_ctx), | ||||||
|  |              radio_get_scan_name_from_type(scan_type), | ||||||
|  | --- a/src/wm2/src/wm2_radio.c | ||||||
|  | +++ b/src/wm2/src/wm2_radio.c | ||||||
|  | @@ -517,7 +517,7 @@ wm2_radio_update_port_state_set_inactive | ||||||
|  |   | ||||||
|  |  #define CMP(cmp, name) \ | ||||||
|  |      (changed |= (changedf->name = ((cmp(conf, state, name, changedf->_uuid)) && \ | ||||||
|  | -                                   (LOGI("%s: '%s' changed", conf->if_name, #name), 1)))) | ||||||
|  | +                                   (LOGT("%s: '%s' changed", conf->if_name, #name), 1)))) | ||||||
|  |   | ||||||
|  |  static bool | ||||||
|  |  wm2_vconf_changed(const struct schema_Wifi_VIF_Config *conf, | ||||||
|  | @@ -559,7 +559,7 @@ wm2_vconf_changed(const struct schema_Wi | ||||||
|  |      CMP(CHANGED_SET_CASE, captive_allowlist); | ||||||
|  |   | ||||||
|  |      if (changed) | ||||||
|  | -        LOGD("%s: changed (forced=%d)", conf->if_name, changedf->_uuid); | ||||||
|  | +        LOGT("%s: changed (forced=%d)", conf->if_name, changedf->_uuid); | ||||||
|  |   | ||||||
|  |      return changed; | ||||||
|  |  } | ||||||
|  | @@ -597,7 +597,7 @@ wm2_rconf_changed(const struct schema_Wi | ||||||
|  |      CMP(CHANGED_MAP_STRSTR, custom_options); | ||||||
|  |   | ||||||
|  |      if (changed) | ||||||
|  | -        LOGD("%s: changed (forced=%d)", conf->if_name, changedf->_uuid); | ||||||
|  | +        LOGT("%s: changed (forced=%d)", conf->if_name, changedf->_uuid); | ||||||
|  |   | ||||||
|  |      return changed; | ||||||
|  |  } | ||||||
|  | @@ -1351,7 +1351,7 @@ wm2_op_vstate(const struct schema_Wifi_V | ||||||
|  |                                    SCHEMA_COLUMN(Wifi_VIF_State, if_name), | ||||||
|  |                                    state.if_name); | ||||||
|  |      } | ||||||
|  | -    LOGI("%s: updated vif state", state.if_name); | ||||||
|  | +    LOGD("%s: updated vif state", state.if_name); | ||||||
|  |  recalc: | ||||||
|  |      /* Reconnect workaround is for CAES-771 */ | ||||||
|  |      if (wm2_sta_has_reconnected(&oldstate, &state)) | ||||||
|  | @@ -1392,7 +1392,7 @@ wm2_op_rstate(const struct schema_Wifi_R | ||||||
|  |      } | ||||||
|  |   | ||||||
|  |      REQUIRE(state.if_name, 1 == ovsdb_table_upsert_f(&table_Wifi_Radio_State, &state, false, NULL)); | ||||||
|  | -    LOGI("%s: updated radio state", state.if_name); | ||||||
|  | +    LOGD("%s: updated radio state", state.if_name); | ||||||
|  |      wm2_delayed_recalc(wm2_rconf_recalc, state.if_name); | ||||||
|  |  } | ||||||
|  |   | ||||||
							
								
								
									
										349
									
								
								feeds/wlan-ap/opensync/patches/32-noisy-logs-clean
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										349
									
								
								feeds/wlan-ap/opensync/patches/32-noisy-logs-clean
									
									
									
									
									
										Normal file
									
								
							| @@ -0,0 +1,349 @@ | |||||||
|  | --- a/src/sm/src/sm_client_report.c | ||||||
|  | +++ b/src/sm/src/sm_client_report.c | ||||||
|  | @@ -792,7 +792,7 @@ bool sm_client_report_send( | ||||||
|  |          ds_dlist_insert_tail(report_list, report_entry); | ||||||
|  |      } | ||||||
|  |   | ||||||
|  | -    LOG(INFO, | ||||||
|  | +    LOG(DEBUG, | ||||||
|  |          "Sending %s client report at '%s'", | ||||||
|  |          radio_get_name_from_cfg(radio_cfg_ctx), | ||||||
|  |          sm_timestamp_ms_to_date(report_ctx->timestamp_ms)); | ||||||
|  | --- a/src/sm/src/sm_neighbor_report.c | ||||||
|  | +++ b/src/sm/src/sm_neighbor_report.c | ||||||
|  | @@ -390,7 +390,7 @@ bool sm_neighbor_report_send_diff( | ||||||
|  |          } | ||||||
|  |      } | ||||||
|  |   | ||||||
|  | -    LOGI("Sending %s %s neighbor report at '%s'", | ||||||
|  | +    LOGD("Sending %s %s neighbor report at '%s'", | ||||||
|  |           radio_get_name_from_cfg(radio_cfg_ctx), | ||||||
|  |           radio_get_scan_name_from_type(scan_type), | ||||||
|  |           sm_timestamp_ms_to_date(report_diff.timestamp_ms)); | ||||||
|  | @@ -503,7 +503,7 @@ bool sm_neighbor_report_send_raw( | ||||||
|  |               neighbor_entry->chan); | ||||||
|  |      } | ||||||
|  |   | ||||||
|  | -    LOGI("Sending %s %s neighbor report at '%s'", | ||||||
|  | +    LOGD("Sending %s %s neighbor report at '%s'", | ||||||
|  |           radio_get_name_from_cfg(radio_cfg_ctx), | ||||||
|  |           radio_get_scan_name_from_type(scan_type), | ||||||
|  |           sm_timestamp_ms_to_date(report_ctx->timestamp_ms)); | ||||||
|  | --- a/src/sm/src/sm_capacity_report.c | ||||||
|  | +++ b/src/sm/src/sm_capacity_report.c | ||||||
|  | @@ -288,7 +288,7 @@ bool sm_capacity_report_send( | ||||||
|  |          } | ||||||
|  |      } | ||||||
|  |   | ||||||
|  | -    LOG(INFO, | ||||||
|  | +    LOG(DEBUG, | ||||||
|  |          "Sending %s capacity report at '%s'", | ||||||
|  |          radio_get_name_from_cfg(radio_cfg_ctx), | ||||||
|  |          sm_timestamp_ms_to_date(report_ctx->timestamp_ms)); | ||||||
|  | --- a/src/sm/src/sm_device_report.c | ||||||
|  | +++ b/src/sm/src/sm_device_report.c | ||||||
|  | @@ -219,14 +219,14 @@ void sm_device_report (EV_P_ ev_timer *w | ||||||
|  |          request_ctx->reporting_timestamp - device_ctx->report_ts + | ||||||
|  |          get_timestamp(); | ||||||
|  |   | ||||||
|  | -    LOG(INFO, | ||||||
|  | +    LOG(DEBUG, | ||||||
|  |          "uptime=%u, mem=%u/%u, cpu=%u", | ||||||
|  |          report_ctx->record.uptime, | ||||||
|  |          report_ctx->record.mem_util.mem_used, | ||||||
|  |          report_ctx->record.mem_util.mem_total, | ||||||
|  |          report_ctx->record.cpu_util.cpu_util); | ||||||
|  |   | ||||||
|  | -    LOG(INFO, | ||||||
|  | +    LOG(DEBUG, | ||||||
|  |          "Sending device report at '%s'", | ||||||
|  |          sm_timestamp_ms_to_date(report_ctx->timestamp_ms)); | ||||||
|  |   | ||||||
|  | @@ -345,7 +345,7 @@ bool sm_device_report_request( | ||||||
|  |          memset(request_ctx, 0, sizeof(*request_ctx)); | ||||||
|  |          memset(report_ctx, 0, sizeof(*report_ctx)); | ||||||
|  |   | ||||||
|  | -        LOG(INFO, | ||||||
|  | +        LOG(DEBUG, | ||||||
|  |              "Initializing device reporting"); | ||||||
|  |   | ||||||
|  |          /* Initialize report device temp list */ | ||||||
|  | --- a/src/sm/src/sm_network_probe_report.c | ||||||
|  | +++ b/src/sm/src/sm_network_probe_report.c | ||||||
|  | @@ -188,7 +188,7 @@ void sm_network_probe_report (EV_P_ ev_t | ||||||
|  |          request_ctx->reporting_timestamp - network_probe_ctx->report_ts + | ||||||
|  |          get_timestamp(); | ||||||
|  |   | ||||||
|  | -    LOG(INFO, | ||||||
|  | +    LOG(DEBUG, | ||||||
|  |          "Sending network probe report at '%s' , latency : '%d'", | ||||||
|  |          sm_timestamp_ms_to_date(report_ctx->timestamp_ms), report_ctx->record.dns_probe.latency); | ||||||
|  |   | ||||||
|  | --- a/src/sm/src/sm_rssi_report.c | ||||||
|  | +++ b/src/sm/src/sm_rssi_report.c | ||||||
|  | @@ -514,7 +514,7 @@ bool sm_rssi_report_send( | ||||||
|  |          } | ||||||
|  |      } | ||||||
|  |   | ||||||
|  | -    LOGI("Sending %s rssi report at '%s'", | ||||||
|  | +    LOGD("Sending %s rssi report at '%s'", | ||||||
|  |           radio_get_name_from_cfg(radio_cfg_ctx), | ||||||
|  |           sm_timestamp_ms_to_date(report_ctx->timestamp_ms)); | ||||||
|  |   | ||||||
|  | --- a/src/sm/src/sm_survey_report.c | ||||||
|  | +++ b/src/sm/src/sm_survey_report.c | ||||||
|  | @@ -592,7 +592,7 @@ bool sm_survey_report_send( | ||||||
|  |              goto exit; | ||||||
|  |      } | ||||||
|  |   | ||||||
|  | -    LOGI("Sending %s %s survey report at '%s'", | ||||||
|  | +    LOGD("Sending %s %s survey report at '%s'", | ||||||
|  |           radio_get_name_from_cfg(radio_cfg_ctx), | ||||||
|  |           radio_get_scan_name_from_type(scan_type), | ||||||
|  |           sm_timestamp_ms_to_date(report_ctx->timestamp_ms)); | ||||||
|  | @@ -979,7 +979,7 @@ bool sm_survey_threshold_util_cb ( | ||||||
|  |           survey_ctx->threshold_count, request_ctx->radio_chan_list.chan_num); | ||||||
|  |   | ||||||
|  |      if (threshold_util >= request_ctx->threshold_util) { | ||||||
|  | -        LOGI("Skip processing %s %s survey (threshold util exceeded %d >= %d)", | ||||||
|  | +        LOGD("Skip processing %s %s survey (threshold util exceeded %d >= %d)", | ||||||
|  |               radio_get_name_from_cfg(radio_cfg_ctx), | ||||||
|  |               radio_get_scan_name_from_type(scan_type), | ||||||
|  |               threshold_util, | ||||||
|  | @@ -1103,7 +1103,7 @@ bool sm_survey_stats_update ( | ||||||
|  |              scan_interval = SURVEY_MIN_SCAN_INTERVAL; | ||||||
|  |   | ||||||
|  |              // always scan if max_delay exceeded | ||||||
|  | -            LOGI("Force processing %s %s survey delay: %ld/%d count: %d/%d", | ||||||
|  | +            LOGD("Force processing %s %s survey delay: %ld/%d count: %d/%d", | ||||||
|  |                   radio_get_name_from_cfg(radio_cfg_ctx), | ||||||
|  |                   radio_get_scan_name_from_type(scan_type), | ||||||
|  |                   survey_ctx->threshold_time_delta, request_ctx->threshold_max_delay, | ||||||
|  | @@ -1771,7 +1771,7 @@ bool sm_survey_stats_process ( | ||||||
|  |                      request_ctx->threshold_pod_num * request_ctx->sampling_interval; | ||||||
|  |              } | ||||||
|  |   | ||||||
|  | -            LOGI("Updated %s %s survey threshold_max_delay (%d + %d) * %d) -> %ds) ", | ||||||
|  | +            LOGD("Updated %s %s survey threshold_max_delay (%d + %d) * %d) -> %ds) ", | ||||||
|  |                   radio_get_name_from_cfg(radio_cfg_ctx), | ||||||
|  |                   radio_get_scan_name_from_type(scan_type), | ||||||
|  |                   request_ctx->threshold_pod_num, | ||||||
|  | @@ -1790,7 +1790,7 @@ bool sm_survey_stats_process ( | ||||||
|  |                  request_ctx->sampling_interval - | ||||||
|  |                  (uint32_t)((request_ctx->reporting_timestamp / 1000) % request_ctx->sampling_interval); | ||||||
|  |   | ||||||
|  | -            LOGI("Updated %s %s survey synchronization_delay %d - %d -> %"PRIu64"s) ", | ||||||
|  | +            LOGD("Updated %s %s survey synchronization_delay %d - %d -> %"PRIu64"s) ", | ||||||
|  |                   radio_get_name_from_cfg(radio_cfg_ctx), | ||||||
|  |                   radio_get_scan_name_from_type(scan_type), | ||||||
|  |                   request_ctx->sampling_interval, | ||||||
|  | --- a/src/wm2/src/wm2_radio.c | ||||||
|  | +++ b/src/wm2/src/wm2_radio.c | ||||||
|  | @@ -137,7 +137,7 @@ wm2_delayed(void (*fn)(const char *ifnam | ||||||
|  |      ev_timer_init(&i->timer, wm2_delayed_cb, seconds, 0); | ||||||
|  |      ev_timer_start(EV_DEFAULT, &i->timer); | ||||||
|  |      ds_dlist_insert_tail(&delayed_list, i); | ||||||
|  | -    LOGI("%s: scheduling delayed (%us) work %s", ifname, seconds, workname); | ||||||
|  | +    LOGD("%s: scheduling delayed (%us) work %s", ifname, seconds, workname); | ||||||
|  |  } | ||||||
|  |   | ||||||
|  |  #define wm2_delayed_recalc(fn, ifname) (wm2_delayed((fn), (ifname), WM2_RECALC_DELAY_SECONDS, #fn)) | ||||||
|  | @@ -267,7 +267,7 @@ wm2_parent_change(void) | ||||||
|  |  static void | ||||||
|  |  wm2_dfs_disconnect_check(const char *ifname, bool force) | ||||||
|  |  { | ||||||
|  | -    LOGN("%s %s called", ifname, __func__); | ||||||
|  | +    LOGD("%s %s called", ifname, __func__); | ||||||
|  |      wm2_parent_change(); | ||||||
|  |  } | ||||||
|  |   | ||||||
|  | @@ -286,7 +286,7 @@ wm2_sta_has_dfs_channel(const struct sch | ||||||
|  |          if (rstate->channel != atoi(rstate->channels_keys[i])) | ||||||
|  |              continue; | ||||||
|  |   | ||||||
|  | -        LOGI("%s: check channel %d (%d) %s", vstate->if_name, rstate->channel, vstate->channel, rstate->channels[i]); | ||||||
|  | +        LOGD("%s: check channel %d (%d) %s", vstate->if_name, rstate->channel, vstate->channel, rstate->channels[i]); | ||||||
|  |          if (!strstr(rstate->channels[i], "allowed")) | ||||||
|  |              status = true; | ||||||
|  |   | ||||||
|  | @@ -319,7 +319,7 @@ wm2_sta_handle_dfs_link_change(const str | ||||||
|  |   | ||||||
|  |      if (wm2_sta_has_disconnected(oldstate, newstate) && | ||||||
|  |          wm2_sta_has_dfs_channel(rstate, oldstate)) { | ||||||
|  | -            LOGN("%s: sta: dfs: disconnected from %s - arm fallback parents timer", oldstate->if_name, oldstate->parent); | ||||||
|  | +            LOGD("%s: sta: dfs: disconnected from %s - arm fallback parents timer", oldstate->if_name, oldstate->parent); | ||||||
|  |              wm2_timer(wm2_dfs_disconnect_check, oldstate->if_name, WM2_DFS_FALLBACK_GRACE_PERIOD_SECONDS); | ||||||
|  |      } | ||||||
|  |  } | ||||||
|  | @@ -923,13 +923,13 @@ wm2_vconf_recalc(const char *ifname, boo | ||||||
|  |   | ||||||
|  |      wm2_radio_update_port_state(vconf.if_name); | ||||||
|  |   | ||||||
|  | -    LOGI("%s@%s: changed, configuring", ifname, rconf.if_name); | ||||||
|  | +    LOGD("%s@%s: changed, configuring", ifname, rconf.if_name); | ||||||
|  |   | ||||||
|  |      if (vchanged.parent) | ||||||
|  | -        LOGN("%s: topology change: parent '%s' -> '%s'", ifname, vstate.parent, vconf.parent); | ||||||
|  | +        LOGD("%s: topology change: parent '%s' -> '%s'", ifname, vstate.parent, vconf.parent); | ||||||
|  |   | ||||||
|  |      if (vchanged.ssid && strlen(vconf.ssid) > 0 && !strcmp(vconf.mode, "sta")) | ||||||
|  | -        LOGN("%s: topology change: ssid '%s' -> '%s'", ifname, vstate.ssid, vconf.ssid); | ||||||
|  | +        LOGD("%s: topology change: ssid '%s' -> '%s'", ifname, vstate.ssid, vconf.ssid); | ||||||
|  |   | ||||||
|  |      if (!target_vif_config_set2(&vconf, &rconf, cconfs, &vchanged, num_cconfs)) { | ||||||
|  |          LOGW("%s: failed to configure, will retry later", ifname); | ||||||
|  | @@ -1047,7 +1047,7 @@ wm2_rconf_recalc_fixup_channel(struct sc | ||||||
|  |       * i.e. when radio_config channel is more important than | ||||||
|  |       * sta vif channel in cases of sta csa, sta (re)assoc. | ||||||
|  |       */ | ||||||
|  | -    LOGN("%s: ignoring channel change %d -> %d because sta vif %s is connected on %d, see CAES-600", | ||||||
|  | +    LOGD("%s: ignoring channel change %d -> %d because sta vif %s is connected on %d, see CAES-600", | ||||||
|  |              rconf->if_name, rstate->channel, rconf->channel, | ||||||
|  |              vstate.if_name, vstate.channel); | ||||||
|  |      rconf->channel = vstate.channel; | ||||||
|  | @@ -1146,10 +1146,10 @@ wm2_rconf_recalc(const char *ifname, boo | ||||||
|  |      if (!wm2_rconf_changed(&rconf, &rstate, &changed) && !force) | ||||||
|  |          goto recalc; | ||||||
|  |   | ||||||
|  | -    LOGI("%s: changed, configuring", ifname); | ||||||
|  | +    LOGD("%s: changed, configuring", ifname); | ||||||
|  |   | ||||||
|  |      if ((changed.channel || changed.ht_mode) && rconf.channel) { | ||||||
|  | -        LOGN("%s: topology change: channel %d @ %s -> %d @ %s", | ||||||
|  | +        LOGD("%s: topology change: channel %d @ %s -> %d @ %s", | ||||||
|  |               ifname, | ||||||
|  |               rstate.channel, rstate.ht_mode, | ||||||
|  |               rconf.channel, rconf.ht_mode); | ||||||
|  | @@ -1183,7 +1183,7 @@ wm2_op_vconf(const struct schema_Wifi_VI | ||||||
|  |      memcpy(&tmp, vconf, sizeof(tmp)); | ||||||
|  |      memset(&rconf, 0, sizeof(rconf)); | ||||||
|  |   | ||||||
|  | -    LOGI("%s @ %s: updating vconf", vconf->if_name, phy); | ||||||
|  | +    LOGD("%s @ %s: updating vconf", vconf->if_name, phy); | ||||||
|  |      REQUIRE(vconf->if_name, strlen(vconf->if_name) > 0); | ||||||
|  |      REQUIRE(vconf->if_name, vconf->_partial_update); | ||||||
|  |      if (!(where = ovsdb_where_simple(SCHEMA_COLUMN(Wifi_Radio_Config, if_name), phy))) | ||||||
|  | @@ -1203,7 +1203,7 @@ wm2_op_vconf(const struct schema_Wifi_VI | ||||||
|  |                                                             SCHEMA_TABLE(Wifi_Radio_Config), | ||||||
|  |                                                             where, | ||||||
|  |                                                             SCHEMA_COLUMN(Wifi_Radio_Config, vif_configs))); | ||||||
|  | -    LOGI("%s @ %s: updated vconf", vconf->if_name, phy); | ||||||
|  | +    LOGD("%s @ %s: updated vconf", vconf->if_name, phy); | ||||||
|  |      wm2_delayed_recalc(wm2_vconf_recalc, vconf->if_name); | ||||||
|  |  } | ||||||
|  |   | ||||||
|  | @@ -1212,14 +1212,14 @@ wm2_op_rconf(const struct schema_Wifi_Ra | ||||||
|  |  { | ||||||
|  |      struct schema_Wifi_Radio_Config tmp; | ||||||
|  |      memcpy(&tmp, rconf, sizeof(tmp)); | ||||||
|  | -    LOGI("%s: updating rconf", rconf->if_name); | ||||||
|  | +    LOGD("%s: updating rconf", rconf->if_name); | ||||||
|  |      REQUIRE(rconf->if_name, strlen(rconf->if_name) > 0); | ||||||
|  |      REQUIRE(rconf->if_name, rconf->_partial_update); | ||||||
|  |      OVERRIDE(rconf->if_name, tmp.vif_configs_present, false); | ||||||
|  |      tmp.vif_configs_len = 0; | ||||||
|  |      tmp.vif_configs_present = true; | ||||||
|  |      REQUIRE(rconf->if_name, 1 == ovsdb_table_upsert_f(&table_Wifi_Radio_Config, &tmp, false, NULL)); | ||||||
|  | -    LOGI("%s: updated rconf", rconf->if_name); | ||||||
|  | +    LOGD("%s: updated rconf", rconf->if_name); | ||||||
|  |      wm2_delayed_recalc(wm2_rconf_recalc, rconf->if_name); | ||||||
|  |  } | ||||||
|  |   | ||||||
|  | --- a/src/xm/src/xm_ovsdb.c | ||||||
|  | +++ b/src/xm/src/xm_ovsdb.c | ||||||
|  | @@ -91,7 +91,7 @@ static bool xm_device_info_update(const | ||||||
|  |   | ||||||
|  |      if (ovsdb_table_upsert_f(&table_AWLAN_Node, &node, false, NULL)) | ||||||
|  |      { | ||||||
|  | -        LOGI("External: Updated device info"); | ||||||
|  | +        LOGD("External: Updated device info"); | ||||||
|  |      } | ||||||
|  |      else | ||||||
|  |      { | ||||||
|  | @@ -127,7 +127,7 @@ static bool xm_mode_update(const connect | ||||||
|  |   | ||||||
|  |      if (ovsdb_table_upsert_f(&table_AWLAN_Node, &node, false, NULL)) | ||||||
|  |      { | ||||||
|  | -        LOGI("External: Updated device mode"); | ||||||
|  | +        LOGD("External: Updated device mode"); | ||||||
|  |      } | ||||||
|  |      else | ||||||
|  |      { | ||||||
|  | @@ -150,7 +150,7 @@ static bool xm_address_update(const char | ||||||
|  |      SCHEMA_SET_STR(node.redirector_addr, cloud_address); | ||||||
|  |      if (ovsdb_table_upsert_f(&table_AWLAN_Node, &node, false, NULL)) | ||||||
|  |      { | ||||||
|  | -        LOGI("External: Updated cloud address"); | ||||||
|  | +        LOGD("External: Updated cloud address"); | ||||||
|  |      } | ||||||
|  |      else | ||||||
|  |      { | ||||||
|  | @@ -165,11 +165,11 @@ static bool xm_radio_update(const struct | ||||||
|  |      struct schema_Wifi_Radio_Config tmp; | ||||||
|  |   | ||||||
|  |      memcpy(&tmp, rconf, sizeof(tmp)); | ||||||
|  | -    LOGI("External: Updating radio %s (partial %d)", tmp.if_name, rconf->_partial_update); | ||||||
|  | +    LOGD("External: Updating radio %s (partial %d)", tmp.if_name, rconf->_partial_update); | ||||||
|  |      REQUIRE(rconf->if_name, strlen(rconf->if_name) > 0); | ||||||
|  |      tmp.vif_configs_present = false; | ||||||
|  |      REQUIRE(rconf->if_name, 1 == ovsdb_table_upsert_f(&table_Wifi_Radio_Config, &tmp, false, NULL)); | ||||||
|  | -    LOGI("External: Update radio %s", tmp.if_name); | ||||||
|  | +    LOGD("External: Update radio %s", tmp.if_name); | ||||||
|  |   | ||||||
|  |      return true; | ||||||
|  |  } | ||||||
|  | @@ -181,10 +181,10 @@ static bool xm_vif_update(const struct s | ||||||
|  |      json_t *where; | ||||||
|  |   | ||||||
|  |      memcpy(&tmp, vconf, sizeof(tmp)); | ||||||
|  | -    LOGI("External: Updating vif %s @ %s (partial %d)", vconf->if_name, radio_ifname, vconf->_partial_update); | ||||||
|  | +    LOGD("External: Updating vif %s @ %s (partial %d)", vconf->if_name, radio_ifname, vconf->_partial_update); | ||||||
|  |      REQUIRE(vconf->if_name, strlen(vconf->if_name) > 0); | ||||||
|  |      if (!(where = ovsdb_where_simple(SCHEMA_COLUMN(Wifi_Radio_Config, if_name), radio_ifname))){ | ||||||
|  | -        LOGI("External: Updating vif %s @ %s (no radio found)", vconf->if_name, radio_ifname); | ||||||
|  | +        LOGD("External: Updating vif %s @ %s (no radio found)", vconf->if_name, radio_ifname); | ||||||
|  |          return false; | ||||||
|  |      } | ||||||
|  |      REQUIRE(vconf->if_name, | ||||||
|  | @@ -198,7 +198,7 @@ static bool xm_vif_update(const struct s | ||||||
|  |                      where, | ||||||
|  |                      SCHEMA_COLUMN(Wifi_Radio_Config, vif_configs)) | ||||||
|  |      ); | ||||||
|  | -    LOGI("External: Update vif %s @ %s", vconf->if_name, radio_ifname); | ||||||
|  | +    LOGD("External: Update vif %s @ %s", vconf->if_name, radio_ifname); | ||||||
|  |   | ||||||
|  |      return true; | ||||||
|  |  } | ||||||
|  | @@ -208,10 +208,10 @@ static bool xm_inet_update(const struct | ||||||
|  |      struct schema_Wifi_Inet_Config tmp; | ||||||
|  |   | ||||||
|  |      memcpy(&tmp, iconf, sizeof(tmp)); | ||||||
|  | -    LOGI("External: Updating inet %s (partial %d)", tmp.if_name, iconf->_partial_update); | ||||||
|  | +    LOGD("External: Updating inet %s (partial %d)", tmp.if_name, iconf->_partial_update); | ||||||
|  |      REQUIRE(iconf->if_name, strlen(iconf->if_name) > 0); | ||||||
|  |      REQUIRE(iconf->if_name, 1 == ovsdb_table_upsert_f(&table_Wifi_Inet_Config, &tmp, false, NULL)); | ||||||
|  | -    LOGI("External: Update inet %s", tmp.if_name); | ||||||
|  | +    LOGD("External: Update inet %s", tmp.if_name); | ||||||
|  |   | ||||||
|  |      return true; | ||||||
|  |  } | ||||||
|  | --- a/src/qm/src/qm_mqtt.c | ||||||
|  | +++ b/src/qm/src/qm_mqtt.c | ||||||
|  | @@ -221,7 +221,7 @@ bool qm_mqtt_publish(mosqev_t *mqtt, qm_ | ||||||
|  |          mlen = len; | ||||||
|  |          mbuf = buf; | ||||||
|  |      } | ||||||
|  | -    LOGI("MQTT: Publishing %ld bytes", mlen); | ||||||
|  | +    LOGD("MQTT: Publishing %ld bytes", mlen); | ||||||
|  |      ret = mosqev_publish(mqtt, NULL, topic, mlen, mbuf, qos, false); | ||||||
|  |  exit: | ||||||
|  |      if (buf) free(buf); | ||||||
|  | @@ -314,7 +314,7 @@ first: | ||||||
|  |          void *buf = malloc(size); | ||||||
|  |          if (!buf) goto out; | ||||||
|  |          size = sts__report__pack(rpt, buf); | ||||||
|  | -        LOGI("merged reports stats %zd + %zd = %d", rep->size, qi->size, size); | ||||||
|  | +        LOGD("merged reports stats %zd + %zd = %d", rep->size, qi->size, size); | ||||||
|  |   | ||||||
|  |          // replace message | ||||||
|  |          if(rep->buf) free(rep->buf); | ||||||
| @@ -0,0 +1,24 @@ | |||||||
|  | Index: opensync-2.0.5.0/src/lib/schema/inc/schema_consts.h | ||||||
|  | =================================================================== | ||||||
|  | --- opensync-2.0.5.0.orig/src/lib/schema/inc/schema_consts.h | ||||||
|  | +++ opensync-2.0.5.0/src/lib/schema/inc/schema_consts.h | ||||||
|  | @@ -142,7 +142,7 @@ typedef enum { | ||||||
|  |  #define SCHEMA_CONSTS_INET_DHCP_LEASE_TIME  "lease_time" | ||||||
|  |  #define SCHEMA_CONSTS_INET_DHCP_FORCE       "force" | ||||||
|  |   | ||||||
|  | -/* Custom options */ | ||||||
|  | +/* vif Custom options */ | ||||||
|  |  #define SCHEMA_CONSTS_RATE_LIMIT    "rate_limit_en" | ||||||
|  |  #define SCHEMA_CONSTS_RATE_DL       "ssid_dl_limit" | ||||||
|  |  #define SCHEMA_CONSTS_RATE_UL       "ssid_ul_limit" | ||||||
|  | @@ -154,6 +154,10 @@ typedef enum { | ||||||
|  |  #define SCHEMA_CONSTS_DISABLE_B_RATES	"disable_b_rates" | ||||||
|  |  #define SCHEMA_CONSTS_IEEE80211k	"ieee80211k" | ||||||
|  |  #define SCHEMA_CONSTS_DYNAMIC_VLAN	"dynamic_vlan" | ||||||
|  | + | ||||||
|  | +/* radio Custom options */ | ||||||
|  | +#define SCHEMA_CONSTS_LOCAL_PWR_CONSTRAINT "local_pwr_constraint" | ||||||
|  | + | ||||||
|  |  /* Captive Portal */ | ||||||
|  |  #define SCHEMA_CONSTS_SESSION_TIMEOUT              "session_timeout" | ||||||
|  |  #define SCHEMA_CONSTS_BROWSER_TITLE                "browser_title" | ||||||
| @@ -0,0 +1,86 @@ | |||||||
|  | Index: opensync-2.0.5.0/interfaces/opensync.ovsschema | ||||||
|  | =================================================================== | ||||||
|  | --- opensync-2.0.5.0.orig/interfaces/opensync.ovsschema | ||||||
|  | +++ opensync-2.0.5.0/interfaces/opensync.ovsschema | ||||||
|  | @@ -9368,6 +9368,69 @@ | ||||||
|  |              } | ||||||
|  |         }, | ||||||
|  |        "isRoot": true | ||||||
|  | +    }, | ||||||
|  | +    "APC_Config": { | ||||||
|  | +      "columns": { | ||||||
|  | +        "enabled": { | ||||||
|  | +          "type": { | ||||||
|  | +            "key": { | ||||||
|  | +              "type": "boolean" | ||||||
|  | +            }, | ||||||
|  | +            "min": 0, | ||||||
|  | +            "max": 1 | ||||||
|  | +          } | ||||||
|  | +        } | ||||||
|  | +      }, | ||||||
|  | +      "isRoot": true, | ||||||
|  | +      "maxRows": 1 | ||||||
|  | +    }, | ||||||
|  | +    "APC_State": { | ||||||
|  | +      "columns": { | ||||||
|  | +        "dr_addr": { | ||||||
|  | +          "type": { | ||||||
|  | +            "key": { | ||||||
|  | +              "type": "string" | ||||||
|  | +            } | ||||||
|  | +          } | ||||||
|  | +        }, | ||||||
|  | +        "bdr_addr": { | ||||||
|  | +          "type": { | ||||||
|  | +            "key": { | ||||||
|  | +              "type": "string" | ||||||
|  | +            } | ||||||
|  | +          } | ||||||
|  | +        }, | ||||||
|  | +        "enabled": { | ||||||
|  | +          "type": { | ||||||
|  | +            "key": { | ||||||
|  | +              "type": "boolean" | ||||||
|  | +            }, | ||||||
|  | +            "min": 0, | ||||||
|  | +            "max": 1 | ||||||
|  | +          } | ||||||
|  | +        }, | ||||||
|  | +        "mode": { | ||||||
|  | +          "type": { | ||||||
|  | +            "key": { | ||||||
|  | +              "type": "string", | ||||||
|  | +              "enum": [ | ||||||
|  | +                "set", | ||||||
|  | +                [ | ||||||
|  | +                  "DR", | ||||||
|  | +                  "BDR", | ||||||
|  | +                  "OR", | ||||||
|  | +                  "WT", | ||||||
|  | +                  "NC" | ||||||
|  | +                ] | ||||||
|  | +              ] | ||||||
|  | +            }, | ||||||
|  | +            "min": 0, | ||||||
|  | +            "max": 1 | ||||||
|  | +          } | ||||||
|  | +        } | ||||||
|  | +      }, | ||||||
|  | +      "isRoot": true, | ||||||
|  | +      "maxRows": 1 | ||||||
|  |      } | ||||||
|  |    } | ||||||
|  |  } | ||||||
|  | Index: opensync-2.0.5.0/src/lib/schema/inc/schema_consts.h | ||||||
|  | =================================================================== | ||||||
|  | --- opensync-2.0.5.0.orig/src/lib/schema/inc/schema_consts.h | ||||||
|  | +++ opensync-2.0.5.0/src/lib/schema/inc/schema_consts.h | ||||||
|  | @@ -154,6 +154,7 @@ typedef enum { | ||||||
|  |  #define SCHEMA_CONSTS_DISABLE_B_RATES	"disable_b_rates" | ||||||
|  |  #define SCHEMA_CONSTS_IEEE80211k	"ieee80211k" | ||||||
|  |  #define SCHEMA_CONSTS_DYNAMIC_VLAN	"dynamic_vlan" | ||||||
|  | +#define SCHEMA_CONSTS_RADPROXY	"radproxy" | ||||||
|  |   | ||||||
|  |  /* radio Custom options */ | ||||||
|  |  #define SCHEMA_CONSTS_LOCAL_PWR_CONSTRAINT "local_pwr_constraint" | ||||||
| @@ -0,0 +1,270 @@ | |||||||
|  | Index: opensync-2.0.5.0/interfaces/opensync.ovsschema | ||||||
|  | =================================================================== | ||||||
|  | --- opensync-2.0.5.0.orig/interfaces/opensync.ovsschema | ||||||
|  | +++ opensync-2.0.5.0/interfaces/opensync.ovsschema | ||||||
|  | @@ -199,6 +199,59 @@ | ||||||
|  |                "type": "integer" | ||||||
|  |              } | ||||||
|  |            } | ||||||
|  | +        }, | ||||||
|  | +        "qr_code": { | ||||||
|  | +          "type": { | ||||||
|  | +            "key": "string", | ||||||
|  | +            "value": { | ||||||
|  | +               "type": "string", | ||||||
|  | +               "maxLength": 128 | ||||||
|  | +            }, | ||||||
|  | +            "min": 0, | ||||||
|  | +            "max": "unlimited" | ||||||
|  | +          } | ||||||
|  | +        }, | ||||||
|  | +        "model_description": { | ||||||
|  | +          "type": { | ||||||
|  | +            "key": { | ||||||
|  | +              "type": "string" | ||||||
|  | +            } | ||||||
|  | +          } | ||||||
|  | +        }, | ||||||
|  | +        "manufacturer_name": { | ||||||
|  | +          "type": { | ||||||
|  | +            "key": { | ||||||
|  | +              "type": "string" | ||||||
|  | +            } | ||||||
|  | +          } | ||||||
|  | +        }, | ||||||
|  | +        "manufacturer_date": { | ||||||
|  | +          "type": { | ||||||
|  | +            "key": { | ||||||
|  | +              "type": "string" | ||||||
|  | +            } | ||||||
|  | +          } | ||||||
|  | +        }, | ||||||
|  | +        "manufacturer_url": { | ||||||
|  | +          "type": { | ||||||
|  | +            "key": { | ||||||
|  | +              "type": "string" | ||||||
|  | +            } | ||||||
|  | +          } | ||||||
|  | +        }, | ||||||
|  | +        "reference_design": { | ||||||
|  | +          "type": { | ||||||
|  | +            "key": { | ||||||
|  | +              "type": "string" | ||||||
|  | +            } | ||||||
|  | +          } | ||||||
|  | +        }, | ||||||
|  | +        "certification_region": { | ||||||
|  | +          "type": { | ||||||
|  | +            "key": { | ||||||
|  | +              "type": "string" | ||||||
|  | +            } | ||||||
|  | +          } | ||||||
|  |          } | ||||||
|  |        }, | ||||||
|  |        "isRoot": true, | ||||||
|  | Index: opensync-2.0.5.0/src/lib/target/inc/target.h | ||||||
|  | =================================================================== | ||||||
|  | --- opensync-2.0.5.0.orig/src/lib/target/inc/target.h | ||||||
|  | +++ opensync-2.0.5.0/src/lib/target/inc/target.h | ||||||
|  | @@ -332,6 +332,115 @@ bool target_hw_revision_get(void *buff, | ||||||
|  |   */ | ||||||
|  |  bool target_platform_version_get(void *buff, size_t buffsz); | ||||||
|  |   | ||||||
|  | +/** | ||||||
|  | + * @brief Return device model revision | ||||||
|  | + * | ||||||
|  | + * This function provides a null terminated byte string containing the | ||||||
|  | + * model revision. The model revision is a part of AWLAN_Node table. | ||||||
|  | + * | ||||||
|  | + * @param buff   pointer to a string buffer | ||||||
|  | + * @param buffsz size of string buffer | ||||||
|  | + * @return true on success | ||||||
|  | + */ | ||||||
|  | +bool target_model_revision_get(void *buff, size_t buffsz); | ||||||
|  | + | ||||||
|  | +/** | ||||||
|  | + * @brief Return device model description | ||||||
|  | + * | ||||||
|  | + * This function provides a null terminated byte string containing the | ||||||
|  | + * model description. The model description is a part of AWLAN_Node table. | ||||||
|  | + * | ||||||
|  | + * @param buff   pointer to a string buffer | ||||||
|  | + * @param buffsz size of string buffer | ||||||
|  | + * @return true on success | ||||||
|  | + */ | ||||||
|  | +bool target_model_description_get(void *buff, size_t buffsz); | ||||||
|  | + | ||||||
|  | +/** | ||||||
|  | + * @brief Return device manufacturer name | ||||||
|  | + * | ||||||
|  | + * This function provides a null terminated byte string containing the | ||||||
|  | + * manufacturer name. The manufacturer name is a part of AWLAN_Node table. | ||||||
|  | + * | ||||||
|  | + * @param buff   pointer to a string buffer | ||||||
|  | + * @param buffsz size of string buffer | ||||||
|  | + * @return true on success | ||||||
|  | + */ | ||||||
|  | +bool target_manuf_name_get(void *buff, size_t buffsz); | ||||||
|  | + | ||||||
|  | +/** | ||||||
|  | + * @brief Return device manufacturer date | ||||||
|  | + * | ||||||
|  | + * This function provides a null terminated byte string containing the | ||||||
|  | + * manufacturer date. The manufacturer date is a part of AWLAN_Node table. | ||||||
|  | + * | ||||||
|  | + * @param buff   pointer to a string buffer | ||||||
|  | + * @param buffsz size of string buffer | ||||||
|  | + * @return true on success | ||||||
|  | + */ | ||||||
|  | +bool target_manuf_date_get(void *buff, size_t buffsz); | ||||||
|  | + | ||||||
|  | +/** | ||||||
|  | + * @brief Return device manufacturer url | ||||||
|  | + * | ||||||
|  | + * This function provides a null terminated byte string containing the | ||||||
|  | + * manufacturer url. The manufacturer url is a part of AWLAN_Node table. | ||||||
|  | + * | ||||||
|  | + * @param buff   pointer to a string buffer | ||||||
|  | + * @param buffsz size of string buffer | ||||||
|  | + * @return true on success | ||||||
|  | + */ | ||||||
|  | +bool target_manuf_url_get(void *buff, size_t buffsz); | ||||||
|  | + | ||||||
|  | +/** | ||||||
|  | + * @brief Return device manufacturer name abbreviation | ||||||
|  | + * | ||||||
|  | + * This function provides a null terminated byte string containing the | ||||||
|  | + * manufacturer name abbreviation. This is one of the pieces that form | ||||||
|  | + * the QR code entry which is a part of AWLAN_Node table. | ||||||
|  | + * | ||||||
|  | + * @param buff   pointer to a string buffer | ||||||
|  | + * @param buffsz size of string buffer | ||||||
|  | + * @return true on success | ||||||
|  | + */ | ||||||
|  | +bool target_manuf_abbr_get(void *buff, size_t buffsz); | ||||||
|  | + | ||||||
|  | +/** | ||||||
|  | + * @brief Return device reference design | ||||||
|  | + * | ||||||
|  | + * This function provides a null terminated byte string containing the | ||||||
|  | + * reference design. The reference design is a part of AWLAN_Node table. | ||||||
|  | + * | ||||||
|  | + * @param buff   pointer to a string buffer | ||||||
|  | + * @param buffsz size of string buffer | ||||||
|  | + * @return true on success | ||||||
|  | + */ | ||||||
|  | +bool target_ref_design_get(void *buff, size_t buffsz); | ||||||
|  | + | ||||||
|  | +/** | ||||||
|  | + * @brief Return device certification region | ||||||
|  | + * | ||||||
|  | + * This function provides a null terminated byte string containing the | ||||||
|  | + * certification region. The certification region is a part of AWLAN_Node table. | ||||||
|  | + * | ||||||
|  | + * @param buff   pointer to a string buffer | ||||||
|  | + * @param buffsz size of string buffer | ||||||
|  | + * @return true on success | ||||||
|  | + */ | ||||||
|  | +bool target_cert_region_get(void *buff, size_t buffsz); | ||||||
|  | + | ||||||
|  | +/** | ||||||
|  | + * @brief Return device mac address | ||||||
|  | + * | ||||||
|  | + * This function provides a null terminated byte string containing the | ||||||
|  | + * mac address. The mac address is a part of AWLAN_Node table. | ||||||
|  | + * | ||||||
|  | + * @param buff   pointer to a string buffer | ||||||
|  | + * @param buffsz size of string buffer | ||||||
|  | + * @return true on success | ||||||
|  | + */ | ||||||
|  | +bool target_mac_addr_get(void *buff, size_t buffsz); | ||||||
|  | + | ||||||
|  |  /// @} LIB_TARGET_ENTITY | ||||||
|  |   | ||||||
|  |  /// @defgroup LIB_TARGET_MAP Interface Mapping API | ||||||
|  | Index: opensync-2.0.5.0/src/dm/src/dm_ovsdb.c | ||||||
|  | =================================================================== | ||||||
|  | --- opensync-2.0.5.0.orig/src/dm/src/dm_ovsdb.c | ||||||
|  | +++ opensync-2.0.5.0/src/dm/src/dm_ovsdb.c | ||||||
|  | @@ -326,7 +326,7 @@ void fill_entity_data(struct schema_AWLA | ||||||
|  |          s_awlan_node->sku_number_exists = true; | ||||||
|  |      } | ||||||
|  |   | ||||||
|  | -    if (true == target_hw_revision_get(buff, sizeof(buff))) | ||||||
|  | +    if (true == target_model_revision_get(buff, sizeof(buff))) | ||||||
|  |      { | ||||||
|  |          STRSCPY(s_awlan_node->revision, buff); | ||||||
|  |      } | ||||||
|  | @@ -359,6 +359,58 @@ void fill_entity_data(struct schema_AWLA | ||||||
|  |      } | ||||||
|  |      s_awlan_node->model_exists = true; | ||||||
|  |   | ||||||
|  | +    if (true == target_model_description_get(buff, sizeof(buff))) | ||||||
|  | +    { | ||||||
|  | +        STRSCPY(s_awlan_node->model_description, buff); | ||||||
|  | +        s_awlan_node->model_description_exists = true; | ||||||
|  | +    } | ||||||
|  | + | ||||||
|  | +    if (true == target_manuf_name_get(buff, sizeof(buff))) | ||||||
|  | +    { | ||||||
|  | +        STRSCPY(s_awlan_node->manufacturer_name, buff); | ||||||
|  | +        s_awlan_node->manufacturer_name_exists = true; | ||||||
|  | +    } | ||||||
|  | + | ||||||
|  | +    if (true == target_manuf_date_get(buff, sizeof(buff))) | ||||||
|  | +    { | ||||||
|  | +        STRSCPY(s_awlan_node->manufacturer_date, buff); | ||||||
|  | +        s_awlan_node->manufacturer_date_exists = true; | ||||||
|  | +    } | ||||||
|  | + | ||||||
|  | +    if (true == target_manuf_url_get(buff, sizeof(buff))) | ||||||
|  | +    { | ||||||
|  | +        STRSCPY(s_awlan_node->manufacturer_url, buff); | ||||||
|  | +        s_awlan_node->manufacturer_url_exists = true; | ||||||
|  | +    } | ||||||
|  | + | ||||||
|  | +    if (true == target_ref_design_get(buff, sizeof(buff))) | ||||||
|  | +    { | ||||||
|  | +        STRSCPY(s_awlan_node->reference_design, buff); | ||||||
|  | +        s_awlan_node->reference_design_exists = true; | ||||||
|  | +    } | ||||||
|  | + | ||||||
|  | +    if (true == target_cert_region_get(buff, sizeof(buff))) | ||||||
|  | +    { | ||||||
|  | +        STRSCPY(s_awlan_node->certification_region, buff); | ||||||
|  | +        s_awlan_node->certification_region_exists = true; | ||||||
|  | +    } | ||||||
|  | + | ||||||
|  | +    if (true == target_mac_addr_get(buff, sizeof(buff))) | ||||||
|  | +    { | ||||||
|  | +        STRSCPY(s_awlan_node->id, buff); | ||||||
|  | +        s_awlan_node->id_exists = true; | ||||||
|  | +    } | ||||||
|  | + | ||||||
|  | +    SCHEMA_KEY_VAL_APPEND(s_awlan_node->qr_code, "DT", "AP"); | ||||||
|  | +    SCHEMA_KEY_VAL_APPEND(s_awlan_node->qr_code, "DM", s_awlan_node->id); | ||||||
|  | +    if (true == target_manuf_abbr_get(buff, sizeof(buff))) | ||||||
|  | +    { | ||||||
|  | +    	SCHEMA_KEY_VAL_APPEND(s_awlan_node->qr_code, "VN", buff); | ||||||
|  | +    } | ||||||
|  | +    SCHEMA_KEY_VAL_APPEND(s_awlan_node->qr_code, "SN", s_awlan_node->serial_number); | ||||||
|  | +    SCHEMA_KEY_VAL_APPEND(s_awlan_node->qr_code, "MN", s_awlan_node->model); | ||||||
|  | +    SCHEMA_KEY_VAL_APPEND(s_awlan_node->qr_code, "HW", s_awlan_node->revision); | ||||||
|  | + | ||||||
|  |      LOG(NOTICE, "Device entity {serial=%s id=%s version=%s platform=%s sku=%s}", | ||||||
|  |              s_awlan_node->serial_number, | ||||||
|  |              s_awlan_node->id, | ||||||
|  | @@ -422,6 +474,13 @@ bool act_update_entity (void) | ||||||
|  |                                   "sku_number", | ||||||
|  |                                   "upgrade_status", | ||||||
|  |                                   "upgrade_timer", | ||||||
|  | +                                 "qr_code", | ||||||
|  | +                                 "model_description", | ||||||
|  | +                                 "manufacturer_name", | ||||||
|  | +                                 "manufacturer_date", | ||||||
|  | +                                 "manufacturer_url", | ||||||
|  | +                                 "reference_design", | ||||||
|  | +                                 "certification_region", | ||||||
|  |                                   NULL) | ||||||
|  |                               ); | ||||||
|  |   | ||||||
							
								
								
									
										149
									
								
								feeds/wlan-ap/opensync/patches/34-radsec-schema-consts.patch
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										149
									
								
								feeds/wlan-ap/opensync/patches/34-radsec-schema-consts.patch
									
									
									
									
									
										Normal file
									
								
							| @@ -0,0 +1,149 @@ | |||||||
|  | --- a/interfaces/opensync.ovsschema | ||||||
|  | +++ b/interfaces/opensync.ovsschema | ||||||
|  | @@ -9493,6 +9493,146 @@ | ||||||
|  |        }, | ||||||
|  |        "isRoot": true, | ||||||
|  |        "maxRows": 1 | ||||||
|  | +    }, | ||||||
|  | +    "Radius_Proxy_Config": { | ||||||
|  | +        "columns": { | ||||||
|  | +            "radius_config_name": { | ||||||
|  | +                "type": { | ||||||
|  | +                "key": { | ||||||
|  | +                  "type": "string" | ||||||
|  | +                }, | ||||||
|  | +                "min": 1, | ||||||
|  | +                "max": 1 | ||||||
|  | +              } | ||||||
|  | +            }, | ||||||
|  | +            "radsec": { | ||||||
|  | +                "type": { | ||||||
|  | +                "key": { | ||||||
|  | +                  "type": "boolean" | ||||||
|  | +                }, | ||||||
|  | +                "min": 1, | ||||||
|  | +                "max": 1 | ||||||
|  | +              } | ||||||
|  | +            }, | ||||||
|  | +            "auto_discover": { | ||||||
|  | +                "type": { | ||||||
|  | +                "key": { | ||||||
|  | +                  "type": "boolean" | ||||||
|  | +                }, | ||||||
|  | +                "min": 1, | ||||||
|  | +                "max": 1 | ||||||
|  | +              } | ||||||
|  | +            }, | ||||||
|  | +            "server": { | ||||||
|  | +                "type": { | ||||||
|  | +                "key": { | ||||||
|  | +                  "type": "string" | ||||||
|  | +                }, | ||||||
|  | +                "min": 1, | ||||||
|  | +                "max": 1 | ||||||
|  | +              } | ||||||
|  | +            }, | ||||||
|  | +            "port": { | ||||||
|  | +              "type": { | ||||||
|  | +                "key": { | ||||||
|  | +                  "type": "integer" | ||||||
|  | +                }, | ||||||
|  | +                "min": 1, | ||||||
|  | +                "max": 1 | ||||||
|  | +              } | ||||||
|  | +            }, | ||||||
|  | +            "secret": { | ||||||
|  | +                "type": { | ||||||
|  | +                "key": { | ||||||
|  | +                  "type": "string" | ||||||
|  | +                }, | ||||||
|  | +                "min": 1, | ||||||
|  | +                "max": 1 | ||||||
|  | +              } | ||||||
|  | +            }, | ||||||
|  | +            "acct_server": { | ||||||
|  | +                "type": { | ||||||
|  | +                "key": { | ||||||
|  | +                  "type": "string" | ||||||
|  | +                }, | ||||||
|  | +                "min": 0, | ||||||
|  | +                "max": 1 | ||||||
|  | +              } | ||||||
|  | +            }, | ||||||
|  | +            "acct_port": { | ||||||
|  | +              "type": { | ||||||
|  | +                "key": { | ||||||
|  | +                  "type": "integer" | ||||||
|  | +                }, | ||||||
|  | +                "min": 0, | ||||||
|  | +                "max": 1 | ||||||
|  | +              } | ||||||
|  | +            }, | ||||||
|  | +            "acct_secret": { | ||||||
|  | +                "type": { | ||||||
|  | +                "key": { | ||||||
|  | +                  "type": "string" | ||||||
|  | +                }, | ||||||
|  | +                "min": 0, | ||||||
|  | +                "max": 1 | ||||||
|  | +              } | ||||||
|  | +            }, | ||||||
|  | +            "ca_cert": { | ||||||
|  | +                "type": { | ||||||
|  | +                    "key": { | ||||||
|  | +                        "type": "string", | ||||||
|  | +                        "minLength": 1, | ||||||
|  | +                        "maxLength": 256 | ||||||
|  | +                    }, | ||||||
|  | +                    "min": 0, | ||||||
|  | +                    "max": 1 | ||||||
|  | +                } | ||||||
|  | +              }, | ||||||
|  | +            "client_cert": { | ||||||
|  | +                "type": { | ||||||
|  | +                    "key": { | ||||||
|  | +                        "type": "string", | ||||||
|  | +                        "minLength": 1, | ||||||
|  | +                        "maxLength": 256 | ||||||
|  | +                    }, | ||||||
|  | +                    "min": 0, | ||||||
|  | +                    "max": 1 | ||||||
|  | +                } | ||||||
|  | +              }, | ||||||
|  | +            "client_key": { | ||||||
|  | +                "type": { | ||||||
|  | +                    "key": { | ||||||
|  | +                        "type": "string", | ||||||
|  | +                        "minLength": 1, | ||||||
|  | +                        "maxLength": 256 | ||||||
|  | +                    }, | ||||||
|  | +                    "min": 0, | ||||||
|  | +                    "max": 1 | ||||||
|  | +                } | ||||||
|  | +              }, | ||||||
|  | +            "passphrase": { | ||||||
|  | +                "type": { | ||||||
|  | +                    "key": { | ||||||
|  | +                        "type": "string", | ||||||
|  | +                        "minLength": 0, | ||||||
|  | +                        "maxLength": 128 | ||||||
|  | +                    }, | ||||||
|  | +                    "min": 0, | ||||||
|  | +                    "max": 1 | ||||||
|  | +                } | ||||||
|  | +              }, | ||||||
|  | +            "realm": { | ||||||
|  | +              "type": { | ||||||
|  | +                "key": { | ||||||
|  | +                  "type": "string", | ||||||
|  | +                  "maxLength": 256 | ||||||
|  | +                }, | ||||||
|  | +                "min": 0, | ||||||
|  | +                "max": 16 | ||||||
|  | +              } | ||||||
|  | +            } | ||||||
|  | +         }, | ||||||
|  | +        "isRoot": true | ||||||
|  |      } | ||||||
|  |    } | ||||||
|  |  } | ||||||
							
								
								
									
										13
									
								
								feeds/wlan-ap/opensync/patches/35-add-proxy-arp-schema.patch
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										13
									
								
								feeds/wlan-ap/opensync/patches/35-add-proxy-arp-schema.patch
									
									
									
									
									
										Normal file
									
								
							| @@ -0,0 +1,13 @@ | |||||||
|  | Index: opensync-2.0.5.0/src/lib/schema/inc/schema_consts.h | ||||||
|  | =================================================================== | ||||||
|  | --- opensync-2.0.5.0.orig/src/lib/schema/inc/schema_consts.h | ||||||
|  | +++ opensync-2.0.5.0/src/lib/schema/inc/schema_consts.h | ||||||
|  | @@ -155,6 +155,8 @@ typedef enum { | ||||||
|  |  #define SCHEMA_CONSTS_IEEE80211k	"ieee80211k" | ||||||
|  |  #define SCHEMA_CONSTS_DYNAMIC_VLAN	"dynamic_vlan" | ||||||
|  |  #define SCHEMA_CONSTS_RADPROXY	"radproxy" | ||||||
|  | +#define SCHEMA_CONSTS_PROXY_ARP		"proxy_arp" | ||||||
|  | +#define SCHEMA_CONSTS_MCAST_TO_UCAST	"mcast_to_ucast" | ||||||
|  |   | ||||||
|  |  /* radio Custom options */ | ||||||
|  |  #define SCHEMA_CONSTS_LOCAL_PWR_CONSTRAINT "local_pwr_constraint" | ||||||
Some files were not shown because too many files have changed in this diff Show More
		Reference in New Issue
	
	Block a user