mirror of
				https://github.com/Telecominfraproject/wlan-ap.git
				synced 2025-10-31 02:17:58 +00:00 
			
		
		
		
	Compare commits
	
		
			107 Commits
		
	
	
		
			v2.7.1-rc1
			...
			v2.8.0-rc4
		
	
	| Author | SHA1 | Date | |
|---|---|---|---|
|   | 5ed2f1d964 | ||
|   | 515793450e | ||
|   | 541e9b0b4f | ||
|   | 24611df4c6 | ||
|   | 083010d43c | ||
|   | f9b46fd6b0 | ||
|   | 74eb6f96ab | ||
|   | 4967fcd2be | ||
|   | e973110de7 | ||
|   | a62503328b | ||
|   | e42051d3a9 | ||
|   | e5336b7351 | ||
|   | 5469af35f1 | ||
|   | 8c9cd8f9d2 | ||
|   | 8b3ac5ea36 | ||
|   | c230825486 | ||
|   | e8b0f5da60 | ||
|   | bc45e11824 | ||
|   | d6b3e97c34 | ||
|   | d35a12b4f4 | ||
|   | a42f103500 | ||
|   | dc2a48c515 | ||
|   | db617e23f0 | ||
|   | 71189b1b74 | ||
|   | 5567de89e6 | ||
|   | 5430d79f53 | ||
|   | 9d82d88a0c | ||
|   | 0e264203de | ||
|   | 469443da2a | ||
|   | 692958d2fd | ||
|   | e65fa74071 | ||
|   | fb64d45c39 | ||
|   | 71e5c8f441 | ||
|   | 8e34f6653c | ||
|   | bee060b9bb | ||
|   | e3e94fe520 | ||
|   | 237c090cb4 | ||
|   | 74ea7a7a1e | ||
|   | 330dbd49e6 | ||
|   | a84b047061 | ||
|   | 3795060bf2 | ||
|   | e61ab97815 | ||
|   | 0162828df8 | ||
|   | 73cfef1203 | ||
|   | 3eb6360054 | ||
|   | 47e4bc585a | ||
|   | 3746722a4d | ||
|   | 5828971cfe | ||
|   | dd911cbf21 | ||
|   | f167553348 | ||
|   | d483c55c14 | ||
|   | d9815c0f62 | ||
|   | daadf043d8 | ||
|   | 1a56d5820d | ||
|   | 8e2f2fcce3 | ||
|   | fc5a841563 | ||
|   | d511a338df | ||
|   | a3d348b664 | ||
|   | b48506b156 | ||
|   | 17bb88b67a | ||
|   | 578a616b00 | ||
|   | 93f603e27c | ||
|   | 09b513550c | ||
|   | 5e451461cf | ||
|   | fd33396acb | ||
|   | 3bdfa68ff5 | ||
|   | 3dbc070f2c | ||
|   | b48e5eb057 | ||
|   | 3501bd9c11 | ||
|   | 70635ac911 | ||
|   | f9a00b7ebd | ||
|   | 5bec28b7e5 | ||
|   | e41818470f | ||
|   | a31422d3d7 | ||
|   | bea3d2c4f8 | ||
|   | 4c4cb58027 | ||
|   | 4312a42b62 | ||
|   | 011e5b6e1a | ||
|   | 8233c10569 | ||
|   | fb73d889ed | ||
|   | 80bfb8671d | ||
|   | 521df1a142 | ||
|   | 72a75b72ac | ||
|   | c22dce10d3 | ||
|   | 8eb801a0cc | ||
|   | 6eaef7adad | ||
|   | 0272d4bcad | ||
|   | 41c64e9978 | ||
|   | 9c2f0a098d | ||
|   | 0bb8d0dcc0 | ||
|   | a542660072 | ||
|   | 8ee15d0053 | ||
|   | 311515867c | ||
|   | 16bbcddd40 | ||
|   | ca26d347eb | ||
|   | 9eeefa2fbf | ||
|   | c33705ca60 | ||
|   | ba41e6773b | ||
|   | 8ebf884436 | ||
|   | 7d4353caf0 | ||
|   | fa6220a615 | ||
|   | 26517bb6ae | ||
|   | ea4c4b3fe5 | ||
|   | 00f273000e | ||
|   | 6014d3a04d | ||
|   | 08f082acfe | ||
|   | 12e5efcda4 | 
| @@ -15,7 +15,7 @@ runs: | |||||||
|       id: import_snapshot |       id: import_snapshot | ||||||
|       shell: bash |       shell: bash | ||||||
|       run: | |       run: | | ||||||
|         echo ::set-output name=import_task_id::$(aws ec2 import-snapshot --description '${{ inputs.firmware_image_name }}' --disk-container 'Format=raw,UserBucket={S3Bucket=${{ inputs.firmware_image_s3_bucket }},S3Key=${{ inputs.firmware_image_name }}}' | jq -r '.ImportTaskId') |         echo "import_task_id=$(aws ec2 import-snapshot --description '${{ inputs.firmware_image_name }}' --disk-container 'Format=raw,UserBucket={S3Bucket=${{ inputs.firmware_image_s3_bucket }},S3Key=${{ inputs.firmware_image_name }}}' | jq -r '.ImportTaskId')" >> $GITHUB_OUTPUT | ||||||
|  |  | ||||||
|     - name: Wait for import task to complete and get snapshot ID |     - name: Wait for import task to complete and get snapshot ID | ||||||
|       id: get_snapshot_id |       id: get_snapshot_id | ||||||
| @@ -26,7 +26,7 @@ runs: | |||||||
|           IMPORT_TASK_STATUS=$(aws ec2 describe-import-snapshot-tasks --import-task-ids ${{ steps.import_snapshot.outputs.import_task_id }} | jq -r '.ImportSnapshotTasks[].SnapshotTaskDetail.Status') |           IMPORT_TASK_STATUS=$(aws ec2 describe-import-snapshot-tasks --import-task-ids ${{ steps.import_snapshot.outputs.import_task_id }} | jq -r '.ImportSnapshotTasks[].SnapshotTaskDetail.Status') | ||||||
|           echo "Import task status is $IMPORT_TASK_STATUS, waiting for completion." |           echo "Import task status is $IMPORT_TASK_STATUS, waiting for completion." | ||||||
|         done |         done | ||||||
|         echo ::set-output name=id::$(aws ec2 describe-import-snapshot-tasks --import-task-ids ${{ steps.import_snapshot.outputs.import_task_id }} | jq -r '.ImportSnapshotTasks[].SnapshotTaskDetail.SnapshotId') |         echo "id=$(aws ec2 describe-import-snapshot-tasks --import-task-ids ${{ steps.import_snapshot.outputs.import_task_id }} | jq -r '.ImportSnapshotTasks[].SnapshotTaskDetail.SnapshotId')" >> $GITHUB_OUTPUT | ||||||
|  |  | ||||||
|     - name: Tag snapshot with image name |     - name: Tag snapshot with image name | ||||||
|       shell: bash |       shell: bash | ||||||
|   | |||||||
							
								
								
									
										8
									
								
								.github/workflows/build-dev.yml
									
									
									
									
										vendored
									
									
								
							
							
						
						
									
										8
									
								
								.github/workflows/build-dev.yml
									
									
									
									
										vendored
									
									
								
							| @@ -21,10 +21,10 @@ jobs: | |||||||
|     strategy: |     strategy: | ||||||
|       fail-fast: false |       fail-fast: false | ||||||
|       matrix: |       matrix: | ||||||
|         target: ['actiontec_web7200', 'cig_wf188n', 'cig_wf196', 'cig_wf610d', 'cig_wf808', 'cybertan_eww622-a1', 'edgecore_eap101', 'edgecore_eap102', 'edgecore_eap104', 'liteon_wpx8324', 'edgecore_ecs4100-12ph', 'edgecore_ecw5211', 'edgecore_ecw5410', 'edgecore_oap100', 'edgecore_ssw2ac2600', 'edgecore_spw2ac1200', 'edgecore_spw2ac1200-lan-poe', 'hfcl_ion4', 'hfcl_ion4xe', 'hfcl_ion4xi', 'indio_um-305ac', 'indio_um-305ax', 'indio_um-325ac', 'indio_um-510ac-v3', 'indio_um-550ac', 'linksys_ea6350-v4', 'linksys_e8450-ubi', 'linksys_ea8300', 'meshpp_s618_cp03', 'meshpp_s618_cp01', 'udaya_a5-id2', 'wallys_dr40x9', 'wallys_dr6018', 'x64_vm' ] |         target: ['actiontec_web7200', 'cig_wf188n', 'cig_wf194c4', 'cig_wf196', 'cig_wf610d', 'cig_wf808', 'cybertan_eww622-a1', 'edgecore_eap101', 'edgecore_eap102', 'edgecore_eap104', 'liteon_wpx8324', 'edgecore_ecs4100-12ph', 'edgecore_ecw5211', 'edgecore_ecw5410', 'edgecore_oap100', 'edgecore_ssw2ac2600', 'edgecore_spw2ac1200', 'edgecore_spw2ac1200-lan-poe', 'hfcl_ion4', 'hfcl_ion4xe', 'hfcl_ion4xi', 'hfcl_ion4x', 'hfcl_ion4x_2', 'indio_um-305ac', 'indio_um-305ax', 'indio_um-325ac', 'indio_um-510ac-v3', 'indio_um-550ac', 'indio_um-310ax-v1', 'indio_um-510axp-v1', 'indio_um-510axm-v1', 'linksys_ea6350-v4', 'linksys_e8450-ubi', 'linksys_ea8300', 'meshpp_s618_cp03', 'meshpp_s618_cp01', 'udaya_a5-id2', 'wallys_dr40x9', 'wallys_dr6018', 'wallys_dr6018_v4', 'x64_vm', 'yuncore_ax840', 'yuncore_fap640', 'yuncore_fap650' ] | ||||||
|  |  | ||||||
|     steps: |     steps: | ||||||
|     - uses: actions/checkout@v2 |     - uses: actions/checkout@v3 | ||||||
|  |  | ||||||
|     - name: Build image for ${{ matrix.target }} |     - name: Build image for ${{ matrix.target }} | ||||||
|       id: build |       id: build | ||||||
| @@ -72,7 +72,7 @@ jobs: | |||||||
|         [ -f openwrt/tmp/image-file ] && aws s3api put-object-tagging --bucket "$AWS_S3_BUCKET_NAME" --key "$JSON_NAME" --tagging "{\"TagSet\":[{\"Key\":\"release\",\"Value\":\"$IS_RELEASE\"}]}" |         [ -f openwrt/tmp/image-file ] && aws s3api put-object-tagging --bucket "$AWS_S3_BUCKET_NAME" --key "$JSON_NAME" --tagging "{\"TagSet\":[{\"Key\":\"release\",\"Value\":\"$IS_RELEASE\"}]}" | ||||||
|  |  | ||||||
|         if [ ${{ matrix.target }} == 'x64_vm' ]; then |         if [ ${{ matrix.target }} == 'x64_vm' ]; then | ||||||
|           echo ::set-output name=x64_vm_image_name::"$(echo $IMG_NAME)" |           echo "x64_vm_image_name=$(echo $IMG_NAME)" >> $GITHUB_OUTPUT | ||||||
|         fi |         fi | ||||||
|  |  | ||||||
|   trigger-testing: |   trigger-testing: | ||||||
| @@ -93,7 +93,7 @@ jobs: | |||||||
|     needs: build |     needs: build | ||||||
|     if: startsWith(github.ref, 'refs/tags/v') |     if: startsWith(github.ref, 'refs/tags/v') | ||||||
|     steps: |     steps: | ||||||
|     - uses: actions/checkout@v2 |     - uses: actions/checkout@v3 | ||||||
|  |  | ||||||
|     - name: Use create-ami-from-image composite action |     - name: Use create-ami-from-image composite action | ||||||
|       uses: ./.github/actions/create-ami-from-image |       uses: ./.github/actions/create-ami-from-image | ||||||
|   | |||||||
							
								
								
									
										6
									
								
								.github/workflows/x64_vm-build-test.yml
									
									
									
									
										vendored
									
									
								
							
							
						
						
									
										6
									
								
								.github/workflows/x64_vm-build-test.yml
									
									
									
									
										vendored
									
									
								
							| @@ -22,7 +22,7 @@ jobs: | |||||||
|         target: ['x64_vm'] |         target: ['x64_vm'] | ||||||
|  |  | ||||||
|     steps: |     steps: | ||||||
|     - uses: actions/checkout@v2 |     - uses: actions/checkout@v3 | ||||||
|  |  | ||||||
|     - name: Build image for ${{ matrix.target }} |     - name: Build image for ${{ matrix.target }} | ||||||
|       id: build |       id: build | ||||||
| @@ -70,14 +70,14 @@ jobs: | |||||||
|         [ -f openwrt/tmp/image-file ] && aws s3api put-object-tagging --bucket "$AWS_S3_BUCKET_NAME" --key "$JSON_NAME" --tagging "{\"TagSet\":[{\"Key\":\"release\",\"Value\":\"$IS_RELEASE\"}]}" |         [ -f openwrt/tmp/image-file ] && aws s3api put-object-tagging --bucket "$AWS_S3_BUCKET_NAME" --key "$JSON_NAME" --tagging "{\"TagSet\":[{\"Key\":\"release\",\"Value\":\"$IS_RELEASE\"}]}" | ||||||
|  |  | ||||||
|         if [[ ${{ matrix.target }} == 'x64_vm' ]]; then |         if [[ ${{ matrix.target }} == 'x64_vm' ]]; then | ||||||
|           echo ::set-output name=x64_vm_image_name::"$(echo $IMG_NAME)" |             echo "x64_vm_image_name=$(echo $IMG_NAME)" >> $GITHUB_OUTPUT | ||||||
|         fi |         fi | ||||||
|  |  | ||||||
|   create-x64_vm-ami: |   create-x64_vm-ami: | ||||||
|     runs-on: ubuntu-latest |     runs-on: ubuntu-latest | ||||||
|     needs: build |     needs: build | ||||||
|     steps: |     steps: | ||||||
|     - uses: actions/checkout@v2 |     - uses: actions/checkout@v3 | ||||||
|       with: |       with: | ||||||
|         ref: WIFI-7206-add-workflow-to-build-virtual-ap-image |         ref: WIFI-7206-add-workflow-to-build-virtual-ap-image | ||||||
|  |  | ||||||
|   | |||||||
							
								
								
									
										83
									
								
								README.md
									
									
									
									
									
								
							
							
						
						
									
										83
									
								
								README.md
									
									
									
									
									
								
							| @@ -1,20 +1,83 @@ | |||||||
| # Setting up your build machine | # OpenWiFi AP NOS | ||||||
|  |  | ||||||
| Requires a recent linux installation. Older systems without python 3.7 will have trouble.  See this link for details: https://openwrt.org/docs/guide-developer/quickstart-build-images | OpenWrt-based access point network operating system (AP NOS) for TIP OpenWiFi. | ||||||
|  | Read more at [openwifi.tip.build](https://openwifi.tip.build/). | ||||||
|  |  | ||||||
| Install build packages:  sudo apt install build-essential libncurses5-dev gawk git libssl-dev gettext zlib1g-dev swig unzip time rsync python3 python3-setuptools python3-yaml. | ## Building | ||||||
|  |  | ||||||
| # Doing a native build on Linux | ### Setting up your build machine | ||||||
| First we need to clone and setup our tree. This will result in an openwrt/. |  | ||||||
|  | Building requires a recent Linux installation. Older systems without Python 3.7 | ||||||
|  | will have trouble. See this guide for details: | ||||||
|  | https://openwrt.org/docs/guide-developer/toolchain/beginners-build-guide | ||||||
|  |  | ||||||
|  | Install build packages on Debian/Ubuntu (or see above guide for other systems): | ||||||
| ``` | ``` | ||||||
| ./setup.py --setup | sudo apt install build-essential libncurses5-dev gawk git libssl-dev gettext zlib1g-dev swig unzip time rsync python3 python3-setuptools python3-yaml | ||||||
| ``` | ``` | ||||||
| Next we need to select the profile and base package selection. This setup will install the feeds, packages and generate the .config file. |  | ||||||
|  | ### Doing a native build on Linux | ||||||
|  |  | ||||||
|  | Use `./build.sh <target>`, or follow the manual steps below: | ||||||
|  |  | ||||||
|  | 1. Clone and set up the tree. This will create an `openwrt/` directory. | ||||||
|  | ```shell | ||||||
|  | ./setup.py --setup    # for subsequent builds, use --rebase instead | ||||||
| ``` | ``` | ||||||
|  |  | ||||||
|  | 2. Select the profile and base package selection. This setup will install the | ||||||
|  |    feeds and packages and generate the `.config` file. | ||||||
|  | ```shell | ||||||
| cd openwrt | cd openwrt | ||||||
| ./scripts/gen_config.py linksys_ea8300 | ./scripts/gen_config.py linksys_ea8300 | ||||||
| ``` | ``` | ||||||
| Finally we can build the tree. |  | ||||||
| ``` | 3. Build the tree (replace `-j 8` with the number of cores to use). | ||||||
| make -j X V=s | ```shell | ||||||
|  | make -j 8 V=s | ||||||
| ``` | ``` | ||||||
|  |  | ||||||
|  | ### Build output | ||||||
|  |  | ||||||
|  | The build results are located in the `openwrt/bin/` directory: | ||||||
|  |  | ||||||
|  | | Type             | Path                                                 | | ||||||
|  | | ---------------- | ---------------------------------------------------- | | ||||||
|  | | Firmware images  | `openwrt/bin/targets/<target>/<subtarget>/`          | | ||||||
|  | | Kernel modules   | `openwrt/bin/targets/<target>/<subtarget>/packages/` | | ||||||
|  | | Package binaries | `openwrt/bin/packages/<platform>/<feed>/`            | | ||||||
|  |  | ||||||
|  | ## Developer Notes | ||||||
|  |  | ||||||
|  | ### Branching model | ||||||
|  |  | ||||||
|  | - `main` - Stable dev branch | ||||||
|  | - `next` - Integration branch | ||||||
|  | - `staging-*` - Feature/bug branches | ||||||
|  | - `release/v#.#.#` - Release branches (*major.minor.patch*) | ||||||
|  |  | ||||||
|  | ### Repository structure | ||||||
|  |  | ||||||
|  | Build files: | ||||||
|  | - `Makefile` - Calls Docker environment per target | ||||||
|  | - `dock-run.sh` - Dockerized build environment | ||||||
|  | - `docker/Dockerfile` - Dockerfile for build image | ||||||
|  | - `build.sh` - Build script | ||||||
|  | - `setup.py` - Clone and set up the tree | ||||||
|  | - `config.yml` - Specifies OpenWrt version and patches to apply | ||||||
|  |  | ||||||
|  | Directories: | ||||||
|  | - `feeds/` - OpenWiFi feeds | ||||||
|  | - `patches/` - OpenWiFi patches applied during builds | ||||||
|  | - `profiles/` - Per-target kernel configs, packages, and feeds | ||||||
|  |     - [wifi-ax](profiles/wifi-ax.yml): Wi-Fi AX packages | ||||||
|  |     - [ucentral-ap](profiles/ucentral-ap.yml): uCentral packages | ||||||
|  |     - [x64_vm](profiles/x64_vm.yml): x86-64 VM image | ||||||
|  |  | ||||||
|  | ### uCentral packages | ||||||
|  |  | ||||||
|  | AP-NOS packages implementing the uCentral protocol include the following | ||||||
|  | repositories (refer to the [ucentral](feeds/ucentral/) feed for a full list): | ||||||
|  | - ucentral-client: https://github.com/Telecominfraproject/wlan-ucentral-client | ||||||
|  | - ucentral-schema: https://github.com/Telecominfraproject/wlan-ucentral-schema | ||||||
|  | - ucentral-wifi: https://github.com/blogic/ucentral-wifi | ||||||
|   | |||||||
| @@ -40,6 +40,8 @@ liteon,wpx8324) | |||||||
| 	ucidef_set_led_netdev "wan" "wan" "blue:uplink" "eth0" | 	ucidef_set_led_netdev "wan" "wan" "blue:uplink" "eth0" | ||||||
| 	;; | 	;; | ||||||
| hfcl,ion4xi|\ | hfcl,ion4xi|\ | ||||||
|  | hfcl,ion4x|\ | ||||||
|  | hfcl,ion4x_2|\ | ||||||
| hfcl,ion4xe) | hfcl,ion4xe) | ||||||
|         ucidef_set_led_wlan "wlan5g" "WLAN5G" "blue:wifi5" "phy0tpt" |         ucidef_set_led_wlan "wlan5g" "WLAN5G" "blue:wifi5" "phy0tpt" | ||||||
|         ucidef_set_led_wlan "wlan2g" "WLAN2G" "blue:wifi2" "phy1tpt" |         ucidef_set_led_wlan "wlan2g" "WLAN2G" "blue:wifi2" "phy1tpt" | ||||||
| @@ -48,6 +50,11 @@ glinet,ax1800|\ | |||||||
| glinet,axt1800) | glinet,axt1800) | ||||||
| 	ucidef_set_led_netdev "wan" "WAN" "blue:wan" "eth0" "tx rx link" | 	ucidef_set_led_netdev "wan" "WAN" "blue:wan" "eth0" "tx rx link" | ||||||
| 	;; | 	;; | ||||||
|  | yuncore,fap650|\ | ||||||
|  | muxi,ap3220l) | ||||||
|  |         ucidef_set_led_wlan "wlan2g" "WLAN2G" "green:wifi2" "phy0tpt" | ||||||
|  |         ucidef_set_led_wlan "wlan5g" "WLAN5G" "green:wifi5" "phy1tpt" | ||||||
|  | 	;; | ||||||
| esac | esac | ||||||
|  |  | ||||||
| board_config_flush | board_config_flush | ||||||
|   | |||||||
| @@ -13,6 +13,8 @@ qcom_setup_interfaces() | |||||||
|  |  | ||||||
| 	case $board in | 	case $board in | ||||||
| 	hfcl,ion4xi|\ | 	hfcl,ion4xi|\ | ||||||
|  | 	hfcl,ion4x|\ | ||||||
|  | 	hfcl,ion4x_2|\ | ||||||
| 	hfcl,ion4xe) | 	hfcl,ion4xe) | ||||||
| 		ucidef_set_interface_wan "eth0 eth1" | 		ucidef_set_interface_wan "eth0 eth1" | ||||||
| 		ucidef_set_interface_lan "" | 		ucidef_set_interface_lan "" | ||||||
| @@ -49,14 +51,18 @@ qcom_setup_interfaces() | |||||||
| 		ucidef_set_interface_wan "eth0" | 		ucidef_set_interface_wan "eth0" | ||||||
| 		;; | 		;; | ||||||
| 	edgecore,eap102|\ | 	edgecore,eap102|\ | ||||||
| 	edgecore,eap104|\ |  | ||||||
| 	liteon,wpx8324|\ | 	liteon,wpx8324|\ | ||||||
| 	wallys,dr6018|\ | 	wallys,dr6018|\ | ||||||
| 	cig,wf188n|\ | 	cig,wf188n|\ | ||||||
| 	cig,wf196) | 	cig,wf196|\ | ||||||
|  | 	muxi,ap3220l) | ||||||
| 		ucidef_set_interface_lan "eth1" | 		ucidef_set_interface_lan "eth1" | ||||||
| 		ucidef_set_interface_wan "eth0" | 		ucidef_set_interface_wan "eth0" | ||||||
| 		;; | 		;; | ||||||
|  | 	yuncore,fap650) | ||||||
|  | 		ucidef_set_interface_lan "eth3 eth2 eth1 eth0" | ||||||
|  | 		ucidef_set_interface_wan "eth4" | ||||||
|  | 		;; | ||||||
| 	qcom,ipq807x-hk14) | 	qcom,ipq807x-hk14) | ||||||
| 		ucidef_set_interface_lan "eth0 eth1 eth2 eth3" | 		ucidef_set_interface_lan "eth0 eth1 eth2 eth3" | ||||||
| 		ucidef_set_interface_wan "eth4" | 		ucidef_set_interface_wan "eth4" | ||||||
| @@ -76,6 +82,12 @@ qcom_setup_interfaces() | |||||||
| 		ucidef_add_switch_attr "switch1" "enable" "false" | 		ucidef_add_switch_attr "switch1" "enable" "false" | ||||||
| 		ucidef_add_switch_attr "switch1" "reset" "true" | 		ucidef_add_switch_attr "switch1" "reset" "true" | ||||||
| 		;; | 		;; | ||||||
|  | 	edgecore,eap104) | ||||||
|  | 		ucidef_set_interface_lan "lan1 lan2 lan3 lan4" | ||||||
|  | 		ucidef_set_interface_wan "eth0" | ||||||
|  | 		ucidef_add_switch "switch1" \ | ||||||
|  | 			"6@eth1" "1:lan1" "2:lan2" "3:lan3" "4:lan4" | ||||||
|  | 		;; | ||||||
| 	esac | 	esac | ||||||
| } | } | ||||||
|  |  | ||||||
| @@ -85,13 +97,24 @@ qcom_setup_macs() | |||||||
|  |  | ||||||
| 	case $board in | 	case $board in | ||||||
| 	cig,wf194c|\ | 	cig,wf194c|\ | ||||||
| 	cig,wf194c4|\ | 	cig,wf194c4) | ||||||
| 	cig,wf196) |  | ||||||
| 		mac=$(grep BaseMacAddress= /dev/mtd14 | cut -dx -f2) | 		mac=$(grep BaseMacAddress= /dev/mtd14 | cut -dx -f2) | ||||||
| 		wan_mac=$(macaddr_canonicalize $mac) | 		wan_mac=$(macaddr_canonicalize $mac) | ||||||
| 		lan_mac=$(macaddr_add "$wan_mac" 1) | 		lan_mac=$(macaddr_add "$wan_mac" 1) | ||||||
| 		ucidef_set_network_device_mac eth0 $lan_mac | 		ucidef_set_network_device_mac eth0 $lan_mac | ||||||
| 		ucidef_set_network_device_mac eth1 $wan_mac | 		ucidef_set_network_device_mac eth1 $wan_mac | ||||||
|  | 		ip link set eth0 address $lan_mac | ||||||
|  | 		ip link set eth1 address $wan_mac | ||||||
|  | 		ucidef_set_label_macaddr $wan_mac | ||||||
|  | 		;; | ||||||
|  | 	cig,wf196) | ||||||
|  | 		mac=$(grep BaseMacAddress= /dev/mtd14 | cut -dx -f2) | ||||||
|  | 		wan_mac=$(macaddr_canonicalize $mac) | ||||||
|  | 		lan_mac=$(macaddr_add "$wan_mac" 1) | ||||||
|  | 		ucidef_set_network_device_mac eth1 $lan_mac | ||||||
|  | 		ucidef_set_network_device_mac eth0 $wan_mac | ||||||
|  | 		ip link set eth0 address $wan_mac | ||||||
|  | 		ip link set eth1 address $lan_mac | ||||||
| 		ucidef_set_label_macaddr $wan_mac | 		ucidef_set_label_macaddr $wan_mac | ||||||
| 		;; | 		;; | ||||||
| 	cybertan,eww622-a1) | 	cybertan,eww622-a1) | ||||||
| @@ -110,6 +133,14 @@ qcom_setup_macs() | |||||||
| 		wan_mac=$(cat /sys/class/net/eth1/address) | 		wan_mac=$(cat /sys/class/net/eth1/address) | ||||||
| 		lan_mac=$(macaddr_add "$wan_mac" 1) | 		lan_mac=$(macaddr_add "$wan_mac" 1) | ||||||
| 		;; | 		;; | ||||||
|  | 	muxi,ap3220l) | ||||||
|  | 		wan_mac=$(mtd_get_mac_binary 0:Product_Info 0x5b) | ||||||
|  | 		lan_mac=$(macaddr_add "$wan_mac" 1) | ||||||
|  | 		ucidef_set_network_device_mac eth0 $wan_mac | ||||||
|  | 		ucidef_set_network_device_mac eth1 $lan_mac | ||||||
|  | 		ip link set eth0 address $wan_mac | ||||||
|  | 		ip link set eth1 address $lan_mac | ||||||
|  | 		;; | ||||||
| 	*) | 	*) | ||||||
| 		wan_mac=$(cat /sys/class/net/eth0/address) | 		wan_mac=$(cat /sys/class/net/eth0/address) | ||||||
| 		lan_mac=$(macaddr_add "$wan_mac" 1) | 		lan_mac=$(macaddr_add "$wan_mac" 1) | ||||||
|   | |||||||
| @@ -93,7 +93,6 @@ case "$FIRMWARE" in | |||||||
| 	qcom,ipq807x-hk14|\ | 	qcom,ipq807x-hk14|\ | ||||||
| 	tplink,ex227|\ | 	tplink,ex227|\ | ||||||
| 	tplink,ex447|\ | 	tplink,ex447|\ | ||||||
| 	yuncore,ax840|\ |  | ||||||
| 	sercomm,wallaby) | 	sercomm,wallaby) | ||||||
|                 caldata_extract "0:ART" 0x1000 0x20000 |                 caldata_extract "0:ART" 0x1000 0x20000 | ||||||
| 		;; | 		;; | ||||||
| @@ -105,6 +104,8 @@ case "$FIRMWARE" in | |||||||
| 	cig,wf188n|\ | 	cig,wf188n|\ | ||||||
| 	edgecore,eap101|\ | 	edgecore,eap101|\ | ||||||
| 	hfcl,ion4xi|\ | 	hfcl,ion4xi|\ | ||||||
|  | 	hfcl,ion4x_2|\ | ||||||
|  | 	hfcl,ion4x|\ | ||||||
| 	hfcl,ion4xe|\ | 	hfcl,ion4xe|\ | ||||||
| 	wallys,dr6018|\ | 	wallys,dr6018|\ | ||||||
| 	wallys,dr6018-v4|\ | 	wallys,dr6018-v4|\ | ||||||
| @@ -114,6 +115,8 @@ case "$FIRMWARE" in | |||||||
| 	qcom,ipq6018-cp01|\ | 	qcom,ipq6018-cp01|\ | ||||||
| 	xiaomi,ax1800|\ | 	xiaomi,ax1800|\ | ||||||
| 	glinet,ax1800|\ | 	glinet,ax1800|\ | ||||||
|  | 	yuncore,ax840|\ | ||||||
|  | 	yuncore,fap650|\ | ||||||
| 	plasmacloud,pax1800-v1|\ | 	plasmacloud,pax1800-v1|\ | ||||||
| 	plasmacloud,pax1800-v2) | 	plasmacloud,pax1800-v2) | ||||||
|                 caldata_extract "0:ART" 0x1000 0x20000   |                 caldata_extract "0:ART" 0x1000 0x20000   | ||||||
| @@ -126,6 +129,7 @@ ath11k/IPQ5018/hw1.0/caldata.bin) | |||||||
| 	edgecore,eap104|\ | 	edgecore,eap104|\ | ||||||
| 	liteon,wpx8324|\ | 	liteon,wpx8324|\ | ||||||
| 	motorola,q14|\ | 	motorola,q14|\ | ||||||
|  | 	muxi,ap3220l|\ | ||||||
| 	qcom,ipq5018-mp03.1) | 	qcom,ipq5018-mp03.1) | ||||||
|                 caldata_extract "0:ART" 0x1000 0x20000   |                 caldata_extract "0:ART" 0x1000 0x20000   | ||||||
| 		;; | 		;; | ||||||
| @@ -145,6 +149,9 @@ ath11k/qcn6122/hw1.0/caldata_2.bin) | |||||||
| 	liteon,wpx8324) | 	liteon,wpx8324) | ||||||
|                 caldata_extract "0:ART" 0x4c000 0x20000   |                 caldata_extract "0:ART" 0x4c000 0x20000   | ||||||
| 		;; | 		;; | ||||||
|  | 	muxi,ap3220l) | ||||||
|  | 		caldata_extract "0:ART" 0x26800 0x20000 | ||||||
|  | 		;; | ||||||
| 	esac | 	esac | ||||||
| 	;; | 	;; | ||||||
| ath11k/QCN9074/hw1.0/caldata_1.bin) | ath11k/QCN9074/hw1.0/caldata_1.bin) | ||||||
| @@ -169,6 +176,8 @@ ath11k/QCN9074/hw1.0/caldata_2.bin) | |||||||
| ath11k-macs) | ath11k-macs) | ||||||
| 	case "$board" in | 	case "$board" in | ||||||
| 	hfcl,ion4xi|\ | 	hfcl,ion4xi|\ | ||||||
|  | 	hfcl,ion4x|\ | ||||||
|  | 	hfcl,ion4x_2|\ | ||||||
| 	hfcl,ion4xe)                                                | 	hfcl,ion4xe)                                                | ||||||
| 		ath11k_generate_macs_ion4x | 		ath11k_generate_macs_ion4x | ||||||
| 		;; | 		;; | ||||||
| @@ -185,7 +194,8 @@ ath11k-macs) | |||||||
| 		ath11k_generate_macs | 		ath11k_generate_macs | ||||||
| 		;; | 		;; | ||||||
| 	cig,wf194c|\ | 	cig,wf194c|\ | ||||||
| 	cig,wf194c) | 	cig,wf194c4|\ | ||||||
|  | 	cig,wf196) | ||||||
| 		ath11k_generate_macs_wf194 | 		ath11k_generate_macs_wf194 | ||||||
| 		;; | 		;; | ||||||
| 	plasmacloud,pax1800-v1|\ | 	plasmacloud,pax1800-v1|\ | ||||||
|   | |||||||
| @@ -87,13 +87,17 @@ platform_check_image() { | |||||||
| 	liteon,wpx8324|\ | 	liteon,wpx8324|\ | ||||||
| 	edgecore,eap106|\ | 	edgecore,eap106|\ | ||||||
| 	hfcl,ion4xi|\ | 	hfcl,ion4xi|\ | ||||||
|  | 	hfcl,ion4x|\ | ||||||
|  | 	hfcl,ion4x_2|\ | ||||||
| 	hfcl,ion4xe|\ | 	hfcl,ion4xe|\ | ||||||
|  | 	muxi,ap3220l|\ | ||||||
| 	plasmacloud,pax1800-v1|\ | 	plasmacloud,pax1800-v1|\ | ||||||
| 	plasmacloud,pax1800-v2|\ | 	plasmacloud,pax1800-v2|\ | ||||||
| 	tplink,ex227|\ | 	tplink,ex227|\ | ||||||
| 	tplink,ex447|\ | 	tplink,ex447|\ | ||||||
| 	yuncore,ax840|\ | 	yuncore,ax840|\ | ||||||
| 	motorola,q14|\ | 	motorola,q14|\ | ||||||
|  | 	muxi,ap3220l|\ | ||||||
| 	qcom,ipq6018-cp01|\ | 	qcom,ipq6018-cp01|\ | ||||||
| 	qcom,ipq807x-hk01|\ | 	qcom,ipq807x-hk01|\ | ||||||
| 	qcom,ipq807x-hk14|\ | 	qcom,ipq807x-hk14|\ | ||||||
| @@ -141,6 +145,8 @@ platform_do_upgrade() { | |||||||
| 		nand_upgrade_tar "$1" | 		nand_upgrade_tar "$1" | ||||||
| 		;; | 		;; | ||||||
| 	hfcl,ion4xi|\ | 	hfcl,ion4xi|\ | ||||||
|  | 	hfcl,ion4x|\ | ||||||
|  | 	hfcl,ion4x_2|\ | ||||||
| 	hfcl,ion4xe) | 	hfcl,ion4xe) | ||||||
| 		if grep -q rootfs_1 /proc/cmdline; then | 		if grep -q rootfs_1 /proc/cmdline; then | ||||||
| 			CI_UBIPART="rootfs" | 			CI_UBIPART="rootfs" | ||||||
|   | |||||||
| @@ -0,0 +1,23 @@ | |||||||
|  | /* | ||||||
|  |  * Copyright (c) 2018-2020, 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. | ||||||
|  |  */ | ||||||
|  |  | ||||||
|  | #include "../../../arm64/boot/dts/qcom/qcom-ipq5018-muxi-ap3220l.dts" | ||||||
|  |  | ||||||
|  | / { | ||||||
|  | 	pmuv8: pmu { | ||||||
|  | 		compatible = "arm,cortex-a7-pmu"; | ||||||
|  | 	}; | ||||||
|  | }; | ||||||
| @@ -0,0 +1,18 @@ | |||||||
|  | /* | ||||||
|  |  * 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. | ||||||
|  |  */ | ||||||
|  |  | ||||||
|  | #include "../../../arm64/boot/dts/qcom/qcom-ipq6018-hfcl-ion4x.dts" | ||||||
|  | #include "qcom-ipq6018.dtsi" | ||||||
| @@ -0,0 +1,18 @@ | |||||||
|  | /* | ||||||
|  |  * 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. | ||||||
|  |  */ | ||||||
|  |  | ||||||
|  | #include "../../../arm64/boot/dts/qcom/qcom-ipq6018-hfcl-ion4x_2.dts" | ||||||
|  | #include "qcom-ipq6018.dtsi" | ||||||
| @@ -0,0 +1,18 @@ | |||||||
|  | /* | ||||||
|  |  * 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. | ||||||
|  |  */ | ||||||
|  |  | ||||||
|  | #include "../../../arm64/boot/dts/qcom/qcom-ipq6018-yuncore-fap650.dts" | ||||||
|  | #include "qcom-ipq6018.dtsi" | ||||||
| @@ -0,0 +1,891 @@ | |||||||
|  | /dts-v1/; | ||||||
|  | /* Copyright (c) 2018-2020, 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. | ||||||
|  |  */ | ||||||
|  |  | ||||||
|  | #include "qcom-ipq5018.dtsi" | ||||||
|  |  | ||||||
|  | / { | ||||||
|  | 	#address-cells = <0x2>; | ||||||
|  | 	#size-cells = <0x2>; | ||||||
|  | 	model = "MUXI AP3220L"; | ||||||
|  | 	compatible = "muxi,ap3220l", "qcom,ipq5018-mp03.5-c1", "qcom,ipq5018"; | ||||||
|  | 	interrupt-parent = <&intc>; | ||||||
|  |  | ||||||
|  | 	aliases { | ||||||
|  | 		serial0 = &blsp1_uart1; | ||||||
|  | 		serial1 = &blsp1_uart2; | ||||||
|  | 		ethernet0 = "/soc/dp1"; | ||||||
|  | 		ethernet1 = "/soc/dp2"; | ||||||
|  |  | ||||||
|  | 		led-boot = &led_power; | ||||||
|  | 		led-failsafe = &led_power; | ||||||
|  | 		led-running = &led_power; | ||||||
|  | 		led-upgrade = &led_power; | ||||||
|  | 	}; | ||||||
|  |  | ||||||
|  | 	chosen { | ||||||
|  | 		bootargs = "console=ttyMSM0,115200,n8 rw init=/init"; | ||||||
|  | 	#ifdef __IPQ_MEM_PROFILE_256_MB__ | ||||||
|  | 		bootargs-append = " swiotlb=1"; | ||||||
|  | 	#else | ||||||
|  | 		bootargs-append = " swiotlb=1 coherent_pool=2M"; | ||||||
|  | 	#endif | ||||||
|  | 		stdout-path = "serial0"; | ||||||
|  | 	}; | ||||||
|  |  | ||||||
|  | 	reserved-memory { | ||||||
|  | 	#ifdef __IPQ_MEM_PROFILE_256_MB__ | ||||||
|  | 	/*                   256 MB Profile | ||||||
|  | 	 * +==========+==============+=========================+ | ||||||
|  | 	 * |          |              |                         | | ||||||
|  | 	 * |  Region  | Start Offset |          Size           | | ||||||
|  | 	 * |          |              |                         | | ||||||
|  | 	 * +----------+--------------+-------------------------+ | ||||||
|  | 	 * |    NSS   |  0x40000000  |           8MB           | | ||||||
|  | 	 * +----------+--------------+-------------------------+ | ||||||
|  | 	 * |   Linux  |  0x40800000  | Depends on total memory | | ||||||
|  | 	 * +----------+--------------+-------------------------+ | ||||||
|  | 	 * |   uboot  |  0x4A600000  |           4MB           | | ||||||
|  | 	 * +----------+--------------+-------------------------+ | ||||||
|  | 	 * |    SBL   |  0x4AA00000  |           1MB           | | ||||||
|  | 	 * +----------+--------------+-------------------------+ | ||||||
|  | 	 * |   smem   |  0x4AB00000  |           1MB           | | ||||||
|  | 	 * +----------+--------------+-------------------------+ | ||||||
|  | 	 * |    TZ    |  0x4AC00000  |           4MB           | | ||||||
|  | 	 * +----------+--------------+-------------------------+ | ||||||
|  | 	 * |    Q6    |              |                         | | ||||||
|  | 	 * |   code/  |  0x4B000000  |          20MB           | | ||||||
|  | 	 * |   data   |              |                         | | ||||||
|  | 	 * +----------+--------------+-------------------------+ | ||||||
|  | 	 * |  IPQ5018 |              |                         | | ||||||
|  | 	 * |   data   |  0x4C400000  |          13MB           | | ||||||
|  | 	 * +----------+--------------+-------------------------+ | ||||||
|  | 	 * |  IPQ5018 |              |                         | | ||||||
|  | 	 * |  M3 Dump |  0x4D100000  |           1MB           | | ||||||
|  | 	 * +----------+--------------+-------------------------+ | ||||||
|  | 	 * |  IPQ5018 |              |                         | | ||||||
|  | 	 * |   QDSS   |  0x4D200000  |           1MB           | | ||||||
|  | 	 * +----------+--------------+-------------------------+ | ||||||
|  | 	 * | QCN6122_1|              |                         | | ||||||
|  | 	 * |   data   |  0x4D300000  |          15MB           | | ||||||
|  | 	 * +----------+--------------+-------------------------+ | ||||||
|  | 	 * | QCN6122_1|              |                         | | ||||||
|  | 	 * |  M3 Dump |  0x4E200000  |           1MB           | | ||||||
|  | 	 * +----------+--------------+-------------------------+ | ||||||
|  | 	 * | QCN6122_1|              |                         | | ||||||
|  | 	 * |   QDSS   |  0x4E300000  |           1MB           | | ||||||
|  | 	 * +----------+--------------+-------------------------+ | ||||||
|  | 	 * | QCN6122_2|              |                         | | ||||||
|  | 	 * |   data   |  0x4E400000  |          15MB           | | ||||||
|  | 	 * +----------+--------------+-------------------------+ | ||||||
|  | 	 * | QCN6122_2|              |                         | | ||||||
|  | 	 * |  M3 Dump |  0x4F300000  |           1MB           | | ||||||
|  | 	 * +----------+--------------+-------------------------+ | ||||||
|  | 	 * | QCN6122_2|              |                         | | ||||||
|  | 	 * |   QDSS   |  0x4F400000  |           1MB           | | ||||||
|  | 	 * +----------+--------------+-------------------------+ | ||||||
|  | 	 * |                                                   | | ||||||
|  | 	 * |            Rest of the memory for Linux           | | ||||||
|  | 	 * |                                                   | | ||||||
|  | 	 * +===================================================+ | ||||||
|  | 	 */ | ||||||
|  | 		q6_mem_regions: q6_mem_regions@4B000000 { | ||||||
|  | 			no-map; | ||||||
|  | 			reg = <0x0 0x4B000000 0x0 0x4500000>; | ||||||
|  | 		}; | ||||||
|  |  | ||||||
|  | 		q6_code_data: q6_code_data@4B000000 { | ||||||
|  | 			no-map; | ||||||
|  | 			reg = <0x0 0x4B000000 0x0 0x1400000>; | ||||||
|  | 		}; | ||||||
|  |  | ||||||
|  | 		q6_ipq5018_data: q6_ipq5018_data@4C400000 { | ||||||
|  | 			no-map; | ||||||
|  | 			reg = <0x0 0x4C400000 0x0 0xD00000>; | ||||||
|  | 		}; | ||||||
|  |  | ||||||
|  | 		m3_dump: m3_dump@4D100000 { | ||||||
|  | 			no-map; | ||||||
|  | 			reg = <0x0 0x4D100000 0x0 0x100000>; | ||||||
|  | 		}; | ||||||
|  |  | ||||||
|  | 		q6_etr_region: q6_etr_dump@4D200000 { | ||||||
|  | 			no-map; | ||||||
|  | 			reg = <0x0 0x4D200000 0x0 0x100000>; | ||||||
|  | 		}; | ||||||
|  |  | ||||||
|  | 		q6_qcn6122_data1: q6_qcn6122_data1@4D300000 { | ||||||
|  | 			no-map; | ||||||
|  | 			reg = <0x0 0x4D300000 0x0 0xF00000>; | ||||||
|  | 		}; | ||||||
|  |  | ||||||
|  | 		m3_dump_qcn6122_1: m3_dump_qcn6122_1@4E200000 { | ||||||
|  | 			no-map; | ||||||
|  | 			reg = <0x0 0x4E200000 0x0 0x100000>; | ||||||
|  | 		}; | ||||||
|  |  | ||||||
|  | 		q6_qcn6122_etr_1: q6_qcn6122_etr_1@4E300000 { | ||||||
|  | 			no-map; | ||||||
|  | 			reg = <0x0 0x4E300000 0x0 0x100000>; | ||||||
|  | 		}; | ||||||
|  |  | ||||||
|  | 		q6_qcn6122_data2: q6_qcn6122_data2@4E400000 { | ||||||
|  | 			no-map; | ||||||
|  | 			reg = <0x0 0x4E400000 0x0 0xF00000>; | ||||||
|  | 		}; | ||||||
|  |  | ||||||
|  | 		m3_dump_qcn6122_2: m3_dump_qcn6122_2@4F300000 { | ||||||
|  | 			no-map; | ||||||
|  | 			reg = <0x0 0x4F300000 0x0 0x100000>; | ||||||
|  | 		}; | ||||||
|  |  | ||||||
|  | 		q6_qcn6122_etr_2: q6_qcn6122_etr_2@4F400000 { | ||||||
|  | 			no-map; | ||||||
|  | 			reg = <0x0 0x4F400000 0x0 0x100000>; | ||||||
|  | 		}; | ||||||
|  | 	#else | ||||||
|  | 	/*                 512MB/1GB Profiles | ||||||
|  | 	 * +==========+==============+=========================+ | ||||||
|  | 	 * |          |              |                         | | ||||||
|  | 	 * |  Region  | Start Offset |          Size           | | ||||||
|  | 	 * |          |              |                         | | ||||||
|  | 	 * +----------+--------------+-------------------------+ | ||||||
|  | 	 * |    NSS   |  0x40000000  |          16MB           | | ||||||
|  | 	 * +----------+--------------+-------------------------+ | ||||||
|  | 	 * |   Linux  |  0x41000000  | Depends on total memory | | ||||||
|  | 	 * +----------+--------------+-------------------------+ | ||||||
|  | 	 * |   uboot  |  0x4A600000  |           4MB           | | ||||||
|  | 	 * +----------+--------------+-------------------------+ | ||||||
|  | 	 * |    SBL   |  0x4AA00000  |           1MB           | | ||||||
|  | 	 * +----------+--------------+-------------------------+ | ||||||
|  | 	 * |   smem   |  0x4AB00000  |           1MB           | | ||||||
|  | 	 * +----------+--------------+-------------------------+ | ||||||
|  | 	 * |    TZ    |  0x4AC00000  |           4MB           | | ||||||
|  | 	 * +----------+--------------+-------------------------+ | ||||||
|  | 	 * |    Q6    |              |                         | | ||||||
|  | 	 * |   code/  |  0x4B000000  |          20MB           | | ||||||
|  | 	 * |   data   |              |                         | | ||||||
|  | 	 * +----------+--------------+-------------------------+ | ||||||
|  | 	 * |  IPQ5018 |              |                         | | ||||||
|  | 	 * |   data   |  0x4C400000  |          14MB           | | ||||||
|  | 	 * +----------+--------------+-------------------------+ | ||||||
|  | 	 * |  IPQ5018 |              |                         | | ||||||
|  | 	 * |  M3 Dump |  0x4D200000  |           1MB           | | ||||||
|  | 	 * +----------+--------------+-------------------------+ | ||||||
|  | 	 * |  IPQ5018 |              |                         | | ||||||
|  | 	 * |   QDSS   |  0x4D300000  |           1MB           | | ||||||
|  | 	 * +----------+--------------+-------------------------+ | ||||||
|  | 	 * |  IPQ5018 |              |                         | | ||||||
|  | 	 * |  Caldb   |  0x4D400000  |           2MB           | | ||||||
|  | 	 * +----------+--------------+-------------------------+ | ||||||
|  | 	 * | QCN6122_1|              |                         | | ||||||
|  | 	 * |   data   |  0x4D600000  |          16MB           | | ||||||
|  | 	 * +----------+--------------+-------------------------+ | ||||||
|  | 	 * | QCN6122_1|              |                         | | ||||||
|  | 	 * |  M3 Dump |  0x4E600000  |           1MB           | | ||||||
|  | 	 * +----------+--------------+-------------------------+ | ||||||
|  | 	 * | QCN6122_1|              |                         | | ||||||
|  | 	 * |   QDSS   |  0x4E700000  |           1MB           | | ||||||
|  | 	 * +----------+--------------+-------------------------+ | ||||||
|  | 	 * | QCN6122_1|              |                         | | ||||||
|  | 	 * |  Caldb   |  0x4E800000  |           5MB           | | ||||||
|  | 	 * +----------+--------------+-------------------------+ | ||||||
|  | 	 * | QCN6122_2|              |                         | | ||||||
|  | 	 * |   data   |  0x4ED00000  |          16MB           | | ||||||
|  | 	 * +----------+--------------+-------------------------+ | ||||||
|  | 	 * | QCN6122_2|              |                         | | ||||||
|  | 	 * |  M3 Dump |  0x4FD00000  |           1MB           | | ||||||
|  | 	 * +----------+--------------+-------------------------+ | ||||||
|  | 	 * | QCN6122_2|              |                         | | ||||||
|  | 	 * |   QDSS   |  0x4FE00000  |           1MB           | | ||||||
|  | 	 * +----------+--------------+-------------------------+ | ||||||
|  | 	 * | QCN6122_2|              |                         | | ||||||
|  | 	 * |  Caldb   |  0x4FF00000  |           5MB           | | ||||||
|  | 	 * +----------+--------------+-------------------------+ | ||||||
|  | 	 * |                                                   | | ||||||
|  | 	 * |            Rest of the memory for Linux           | | ||||||
|  | 	 * |                                                   | | ||||||
|  | 	 * +===================================================+ | ||||||
|  | 	 */ | ||||||
|  | 		q6_mem_regions: q6_mem_regions@4B000000 { | ||||||
|  | 			no-map; | ||||||
|  | 			reg = <0x0 0x4B000000 0x0 0x5400000>; | ||||||
|  | 		}; | ||||||
|  |  | ||||||
|  | 		q6_code_data: q6_code_data@4B000000 { | ||||||
|  | 			no-map; | ||||||
|  | 			reg = <0x0 0x4B000000 0x0 01400000>; | ||||||
|  | 		}; | ||||||
|  |  | ||||||
|  | 		q6_ipq5018_data: q6_ipq5018_data@4C400000 { | ||||||
|  | 			no-map; | ||||||
|  | 			reg = <0x0 0x4C400000 0x0 0xE00000>; | ||||||
|  | 		}; | ||||||
|  |  | ||||||
|  | 		m3_dump: m3_dump@4D200000 { | ||||||
|  | 			no-map; | ||||||
|  | 			reg = <0x0 0x4D200000 0x0 0x100000>; | ||||||
|  | 		}; | ||||||
|  |  | ||||||
|  | 		q6_etr_region: q6_etr_dump@4D300000 { | ||||||
|  | 			no-map; | ||||||
|  | 			reg = <0x0 0x4D300000 0x0 0x100000>; | ||||||
|  | 		}; | ||||||
|  |  | ||||||
|  | 		q6_caldb_region: q6_caldb_region@4D400000 { | ||||||
|  | 			no-map; | ||||||
|  | 			reg = <0x0 0x4D400000 0x0 0x200000>; | ||||||
|  | 		}; | ||||||
|  |  | ||||||
|  | 		q6_qcn6122_data1: q6_qcn6122_data1@4D600000 { | ||||||
|  | 			no-map; | ||||||
|  | 			reg = <0x0 0x4D600000 0x0 0x1000000>; | ||||||
|  | 		}; | ||||||
|  |  | ||||||
|  | 		m3_dump_qcn6122_1: m3_dump_qcn6122_1@4E600000 { | ||||||
|  | 			no-map; | ||||||
|  | 			reg = <0x0 0x4E600000 0x0 0x100000>; | ||||||
|  | 		}; | ||||||
|  |  | ||||||
|  | 		q6_qcn6122_etr_1: q6_qcn6122_etr_1@4E700000 { | ||||||
|  | 			no-map; | ||||||
|  | 			reg = <0x0 0x4E700000 0x0 0x100000>; | ||||||
|  | 		}; | ||||||
|  |  | ||||||
|  | 		q6_qcn6122_caldb_1: q6_qcn6122_caldb_1@4E800000 { | ||||||
|  | 			no-map; | ||||||
|  | 			reg = <0x0 0x4E800000 0x0 0x500000>; | ||||||
|  | 		}; | ||||||
|  |  | ||||||
|  | 		q6_qcn6122_data2: q6_qcn6122_data2@4E900000 { | ||||||
|  | 			no-map; | ||||||
|  | 			reg = <0x0 0x4ED00000 0x0 0x1000000>; | ||||||
|  | 		}; | ||||||
|  |  | ||||||
|  | 		m3_dump_qcn6122_2: m3_dump_qcn6122_2@4FD00000 { | ||||||
|  | 			no-map; | ||||||
|  | 			reg = <0x0 0x4FD00000 0x0 0x100000>; | ||||||
|  | 		}; | ||||||
|  |  | ||||||
|  | 		q6_qcn6122_etr_2: q6_qcn6122_etr_2@4FE00000 { | ||||||
|  | 			no-map; | ||||||
|  | 			reg = <0x0 0x4FE00000 0x0 0x100000>; | ||||||
|  | 		}; | ||||||
|  |  | ||||||
|  | 		q6_qcn6122_caldb_2: q6_qcn6122_caldb_2@4FF00000 { | ||||||
|  | 			no-map; | ||||||
|  | 			reg = <0x0 0x4FF00000 0x0 0x500000>; | ||||||
|  | 		}; | ||||||
|  |  | ||||||
|  | 	#endif | ||||||
|  | 	}; | ||||||
|  |  | ||||||
|  | 	soc { | ||||||
|  |  | ||||||
|  | 		blsp1_uart1: serial@78af000 { | ||||||
|  | 			pinctrl-0 = <&blsp0_uart_pins>; | ||||||
|  | 			pinctrl-names = "default"; | ||||||
|  | 			status = "okay"; | ||||||
|  | 		}; | ||||||
|  |  | ||||||
|  | 		blsp1_uart2: serial@78b0000 { | ||||||
|  | 			pinctrl-0 = <&blsp1_uart_pins>; | ||||||
|  | 			pinctrl-names = "default"; | ||||||
|  | 			status = "disabled"; | ||||||
|  | 		}; | ||||||
|  |  | ||||||
|  | 		qpic_bam: dma@7984000{ | ||||||
|  | 			status = "ok"; | ||||||
|  | 		}; | ||||||
|  |  | ||||||
|  | 		nand: qpic-nand@79b0000 { | ||||||
|  | 			pinctrl-0 = <&qspi_nand_pins>; | ||||||
|  | 			pinctrl-names = "default"; | ||||||
|  | 			status = "ok"; | ||||||
|  | 		}; | ||||||
|  |  | ||||||
|  | 		spi_0: spi@78b5000 { /* BLSP1 QUP0 */ | ||||||
|  | 			pinctrl-0 = <&blsp0_spi_pins>; | ||||||
|  | 			pinctrl-names = "default"; | ||||||
|  | 			cs-select = <0>; | ||||||
|  | 			status = "ok"; | ||||||
|  |  | ||||||
|  | 			m25p80@0 { | ||||||
|  | 				#address-cells = <1>; | ||||||
|  | 				#size-cells = <1>; | ||||||
|  | 				reg = <0>; | ||||||
|  | 				compatible = "n25q128a11"; | ||||||
|  | 				linux,modalias = "m25p80", "n25q128a11"; | ||||||
|  | 				spi-max-frequency = <50000000>; | ||||||
|  | 				use-default-sizes; | ||||||
|  | 			}; | ||||||
|  | 		}; | ||||||
|  |  | ||||||
|  | 		mdio0: mdio@88000 { | ||||||
|  | 			status = "ok"; | ||||||
|  |  | ||||||
|  | 			ethernet-phy@0 { | ||||||
|  | 				reg = <7>; | ||||||
|  | 			}; | ||||||
|  | 		}; | ||||||
|  |  | ||||||
|  | 		mdio1: mdio@90000 { | ||||||
|  | 			status = "ok"; | ||||||
|  | 			pinctrl-0 = <&mdio1_pins &phy_pins>; | ||||||
|  | 			pinctrl-names = "default"; | ||||||
|  | 			phy-reset-gpio = <&tlmm 39 0>; | ||||||
|  |  | ||||||
|  | 			ethernet-phy@0 { | ||||||
|  | 				reg = <0>; | ||||||
|  | 			}; | ||||||
|  |  | ||||||
|  | 			ethernet-phy@1 { | ||||||
|  | 				reg = <1>; | ||||||
|  | 			}; | ||||||
|  |  | ||||||
|  | 			ethernet-phy@2 { | ||||||
|  | 				reg = <2>; | ||||||
|  | 			}; | ||||||
|  |  | ||||||
|  | 			ethernet-phy@3 { | ||||||
|  | 				reg = <3>; | ||||||
|  | 			}; | ||||||
|  | 		}; | ||||||
|  |  | ||||||
|  | 		ess-instance { | ||||||
|  | 			num_devices = <0x2>; | ||||||
|  | 			ess-switch@0x39c00000 { | ||||||
|  | 				compatible = "qcom,ess-switch-ipq50xx"; | ||||||
|  | 				device_id = <0>; | ||||||
|  | 				switch_mac_mode = <0xf>; /* mac mode for uniphy instance*/ | ||||||
|  | 				cmnblk_clk = "internal_96MHz"; /* cmnblk clk*/ | ||||||
|  | 				qcom,port_phyinfo { | ||||||
|  | 					port@0 { | ||||||
|  | 						port_id = <1>; | ||||||
|  | 						phy_address = <7>; | ||||||
|  | 					}; | ||||||
|  | 					port@1 { | ||||||
|  | 						port_id = <2>; | ||||||
|  | 						forced-speed = <1000>; | ||||||
|  | 						forced-duplex = <1>; | ||||||
|  | 					}; | ||||||
|  | 				}; | ||||||
|  | 				/* | ||||||
|  | 				led_source@0 { | ||||||
|  | 					source = <0>; | ||||||
|  | 					mode = "normal"; | ||||||
|  | 					speed = "all"; | ||||||
|  | 					blink_en = "enable"; | ||||||
|  | 					active = "high"; | ||||||
|  | 				}; | ||||||
|  | 				*/ | ||||||
|  | 			}; | ||||||
|  | 			ess-switch1@1 { | ||||||
|  | 				compatible = "qcom,ess-switch-qca83xx"; | ||||||
|  | 				device_id = <1>; | ||||||
|  | 				switch_access_mode = "mdio"; | ||||||
|  | 				mdio-bus = <&mdio1>; | ||||||
|  | 				reset_gpio = <0x27>; | ||||||
|  | 				switch_cpu_bmp = <0x40>;  /* cpu port bitmap */ | ||||||
|  | 				switch_lan_bmp = <0x1e>; /* lan port bitmap */ | ||||||
|  | 				switch_wan_bmp = <0x0>;  /* wan port bitmap */ | ||||||
|  | 				qca,ar8327-initvals = < | ||||||
|  | 						0x00004 0x7600000   /* PAD0_MODE */ | ||||||
|  | 						0x00008 0x1000000   /* PAD5_MODE */ | ||||||
|  | 						0x0000c 0x80        /* PAD6_MODE */ | ||||||
|  | 						0x00010 0x2613a0    /* PORT6 FORCE MODE*/ | ||||||
|  | 						0x000e4 0xaa545     /* MAC_POWER_SEL */ | ||||||
|  | 						0x000e0 0xc74164de  /* SGMII_CTRL */ | ||||||
|  | 						0x0007c 0x4e        /* PORT0_STATUS */ | ||||||
|  | 						0x00094 0x4e        /* PORT6_STATUS */ | ||||||
|  | 				>; | ||||||
|  | 				qcom,port_phyinfo { | ||||||
|  | 					port@0 { | ||||||
|  | 						port_id = <1>; | ||||||
|  | 						phy_address = <0>; | ||||||
|  | 					}; | ||||||
|  | 					port@1 { | ||||||
|  | 						port_id = <2>; | ||||||
|  | 						phy_address = <1>; | ||||||
|  | 					}; | ||||||
|  | 					port@2 { | ||||||
|  | 						port_id = <3>; | ||||||
|  | 						phy_address = <2>; | ||||||
|  | 					}; | ||||||
|  | 					port@3 { | ||||||
|  | 						port_id = <4>; | ||||||
|  | 						phy_address = <3>; | ||||||
|  | 					}; | ||||||
|  | 				}; | ||||||
|  | 			}; | ||||||
|  | 		}; | ||||||
|  |  | ||||||
|  | 		ess-uniphy@98000 { | ||||||
|  | 			status = "disabled"; | ||||||
|  | 		}; | ||||||
|  |  | ||||||
|  | 		dp1 { | ||||||
|  | 			device_type = "network"; | ||||||
|  | 			compatible = "qcom,nss-dp"; | ||||||
|  | 			clocks = <&gcc GCC_SNOC_GMAC0_AXI_CLK>; | ||||||
|  | 			clock-names = "nss-snoc-gmac-axi-clk"; | ||||||
|  | 			qcom,id = <1>; | ||||||
|  | 			reg = <0x39C00000 0x10000>; | ||||||
|  | 			interrupts = <GIC_SPI 101 IRQ_TYPE_LEVEL_HIGH>; | ||||||
|  | 			qcom,mactype = <2>; | ||||||
|  | 			qcom,link-poll = <1>; | ||||||
|  | 			qcom,phy-mdio-addr = <7>; | ||||||
|  | 			mdio-bus = <&mdio0>; | ||||||
|  | 			local-mac-address = [000000000000]; | ||||||
|  | 			phy-mode = "sgmii"; | ||||||
|  | 		}; | ||||||
|  |  | ||||||
|  | 		dp2 { | ||||||
|  | 			device_type = "network"; | ||||||
|  | 			compatible = "qcom,nss-dp"; | ||||||
|  | 			clocks = <&gcc GCC_SNOC_GMAC1_AXI_CLK>; | ||||||
|  | 			clock-names = "nss-snoc-gmac-axi-clk"; | ||||||
|  | 			qcom,id = <2>; | ||||||
|  | 			reg = <0x39D00000 0x10000>; | ||||||
|  | 			interrupts = <GIC_SPI 109 IRQ_TYPE_LEVEL_HIGH>; | ||||||
|  | 			qcom,mactype = <2>; | ||||||
|  | 			qcom,link-poll = <1>; | ||||||
|  | 			qcom,phy-mdio-addr = <3>; | ||||||
|  | 			mdio-bus = <&mdio1>; | ||||||
|  | 			local-mac-address = [000000000000]; | ||||||
|  | 			phy-mode = "sgmii"; | ||||||
|  | 		}; | ||||||
|  |  | ||||||
|  | 		qcom,test@0 { | ||||||
|  | 			status = "ok"; | ||||||
|  | 		}; | ||||||
|  |  | ||||||
|  | 	}; | ||||||
|  |  | ||||||
|  | 	thermal-zones { | ||||||
|  | 		status = "ok"; | ||||||
|  | 	}; | ||||||
|  | }; | ||||||
|  |  | ||||||
|  | &tlmm { | ||||||
|  | 	//pinctrl-0 = <&phy_led_pins>; | ||||||
|  | 	pinctrl-names = "default"; | ||||||
|  |  | ||||||
|  | 	blsp0_uart_pins: uart_pins { | ||||||
|  | 		blsp0_uart_rx_tx { | ||||||
|  | 			pins = "gpio20", "gpio21"; | ||||||
|  | 			function = "blsp0_uart0"; | ||||||
|  | 			bias-disable; | ||||||
|  | 		}; | ||||||
|  | 	}; | ||||||
|  |  | ||||||
|  | 	blsp1_uart_pins: blsp1_uart_pins { | ||||||
|  | 		blsp1_uart_rx_tx { | ||||||
|  | 			pins = "gpio23", "gpio25"; | ||||||
|  | 			function = "blsp1_uart2"; | ||||||
|  | 			bias-disable; | ||||||
|  | 		}; | ||||||
|  | 	}; | ||||||
|  |  | ||||||
|  | 	blsp0_spi_pins: blsp0_spi_pins { | ||||||
|  | 		mux { | ||||||
|  | 			pins = "gpio10", "gpio11", "gpio12", "gpio13"; | ||||||
|  | 			function = "blsp0_spi"; | ||||||
|  | 			drive-strength = <2>; | ||||||
|  | 			bias-disable; | ||||||
|  | 		}; | ||||||
|  | 	}; | ||||||
|  |  | ||||||
|  | 	qspi_nand_pins: qspi_nand_pins { | ||||||
|  | 		qspi_clock { | ||||||
|  | 				pins = "gpio9"; | ||||||
|  | 				function = "qspi_clk"; | ||||||
|  | 				drive-strength = <8>; | ||||||
|  | 				bias-disable; | ||||||
|  | 			}; | ||||||
|  | 		qspi_cs { | ||||||
|  | 				pins = "gpio8"; | ||||||
|  | 				function = "qspi_cs"; | ||||||
|  | 				drive-strength = <8>; | ||||||
|  | 				bias-disable; | ||||||
|  | 			}; | ||||||
|  | 		qspi_data_0 { | ||||||
|  | 				pins = "gpio7"; | ||||||
|  | 				function = "qspi0"; | ||||||
|  | 				drive-strength = <8>; | ||||||
|  | 				bias-disable; | ||||||
|  | 			}; | ||||||
|  | 		qspi_data_1 { | ||||||
|  | 				pins = "gpio6"; | ||||||
|  | 				function = "qspi1"; | ||||||
|  | 				drive-strength = <8>; | ||||||
|  | 				bias-disable; | ||||||
|  | 			}; | ||||||
|  | 		qspi_data_2 { | ||||||
|  | 				pins = "gpio5"; | ||||||
|  | 				function = "qspi2"; | ||||||
|  | 				drive-strength = <8>; | ||||||
|  | 				bias-disable; | ||||||
|  | 			}; | ||||||
|  | 		qspi_data_3 { | ||||||
|  | 				pins = "gpio4"; | ||||||
|  | 				function = "qspi3"; | ||||||
|  | 				drive-strength = <8>; | ||||||
|  | 				bias-disable; | ||||||
|  | 			}; | ||||||
|  | 	}; | ||||||
|  |  | ||||||
|  | 	phy_pins: phy_pins { | ||||||
|  | 		phy_intr { | ||||||
|  | 			pins = "gpio29"; | ||||||
|  | 			function = "gpio"; | ||||||
|  | 			drive-strength = <8>; | ||||||
|  | 			bias-pull-up; | ||||||
|  | 			bias-disable; | ||||||
|  | 		}; | ||||||
|  | 		phy_reset { | ||||||
|  | 			pins = "gpio39"; | ||||||
|  | 			function = "gpio"; | ||||||
|  | 			drive-strength = <8>; | ||||||
|  | 			bias-pull-down; | ||||||
|  | 			output-low; | ||||||
|  | 		}; | ||||||
|  | 	}; | ||||||
|  |  | ||||||
|  | 	mdio1_pins: mdio_pinmux { | ||||||
|  | 		mux_0 { | ||||||
|  | 			pins = "gpio36"; | ||||||
|  | 			function = "mdc"; | ||||||
|  | 			drive-strength = <8>; | ||||||
|  | 			bias-pull-up; | ||||||
|  | 		}; | ||||||
|  |  | ||||||
|  | 		mux_1 { | ||||||
|  | 			pins = "gpio37"; | ||||||
|  | 			function = "mdio"; | ||||||
|  | 			drive-strength = <8>; | ||||||
|  | 			bias-pull-up; | ||||||
|  | 		}; | ||||||
|  | 	}; | ||||||
|  |  | ||||||
|  | 	phy_led_pins: phy_led_pins { | ||||||
|  | 		gephy_led_pin { | ||||||
|  | 			//pins = "gpio46"; | ||||||
|  | 			function = "led0"; | ||||||
|  | 			drive-strength = <8>; | ||||||
|  | 			bias-pull-down; | ||||||
|  | 		}; | ||||||
|  | 	}; | ||||||
|  |  | ||||||
|  | 	button_pins: button_pins { | ||||||
|  | 		reset_button { | ||||||
|  | 			pins = "gpio32"; | ||||||
|  | 			function = "gpio"; | ||||||
|  | 			drive-strength = <8>; | ||||||
|  | 			bias-pull-up; | ||||||
|  | 		}; | ||||||
|  | 	}; | ||||||
|  |  | ||||||
|  | 	led_pins: led_pins { | ||||||
|  | 		led_pwr { | ||||||
|  | 			pins = "gpio26"; | ||||||
|  | 			function = "gpio"; | ||||||
|  | 			drive-strength = <8>; | ||||||
|  | 			bias-pull-down; | ||||||
|  | 		}; | ||||||
|  |  | ||||||
|  | 		led_2g { | ||||||
|  | 			pins = "gpio31"; | ||||||
|  | 			function = "gpio"; | ||||||
|  | 			drive-strength = <8>; | ||||||
|  | 			bias-pull-down; | ||||||
|  | 		}; | ||||||
|  |  | ||||||
|  | 		led_5g { | ||||||
|  | 			pins = "gpio33"; | ||||||
|  | 			function = "gpio"; | ||||||
|  | 			drive-strength = <8>; | ||||||
|  | 			bias-pull-down; | ||||||
|  | 		}; | ||||||
|  | 	}; | ||||||
|  |  | ||||||
|  | }; | ||||||
|  |  | ||||||
|  | &soc { | ||||||
|  | 	gpio_keys { | ||||||
|  | 		compatible = "gpio-keys"; | ||||||
|  | 		pinctrl-0 = <&button_pins>; | ||||||
|  | 		pinctrl-names = "default"; | ||||||
|  |  | ||||||
|  | 		button@1 { | ||||||
|  | 			label = "reset_button"; | ||||||
|  | 			linux,code = <KEY_RESTART>; | ||||||
|  | 			gpios = <&tlmm 32 GPIO_ACTIVE_LOW>; | ||||||
|  | 			linux,input-type = <1>; | ||||||
|  | 			debounce-interval = <60>; | ||||||
|  | 		}; | ||||||
|  | 	}; | ||||||
|  |  | ||||||
|  | 	leds { | ||||||
|  | 		compatible = "gpio-leds"; | ||||||
|  | 		pinctrl-0 = <&led_pins>; | ||||||
|  | 		pinctrl-names = "default"; | ||||||
|  |  | ||||||
|  | 			led_power: led_pwr { | ||||||
|  | 				label = "green:led_pwr"; | ||||||
|  | 				gpios = <&tlmm 26 GPIO_ACTIVE_HIGH>; | ||||||
|  | 				default-state = "on"; | ||||||
|  | 				linux,default-trigger = "led_pwr"; | ||||||
|  | 			}; | ||||||
|  |  | ||||||
|  | 			led_2g { | ||||||
|  | 				label = "green:wifi2"; | ||||||
|  | 				gpio = <&tlmm 33 GPIO_ACTIVE_HIGH>; | ||||||
|  | 				default-state = "off"; | ||||||
|  | 			}; | ||||||
|  |  | ||||||
|  | 			led_5g { | ||||||
|  | 				label = "green:wifi5"; | ||||||
|  | 				gpio = <&tlmm 31 GPIO_ACTIVE_HIGH>; | ||||||
|  | 				default-state = "off"; | ||||||
|  | 			}; | ||||||
|  | 	}; | ||||||
|  | }; | ||||||
|  |  | ||||||
|  | &usb3 { | ||||||
|  | 	status = "ok"; | ||||||
|  | 	device-power-gpio = <&tlmm 30 1>; | ||||||
|  | }; | ||||||
|  |  | ||||||
|  | &eud { | ||||||
|  | 	status = "ok"; | ||||||
|  | }; | ||||||
|  |  | ||||||
|  | &pcie_x1 { | ||||||
|  | 	status = "disabled"; | ||||||
|  | 	perst-gpio = <&tlmm 18 1>; | ||||||
|  | }; | ||||||
|  |  | ||||||
|  | &pcie_x2 { | ||||||
|  | 	status = "disabled"; | ||||||
|  | 	perst-gpio = <&tlmm 15 1>; | ||||||
|  | }; | ||||||
|  |  | ||||||
|  | &dwc_0 { | ||||||
|  | 	/delete-property/ #phy-cells; | ||||||
|  | 	/delete-property/ phys; | ||||||
|  | 	/delete-property/ phy-names; | ||||||
|  | }; | ||||||
|  |  | ||||||
|  | &hs_m31phy_0 { | ||||||
|  | 	status = "ok"; | ||||||
|  | }; | ||||||
|  |  | ||||||
|  | &pcie_x1phy { | ||||||
|  | 	status = "disabled"; | ||||||
|  | }; | ||||||
|  |  | ||||||
|  | &pcie_x2phy { | ||||||
|  | 	status = "disabled"; | ||||||
|  | }; | ||||||
|  |  | ||||||
|  | &pcie_x1_rp { | ||||||
|  |         status = "disabled"; | ||||||
|  |  | ||||||
|  | 	mhi_0: qcom,mhi@0 { | ||||||
|  | 		reg = <0 0 0 0 0 >; | ||||||
|  | 	}; | ||||||
|  | }; | ||||||
|  |  | ||||||
|  | &pcie_x2_rp { | ||||||
|  |         status = "disabled"; | ||||||
|  |  | ||||||
|  | 	mhi_1: qcom,mhi@1 { | ||||||
|  | 		reg = <0 0 0 0 0 >; | ||||||
|  |  | ||||||
|  | 	}; | ||||||
|  | }; | ||||||
|  |  | ||||||
|  | &qfprom { | ||||||
|  | 	status = "ok"; | ||||||
|  | }; | ||||||
|  |  | ||||||
|  | &tsens { | ||||||
|  | 	status = "ok"; | ||||||
|  | }; | ||||||
|  |  | ||||||
|  | &qcom_q6v5_wcss { | ||||||
|  | 	qcom,multipd_arch; | ||||||
|  | 	memory-region = <&q6_mem_regions>; | ||||||
|  | 	qcom,share_bootargs; | ||||||
|  | 	qcom,bootargs_smem = <507>; | ||||||
|  | 	boot-args = <0x2 0x4 0x2 0xF 0x0 0x0>; | ||||||
|  |  | ||||||
|  | 	/* IPQ5018 */ | ||||||
|  | 	q6v5_wcss_userpd1 { | ||||||
|  | 		m3_firmware = "IPQ5018/m3_fw.mdt"; | ||||||
|  | 		interrupts-extended = <&wcss_smp2p_in 8 0>, | ||||||
|  | 			<&wcss_smp2p_in 9 0>, | ||||||
|  | 			<&wcss_smp2p_in 12 0>, | ||||||
|  | 			<&wcss_smp2p_in 11 0>; | ||||||
|  | 		interrupt-names ="fatal", | ||||||
|  | 			"ready", | ||||||
|  | 			"spawn_ack", | ||||||
|  | 			"stop-ack"; | ||||||
|  | 		qcom,smem-states = <&wcss_smp2p_out 8>, | ||||||
|  | 			<&wcss_smp2p_out 9>, | ||||||
|  | 			<&wcss_smp2p_out 10>; | ||||||
|  | 		qcom,smem-state-names = "shutdown", | ||||||
|  | 			"stop", | ||||||
|  | 			"spawn"; | ||||||
|  | 		qca,asid = <1>; | ||||||
|  | 		qca,auto-restart; | ||||||
|  | 		qca,int_radio; | ||||||
|  | 		#ifdef __IPQ_MEM_PROFILE_256_MB__ | ||||||
|  | 		memory-region = <&q6_ipq5018_data>, <&m3_dump>, | ||||||
|  | 				<&q6_etr_region>; | ||||||
|  | 		#else | ||||||
|  | 		memory-region = <&q6_ipq5018_data>, <&m3_dump>, | ||||||
|  | 				<&q6_etr_region>, <&q6_caldb_region>; | ||||||
|  | 		#endif | ||||||
|  | 	}; | ||||||
|  |  | ||||||
|  | 	/* QCN6122 6G */ | ||||||
|  | 	q6v5_wcss_userpd2 { | ||||||
|  | 		m3_firmware = "qcn6122/m3_fw.mdt"; | ||||||
|  | 		interrupts-extended = <&wcss_smp2p_in 16 0>, | ||||||
|  | 			<&wcss_smp2p_in 17 0>, | ||||||
|  | 			<&wcss_smp2p_in 20 0>, | ||||||
|  | 			<&wcss_smp2p_in 19 0>; | ||||||
|  | 		interrupt-names ="fatal", | ||||||
|  | 			"ready", | ||||||
|  | 			"spawn_ack", | ||||||
|  | 			"stop-ack"; | ||||||
|  | 		qcom,smem-states = <&wcss_smp2p_out 16>, | ||||||
|  | 			<&wcss_smp2p_out 17>, | ||||||
|  | 			<&wcss_smp2p_out 18>; | ||||||
|  | 		qcom,smem-state-names = "shutdown", | ||||||
|  | 			"stop", | ||||||
|  | 			"spawn"; | ||||||
|  | 		qca,asid = <2>; | ||||||
|  | 		qca,auto-restart; | ||||||
|  | 		#ifdef __IPQ_MEM_PROFILE_256_MB__ | ||||||
|  | 		memory-region = <&q6_qcn6122_data1>, <&m3_dump_qcn6122_1>, | ||||||
|  | 				<&q6_qcn6122_etr_1>; | ||||||
|  | 		#else | ||||||
|  | 		memory-region = <&q6_qcn6122_data1>, <&m3_dump_qcn6122_1>, | ||||||
|  | 				<&q6_qcn6122_etr_1>, <&q6_qcn6122_caldb_1>; | ||||||
|  | 		#endif | ||||||
|  | 	}; | ||||||
|  |  | ||||||
|  | 	/* QCN6122 5G */ | ||||||
|  | 	q6v5_wcss_userpd3 { | ||||||
|  | 		m3_firmware = "qcn6122/m3_fw.mdt"; | ||||||
|  | 		interrupts-extended = <&wcss_smp2p_in 24 0>, | ||||||
|  | 			<&wcss_smp2p_in 25 0>, | ||||||
|  | 			<&wcss_smp2p_in 28 0>, | ||||||
|  | 			<&wcss_smp2p_in 27 0>; | ||||||
|  | 		interrupt-names ="fatal", | ||||||
|  | 			"ready", | ||||||
|  | 			"spawn_ack", | ||||||
|  | 			"stop-ack"; | ||||||
|  | 		qcom,smem-states = <&wcss_smp2p_out 24>, | ||||||
|  | 			<&wcss_smp2p_out 25>, | ||||||
|  | 			<&wcss_smp2p_out 26>; | ||||||
|  | 		qcom,smem-state-names = "shutdown", | ||||||
|  | 			"stop", | ||||||
|  | 			"spawn"; | ||||||
|  | 		qca,asid = <3>; | ||||||
|  | 		qca,auto-restart; | ||||||
|  | 		#ifdef __IPQ_MEM_PROFILE_256_MB__ | ||||||
|  | 		memory-region = <&q6_qcn6122_data2>, <&m3_dump_qcn6122_2>, | ||||||
|  | 				<&q6_qcn6122_etr_2>; | ||||||
|  | 		#else | ||||||
|  | 		memory-region = <&q6_qcn6122_data2>, <&m3_dump_qcn6122_2>, | ||||||
|  | 				<&q6_qcn6122_etr_2>, <&q6_qcn6122_caldb_2>; | ||||||
|  | 		#endif | ||||||
|  | 	}; | ||||||
|  | }; | ||||||
|  |  | ||||||
|  | &qgic_msi_0 { | ||||||
|  | 	status = "ok"; | ||||||
|  | }; | ||||||
|  |  | ||||||
|  | &qgic_msi_1 { | ||||||
|  | 	status = "ok"; | ||||||
|  | }; | ||||||
|  |  | ||||||
|  | &wifi0 { | ||||||
|  | 	/* IPQ5018 */ | ||||||
|  | 	qcom,multipd_arch; | ||||||
|  | 	qcom,userpd-subsys-name = "q6v5_wcss_userpd1"; | ||||||
|  | #ifdef __IPQ_MEM_PROFILE_256_MB__ | ||||||
|  | 	qcom,tgt-mem-mode = <2>; | ||||||
|  | #else | ||||||
|  | 	qcom,tgt-mem-mode = <1>; | ||||||
|  | #endif | ||||||
|  | 	qcom,board_id = <0x24>; | ||||||
|  | 	qcom,bdf-addr = <0x4C400000 0x4C400000 0x4C400000 0x0 0x0>; | ||||||
|  | #ifdef __CNSS2__ | ||||||
|  | 	qcom,caldb-addr = <0x4D400000 0x4D400000 0 0 0>; | ||||||
|  | #else | ||||||
|  | 	qcom,caldb-addr = <0x4D400000>; | ||||||
|  | 	m3-dump-addr = <0x4D200000>; | ||||||
|  | #endif | ||||||
|  | 	qcom,caldb-size = <0x200000>; | ||||||
|  | 	status = "ok"; | ||||||
|  | }; | ||||||
|  |  | ||||||
|  | &wifi1 { | ||||||
|  | 	/* QCN6122 6G */ | ||||||
|  | 	qcom,multipd_arch; | ||||||
|  | 	qcom,userpd-subsys-name = "q6v5_wcss_userpd2"; | ||||||
|  | #ifdef __IPQ_MEM_PROFILE_256_MB__ | ||||||
|  | 	qcom,tgt-mem-mode = <2>; | ||||||
|  | #else | ||||||
|  | 	qcom,tgt-mem-mode = <1>; | ||||||
|  | #endif | ||||||
|  | 	qcom,board_id = <0x60>; | ||||||
|  | 	qcom,bdf-addr = <0x4D600000 0x4D600000 0x4D300000 0x0 0x0>; | ||||||
|  | #ifdef __CNSS2__ | ||||||
|  | 	qcom,caldb-addr = <0x4E800000 0x4E800000 0 0 0>; | ||||||
|  | #else | ||||||
|  | 	qcom,caldb-addr = <0x4E800000>; | ||||||
|  | 	m3-dump-addr = <0x4E600000>; | ||||||
|  | #endif | ||||||
|  | 	qcom,caldb-size = <0x500000>; | ||||||
|  | 	status = "disabled"; | ||||||
|  | }; | ||||||
|  |  | ||||||
|  | &wifi2 { | ||||||
|  | 	/* QCN6122 5G */ | ||||||
|  | 	qcom,multipd_arch; | ||||||
|  | 	qcom,userpd-subsys-name = "q6v5_wcss_userpd3"; | ||||||
|  | #ifdef __IPQ_MEM_PROFILE_256_MB__ | ||||||
|  | 	qcom,tgt-mem-mode = <2>; | ||||||
|  | #else | ||||||
|  | 	qcom,tgt-mem-mode = <1>; | ||||||
|  | #endif | ||||||
|  | 	qcom,board_id = <0x60>; | ||||||
|  | 	qcom,bdf-addr = <0x4ED00000 0x4ED00000 0x4E400000 0x0 0x0>; | ||||||
|  | #ifdef __CNSS2__ | ||||||
|  | 	qcom,caldb-addr = <0x4FF00000 0x4FF00000 0 0 0>; | ||||||
|  | #else | ||||||
|  | 	qcom,caldb-addr = <0x4FF00000>; | ||||||
|  | 	m3-dump-addr = <0x4FD00000>; | ||||||
|  | #endif | ||||||
|  | 	qcom,caldb-size = <0x500000>; | ||||||
|  | 	status = "ok"; | ||||||
|  | }; | ||||||
| @@ -0,0 +1,155 @@ | |||||||
|  | /dts-v1/; | ||||||
|  | /* | ||||||
|  |  * 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. | ||||||
|  |  */ | ||||||
|  |  | ||||||
|  | #include "qcom-ipq6018-cp01-hfcl.dtsi" | ||||||
|  | #include "qcom-ipq6018-rpm-regulator.dtsi" | ||||||
|  | #include "qcom-ipq6018-cpr-regulator.dtsi" | ||||||
|  | #include "qcom-ipq6018-cp-cpu.dtsi" | ||||||
|  |  | ||||||
|  | / { | ||||||
|  | 	model = "HFCL ION4X"; | ||||||
|  | 	compatible = "hfcl,ion4x", "qcom,ipq6018-cp01", "qcom,ipq6018"; | ||||||
|  |  | ||||||
|  | 	/* | ||||||
|  | 	 * +=========+==============+========================+ | ||||||
|  | 	 * |        |              |                         | | ||||||
|  | 	 * | Region | Start Offset |          Size           | | ||||||
|  | 	 * |        |              |                         | | ||||||
|  | 	 * +--------+--------------+-------------------------+ | ||||||
|  | 	 * |        |              |                         | | ||||||
|  | 	 * |        |              |                         | | ||||||
|  | 	 * |        |              |                         | | ||||||
|  | 	 * |        |              |                         | | ||||||
|  | 	 * | Linux  |  0x41000000  |         139MB           | | ||||||
|  | 	 * |        |              |                         | | ||||||
|  | 	 * |        |              |                         | | ||||||
|  | 	 * |        |              |                         | | ||||||
|  | 	 * +--------+--------------+-------------------------+ | ||||||
|  | 	 * | TZ App |  0x49B00000  |           6MB           | | ||||||
|  | 	 * +--------+--------------+-------------------------+ | ||||||
|  | 	 * | ||||||
|  | 	 * From the available 145 MB for Linux in the first 256 MB, | ||||||
|  | 	 * we are reserving 6 MB for TZAPP. | ||||||
|  | 	 * | ||||||
|  | 	 * Refer arch/arm64/boot/dts/qcom/qcom-ipq6018-memory.dtsi | ||||||
|  | 	 * for memory layout. | ||||||
|  | 	 */ | ||||||
|  |  | ||||||
|  | /* TZAPP is enabled in default memory profile only */ | ||||||
|  | #if !defined(__IPQ_MEM_PROFILE_256_MB__) && !defined(__IPQ_MEM_PROFILE_512_MB__) | ||||||
|  | 	reserved-memory { | ||||||
|  | 		tzapp:tzapp@49B00000 {	/* TZAPPS */ | ||||||
|  | 			no-map; | ||||||
|  | 			reg = <0x0 0x49B00000 0x0 0x00600000>; | ||||||
|  | 		}; | ||||||
|  | 	}; | ||||||
|  | #endif | ||||||
|  | }; | ||||||
|  |  | ||||||
|  | &tlmm { | ||||||
|  | 	i2c_1_pins: i2c_1_pins { | ||||||
|  | 		mux { | ||||||
|  | 			pins = "gpio42", "gpio43"; | ||||||
|  | 			function = "blsp2_i2c"; | ||||||
|  | 			drive-strength = <8>; | ||||||
|  | 			bias-pull-down; | ||||||
|  | 		}; | ||||||
|  | 	}; | ||||||
|  | 	 | ||||||
|  | 	i2c_2_pins: i2c_2_pins { | ||||||
|  |                 mux { | ||||||
|  |                         pins = "gpio55", "gpio56"; | ||||||
|  |                         function = "blsp4_i2c"; | ||||||
|  |                         drive-strength = <8>; | ||||||
|  |                         bias-pull-down; | ||||||
|  |                 }; | ||||||
|  |         }; | ||||||
|  | }; | ||||||
|  |  | ||||||
|  | &i2c_1 { | ||||||
|  | 	pinctrl-0 = <&i2c_1_pins>; | ||||||
|  | 	pinctrl-names = "default"; | ||||||
|  | 	status = "ok"; | ||||||
|  |  | ||||||
|  | 	lm75@48 { | ||||||
|  | 		compatible = "lm75"; | ||||||
|  | 		reg = <0x48>; | ||||||
|  | 		status = "okay"; | ||||||
|  | 	}; | ||||||
|  | }; | ||||||
|  |  | ||||||
|  | &i2c_2 { | ||||||
|  |         pinctrl-0 = <&i2c_2_pins>; | ||||||
|  |         pinctrl-names = "default"; | ||||||
|  |         status = "ok"; | ||||||
|  | }; | ||||||
|  |  | ||||||
|  | &sdhc_2 { | ||||||
|  | 	pinctrl-0 = <&sd_pins>; | ||||||
|  | 	pinctrl-names = "default"; | ||||||
|  | 	cd-gpios = <&tlmm 62 1>; | ||||||
|  | 	sd-ldo-gpios = <&tlmm 66 0>; | ||||||
|  | 	vqmmc-supply = <&ipq6018_l2_corner>; | ||||||
|  | 	status = "ok"; | ||||||
|  | }; | ||||||
|  |  | ||||||
|  | &soc { | ||||||
|  |         leds { | ||||||
|  |                 compatible = "gpio-leds"; | ||||||
|  |                 pinctrl-0 = <&leds_pins>; | ||||||
|  |                 pinctrl-names = "default"; | ||||||
|  |  | ||||||
|  |                 led@60 { | ||||||
|  |                         label = "blue:wifi5"; | ||||||
|  |                         gpios = <&tlmm 60 GPIO_ACTIVE_LOW>; | ||||||
|  |                         linux,default-trigger = "led_5g"; | ||||||
|  |                         default-state = "off"; | ||||||
|  |                 }; | ||||||
|  |                 led@61 { | ||||||
|  |                         label = "blue:wifi2"; | ||||||
|  |                         gpios = <&tlmm 61 GPIO_ACTIVE_LOW>; | ||||||
|  |                         linux,default-trigger = "led_2g"; | ||||||
|  |                         default-state = "off"; | ||||||
|  |                 }; | ||||||
|  |         }; | ||||||
|  | }; | ||||||
|  |  | ||||||
|  | &tlmm { | ||||||
|  | 	leds_pins: leds_pins { | ||||||
|  | 		led_5g { | ||||||
|  | 			pins = "gpio60"; | ||||||
|  | 			function = "gpio"; | ||||||
|  | 			drive-strength = <8>; | ||||||
|  | 			bias-pull-down; | ||||||
|  | 		}; | ||||||
|  | 		led_2g { | ||||||
|  | 			pins = "gpio61"; | ||||||
|  | 			function = "gpio"; | ||||||
|  | 			drive-strength = <8>; | ||||||
|  | 			bias-pull-down; | ||||||
|  | 		}; | ||||||
|  | 	}; | ||||||
|  | }; | ||||||
|  |  | ||||||
|  | /* TZAPP is enabled in default memory profile only */ | ||||||
|  | #if !defined(__IPQ_MEM_PROFILE_256_MB__) && !defined(__IPQ_MEM_PROFILE_512_MB__) | ||||||
|  | &qseecom { | ||||||
|  | 	mem-start = <0x49B00000>; | ||||||
|  | 	mem-size = <0x600000>; | ||||||
|  | 	status = "ok"; | ||||||
|  | }; | ||||||
|  | #endif | ||||||
| @@ -0,0 +1,155 @@ | |||||||
|  | /dts-v1/; | ||||||
|  | /* | ||||||
|  |  * 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. | ||||||
|  |  */ | ||||||
|  |  | ||||||
|  | #include "qcom-ipq6018-cp01-hfcl.dtsi" | ||||||
|  | #include "qcom-ipq6018-rpm-regulator.dtsi" | ||||||
|  | #include "qcom-ipq6018-cpr-regulator.dtsi" | ||||||
|  | #include "qcom-ipq6018-cp-cpu.dtsi" | ||||||
|  |  | ||||||
|  | / { | ||||||
|  | 	model = "HFCL ION4X_2"; | ||||||
|  | 	compatible = "hfcl,ion4x_2", "qcom,ipq6018-cp01", "qcom,ipq6018"; | ||||||
|  |  | ||||||
|  | 	/* | ||||||
|  | 	 * +=========+==============+========================+ | ||||||
|  | 	 * |        |              |                         | | ||||||
|  | 	 * | Region | Start Offset |          Size           | | ||||||
|  | 	 * |        |              |                         | | ||||||
|  | 	 * +--------+--------------+-------------------------+ | ||||||
|  | 	 * |        |              |                         | | ||||||
|  | 	 * |        |              |                         | | ||||||
|  | 	 * |        |              |                         | | ||||||
|  | 	 * |        |              |                         | | ||||||
|  | 	 * | Linux  |  0x41000000  |         139MB           | | ||||||
|  | 	 * |        |              |                         | | ||||||
|  | 	 * |        |              |                         | | ||||||
|  | 	 * |        |              |                         | | ||||||
|  | 	 * +--------+--------------+-------------------------+ | ||||||
|  | 	 * | TZ App |  0x49B00000  |           6MB           | | ||||||
|  | 	 * +--------+--------------+-------------------------+ | ||||||
|  | 	 * | ||||||
|  | 	 * From the available 145 MB for Linux in the first 256 MB, | ||||||
|  | 	 * we are reserving 6 MB for TZAPP. | ||||||
|  | 	 * | ||||||
|  | 	 * Refer arch/arm64/boot/dts/qcom/qcom-ipq6018-memory.dtsi | ||||||
|  | 	 * for memory layout. | ||||||
|  | 	 */ | ||||||
|  |  | ||||||
|  | /* TZAPP is enabled in default memory profile only */ | ||||||
|  | #if !defined(__IPQ_MEM_PROFILE_256_MB__) && !defined(__IPQ_MEM_PROFILE_512_MB__) | ||||||
|  | 	reserved-memory { | ||||||
|  | 		tzapp:tzapp@49B00000 {	/* TZAPPS */ | ||||||
|  | 			no-map; | ||||||
|  | 			reg = <0x0 0x49B00000 0x0 0x00600000>; | ||||||
|  | 		}; | ||||||
|  | 	}; | ||||||
|  | #endif | ||||||
|  | }; | ||||||
|  |  | ||||||
|  | &tlmm { | ||||||
|  | 	i2c_1_pins: i2c_1_pins { | ||||||
|  | 		mux { | ||||||
|  | 			pins = "gpio42", "gpio43"; | ||||||
|  | 			function = "blsp2_i2c"; | ||||||
|  | 			drive-strength = <8>; | ||||||
|  | 			bias-pull-down; | ||||||
|  | 		}; | ||||||
|  | 	}; | ||||||
|  | 	 | ||||||
|  | 	i2c_2_pins: i2c_2_pins { | ||||||
|  |                 mux { | ||||||
|  |                         pins = "gpio55", "gpio56"; | ||||||
|  |                         function = "blsp4_i2c"; | ||||||
|  |                         drive-strength = <8>; | ||||||
|  |                         bias-pull-down; | ||||||
|  |                 }; | ||||||
|  |         }; | ||||||
|  | }; | ||||||
|  |  | ||||||
|  | &i2c_1 { | ||||||
|  | 	pinctrl-0 = <&i2c_1_pins>; | ||||||
|  | 	pinctrl-names = "default"; | ||||||
|  | 	status = "ok"; | ||||||
|  |  | ||||||
|  | 	lm75@48 { | ||||||
|  | 		compatible = "lm75"; | ||||||
|  | 		reg = <0x48>; | ||||||
|  | 		status = "okay"; | ||||||
|  | 	}; | ||||||
|  | }; | ||||||
|  |  | ||||||
|  | &i2c_2 { | ||||||
|  |         pinctrl-0 = <&i2c_2_pins>; | ||||||
|  |         pinctrl-names = "default"; | ||||||
|  |         status = "ok"; | ||||||
|  | }; | ||||||
|  |  | ||||||
|  | &sdhc_2 { | ||||||
|  | 	pinctrl-0 = <&sd_pins>; | ||||||
|  | 	pinctrl-names = "default"; | ||||||
|  | 	cd-gpios = <&tlmm 62 1>; | ||||||
|  | 	sd-ldo-gpios = <&tlmm 66 0>; | ||||||
|  | 	vqmmc-supply = <&ipq6018_l2_corner>; | ||||||
|  | 	status = "ok"; | ||||||
|  | }; | ||||||
|  |  | ||||||
|  | &soc { | ||||||
|  |         leds { | ||||||
|  |                 compatible = "gpio-leds"; | ||||||
|  |                 pinctrl-0 = <&leds_pins>; | ||||||
|  |                 pinctrl-names = "default"; | ||||||
|  |  | ||||||
|  |                 led@60 { | ||||||
|  |                         label = "blue:wifi5"; | ||||||
|  |                         gpios = <&tlmm 60 GPIO_ACTIVE_LOW>; | ||||||
|  |                         linux,default-trigger = "led_5g"; | ||||||
|  |                         default-state = "off"; | ||||||
|  |                 }; | ||||||
|  |                 led@61 { | ||||||
|  |                         label = "blue:wifi2"; | ||||||
|  |                         gpios = <&tlmm 61 GPIO_ACTIVE_LOW>; | ||||||
|  |                         linux,default-trigger = "led_2g"; | ||||||
|  |                         default-state = "off"; | ||||||
|  |                 }; | ||||||
|  |         }; | ||||||
|  | }; | ||||||
|  |  | ||||||
|  | &tlmm { | ||||||
|  | 	leds_pins: leds_pins { | ||||||
|  | 		led_5g { | ||||||
|  | 			pins = "gpio60"; | ||||||
|  | 			function = "gpio"; | ||||||
|  | 			drive-strength = <8>; | ||||||
|  | 			bias-pull-down; | ||||||
|  | 		}; | ||||||
|  | 		led_2g { | ||||||
|  | 			pins = "gpio61"; | ||||||
|  | 			function = "gpio"; | ||||||
|  | 			drive-strength = <8>; | ||||||
|  | 			bias-pull-down; | ||||||
|  | 		}; | ||||||
|  | 	}; | ||||||
|  | }; | ||||||
|  |  | ||||||
|  | /* TZAPP is enabled in default memory profile only */ | ||||||
|  | #if !defined(__IPQ_MEM_PROFILE_256_MB__) && !defined(__IPQ_MEM_PROFILE_512_MB__) | ||||||
|  | &qseecom { | ||||||
|  | 	mem-start = <0x49B00000>; | ||||||
|  | 	mem-size = <0x600000>; | ||||||
|  | 	status = "ok"; | ||||||
|  | }; | ||||||
|  | #endif | ||||||
| @@ -0,0 +1,423 @@ | |||||||
|  | /dts-v1/; | ||||||
|  | /* | ||||||
|  |  * 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. | ||||||
|  |  */ | ||||||
|  |  | ||||||
|  | #include "qcom-ipq6018.dtsi" | ||||||
|  | #include "qcom-ipq6018-rpm-regulator.dtsi" | ||||||
|  | #include "qcom-ipq6018-cpr-regulator.dtsi" | ||||||
|  | #include "qcom-ipq6018-cp-cpu.dtsi" | ||||||
|  | #include <dt-bindings/input/input.h> | ||||||
|  | #include <dt-bindings/gpio/gpio.h> | ||||||
|  |  | ||||||
|  | / { | ||||||
|  | 	#address-cells = <0x2>; | ||||||
|  | 	#size-cells = <0x2>; | ||||||
|  | 	model = "Qualcomm Technologies, Inc. IPQ6018/AP-CP03-C1"; | ||||||
|  | 	compatible = "yuncore,fap650", "qcom,ipq6018-cp03", "qcom,ipq6018"; | ||||||
|  | 	interrupt-parent = <&intc>; | ||||||
|  | 	qcom,msm-id = <0x1A5 0x0>; | ||||||
|  |  | ||||||
|  | 	aliases { | ||||||
|  | 		/* | ||||||
|  | 		 * Aliases as required by u-boot | ||||||
|  | 		 * to patch MAC addresses | ||||||
|  | 		 */ | ||||||
|  | 		ethernet0 = "/soc/dp1"; | ||||||
|  | 		ethernet1 = "/soc/dp2"; | ||||||
|  | 		ethernet2 = "/soc/dp3"; | ||||||
|  | 		ethernet3 = "/soc/dp4"; | ||||||
|  | 		ethernet4 = "/soc/dp5"; | ||||||
|  |  | ||||||
|  | 		led-boot = &led_power; | ||||||
|  | 		led-failsafe = &led_power; | ||||||
|  | 		led-running = &led_power; | ||||||
|  | 		led-upgrade = &led_power; | ||||||
|  | 	}; | ||||||
|  |  | ||||||
|  | 	chosen { | ||||||
|  | 		bootargs = "console=ttyMSM0,115200,n8 rw init=/init"; | ||||||
|  | #ifdef __IPQ_MEM_PROFILE_256_MB__ | ||||||
|  | 		bootargs-append = " swiotlb=1"; | ||||||
|  | #else | ||||||
|  | 		bootargs-append = " swiotlb=1 coherent_pool=2M"; | ||||||
|  | #endif | ||||||
|  | 	}; | ||||||
|  |  | ||||||
|  | 	/* | ||||||
|  | 	 * +=========+==============+========================+ | ||||||
|  | 	 * |        |              |                         | | ||||||
|  | 	 * | Region | Start Offset |          Size           | | ||||||
|  | 	 * |        |              |                         | | ||||||
|  | 	 * +--------+--------------+-------------------------+ | ||||||
|  | 	 * |        |              |                         | | ||||||
|  | 	 * |        |              |                         | | ||||||
|  | 	 * |        |              |                         | | ||||||
|  | 	 * |        |              |                         | | ||||||
|  | 	 * | Linux  |  0x41000000  |         139MB           | | ||||||
|  | 	 * |        |              |                         | | ||||||
|  | 	 * |        |              |                         | | ||||||
|  | 	 * |        |              |                         | | ||||||
|  | 	 * +--------+--------------+-------------------------+ | ||||||
|  | 	 * | TZ App |  0x49B00000  |           6MB           | | ||||||
|  | 	 * +--------+--------------+-------------------------+ | ||||||
|  | 	 * | ||||||
|  | 	 * From the available 145 MB for Linux in the first 256 MB, | ||||||
|  | 	 * we are reserving 6 MB for TZAPP. | ||||||
|  | 	 * | ||||||
|  | 	 * Refer arch/arm64/boot/dts/qcom/qcom-ipq6018-memory.dtsi | ||||||
|  | 	 * for memory layout. | ||||||
|  | 	 */ | ||||||
|  |  | ||||||
|  | /* TZAPP is enabled only in default memory profile */ | ||||||
|  | #if !defined(__IPQ_MEM_PROFILE_256_MB__) && !defined(__IPQ_MEM_PROFILE_512_MB__) | ||||||
|  | 	reserved-memory { | ||||||
|  | 		tzapp:tzapp@49B00000 {	/* TZAPPS */ | ||||||
|  | 			no-map; | ||||||
|  | 			reg = <0x0 0x49B00000 0x0 0x00600000>; | ||||||
|  | 		}; | ||||||
|  | 	}; | ||||||
|  | #endif | ||||||
|  | }; | ||||||
|  |  | ||||||
|  | &tlmm { | ||||||
|  | 	uart_pins: uart_pins { | ||||||
|  | 		mux { | ||||||
|  | 			pins = "gpio44", "gpio45"; | ||||||
|  | 			function = "blsp2_uart"; | ||||||
|  | 			drive-strength = <8>; | ||||||
|  | 			bias-pull-down; | ||||||
|  | 		}; | ||||||
|  | 	}; | ||||||
|  |  | ||||||
|  | 	spi_0_pins: spi_0_pins { | ||||||
|  | 		mux { | ||||||
|  | 			pins = "gpio38", "gpio39", "gpio40", "gpio41"; | ||||||
|  | 			function = "blsp0_spi"; | ||||||
|  | 			drive-strength = <8>; | ||||||
|  | 			bias-pull-down; | ||||||
|  | 		}; | ||||||
|  | 	}; | ||||||
|  |  | ||||||
|  | 	qpic_pins: qpic_pins { | ||||||
|  | 		data_0 { | ||||||
|  | 			pins = "gpio15"; | ||||||
|  | 			function = "qpic_pad0"; | ||||||
|  | 			drive-strength = <8>; | ||||||
|  | 			bias-pull-down; | ||||||
|  | 		}; | ||||||
|  | 		data_1 { | ||||||
|  | 			pins = "gpio12"; | ||||||
|  | 			function = "qpic_pad1"; | ||||||
|  | 			drive-strength = <8>; | ||||||
|  | 			bias-pull-down; | ||||||
|  | 		}; | ||||||
|  | 		data_2 { | ||||||
|  | 			pins = "gpio13"; | ||||||
|  | 			function = "qpic_pad2"; | ||||||
|  | 			drive-strength = <8>; | ||||||
|  | 			bias-pull-down; | ||||||
|  | 		}; | ||||||
|  | 		data_3 { | ||||||
|  | 			pins = "gpio14"; | ||||||
|  | 			function = "qpic_pad3"; | ||||||
|  | 			drive-strength = <8>; | ||||||
|  | 			bias-pull-down; | ||||||
|  | 		}; | ||||||
|  | 		data_4 { | ||||||
|  | 			pins = "gpio5"; | ||||||
|  | 			function = "qpic_pad4"; | ||||||
|  | 			drive-strength = <8>; | ||||||
|  | 			bias-pull-down; | ||||||
|  | 		}; | ||||||
|  | 		data_5 { | ||||||
|  | 			pins = "gpio6"; | ||||||
|  | 			function = "qpic_pad5"; | ||||||
|  | 			drive-strength = <8>; | ||||||
|  | 			bias-pull-down; | ||||||
|  | 		}; | ||||||
|  | 		data_6 { | ||||||
|  | 			pins = "gpio7"; | ||||||
|  | 			function = "qpic_pad6"; | ||||||
|  | 			drive-strength = <8>; | ||||||
|  | 			bias-pull-down; | ||||||
|  | 		}; | ||||||
|  | 		data_7 { | ||||||
|  | 			pins = "gpio8"; | ||||||
|  | 			function = "qpic_pad7"; | ||||||
|  | 			drive-strength = <8>; | ||||||
|  | 			bias-pull-down; | ||||||
|  | 		}; | ||||||
|  | 		qpic_pad { | ||||||
|  | 			pins = "gpio1", "gpio3", "gpio4", | ||||||
|  | 			       "gpio10", "gpio11", "gpio17"; | ||||||
|  | 			function = "qpic_pad"; | ||||||
|  | 			drive-strength = <8>; | ||||||
|  | 			bias-pull-down; | ||||||
|  | 		}; | ||||||
|  | 	}; | ||||||
|  |  | ||||||
|  | 	button_pins: button_pins { | ||||||
|  | 		wps_button { | ||||||
|  | 			pins = "gpio19"; | ||||||
|  | 			function = "gpio"; | ||||||
|  | 			drive-strength = <8>; | ||||||
|  | 			bias-pull-down; | ||||||
|  | 		}; | ||||||
|  | 	}; | ||||||
|  |  | ||||||
|  | 	mdio_pins: mdio_pinmux { | ||||||
|  | 		mux_0 { | ||||||
|  | 			pins = "gpio64"; | ||||||
|  | 			function = "mdc"; | ||||||
|  | 			drive-strength = <8>; | ||||||
|  | 			bias-pull-up; | ||||||
|  | 		}; | ||||||
|  | 		mux_1 { | ||||||
|  | 			pins = "gpio65"; | ||||||
|  | 			function = "mdio"; | ||||||
|  | 			drive-strength = <8>; | ||||||
|  | 			bias-pull-up; | ||||||
|  | 		}; | ||||||
|  | 		mux_2 { | ||||||
|  | 			pins = "gpio75"; | ||||||
|  | 			function = "gpio"; | ||||||
|  | 			bias-pull-up; | ||||||
|  | 		}; | ||||||
|  | 	}; | ||||||
|  |  | ||||||
|  | 	leds_pins: leds_pins { | ||||||
|  | 		led_sys { | ||||||
|  | 			pins = "gpio32"; | ||||||
|  | 			function = "gpio"; | ||||||
|  | 			drive-strength = <8>; | ||||||
|  | 			bias-pull-down; | ||||||
|  | 		}; | ||||||
|  |  | ||||||
|  | 		led_5g { | ||||||
|  | 			pins = "gpio35"; | ||||||
|  | 			function = "gpio"; | ||||||
|  | 			drive-strength = <8>; | ||||||
|  | 			bias-pull-down; | ||||||
|  | 		}; | ||||||
|  |  | ||||||
|  | 		led_2g { | ||||||
|  | 			pins = "gpio37"; | ||||||
|  | 			function = "gpio"; | ||||||
|  | 			drive-strength = <8>; | ||||||
|  | 			bias-pull-down; | ||||||
|  | 		}; | ||||||
|  | 	}; | ||||||
|  | }; | ||||||
|  |  | ||||||
|  | &soc { | ||||||
|  | 	mdio@90000 { | ||||||
|  | 		pinctrl-0 = <&mdio_pins>; | ||||||
|  | 		pinctrl-names = "default"; | ||||||
|  | 		phy-reset-gpio = <&tlmm 75 0>; | ||||||
|  | 		status = "ok"; | ||||||
|  | 		phy0: ethernet-phy@0 { | ||||||
|  | 			reg = <0>; | ||||||
|  | 		}; | ||||||
|  | 		phy1: ethernet-phy@1 { | ||||||
|  | 			reg = <1>; | ||||||
|  | 		}; | ||||||
|  | 		phy2: ethernet-phy@2 { | ||||||
|  | 			reg = <2>; | ||||||
|  | 		}; | ||||||
|  | 		phy3: ethernet-phy@3 { | ||||||
|  | 			reg = <3>; | ||||||
|  | 		}; | ||||||
|  | 		phy4: ethernet-phy@4 { | ||||||
|  | 			reg = <4>; | ||||||
|  | 		}; | ||||||
|  | 	}; | ||||||
|  |  | ||||||
|  | 	ess-switch@3a000000 { | ||||||
|  | 		switch_cpu_bmp = <0x1>;  /* cpu port bitmap */ | ||||||
|  | 		switch_lan_bmp = <0x1e>; /* lan port bitmap */ | ||||||
|  | 		switch_wan_bmp = <0x20>; /* wan port bitmap */ | ||||||
|  | 		switch_inner_bmp = <0xc0>; /*inner port bitmap*/ | ||||||
|  | 		switch_mac_mode = <0x0>; /* mac mode for uniphy instance0*/ | ||||||
|  | 		switch_mac_mode1 = <0xff>; /* mac mode for uniphy instance1*/ | ||||||
|  | 		switch_mac_mode2 = <0xff>; /* mac mode for uniphy instance2*/ | ||||||
|  | 		qcom,port_phyinfo { | ||||||
|  | 			port@3 { | ||||||
|  | 				port_id = <3>; | ||||||
|  | 				phy_address = <4>; | ||||||
|  | 			}; | ||||||
|  | 			port@4 { | ||||||
|  | 				port_id = <4>; | ||||||
|  | 				phy_address = <3>; | ||||||
|  | 			}; | ||||||
|  | 		}; | ||||||
|  | 	}; | ||||||
|  |  | ||||||
|  | 	dp1 { | ||||||
|  | 		device_type = "network"; | ||||||
|  | 		compatible = "qcom,nss-dp"; | ||||||
|  | 		qcom,id = <1>; | ||||||
|  | 		reg = <0x3a001000 0x200>; | ||||||
|  | 		qcom,mactype = <0>; | ||||||
|  | 		local-mac-address = [000000000000]; | ||||||
|  | 		qcom,link-poll = <1>; | ||||||
|  | 		qcom,phy-mdio-addr = <0>; | ||||||
|  | 		phy-mode = "sgmii"; | ||||||
|  | 	}; | ||||||
|  |  | ||||||
|  | 	dp2 { | ||||||
|  | 		device_type = "network"; | ||||||
|  | 		compatible = "qcom,nss-dp"; | ||||||
|  | 		qcom,id = <2>; | ||||||
|  | 		reg = <0x3a001200 0x200>; | ||||||
|  | 		qcom,mactype = <0>; | ||||||
|  | 		local-mac-address = [000000000000]; | ||||||
|  | 		qcom,link-poll = <1>; | ||||||
|  | 		qcom,phy-mdio-addr = <1>; | ||||||
|  | 		phy-mode = "sgmii"; | ||||||
|  | 	}; | ||||||
|  |  | ||||||
|  | 	dp3 { | ||||||
|  | 		device_type = "network"; | ||||||
|  | 		compatible = "qcom,nss-dp"; | ||||||
|  | 		qcom,id = <3>; | ||||||
|  | 		reg = <0x3a001400 0x200>; | ||||||
|  | 		qcom,mactype = <0>; | ||||||
|  | 		local-mac-address = [000000000000]; | ||||||
|  | 		qcom,link-poll = <1>; | ||||||
|  | 		qcom,phy-mdio-addr = <2>; | ||||||
|  | 		phy-mode = "sgmii"; | ||||||
|  | 	}; | ||||||
|  |  | ||||||
|  | 	dp4 { | ||||||
|  | 		device_type = "network"; | ||||||
|  | 		compatible = "qcom,nss-dp"; | ||||||
|  | 		qcom,id = <4>; | ||||||
|  | 		reg = <0x3a001600 0x200>; | ||||||
|  | 		qcom,mactype = <0>; | ||||||
|  | 		local-mac-address = [000000000000]; | ||||||
|  | 		qcom,link-poll = <1>; | ||||||
|  | 		qcom,phy-mdio-addr = <3>; | ||||||
|  | 		phy-mode = "sgmii"; | ||||||
|  | 	}; | ||||||
|  |  | ||||||
|  | 	dp5 { | ||||||
|  | 		device_type = "network"; | ||||||
|  | 		compatible = "qcom,nss-dp"; | ||||||
|  | 		qcom,id = <5>; | ||||||
|  | 		reg = <0x3a001800 0x200>; | ||||||
|  | 		qcom,mactype = <0>; | ||||||
|  | 		local-mac-address = [000000000000]; | ||||||
|  | 		qcom,link-poll = <1>; | ||||||
|  | 		qcom,phy-mdio-addr = <4>; | ||||||
|  | 		phy-mode = "sgmii"; | ||||||
|  | 	}; | ||||||
|  |  | ||||||
|  | 	leds { | ||||||
|  | 		compatible = "gpio-leds"; | ||||||
|  | 		pinctrl-0 = <&leds_pins>; | ||||||
|  | 		pinctrl-names = "default"; | ||||||
|  |  | ||||||
|  | 		led_power: led@32 { | ||||||
|  | 			label = "green:power"; | ||||||
|  | 			gpios = <&tlmm 32 GPIO_ACTIVE_HIGH>; | ||||||
|  | 			default-state = "on"; | ||||||
|  | 		}; | ||||||
|  |  | ||||||
|  | 		led@35 { | ||||||
|  | 			label = "green:wifi5"; | ||||||
|  | 			gpios = <&tlmm 35 GPIO_ACTIVE_HIGH>; | ||||||
|  | 			default-state = "off"; | ||||||
|  | 		}; | ||||||
|  |  | ||||||
|  | 		led@37 { | ||||||
|  | 			label = "green:wifi2"; | ||||||
|  | 			gpios = <&tlmm 37 GPIO_ACTIVE_HIGH>; | ||||||
|  | 			default-state = "off"; | ||||||
|  | 		}; | ||||||
|  | 	}; | ||||||
|  |  | ||||||
|  | 	gpio_keys { | ||||||
|  | 		compatible = "gpio-keys"; | ||||||
|  | 		pinctrl-0 = <&button_pins>; | ||||||
|  | 		pinctrl-names = "default"; | ||||||
|  |  | ||||||
|  | 		wps { | ||||||
|  | 			label = "reset"; | ||||||
|  | 			linux,code = <KEY_RESTART>; | ||||||
|  | 			gpios = <&tlmm 19 GPIO_ACTIVE_LOW>; | ||||||
|  | 			linux,input-type = <1>; | ||||||
|  | 			debounce-interval = <60>; | ||||||
|  | 		}; | ||||||
|  | 	}; | ||||||
|  | }; | ||||||
|  |  | ||||||
|  | &blsp1_uart3 { | ||||||
|  | 	pinctrl-0 = <&uart_pins>; | ||||||
|  | 	pinctrl-names = "default"; | ||||||
|  | 	status = "ok"; | ||||||
|  | }; | ||||||
|  |  | ||||||
|  | &spi_0 { | ||||||
|  | 	pinctrl-0 = <&spi_0_pins>; | ||||||
|  | 	pinctrl-names = "default"; | ||||||
|  | 	cs-select = <0>; | ||||||
|  | 	status = "ok"; | ||||||
|  |  | ||||||
|  | 	m25p80@0 { | ||||||
|  | 		#address-cells = <1>; | ||||||
|  | 		#size-cells = <1>; | ||||||
|  | 		reg = <0>; | ||||||
|  | 		compatible = "n25q128a11"; | ||||||
|  | 		linux,modalias = "m25p80", "n25q128a11"; | ||||||
|  | 		spi-max-frequency = <50000000>; | ||||||
|  | 		use-default-sizes; | ||||||
|  | 	}; | ||||||
|  | }; | ||||||
|  |  | ||||||
|  | &qpic_bam { | ||||||
|  | 	status = "ok"; | ||||||
|  | }; | ||||||
|  |  | ||||||
|  | &nand { | ||||||
|  | 	pinctrl-0 = <&qpic_pins>; | ||||||
|  | 	pinctrl-names = "default"; | ||||||
|  | 	status = "ok"; | ||||||
|  | }; | ||||||
|  |  | ||||||
|  | &ssphy_0 { | ||||||
|  | 	status = "ok"; | ||||||
|  | }; | ||||||
|  |  | ||||||
|  | &qusb_phy_0 { | ||||||
|  | 	status = "ok"; | ||||||
|  | }; | ||||||
|  |  | ||||||
|  | &usb3 { | ||||||
|  | 	status = "ok"; | ||||||
|  | }; | ||||||
|  |  | ||||||
|  | &nss_crypto { | ||||||
|  | 	status = "ok"; | ||||||
|  | }; | ||||||
|  |  | ||||||
|  | /* TZAPP is enabled in default memory profile only */ | ||||||
|  | #if !defined(__IPQ_MEM_PROFILE_256_MB__) && !defined(__IPQ_MEM_PROFILE_512_MB__) | ||||||
|  | &qseecom { | ||||||
|  | 	mem-start = <0x49B00000>; | ||||||
|  | 	mem-size = <0x600000>; | ||||||
|  | 	status = "ok"; | ||||||
|  | }; | ||||||
|  | #endif | ||||||
| @@ -50,25 +50,43 @@ | |||||||
| 			bootargs-append = " swiotlb=1 coherent_pool=2M"; | 			bootargs-append = " swiotlb=1 coherent_pool=2M"; | ||||||
| 		#endif | 		#endif | ||||||
| 	}; | 	}; | ||||||
|  |  | ||||||
|  | 	gpio-export { | ||||||
|  | 		compatible = "gpio-export"; | ||||||
|  | 		#size-cells = <0>; | ||||||
|  |  | ||||||
|  | 		mcu-enable { | ||||||
|  | 			gpio-export,name = "mcu-enable"; | ||||||
|  | 			gpio-export,output = <1>; | ||||||
|  | 			gpios = <&tlmm 54 GPIO_ACTIVE_HIGH>; | ||||||
|  | 		}; | ||||||
|  |  | ||||||
|  | 		usb-enable { | ||||||
|  | 			gpio-export,name = "usb-enable"; | ||||||
|  | 			gpio-export,output = <1>; | ||||||
|  | 			gpios = <&tlmm 55 GPIO_ACTIVE_HIGH>; | ||||||
|  | 		}; | ||||||
|  | 	}; | ||||||
| }; | }; | ||||||
|  |  | ||||||
| &tlmm { | &tlmm { | ||||||
| 	pinctrl-0 = <&btcoex_pins>; | 	pinctrl-0 = <&nrf52840_reset &usb_reset>; | ||||||
| 	pinctrl-names = "default"; | 	pinctrl-names = "default"; | ||||||
|  |  | ||||||
| 	btcoex_pins: btcoex_pins { | 	nrf52840_reset: nrf52840_reset_pins { | ||||||
| 		mux_0 { | 		pins = "gpio54"; | ||||||
| 			pins = "gpio64"; | 		function = "gpio"; | ||||||
| 			function = "pta1_1"; | 		drive-strength = <8>; | ||||||
| 			drive-strength = <6>; | 		bias-disable; | ||||||
| 			bias-pull-down; | 		output-high; | ||||||
| 		}; | 	}; | ||||||
| 		mux_1 { |  | ||||||
| 			pins = "gpio65"; | 	usb_reset: usb_reset_pins { | ||||||
| 			function = "pta1_2"; | 		pins = "gpio55"; | ||||||
| 			drive-strength = <6>; | 		function = "gpio"; | ||||||
| 			bias-pull-down; | 		drive-strength = <8>; | ||||||
| 		}; | 		bias-disable; | ||||||
|  | 		output-high; | ||||||
| 	}; | 	}; | ||||||
|  |  | ||||||
| 	mdio_pins: mdio_pinmux { | 	mdio_pins: mdio_pinmux { | ||||||
| @@ -172,17 +190,7 @@ | |||||||
| 		}; | 		}; | ||||||
| 	}; | 	}; | ||||||
|  |  | ||||||
| 	hsuart_pins: hsuart_pins { |  | ||||||
| 		mux { |  | ||||||
| 			pins = "gpio49"; |  | ||||||
| 			function = "blsp2_uart"; |  | ||||||
| 			drive-strength = <8>; |  | ||||||
| 			bias-disable; |  | ||||||
| 		}; |  | ||||||
| 	}; |  | ||||||
|  |  | ||||||
| 	button_pins: button_pins { | 	button_pins: button_pins { | ||||||
|  |  | ||||||
| 		reset_button { | 		reset_button { | ||||||
| 			pins = "gpio66"; | 			pins = "gpio66"; | ||||||
| 			function = "gpio"; | 			function = "gpio"; | ||||||
| @@ -220,31 +228,6 @@ | |||||||
| 			bias-pull-down; | 			bias-pull-down; | ||||||
| 		}; | 		}; | ||||||
| 	}; | 	}; | ||||||
|  |  | ||||||
| 	usb_mux_sel_pins: usb_mux_pins { |  | ||||||
| 		mux { |  | ||||||
| 			pins = "gpio27"; |  | ||||||
| 			function = "gpio"; |  | ||||||
| 			drive-strength = <8>; |  | ||||||
| 			bias-pull-down; |  | ||||||
| 		}; |  | ||||||
| 	}; |  | ||||||
|  |  | ||||||
| 	pcie0_pins: pcie_pins { |  | ||||||
| 		pcie0_rst { |  | ||||||
| 			pins = "gpio58"; |  | ||||||
| 			function = "pcie0_rst"; |  | ||||||
| 			drive-strength = <8>; |  | ||||||
| 			bias-pull-down; |  | ||||||
| 		}; |  | ||||||
| 		pcie0_wake { |  | ||||||
| 			pins = "gpio59"; |  | ||||||
| 			function = "pcie0_wake"; |  | ||||||
| 			drive-strength = <8>; |  | ||||||
| 			bias-pull-down; |  | ||||||
| 		}; |  | ||||||
| 	}; |  | ||||||
|  |  | ||||||
| }; | }; | ||||||
|  |  | ||||||
| &soc { | &soc { | ||||||
| @@ -733,12 +716,6 @@ | |||||||
| 	}; | 	}; | ||||||
| }; | }; | ||||||
|  |  | ||||||
| &serial_blsp2 { |  | ||||||
| 	pinctrl-0 = <&hsuart_pins>; |  | ||||||
| 	pinctrl-names = "default"; |  | ||||||
| 	status = "ok"; |  | ||||||
| }; |  | ||||||
|  |  | ||||||
| &nss0 { | &nss0 { | ||||||
| 	qcom,low-frequency = <187200000>; | 	qcom,low-frequency = <187200000>; | ||||||
| 	qcom,mid-frequency = <748800000>; | 	qcom,mid-frequency = <748800000>; | ||||||
| @@ -812,7 +789,7 @@ | |||||||
| }; | }; | ||||||
|  |  | ||||||
| &pcie0 { | &pcie0 { | ||||||
| 	status = "ok"; | 	status = "disabled"; | ||||||
| }; | }; | ||||||
|  |  | ||||||
| &pcie1 { | &pcie1 { | ||||||
|   | |||||||
| @@ -27,6 +27,15 @@ define Device/liteon_wpx8324 | |||||||
| endef | endef | ||||||
| TARGET_DEVICES += liteon_wpx8324 | TARGET_DEVICES += liteon_wpx8324 | ||||||
|  |  | ||||||
|  | define Device/muxi_ap3220l | ||||||
|  |   DEVICE_TITLE := MUXI AP3220L | ||||||
|  |   DEVICE_DTS := qcom-ipq5018-muxi-ap3220l | ||||||
|  |   SUPPORTED_DEVICES := muxi,ap3220l | ||||||
|  |   DEVICE_PACKAGES := ath11k-wifi-muxi-ap3220l ath11k-firmware-ipq50xx-spruce ath11k-firmware-qcn6122 | ||||||
|  |   DEVICE_DTS_CONFIG := config@mp03.5-c1 | ||||||
|  | endef | ||||||
|  | TARGET_DEVICES += muxi_ap3220l | ||||||
|  |  | ||||||
| define Device/motorola_q14 | define Device/motorola_q14 | ||||||
|   DEVICE_TITLE := Motorola Q14 |   DEVICE_TITLE := Motorola Q14 | ||||||
|   DEVICE_DTS := qcom-ipq5018-q14 |   DEVICE_DTS := qcom-ipq5018-q14 | ||||||
|   | |||||||
| @@ -20,6 +20,24 @@ define Device/hfcl_ion4xe | |||||||
| endef | endef | ||||||
| TARGET_DEVICES += hfcl_ion4xe | TARGET_DEVICES += hfcl_ion4xe | ||||||
|  |  | ||||||
|  | define Device/hfcl_ion4x | ||||||
|  |   DEVICE_TITLE := HFCL ION4X | ||||||
|  |   DEVICE_DTS := qcom-ipq6018-hfcl-ion4x | ||||||
|  |   DEVICE_DTS_CONFIG := config@cp01-c1 | ||||||
|  |   SUPPORTED_DEVICES := hfcl,ion4x | ||||||
|  |   DEVICE_PACKAGES := ath11k-wifi-qcom-ipq6018 uboot-envtools | ||||||
|  | endef | ||||||
|  | TARGET_DEVICES += hfcl_ion4x | ||||||
|  |  | ||||||
|  | define Device/hfcl_ion4x_2 | ||||||
|  |   DEVICE_TITLE := HFCL ION4X_2 | ||||||
|  |   DEVICE_DTS := qcom-ipq6018-hfcl-ion4x_2 | ||||||
|  |   DEVICE_DTS_CONFIG := config@cp01-c1 | ||||||
|  |   SUPPORTED_DEVICES := hfcl,ion4x_2 | ||||||
|  |   DEVICE_PACKAGES := ath11k-wifi-qcom-ipq6018 uboot-envtools | ||||||
|  | endef | ||||||
|  | TARGET_DEVICES += hfcl_ion4x_2 | ||||||
|  |  | ||||||
| define Device/hfcl_ion4xi | define Device/hfcl_ion4xi | ||||||
|   DEVICE_TITLE := HFCL ION4Xi |   DEVICE_TITLE := HFCL ION4Xi | ||||||
|   DEVICE_DTS := qcom-ipq6018-hfcl-ion4xi |   DEVICE_DTS := qcom-ipq6018-hfcl-ion4xi | ||||||
| @@ -167,3 +185,13 @@ define Device/meshpp_s618_cp01 | |||||||
|   DEVICE_PACKAGES := ath11k-wifi-meshpp-s618 -kmod-usb-dwc3-of-simple kmod-usb-dwc3-qcom kmod-usb3 |   DEVICE_PACKAGES := ath11k-wifi-meshpp-s618 -kmod-usb-dwc3-of-simple kmod-usb-dwc3-qcom kmod-usb3 | ||||||
| endef | endef | ||||||
| TARGET_DEVICES += meshpp_s618_cp01 | TARGET_DEVICES += meshpp_s618_cp01 | ||||||
|  |  | ||||||
|  | define Device/yuncore_fap650 | ||||||
|  |   DEVICE_TITLE := YunCore FAP 650 | ||||||
|  |   DEVICE_DTS := qcom-ipq6018-yuncore-fap650 | ||||||
|  |   SUPPORTED_DEVICES := yuncore,fap650 | ||||||
|  |   DEVICE_DTS_CONFIG := config@cp03-c1 | ||||||
|  |   DEVICE_PACKAGES := ath11k-wifi-yuncore-fap650 | ||||||
|  | endef | ||||||
|  | TARGET_DEVICES += yuncore_fap650 | ||||||
|  |  | ||||||
|   | |||||||
| @@ -0,0 +1,162 @@ | |||||||
|  | From cc809a441d8f2924f785eb863dfa6aef47a25b0b Mon Sep 17 00:00:00 2001 | ||||||
|  | From: John Crispin <blogic@openwrt.org> | ||||||
|  | Date: Tue, 12 Aug 2014 20:49:27 +0200 | ||||||
|  | Subject: [PATCH 30/36] GPIO: add named gpio exports | ||||||
|  |  | ||||||
|  | Signed-off-by: John Crispin <blogic@openwrt.org> | ||||||
|  | --- a/drivers/gpio/gpiolib-of.c | ||||||
|  | +++ b/drivers/gpio/gpiolib-of.c | ||||||
|  | @@ -23,6 +23,8 @@ | ||||||
|  |  #include <linux/pinctrl/pinctrl.h> | ||||||
|  |  #include <linux/slab.h> | ||||||
|  |  #include <linux/gpio/machine.h> | ||||||
|  | +#include <linux/init.h> | ||||||
|  | +#include <linux/platform_device.h> | ||||||
|  |   | ||||||
|  |  #include "gpiolib.h" | ||||||
|  |   | ||||||
|  | @@ -450,3 +452,72 @@ void of_gpiochip_remove(struct gpio_chip | ||||||
|  |  	gpiochip_remove_pin_ranges(chip); | ||||||
|  |  	of_node_put(chip->of_node); | ||||||
|  |  } | ||||||
|  | + | ||||||
|  | +#ifdef CONFIG_GPIO_SYSFS | ||||||
|  | + | ||||||
|  | +static struct of_device_id gpio_export_ids[] = { | ||||||
|  | +	{ .compatible = "gpio-export" }, | ||||||
|  | +	{ /* sentinel */ } | ||||||
|  | +}; | ||||||
|  | + | ||||||
|  | +static int of_gpio_export_probe(struct platform_device *pdev) | ||||||
|  | +{ | ||||||
|  | +	struct device_node *np = pdev->dev.of_node; | ||||||
|  | +	struct device_node *cnp; | ||||||
|  | +	u32 val; | ||||||
|  | +	int nb = 0; | ||||||
|  | + | ||||||
|  | +	for_each_child_of_node(np, cnp) { | ||||||
|  | +		const char *name = NULL; | ||||||
|  | +		int gpio; | ||||||
|  | +		bool dmc; | ||||||
|  | +		int max_gpio = 1; | ||||||
|  | +		int i; | ||||||
|  | + | ||||||
|  | +		of_property_read_string(cnp, "gpio-export,name", &name); | ||||||
|  | + | ||||||
|  | +		if (!name) | ||||||
|  | +			max_gpio = of_gpio_count(cnp); | ||||||
|  | + | ||||||
|  | +		for (i = 0; i < max_gpio; i++) { | ||||||
|  | +			unsigned flags = 0; | ||||||
|  | +			enum of_gpio_flags of_flags; | ||||||
|  | + | ||||||
|  | +			gpio = of_get_gpio_flags(cnp, i, &of_flags); | ||||||
|  | +			if (!gpio_is_valid(gpio)) | ||||||
|  | +				return gpio; | ||||||
|  | + | ||||||
|  | +			if (of_flags == OF_GPIO_ACTIVE_LOW) | ||||||
|  | +				flags |= GPIOF_ACTIVE_LOW; | ||||||
|  | + | ||||||
|  | +			if (!of_property_read_u32(cnp, "gpio-export,output", &val)) | ||||||
|  | +				flags |= val ? GPIOF_OUT_INIT_HIGH : GPIOF_OUT_INIT_LOW; | ||||||
|  | +			else | ||||||
|  | +				flags |= GPIOF_IN; | ||||||
|  | + | ||||||
|  | +			if (devm_gpio_request_one(&pdev->dev, gpio, flags, name ? name : of_node_full_name(np))) | ||||||
|  | +				continue; | ||||||
|  | + | ||||||
|  | +			dmc = of_property_read_bool(cnp, "gpio-export,direction_may_change"); | ||||||
|  | +			gpio_export_with_name(gpio, dmc, name); | ||||||
|  | +			nb++; | ||||||
|  | +		} | ||||||
|  | +	} | ||||||
|  | + | ||||||
|  | +	dev_info(&pdev->dev, "%d gpio(s) exported\n", nb); | ||||||
|  | + | ||||||
|  | +	return 0; | ||||||
|  | +} | ||||||
|  | + | ||||||
|  | +static struct platform_driver gpio_export_driver = { | ||||||
|  | +	.driver		= { | ||||||
|  | +		.name		= "gpio-export", | ||||||
|  | +		.owner	= THIS_MODULE, | ||||||
|  | +		.of_match_table	= of_match_ptr(gpio_export_ids), | ||||||
|  | +	}, | ||||||
|  | +	.probe		= of_gpio_export_probe, | ||||||
|  | +}; | ||||||
|  | + | ||||||
|  | +module_platform_driver(gpio_export_driver); | ||||||
|  | + | ||||||
|  | +#endif | ||||||
|  | --- a/include/asm-generic/gpio.h | ||||||
|  | +++ b/include/asm-generic/gpio.h | ||||||
|  | @@ -122,6 +122,12 @@ static inline int gpio_export(unsigned g | ||||||
|  |  	return gpiod_export(gpio_to_desc(gpio), direction_may_change); | ||||||
|  |  } | ||||||
|  |   | ||||||
|  | +int __gpiod_export(struct gpio_desc *desc, bool direction_may_change, const char *name); | ||||||
|  | +static inline int gpio_export_with_name(unsigned gpio, bool direction_may_change, const char *name) | ||||||
|  | +{ | ||||||
|  | +	return __gpiod_export(gpio_to_desc(gpio), direction_may_change, name); | ||||||
|  | +} | ||||||
|  | + | ||||||
|  |  static inline int gpio_export_link(struct device *dev, const char *name, | ||||||
|  |  				   unsigned gpio) | ||||||
|  |  { | ||||||
|  | --- a/include/linux/gpio/consumer.h | ||||||
|  | +++ b/include/linux/gpio/consumer.h | ||||||
|  | @@ -427,6 +427,7 @@ static inline struct gpio_desc *devm_get | ||||||
|  |   | ||||||
|  |  #if IS_ENABLED(CONFIG_GPIOLIB) && IS_ENABLED(CONFIG_GPIO_SYSFS) | ||||||
|  |   | ||||||
|  | +int _gpiod_export(struct gpio_desc *desc, bool direction_may_change, const char *name); | ||||||
|  |  int gpiod_export(struct gpio_desc *desc, bool direction_may_change); | ||||||
|  |  int gpiod_export_link(struct device *dev, const char *name, | ||||||
|  |  		      struct gpio_desc *desc); | ||||||
|  | @@ -434,6 +435,13 @@ void gpiod_unexport(struct gpio_desc *de | ||||||
|  |   | ||||||
|  |  #else  /* CONFIG_GPIOLIB && CONFIG_GPIO_SYSFS */ | ||||||
|  |   | ||||||
|  | +static inline int _gpiod_export(struct gpio_desc *desc, | ||||||
|  | +			       bool direction_may_change, | ||||||
|  | +			       const char *name) | ||||||
|  | +{ | ||||||
|  | +	return -ENOSYS; | ||||||
|  | +} | ||||||
|  | + | ||||||
|  |  static inline int gpiod_export(struct gpio_desc *desc, | ||||||
|  |  			       bool direction_may_change) | ||||||
|  |  { | ||||||
|  | --- a/drivers/gpio/gpiolib-sysfs.c | ||||||
|  | +++ b/drivers/gpio/gpiolib-sysfs.c | ||||||
|  | @@ -544,7 +544,7 @@ static struct class gpio_class = { | ||||||
|  |   * | ||||||
|  |   * Returns zero on success, else an error. | ||||||
|  |   */ | ||||||
|  | -int gpiod_export(struct gpio_desc *desc, bool direction_may_change) | ||||||
|  | +int __gpiod_export(struct gpio_desc *desc, bool direction_may_change, const char *name) | ||||||
|  |  { | ||||||
|  |  	struct gpio_chip	*chip; | ||||||
|  |  	struct gpiod_data	*data; | ||||||
|  | @@ -604,6 +604,8 @@ int gpiod_export(struct gpio_desc *desc, | ||||||
|  |  	offset = gpio_chip_hwgpio(desc); | ||||||
|  |  	if (chip->names && chip->names[offset]) | ||||||
|  |  		ioname = chip->names[offset]; | ||||||
|  | +	if (name) | ||||||
|  | +		ioname = name; | ||||||
|  |   | ||||||
|  |  	dev = device_create_with_groups(&gpio_class, chip->dev, | ||||||
|  |  					MKDEV(0, 0), data, gpio_groups, | ||||||
|  | @@ -625,6 +627,12 @@ err_unlock: | ||||||
|  |  	gpiod_dbg(desc, "%s: status %d\n", __func__, status); | ||||||
|  |  	return status; | ||||||
|  |  } | ||||||
|  | +EXPORT_SYMBOL_GPL(__gpiod_export); | ||||||
|  | + | ||||||
|  | +int gpiod_export(struct gpio_desc *desc, bool direction_may_change) | ||||||
|  | +{ | ||||||
|  | +	return __gpiod_export(desc, direction_may_change, NULL); | ||||||
|  | +} | ||||||
|  |  EXPORT_SYMBOL_GPL(gpiod_export); | ||||||
|  |   | ||||||
|  |  static int match_export(struct device *dev, const void *desc) | ||||||
| @@ -10,6 +10,7 @@ copy_certificates() { | |||||||
| 	chown root.network /etc/ucentral/*.pem | 	chown root.network /etc/ucentral/*.pem | ||||||
| 	chmod 0440 root.network /etc/ucentral/*.pem | 	chmod 0440 root.network /etc/ucentral/*.pem | ||||||
| 	chmod 0400 /etc/ucentral/dev-id | 	chmod 0400 /etc/ucentral/dev-id | ||||||
|  | 	[ -f /certificates/restrictions.json ] && cp /certificates/restrictions.json /etc/ucentral/ | ||||||
| 	exit 0 | 	exit 0 | ||||||
| } | } | ||||||
|  |  | ||||||
|   | |||||||
| @@ -20,7 +20,6 @@ var callReboot = rpc.declare({ | |||||||
| 	expect: { result: 0 } | 	expect: { result: 0 } | ||||||
| }); | }); | ||||||
|  |  | ||||||
|  |  | ||||||
| var mapdata = { actions: {}, config: {} }; | var mapdata = { actions: {}, config: {} }; | ||||||
|  |  | ||||||
| return view.extend({ | return view.extend({ | ||||||
| @@ -45,6 +44,26 @@ return view.extend({ | |||||||
| 		ui.awaitReconnect('192.168.1.1', 'openwrt.lan'); | 		ui.awaitReconnect('192.168.1.1', 'openwrt.lan'); | ||||||
| 	}, | 	}, | ||||||
|  |  | ||||||
|  | 	handleDiagnostics: function(ev) { | ||||||
|  | 		return fs.exec('/sbin/diagnostic-bundle').then(function(result) { | ||||||
|  | 			var form = E('form', { | ||||||
|  | 				method: 'post', | ||||||
|  | 				action: L.env.cgi_base + '/cgi-download', | ||||||
|  | 				enctype: 'application/x-www-form-urlencoded' | ||||||
|  | 			}, [ | ||||||
|  | 				E('input', { 'type': 'hidden', 'name': 'sessionid', 'value': L.env.sessionid }), | ||||||
|  | 				E('input', { 'type': 'hidden', 'name': 'path',      'value': '/tmp/bundle.maverick.tar.gz' }), | ||||||
|  | 				E('input', { 'type': 'hidden', 'name': 'filename',  'value': 'bundle.maverick.tar.gz' }), | ||||||
|  | 				E('input', { 'type': 'hidden', 'name': 'mimetype',  'value': 'application/gzip' }) | ||||||
|  | 			]); | ||||||
|  |  | ||||||
|  | 			document.body.appendChild(form); | ||||||
|  |  | ||||||
|  | 			form.submit(); | ||||||
|  | 			form.parentNode.removeChild(form); | ||||||
|  | 		}); | ||||||
|  | 	}, | ||||||
|  |  | ||||||
| 	handleSysupgrade: function(ev) { | 	handleSysupgrade: function(ev) { | ||||||
| 		return ui.uploadFile('/tmp/firmware.bin', ev.target.firstChild) | 		return ui.uploadFile('/tmp/firmware.bin', ev.target.firstChild) | ||||||
| 			.then(L.bind(function(btn, reply) { | 			.then(L.bind(function(btn, reply) { | ||||||
| @@ -171,6 +190,16 @@ return view.extend({ | |||||||
| 		o.inputtitle = _('Flash image…'); | 		o.inputtitle = _('Flash image…'); | ||||||
| 		o.onclick = L.bind(this.handleSysupgrade, this); | 		o.onclick = L.bind(this.handleSysupgrade, this); | ||||||
|  |  | ||||||
|  | 		o = s.option(form.SectionValue, 'actions', form.NamedSection, 'actions', 'actions', _('Diagnostic bundle'), | ||||||
|  | 			_('Download the default diagnostic bundle from the AP.')); | ||||||
|  |  | ||||||
|  | 		ss = o.subsection; | ||||||
|  |  | ||||||
|  | 		o = ss.option(form.Button, 'Diagnostic'); | ||||||
|  | 		o.inputstyle = 'action important'; | ||||||
|  | 		o.inputtitle = _('Download Diagnostics'); | ||||||
|  | 		o.onclick = L.bind(this.handleDiagnostics, this); | ||||||
|  |  | ||||||
|  |  | ||||||
| 		return m.render(); | 		return m.render(); | ||||||
| 	}, | 	}, | ||||||
|   | |||||||
							
								
								
									
										8
									
								
								feeds/tip/luci/luci-mod-ucentral/root/sbin/diagnostic-bundle
									
									
									
									
									
										Executable file
									
								
							
							
						
						
									
										8
									
								
								feeds/tip/luci/luci-mod-ucentral/root/sbin/diagnostic-bundle
									
									
									
									
									
										Executable file
									
								
							| @@ -0,0 +1,8 @@ | |||||||
|  | #!/usr/bin/ucode | ||||||
|  | push(REQUIRE_SEARCH_PATH, '/usr/share/ucentral/*.uc'); | ||||||
|  | let bundle = require('bundle'); | ||||||
|  |  | ||||||
|  | bundle.init('maverick'); | ||||||
|  | include('/usr/share/ucentral/diagnostic.uc', { bundle }); | ||||||
|  | bundle.complete(); | ||||||
|  | system('chmod +r /tmp/bundle.maverick.tar.gz'); | ||||||
| @@ -2,10 +2,12 @@ | |||||||
| 	"luci-mod-ucentral": { | 	"luci-mod-ucentral": { | ||||||
| 		"description": "Grant access to ucentral configuration", | 		"description": "Grant access to ucentral configuration", | ||||||
| 		"read": { | 		"read": { | ||||||
|  | 			"cgi-io": [ "download" ], | ||||||
| 			"file": { | 			"file": { | ||||||
| 				"/etc/ucentral/profile.json": [ "read" ], | 				"/etc/ucentral/profile.json": [ "read" ], | ||||||
| 				"/proc/mounts": [ "read" ], | 				"/proc/mounts": [ "read" ], | ||||||
| 				"/proc/mtd": [ "read" ] | 				"/proc/mtd": [ "read" ], | ||||||
|  | 				"/tmp/bundle.maverick.tar.gz": [ "read" ] | ||||||
| 			}, | 			}, | ||||||
| 			"ubus": { | 			"ubus": { | ||||||
| 				"file": [ "read" ], | 				"file": [ "read" ], | ||||||
| @@ -17,6 +19,7 @@ | |||||||
| 			"file": { | 			"file": { | ||||||
| 				"/etc/ucentral/profile.json": [ "write" ], | 				"/etc/ucentral/profile.json": [ "write" ], | ||||||
| 				"/sbin/certupdate": [ "exec" ], | 				"/sbin/certupdate": [ "exec" ], | ||||||
|  | 				"/sbin/diagnostic-bundle": [ "exec" ], | ||||||
| 				"/sbin/firstboot -r -y": [ "exec" ], | 				"/sbin/firstboot -r -y": [ "exec" ], | ||||||
| 				"/sbin/profileupdate": [ "exec" ], | 				"/sbin/profileupdate": [ "exec" ], | ||||||
| 				"/sbin/sysupgrade -n /tmp/firmware.bin": [ "exec" ], | 				"/sbin/sysupgrade -n /tmp/firmware.bin": [ "exec" ], | ||||||
|   | |||||||
| @@ -52,6 +52,6 @@ start_service() { | |||||||
| } | } | ||||||
|  |  | ||||||
| service_started() { | service_started() { | ||||||
| 	ubus -t 10 wait_for atfpolicy | 	ubus -t 2 wait_for atfpolicy | ||||||
| 	[ $? = 0 ] && reload_service | 	[ $? = 0 ] && reload_service | ||||||
| } | } | ||||||
|   | |||||||
| @@ -152,13 +152,13 @@ radius_forward_gw(char *buf, enum socket_type type) | |||||||
| } | } | ||||||
|  |  | ||||||
| static int | static int | ||||||
| radius_parse(char *buf, int len, int port, enum socket_type type, int tx) | radius_parse(char *buf, unsigned int len, int port, enum socket_type type, int tx) | ||||||
| { | { | ||||||
| 	struct radius_header *hdr = (struct radius_header *) buf; | 	struct radius_header *hdr = (struct radius_header *) buf; | ||||||
| 	struct radius_tlv *proxy_state = NULL; | 	struct radius_tlv *proxy_state = NULL; | ||||||
| 	char proxy_state_str[256] = {}; | 	char proxy_state_str[256] = {}; | ||||||
| 	void *avp = hdr->avp; | 	void *avp = hdr->avp; | ||||||
| 	int len_orig = ntohs(hdr->len); | 	unsigned int len_orig = ntohs(hdr->len); | ||||||
| 	uint8_t localhost[] = { 0x7f, 0, 0, 1 }; | 	uint8_t localhost[] = { 0x7f, 0, 0, 1 }; | ||||||
|  |  | ||||||
| 	if (len_orig != len) { | 	if (len_orig != len) { | ||||||
| @@ -170,10 +170,10 @@ radius_parse(char *buf, int len, int port, enum socket_type type, int tx) | |||||||
|  |  | ||||||
| 	len -= sizeof(*hdr); | 	len -= sizeof(*hdr); | ||||||
|  |  | ||||||
| 	while (len > 0) { | 	while (len >= sizeof(struct radius_tlv)) { | ||||||
| 		struct radius_tlv *tlv = (struct radius_tlv *)avp; | 		struct radius_tlv *tlv = (struct radius_tlv *)avp; | ||||||
|  |  | ||||||
| 		if (len < tlv->len) { | 		if (len < tlv->len || tlv->len < sizeof(*tlv)) { | ||||||
| 			ULOG_ERR("invalid TLV length\n"); | 			ULOG_ERR("invalid TLV length\n"); | ||||||
| 			return -1; | 			return -1; | ||||||
| 		} | 		} | ||||||
| @@ -312,7 +312,7 @@ sock_recv(struct uloop_fd *u, unsigned int events) | |||||||
|  |  | ||||||
| 		inet_ntop(AF_INET, &sin.sin_addr, addr_str, sizeof(addr_str)); | 		inet_ntop(AF_INET, &sin.sin_addr, addr_str, sizeof(addr_str)); | ||||||
| 		printf("RX: src:%s:%d, len=%d\n", addr_str, sin.sin_port, len); | 		printf("RX: src:%s:%d, len=%d\n", addr_str, sin.sin_port, len); | ||||||
| 		radius_parse(buf, len, sin.sin_port, sock->type, 1); | 		radius_parse(buf, (unsigned int)len, sin.sin_port, sock->type, 1); | ||||||
| 	} while (1); | 	} while (1); | ||||||
| } | } | ||||||
|  |  | ||||||
|   | |||||||
| @@ -3,11 +3,15 @@ | |||||||
| [ "${INTERFACE:0:4}" == "wlan" ] || exit 0 | [ "${INTERFACE:0:4}" == "wlan" ] || exit 0 | ||||||
|  |  | ||||||
| [ "$ACTION" == remove ] && { | [ "$ACTION" == remove ] && { | ||||||
| 	[ -f /tmp/run/hostapd-cli-$INTERFACE.pid ] && kill "$(cat /tmp/run/hostapd-cli-$INTERFACE.pid)" | 	[ -f /tmp/run/hostapd-cli-$INTERFACE.pid ] || return | ||||||
|  | 	kill "$(cat /tmp/run/hostapd-cli-$INTERFACE.pid)" | ||||||
|  | 	rm /tmp/run/hostapd-cli-$INTERFACE.pid | ||||||
| 	exit 0 | 	exit 0 | ||||||
| } | } | ||||||
|  |  | ||||||
| [ "$ACTION" == add ] && { | [ "$ACTION" == add ] && { | ||||||
|  | 	[ -f /tmp/run/hostapd-cli-$INTERFACE.pid ] && return | ||||||
|  | 	touch /tmp/run/hostapd-cli-$INTERFACE.pid | ||||||
| 	/usr/libexec/ratelimit-wait.sh $INTERFACE & | 	/usr/libexec/ratelimit-wait.sh $INTERFACE & | ||||||
| 	exit 0 | 	exit 0 | ||||||
| } | } | ||||||
|   | |||||||
| @@ -3,7 +3,7 @@ | |||||||
| case $2 in | case $2 in | ||||||
| AP-STA-CONNECTED) | AP-STA-CONNECTED) | ||||||
| 	[ $4 = 0 -o $5 = 0 ] && { | 	[ $4 = 0 -o $5 = 0 ] && { | ||||||
| 		ubus call ratelimit client_set '{"device": "'$1'", "address": "'$3'", "defaults": "'$(ubus call wifi iface | jsonfilter -e "@.$1.ssid")'" }' | 		ubus call ratelimit client_set '{"device": "'$1'", "address": "'$3'", "defaults": "'$(ubus call wifi iface | jsonfilter -e "@['$1'].ssid")'" }' | ||||||
| 		logger ratelimit addclient $1 $3 $ssid | 		logger ratelimit addclient $1 $3 $ssid | ||||||
| 		return | 		return | ||||||
| 	} | 	} | ||||||
|   | |||||||
| @@ -33,6 +33,18 @@ static uint32_t client_gettime(void) | |||||||
| 	return ts.tv_sec; | 	return ts.tv_sec; | ||||||
| } | } | ||||||
|  |  | ||||||
|  | static bool client_is_active(const uint8_t *mac) | ||||||
|  | { | ||||||
|  | 	struct interface *iface; | ||||||
|  |  | ||||||
|  | 	avl_for_each_element(&interfaces, iface, node) { | ||||||
|  | 		if (avl_find(&iface->clients, mac)) | ||||||
|  | 			return true; | ||||||
|  | 	} | ||||||
|  |  | ||||||
|  | 	return false; | ||||||
|  | } | ||||||
|  |  | ||||||
| static void client_gc(struct uloop_timeout *t) | static void client_gc(struct uloop_timeout *t) | ||||||
| { | { | ||||||
| 	struct cache_entry *c, *tmp; | 	struct cache_entry *c, *tmp; | ||||||
| @@ -41,6 +53,11 @@ static void client_gc(struct uloop_timeout *t) | |||||||
| 	avl_for_each_element_safe(&cache, c, node, tmp) { | 	avl_for_each_element_safe(&cache, c, node, tmp) { | ||||||
| 		uint32_t diff; | 		uint32_t diff; | ||||||
|  |  | ||||||
|  | 		if (client_is_active(c->macaddr)) { | ||||||
|  | 			c->time = now; | ||||||
|  | 			continue; | ||||||
|  | 		} | ||||||
|  |  | ||||||
| 		diff = now - c->time; | 		diff = now - c->time; | ||||||
| 		if (diff < CACHE_TIMEOUT) | 		if (diff < CACHE_TIMEOUT) | ||||||
| 			continue; | 			continue; | ||||||
| @@ -65,6 +82,7 @@ static void __client_free(struct interface *iface, struct client *cl) | |||||||
| 		avl_delete(&iface->client_ids, &cl->id_node); | 		avl_delete(&iface->client_ids, &cl->id_node); | ||||||
| 	avl_delete(&iface->clients, &cl->node); | 	avl_delete(&iface->clients, &cl->node); | ||||||
| 	kvlist_free(&cl->kvdata); | 	kvlist_free(&cl->kvdata); | ||||||
|  | 	free(cl->device); | ||||||
| 	spotfilter_bpf_set_client(iface, &cl->key, NULL); | 	spotfilter_bpf_set_client(iface, &cl->key, NULL); | ||||||
| 	free(cl); | 	free(cl); | ||||||
| } | } | ||||||
| @@ -143,8 +161,10 @@ int client_set(struct interface *iface, const void *addr, const char *id, | |||||||
|  |  | ||||||
| 		kvlist_set(&cl->kvdata, blobmsg_name(cur), cur); | 		kvlist_set(&cl->kvdata, blobmsg_name(cur), cur); | ||||||
| 	} | 	} | ||||||
| 	if (device) | 	if (device) { | ||||||
| 		cl->device = device; | 		free(cl->device); | ||||||
|  | 		cl->device = strdup(device); | ||||||
|  | 	} | ||||||
| 	if (state >= 0) | 	if (state >= 0) | ||||||
| 		cl->data.cur_class = state; | 		cl->data.cur_class = state; | ||||||
| 	if (dns_state >= 0) | 	if (dns_state >= 0) | ||||||
|   | |||||||
| @@ -17,7 +17,7 @@ struct client { | |||||||
|  |  | ||||||
| 	struct spotfilter_client_key key; | 	struct spotfilter_client_key key; | ||||||
| 	struct spotfilter_client_data data; | 	struct spotfilter_client_data data; | ||||||
| 	const char *device; | 	char *device; | ||||||
| }; | }; | ||||||
|  |  | ||||||
| int client_set(struct interface *iface, const void *addr, const char *id, | int client_set(struct interface *iface, const void *addr, const char *id, | ||||||
|   | |||||||
| @@ -147,6 +147,7 @@ nl80211_device_update(struct interface *iface, struct device *dev) | |||||||
|  |  | ||||||
| 	nl_send_auto_complete(genl, msg); | 	nl_send_auto_complete(genl, msg); | ||||||
| 	nlmsg_free(msg); | 	nlmsg_free(msg); | ||||||
|  | 	nl_wait_for_ack(genl); | ||||||
| } | } | ||||||
|  |  | ||||||
| static void | static void | ||||||
| @@ -247,6 +248,7 @@ int spotfilter_nl80211_init(void) | |||||||
| 	genl_cb = nl_cb_alloc(NL_CB_DEFAULT); | 	genl_cb = nl_cb_alloc(NL_CB_DEFAULT); | ||||||
| 	nl_cb_set(genl_cb, NL_CB_SEQ_CHECK, NL_CB_CUSTOM, no_seq_check, NULL); | 	nl_cb_set(genl_cb, NL_CB_SEQ_CHECK, NL_CB_CUSTOM, no_seq_check, NULL); | ||||||
| 	nl_cb_set(genl_cb, NL_CB_VALID, NL_CB_CUSTOM, valid_msg, NULL); | 	nl_cb_set(genl_cb, NL_CB_VALID, NL_CB_CUSTOM, valid_msg, NULL); | ||||||
|  | 	nl_socket_set_cb(genl, genl_cb); | ||||||
|  |  | ||||||
| 	genl_fd.fd = nl_socket_get_fd(genl); | 	genl_fd.fd = nl_socket_get_fd(genl); | ||||||
| 	genl_fd.cb = nl80211_sock_cb; | 	genl_fd.cb = nl80211_sock_cb; | ||||||
|   | |||||||
| @@ -4,10 +4,10 @@ PKG_NAME:=ucentral-client | |||||||
| PKG_RELEASE:=1 | PKG_RELEASE:=1 | ||||||
|  |  | ||||||
| PKG_SOURCE_URL=https://github.com/Telecominfraproject/wlan-ucentral-client.git | PKG_SOURCE_URL=https://github.com/Telecominfraproject/wlan-ucentral-client.git | ||||||
| PKG_MIRROR_HASH:=c2f41ed2506e3cc1a31c9180d567e68a39c30cae0c4421ca1dc8b58e82ab3ed1 | PKG_MIRROR_HASH:=8e53167e08d36e43ad00819f3bbe882f6957e995f075fa37141b3e8944f3688b | ||||||
| PKG_SOURCE_PROTO:=git | PKG_SOURCE_PROTO:=git | ||||||
| PKG_SOURCE_DATE:=2022-06-22 | PKG_SOURCE_DATE:=2022-06-22 | ||||||
| PKG_SOURCE_VERSION:=154e31dfffba8733895ed2cf87433809b0d19b03 | PKG_SOURCE_VERSION:=5f69da72973409cc63b9991e4c183f8deb5ab0a9 | ||||||
|  |  | ||||||
| PKG_LICENSE:=BSD-3-Clause | PKG_LICENSE:=BSD-3-Clause | ||||||
| PKG_MAINTAINER:=John Crispin <john@phrozen.org> | PKG_MAINTAINER:=John Crispin <john@phrozen.org> | ||||||
|   | |||||||
| @@ -4,10 +4,11 @@ PKG_NAME:=ucentral-schema | |||||||
| PKG_RELEASE:=1 | PKG_RELEASE:=1 | ||||||
|  |  | ||||||
| PKG_SOURCE_URL=https://github.com/Telecominfraproject/wlan-ucentral-schema.git | PKG_SOURCE_URL=https://github.com/Telecominfraproject/wlan-ucentral-schema.git | ||||||
| PKG_MIRROR_HASH:=ebad6fff601a64d3d87778a7413cdd308ed5d4a5187a7ed81070c7899d1b7013 | PKG_MIRROR_HASH:=b1bba8db08a4a1eb4b22500e0598c7940bbf51109add1123bd14e4c14e1ee5be | ||||||
|  | PKG_MIRROR_HASH:=7dc3e99b5b5937b230a465486fa4ac0f6a25ce2e6d6adf8c6999a32408cd293d | ||||||
| PKG_SOURCE_PROTO:=git | PKG_SOURCE_PROTO:=git | ||||||
| PKG_SOURCE_DATE:=2022-05-29 | PKG_SOURCE_DATE:=2022-05-29 | ||||||
| PKG_SOURCE_VERSION:=329dffaf4327bea8ffaa5b59d7bda918e5786150 | PKG_SOURCE_VERSION:=4278dfb73a5c59dbc8a97b8fd53f0c999e95d6ba | ||||||
|  |  | ||||||
| PKG_MAINTAINER:=John Crispin <john@phrozen.org> | PKG_MAINTAINER:=John Crispin <john@phrozen.org> | ||||||
| PKG_LICENSE:=BSD-3-Clause | PKG_LICENSE:=BSD-3-Clause | ||||||
|   | |||||||
| @@ -96,6 +96,7 @@ | |||||||
| 			"auth-server": "radius.hotspotsystem.com", | 			"auth-server": "radius.hotspotsystem.com", | ||||||
| 			"auth-port": 1812, | 			"auth-port": 1812, | ||||||
| 			"auth-secret": "hotsys123", | 			"auth-secret": "hotsys123", | ||||||
|  | 			"final-redirect-url": "uam", | ||||||
| 			"walled-garden-fqdn": [ | 			"walled-garden-fqdn": [ | ||||||
| 				"*.google.com", "telecominfraproject.com", "customer.hotspotsystem.com" | 				"*.google.com", "telecominfraproject.com", "customer.hotspotsystem.com" | ||||||
| 			] | 			] | ||||||
|   | |||||||
| @@ -0,0 +1,138 @@ | |||||||
|  | { | ||||||
|  |     "interfaces": [ | ||||||
|  |         { | ||||||
|  |             "name": "WAN-GRE", | ||||||
|  |             "role": "upstream", | ||||||
|  |             "services": [ | ||||||
|  |                 "wifi-steering" | ||||||
|  |             ], | ||||||
|  |             "ssids": [ | ||||||
|  |                 { | ||||||
|  |                     "bss-mode": "ap", | ||||||
|  |                     "disassoc-low-ack": true, | ||||||
|  |                     "encryption": { | ||||||
|  |                         "proto": "none" | ||||||
|  |                     }, | ||||||
|  |                     "hidden-ssid": false, | ||||||
|  |                     "isolate-clients": true, | ||||||
|  |                     "maximum-clients": 64, | ||||||
|  |                     "name": "..izzi WiFi", | ||||||
|  |                     "services": [ | ||||||
|  |                         "dhcp-snooping" | ||||||
|  |                     ], | ||||||
|  |                     "wifi-bands": [ | ||||||
|  |                         "2G", | ||||||
|  |                         "5G" | ||||||
|  |                     ] | ||||||
|  |                 }, | ||||||
|  |             ], | ||||||
|  |             "tunnel": { | ||||||
|  |                 "peer-address": "2405:200:802:600:61::2", | ||||||
|  |                 "proto": "gre6" | ||||||
|  |             } | ||||||
|  |         }, | ||||||
|  |         { | ||||||
|  |             "ethernet": [ | ||||||
|  |                 { | ||||||
|  |                     "select-ports": [ | ||||||
|  |                         "WAN*" | ||||||
|  |                     ] | ||||||
|  |                 } | ||||||
|  |             ], | ||||||
|  |             "ipv4": { | ||||||
|  |                 "addressing": "dynamic" | ||||||
|  |             }, | ||||||
|  |             "name": "WAN", | ||||||
|  |             "role": "upstream", | ||||||
|  |             "ssids": [] | ||||||
|  |         } | ||||||
|  |     ], | ||||||
|  |     "metrics": { | ||||||
|  |         "dhcp-snooping": { | ||||||
|  |             "filters": [ | ||||||
|  |                 "ack", | ||||||
|  |                 "discover", | ||||||
|  |                 "offer", | ||||||
|  |                 "request", | ||||||
|  |                 "solicit", | ||||||
|  |                 "reply", | ||||||
|  |                 "renew" | ||||||
|  |             ] | ||||||
|  |         }, | ||||||
|  |         "health": { | ||||||
|  |             "interval": 60 | ||||||
|  |         }, | ||||||
|  |         "statistics": { | ||||||
|  |             "interval": 60, | ||||||
|  |             "types": [ | ||||||
|  |                 "ssids", | ||||||
|  |                 "lldp", | ||||||
|  |                 "clients" | ||||||
|  |             ] | ||||||
|  |         }, | ||||||
|  |         "wifi-frames": { | ||||||
|  |             "filters": [ | ||||||
|  |                 "probe", | ||||||
|  |                 "auth", | ||||||
|  |                 "assoc", | ||||||
|  |                 "disassoc", | ||||||
|  |                 "deauth", | ||||||
|  |                 "local-deauth", | ||||||
|  |                 "inactive-deauth", | ||||||
|  |                 "key-mismatch", | ||||||
|  |                 "beacon-report", | ||||||
|  |                 "radar-detected" | ||||||
|  |             ] | ||||||
|  |         } | ||||||
|  |     }, | ||||||
|  |     "radios": [ | ||||||
|  |         { | ||||||
|  |             "band": "2G", | ||||||
|  |             "bandwidth": 20, | ||||||
|  |             "beacon-interval": 100, | ||||||
|  |             "channel": "auto", | ||||||
|  |             "channel-mode": "VHT", | ||||||
|  |             "channel-width": 20, | ||||||
|  |             "country": "CA", | ||||||
|  |             "dtim-period": 2, | ||||||
|  |             "maximum-clients": 64, | ||||||
|  |             "mimo": "2x2", | ||||||
|  |             "rates": { | ||||||
|  |                 "beacon": 6000, | ||||||
|  |                 "multicast": 24000 | ||||||
|  |             }, | ||||||
|  |             "require-mode": "VHT", | ||||||
|  |             "tx-power": 22 | ||||||
|  |         }, | ||||||
|  |         { | ||||||
|  |             "band": "5G", | ||||||
|  |             "bandwidth": 20, | ||||||
|  |             "beacon-interval": 100, | ||||||
|  |             "channel": "auto", | ||||||
|  |             "channel-mode": "VHT", | ||||||
|  |             "channel-width": 40, | ||||||
|  |             "country": "CA", | ||||||
|  |             "dtim-period": 2, | ||||||
|  |             "maximum-clients": 64, | ||||||
|  |             "mimo": "2x2", | ||||||
|  |             "rates": { | ||||||
|  |                 "beacon": 6000, | ||||||
|  |                 "multicast": 24000 | ||||||
|  |             }, | ||||||
|  |             "require-mode": "VHT", | ||||||
|  |             "tx-power": 22 | ||||||
|  |         } | ||||||
|  |     ], | ||||||
|  |     "services": { | ||||||
|  |         "wifi-steering": { | ||||||
|  |             "assoc-steering": true, | ||||||
|  |             "auto-channel": false, | ||||||
|  |             "load-kick-threshold": 80, | ||||||
|  |             "mode": "local", | ||||||
|  |             "required-probe-snr": -75, | ||||||
|  |             "required-roam-snr": -70, | ||||||
|  |             "required-snr": 0 | ||||||
|  |         } | ||||||
|  |     }, | ||||||
|  |     "uuid": 1660159074 | ||||||
|  | } | ||||||
| @@ -0,0 +1,89 @@ | |||||||
|  | { | ||||||
|  | 	"uuid": 2, | ||||||
|  | 	"radios": [ | ||||||
|  | 		{ | ||||||
|  | 			"band": "2G", | ||||||
|  | 			"country": "CA", | ||||||
|  | 			"channel-mode": "HE", | ||||||
|  | 			"channel-width": 80, | ||||||
|  | 			"channel": 32 | ||||||
|  | 		} | ||||||
|  | 	], | ||||||
|  |  | ||||||
|  | 	"interfaces": [ | ||||||
|  | 		{ | ||||||
|  | 			"name": "WAN", | ||||||
|  | 			"role": "upstream", | ||||||
|  | 			"services": [ "lldp" ], | ||||||
|  | 			"ethernet": [ | ||||||
|  | 				{ | ||||||
|  | 					"select-ports": [ | ||||||
|  | 						"WAN*" | ||||||
|  | 					] | ||||||
|  | 				} | ||||||
|  | 			], | ||||||
|  | 			"ipv4": { | ||||||
|  | 				"addressing": "dynamic" | ||||||
|  | 			}, | ||||||
|  | 			"ssids": [ | ||||||
|  | 				{ | ||||||
|  | 					"name": "OpenWifi", | ||||||
|  | 					"wifi-bands": [ | ||||||
|  | 						"2G" | ||||||
|  | 					], | ||||||
|  | 					"bss-mode": "ap", | ||||||
|  | 					"encryption": { | ||||||
|  | 						"proto": "psk2", | ||||||
|  | 						"key": "OpenWifi", | ||||||
|  | 						"ieee80211w": "optional" | ||||||
|  | 					}, | ||||||
|  | 					"quality-thresholds" : { | ||||||
|  | 						"probe-request-rssi": -35, | ||||||
|  | 						"assoctiation-request-rssi": -35, | ||||||
|  | 						"client-kick-rssi": -45, | ||||||
|  | 						"client-kick-ban-time": 60 | ||||||
|  | 					} | ||||||
|  | 				} | ||||||
|  | 			] | ||||||
|  | 		}, | ||||||
|  | 		{ | ||||||
|  | 			"name": "LAN", | ||||||
|  | 			"role": "downstream", | ||||||
|  | 			"services": [ "ssh", "lldp" ], | ||||||
|  | 			"ethernet": [ | ||||||
|  | 				{ | ||||||
|  | 					"select-ports": [ | ||||||
|  | 						"LAN*" | ||||||
|  | 					] | ||||||
|  | 				} | ||||||
|  | 			], | ||||||
|  | 			"ipv4": { | ||||||
|  | 				"addressing": "static", | ||||||
|  | 				"subnet": "192.168.1.1/24", | ||||||
|  | 				"dhcp": { | ||||||
|  | 					"lease-first": 10, | ||||||
|  | 					"lease-count": 100, | ||||||
|  | 					"lease-time": "6h" | ||||||
|  | 				} | ||||||
|  | 			} | ||||||
|  | 		} | ||||||
|  | 	], | ||||||
|  | 	"metrics": { | ||||||
|  | 		"statistics": { | ||||||
|  | 			"interval": 120, | ||||||
|  | 			"types": [ "ssids", "lldp", "clients" ] | ||||||
|  | 		}, | ||||||
|  | 		"health": { | ||||||
|  | 			"interval": 120 | ||||||
|  | 		} | ||||||
|  | 	}, | ||||||
|  | 	"services": { | ||||||
|  | 		"lldp": { | ||||||
|  | 			"describe": "uCentral", | ||||||
|  | 			"location": "universe" | ||||||
|  | 		}, | ||||||
|  | 		"ssh": { | ||||||
|  | 			"port": 22 | ||||||
|  | 		} | ||||||
|  | 	} | ||||||
|  | } | ||||||
| @@ -0,0 +1,16 @@ | |||||||
|  | bundle.wifi(); | ||||||
|  |  | ||||||
|  | let paths = [ | ||||||
|  |         [ 'network.wireless', 'status' ], | ||||||
|  |         [ 'network.device', 'status' ], | ||||||
|  |         [ 'network.interface', 'dump' ], | ||||||
|  |         [ 'log', 'read', { stream: false } ], | ||||||
|  | ]; | ||||||
|  | for (let path in paths) | ||||||
|  |         bundle.ubus(path[0], path[1], path[2]); | ||||||
|  |  | ||||||
|  | for (let config in [ 'network', 'wireless', 'dhcp', 'firewall', 'system' ]) | ||||||
|  |         bundle.uci(config); | ||||||
|  |  | ||||||
|  | for (let cmd in [ "route", "ifconfig", "logread" ]) | ||||||
|  |         bundle.shell(cmd); | ||||||
| @@ -0,0 +1,64 @@ | |||||||
|  | push(REQUIRE_SEARCH_PATH, '/usr/share/ucentral/*.uc'); | ||||||
|  |  | ||||||
|  | let ubus = require('ubus').connect(); | ||||||
|  | let uci = require('uci').cursor(); | ||||||
|  | let fs = require('fs'); | ||||||
|  | let w_iface = require('wifi.iface'); | ||||||
|  | let w_sta = require('wifi.station'); | ||||||
|  |  | ||||||
|  | return { | ||||||
|  | 	init: function(id) { | ||||||
|  | 		this.id = id || 0; | ||||||
|  | 		this.path = `/tmp/bundle.${this.id}/`; | ||||||
|  | 		fs.mkdir(this.path); | ||||||
|  | 	}, | ||||||
|  |  | ||||||
|  | 	complete: function() { | ||||||
|  | 		if (!this.path) | ||||||
|  | 			return; | ||||||
|  | 		system(`tar cfz /tmp/bundle.${this.id}.tar.gz ${this.path}`); | ||||||
|  | 		system(`rm -r ${this.path}`); | ||||||
|  | 	}, | ||||||
|  |  | ||||||
|  | 	add: function(name, data) { | ||||||
|  | 		if (!this.path) | ||||||
|  | 			return; | ||||||
|  | 		let file = fs.open(this.path + name, 'w'); | ||||||
|  | 		file.write(data); | ||||||
|  | 		file.close(); | ||||||
|  | 	}, | ||||||
|  |  | ||||||
|  | 	ubus: function(object, method, args) { | ||||||
|  | 		if (!object || !method) | ||||||
|  | 			return; | ||||||
|  |  | ||||||
|  | 		let data = ubus.call(object, method, args || {}); | ||||||
|  | 		this.add(`ubus-${object}:${method}`, data); | ||||||
|  | 	}, | ||||||
|  |  | ||||||
|  | 	uci: function(config, section) { | ||||||
|  | 		if (!config) | ||||||
|  | 			return; | ||||||
|  |  | ||||||
|  | 		let data = uci.get_all(config, section) || {}; | ||||||
|  | 		let name = `uci-${config}` + (section ? `.${section}` : ''); | ||||||
|  | 		this.add(name, data); | ||||||
|  | 	}, | ||||||
|  |  | ||||||
|  | 	wifi: function() { | ||||||
|  | 		this.add('wifi-iface', w_iface); | ||||||
|  | 		this.add('wifi-station', w_sta); | ||||||
|  | 	}, | ||||||
|  |  | ||||||
|  | 	shell: function(name, command) { | ||||||
|  | 		if (!command) | ||||||
|  | 			command = name; | ||||||
|  |  | ||||||
|  | 		let fp = fs.popen(command); | ||||||
|  | 	        let data = fp.read('all'); | ||||||
|  | 		fp.close(); | ||||||
|  |  | ||||||
|  | 		this.add(`shell-${name}`, data); | ||||||
|  | 	}, | ||||||
|  |  | ||||||
|  | }; | ||||||
| @@ -306,4 +306,6 @@ VALUE		Add-Port-To-IP-Address	Yes			1 | |||||||
| #$INCLUDE /etc/radcli/dictionary.microsoft | #$INCLUDE /etc/radcli/dictionary.microsoft | ||||||
| #$INCLUDE /etc/radcli/dictionary.roaringpenguin | #$INCLUDE /etc/radcli/dictionary.roaringpenguin | ||||||
| $INCLUDE /etc/radcli/dictionary.WISPr | $INCLUDE /etc/radcli/dictionary.WISPr | ||||||
|  | $INCLUDE /etc/radcli/dictionary.CoovaChilli | ||||||
|  | $INCLUDE /etc/radcli/dictionary.chillispot | ||||||
|  |  | ||||||
|   | |||||||
| @@ -0,0 +1,6 @@ | |||||||
|  |  | ||||||
|  | VENDOR		CoovaChilli	14122	CoovaChilli | ||||||
|  |  | ||||||
|  | ATTRIBUTE	CoovaChilli-Max-Input-Octets	1	integer	CoovaChilli | ||||||
|  | ATTRIBUTE	CoovaChilli-Max-Output-Octets	2	integer	CoovaChilli | ||||||
|  | ATTRIBUTE	CoovaChilli-Max-Total-Octets	3	integer	CoovaChilli | ||||||
| @@ -0,0 +1,14 @@ | |||||||
|  | VENDOR	ChilliSpot	14559 ChilliSpot | ||||||
|  |  | ||||||
|  | ATTRIBUTE	ChilliSpot-Max-Input-Octets		1	integer	ChilliSpot | ||||||
|  | ATTRIBUTE	ChilliSpot-Max-Output-Octets		2	integer	ChilliSpot | ||||||
|  | ATTRIBUTE	ChilliSpot-Max-Total-Octets		3	integer	ChilliSpot | ||||||
|  | ATTRIBUTE	ChilliSpot-Bandwidth-Max-Up		4	integer	ChilliSpot | ||||||
|  | ATTRIBUTE	ChilliSpot-Bandwidth-Max-Down		5	integer	ChilliSpot | ||||||
|  | ATTRIBUTE	ChilliSpot-Config			6	string	ChilliSpot | ||||||
|  | ATTRIBUTE	ChilliSpot-Lang				7	string	ChilliSpot | ||||||
|  | ATTRIBUTE	ChilliSpot-Version			8	string	ChilliSpot | ||||||
|  | ATTRIBUTE	ChilliSpot-OriginalURL			9	string	ChilliSpot | ||||||
|  | ATTRIBUTE	ChilliSpot-UAM-Allowed			100	string ChilliSpot | ||||||
|  | ATTRIBUTE	ChilliSpot-MAC-Allowed			101	string ChilliSpot | ||||||
|  | ATTRIBUTE	ChilliSpot-Interval			102	integer ChilliSpot | ||||||
							
								
								
									
										13
									
								
								feeds/ucentral/ucode/patches/0002-ubus-fix.patch
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										13
									
								
								feeds/ucentral/ucode/patches/0002-ubus-fix.patch
									
									
									
									
									
										Normal file
									
								
							| @@ -0,0 +1,13 @@ | |||||||
|  | Index: ucode-2022-04-07-7fa59ce4/lib/uloop.c | ||||||
|  | =================================================================== | ||||||
|  | --- ucode-2022-04-07-7fa59ce4.orig/lib/uloop.c | ||||||
|  | +++ ucode-2022-04-07-7fa59ce4/lib/uloop.c | ||||||
|  | @@ -971,6 +971,8 @@ uc_uloop_task(uc_vm_t *vm, size_t nargs) | ||||||
|  |  		err_return(errno); | ||||||
|  |   | ||||||
|  |  	if (pid == 0) { | ||||||
|  | +		uloop_done(); | ||||||
|  | + | ||||||
|  |  		patch_devnull(0, false); | ||||||
|  |  		patch_devnull(1, true); | ||||||
|  |  		patch_devnull(2, true); | ||||||
							
								
								
									
										34
									
								
								feeds/ucentral/ucrun/Makefile
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										34
									
								
								feeds/ucentral/ucrun/Makefile
									
									
									
									
									
										Normal file
									
								
							| @@ -0,0 +1,34 @@ | |||||||
|  | include $(TOPDIR)/rules.mk | ||||||
|  |  | ||||||
|  | PKG_NAME:=ucrun | ||||||
|  | PKG_RELEASE:=1 | ||||||
|  |  | ||||||
|  | PKG_SOURCE_PROTO:=git | ||||||
|  | PKG_SOURCE_URL=https://github.com/ucentral-io/ucrun.git | ||||||
|  | PKG_MIRROR_HASH:=52aeece27348611197ae5f4b96b3bdf1b5d028ae4ae284806b216d502300d07a | ||||||
|  | PKG_SOURCE_DATE:=2022-02-19 | ||||||
|  | PKG_SOURCE_VERSION:=5be6abebc4ae6057b47a5b3f0799d5ff01bc60c3 | ||||||
|  | CMAKE_INSTALL:=1 | ||||||
|  |  | ||||||
|  | PKG_LICENSE:=GPL-2.0-only | ||||||
|  | PKG_LICENSE_FILES:=GPL | ||||||
|  |  | ||||||
|  | PKG_MAINTAINER:=John Crispin <john@phrozen.org> | ||||||
|  |  | ||||||
|  | include $(INCLUDE_DIR)/package.mk | ||||||
|  | include $(INCLUDE_DIR)/cmake.mk | ||||||
|  |  | ||||||
|  | define Package/ucrun | ||||||
|  |   SECTION:=utils | ||||||
|  |   CATEGORY:=Utilities | ||||||
|  |   DEPENDS:=+libubox +ucode +ucode-mod-uci +ucode-mod-ubus +ucode-mod-fs | ||||||
|  |   TITLE:=uCode main-loop daemon | ||||||
|  | endef | ||||||
|  |  | ||||||
|  | define Package/ucrun/install | ||||||
|  | 	$(INSTALL_DIR) $(1)/usr/bin | ||||||
|  |  | ||||||
|  | 	$(INSTALL_BIN) $(PKG_INSTALL_DIR)/usr/bin/ucrun $(1)/usr/bin | ||||||
|  | endef | ||||||
|  |  | ||||||
|  | $(eval $(call BuildPackage,ucrun)) | ||||||
| @@ -0,0 +1,138 @@ | |||||||
|  | From b24a5a890ccd19b0f1b50340c79c5087f08d9447 Mon Sep 17 00:00:00 2001 | ||||||
|  | From: John Crispin <john@phrozen.org> | ||||||
|  | Date: Fri, 4 Mar 2022 15:56:30 +0100 | ||||||
|  | Subject: [PATCH] ulog: add ringbuffer and log_event notification | ||||||
|  |  | ||||||
|  | Signed-off-by: John Crispin <john@phrozen.org> | ||||||
|  | --- | ||||||
|  |  ucode.c | 75 +++++++++++++++++++++++++++++++++++++++++++++++++++++++-- | ||||||
|  |  1 file changed, 73 insertions(+), 2 deletions(-) | ||||||
|  |  | ||||||
|  | diff --git a/ucode.c b/ucode.c | ||||||
|  | index cef50e2..9e0373a 100644 | ||||||
|  | --- a/ucode.c | ||||||
|  | +++ b/ucode.c | ||||||
|  | @@ -31,6 +31,17 @@ static const char *exception_types[] = { | ||||||
|  |  	[EXCEPTION_EXIT] = "Exit" | ||||||
|  |  }; | ||||||
|  |   | ||||||
|  | +struct log_buffer { | ||||||
|  | +	struct list_head list; | ||||||
|  | +	int severity; | ||||||
|  | +	char entry[]; | ||||||
|  | +}; | ||||||
|  | + | ||||||
|  | +static LIST_HEAD(log_buffer); | ||||||
|  | +static int log_count; | ||||||
|  | +static int log_max = 100; | ||||||
|  | +static uc_value_t *log_event; | ||||||
|  | + | ||||||
|  |  static void | ||||||
|  |  ucode_handle_exception(uc_vm_t *vm, uc_exception_t *ex) | ||||||
|  |  { | ||||||
|  | @@ -287,6 +298,7 @@ static uc_value_t * | ||||||
|  |  uc_ulog(uc_vm_t *vm, size_t nargs, int severity) | ||||||
|  |  { | ||||||
|  |  	uc_value_t *res; | ||||||
|  | +	char *entry; | ||||||
|  |   | ||||||
|  |  	if (!fmtfn) { | ||||||
|  |  		fmtfn = (uc_cfunction_t *)ucv_object_get(uc_vm_scope_get(vm), "sprintf", NULL); | ||||||
|  | @@ -300,7 +312,37 @@ uc_ulog(uc_vm_t *vm, size_t nargs, int severity) | ||||||
|  |  	if (!res) | ||||||
|  |  		return ucv_int64_new(-1); | ||||||
|  |   | ||||||
|  | -	ulog(severity, "%s", ucv_string_get(res)); | ||||||
|  | +	entry = ucv_string_get(res); | ||||||
|  | + | ||||||
|  | +	if (log_max) { | ||||||
|  | +		struct log_buffer *log = calloc(1, sizeof(*log) + strlen(entry) + 1); | ||||||
|  | + | ||||||
|  | +		strcpy(log->entry, entry); | ||||||
|  | +		log->severity = severity; | ||||||
|  | +		list_add_tail(&log->list, &log_buffer); | ||||||
|  | + | ||||||
|  | +		if (log_event) { | ||||||
|  | +			uc_value_t *event = ucv_array_new(vm); | ||||||
|  | + | ||||||
|  | +			ucv_array_push(event, ucv_int64_new(severity)); | ||||||
|  | +			ucv_array_push(event, ucv_string_new(entry)); | ||||||
|  | + | ||||||
|  | +			uc_vm_stack_push(vm, ucv_get(log_event)); | ||||||
|  | +			uc_vm_stack_push(vm, ucv_get(event)); | ||||||
|  | +			uc_vm_call(vm, false, 1); | ||||||
|  | +		} | ||||||
|  | + | ||||||
|  | +		if (log_count == log_max) { | ||||||
|  | +			struct log_buffer *first = list_first_entry(&log_buffer, struct log_buffer, list); | ||||||
|  | + | ||||||
|  | +			list_del(&first->list); | ||||||
|  | +			free(first); | ||||||
|  | +		} else { | ||||||
|  | +			log_count++; | ||||||
|  | +		} | ||||||
|  | +	} | ||||||
|  | + | ||||||
|  | +	ulog(severity, "%s", entry); | ||||||
|  |  	ucv_put(res); | ||||||
|  |   | ||||||
|  |  	return ucv_int64_new(0); | ||||||
|  | @@ -330,11 +372,27 @@ uc_ulog_err(uc_vm_t *vm, size_t nargs) | ||||||
|  |  	return uc_ulog(vm, nargs, LOG_ERR); | ||||||
|  |  } | ||||||
|  |   | ||||||
|  | +static uc_value_t * | ||||||
|  | +uc_ulog_dump(uc_vm_t *vm, size_t nargs) | ||||||
|  | +{ | ||||||
|  | +	uc_value_t *log = ucv_array_new(vm); | ||||||
|  | +	struct log_buffer *iter; | ||||||
|  | + | ||||||
|  | +	list_for_each_entry(iter, &log_buffer, list) { | ||||||
|  | +		uc_value_t *entry = ucv_array_new(vm); | ||||||
|  | +		ucv_array_push(entry, ucv_int64_new(iter->severity)); | ||||||
|  | +		ucv_array_push(entry, ucv_string_new(iter->entry)); | ||||||
|  | +		ucv_array_push(log, entry); | ||||||
|  | +	} | ||||||
|  | + | ||||||
|  | +	return log; | ||||||
|  | +} | ||||||
|  | + | ||||||
|  |  static void | ||||||
|  |  ucode_init_ulog(ucrun_ctx_t *ucrun) | ||||||
|  |  { | ||||||
|  |  	uc_value_t *ulog = ucv_object_get(ucrun->scope, "ulog", NULL); | ||||||
|  | -	uc_value_t *identity, *channels; | ||||||
|  | +	uc_value_t *identity, *channels, *logsize; | ||||||
|  |  	int flags = 0, channel; | ||||||
|  |   | ||||||
|  |  	/* make sure the declartion is complete */ | ||||||
|  | @@ -365,6 +423,18 @@ ucode_init_ulog(ucrun_ctx_t *ucrun) | ||||||
|  |  			flags |= ULOG_STDIO; | ||||||
|  |  	} | ||||||
|  |   | ||||||
|  | +	/* set the internal ring buffer size */ | ||||||
|  | +	logsize = ucv_object_get(ulog, "channels", NULL); | ||||||
|  | +	if (ucv_type(logsize) == UC_INTEGER && ucv_int64_get(logsize)) | ||||||
|  | +		log_max = ucv_int64_get(logsize); | ||||||
|  | + | ||||||
|  | +	/* find out if ucrun wants a notification when a new log entry is generated */ | ||||||
|  | +	log_event = ucv_object_get(ulog, "event", NULL); | ||||||
|  | +	if (ucv_is_callable(log_event)) | ||||||
|  | +		ucv_get(log_event); | ||||||
|  | +	else | ||||||
|  | +		log_event = NULL; | ||||||
|  | + | ||||||
|  |  	/* open the log */ | ||||||
|  |  	ucrun->ulog_identity = strdup(ucv_string_get(identity)); | ||||||
|  |  	ulog_open(flags, LOG_DAEMON, ucrun->ulog_identity); | ||||||
|  | @@ -404,6 +474,7 @@ ucode_init(ucrun_ctx_t *ucrun, int argc, const char **argv, int *rc) | ||||||
|  |  	uc_function_register(ucrun->scope, "ulog_note", uc_ulog_note); | ||||||
|  |  	uc_function_register(ucrun->scope, "ulog_warn", uc_ulog_warn); | ||||||
|  |  	uc_function_register(ucrun->scope, "ulog_err", uc_ulog_err); | ||||||
|  | +	uc_function_register(ucrun->scope, "ulog_dump", uc_ulog_dump); | ||||||
|  |   | ||||||
|  |  	/* add commandline parameters */ | ||||||
|  |  	ARGV = ucv_array_new(&ucrun->vm); | ||||||
|  | --  | ||||||
|  | 2.25.1 | ||||||
|  |  | ||||||
| @@ -5,9 +5,9 @@ PKG_RELEASE:=1 | |||||||
|  |  | ||||||
| PKG_SOURCE_PROTO:=git | PKG_SOURCE_PROTO:=git | ||||||
| PKG_SOURCE_URL=https://github.com/blogic/udevmand.git | PKG_SOURCE_URL=https://github.com/blogic/udevmand.git | ||||||
| PKG_MIRROR_HASH:=25e47c7f3d454cc5eba4e9c19fc9da8431e3c2b1b97b8f0f49798f51c2722df7 | PKG_MIRROR_HASH:=51bcf59754ef87913c40f2f1c708c8d2d2eb0ad5fc128a5c891e54ea4b3b035e | ||||||
| PKG_SOURCE_DATE:=20220112 | PKG_SOURCE_DATE:=20220112 | ||||||
| PKG_SOURCE_VERSION:=065f75cb88aa317441adffeddc8d5302cfaafc8a | PKG_SOURCE_VERSION:=3d2b67b180679a6f5687e8d318a66a7cbad3fa7b | ||||||
| CMAKE_INSTALL:=1 | CMAKE_INSTALL:=1 | ||||||
|  |  | ||||||
| PKG_LICENSE:=LGPL-2.1 | PKG_LICENSE:=LGPL-2.1 | ||||||
|   | |||||||
| @@ -27,6 +27,11 @@ struct vlan_hdr { | |||||||
| 	uint16_t proto; | 	uint16_t proto; | ||||||
| }; | }; | ||||||
|  |  | ||||||
|  | struct gre_hdr { | ||||||
|  | 	uint16_t flags; | ||||||
|  | 	uint16_t proto; | ||||||
|  | }; | ||||||
|  |  | ||||||
| struct packet { | struct packet { | ||||||
| 	void *buffer; | 	void *buffer; | ||||||
| 	unsigned int len; | 	unsigned int len; | ||||||
| @@ -91,6 +96,7 @@ dhcpsnoop_packet_cb(struct packet *pkt) | |||||||
| 	bool ipv6 = false; | 	bool ipv6 = false; | ||||||
| 	uint32_t rebind = 0; | 	uint32_t rebind = 0; | ||||||
|  |  | ||||||
|  | inside_tunnel: | ||||||
| 	eth = pkt_pull(pkt, sizeof(*eth)); | 	eth = pkt_pull(pkt, sizeof(*eth)); | ||||||
| 	if (!eth) | 	if (!eth) | ||||||
| 		return; | 		return; | ||||||
| @@ -129,6 +135,15 @@ dhcpsnoop_packet_cb(struct packet *pkt) | |||||||
| 		return; | 		return; | ||||||
| 	} | 	} | ||||||
|  |  | ||||||
|  | 	if (proto == IPPROTO_GRE) { | ||||||
|  | 		struct gre_hdr *gre; | ||||||
|  | 		gre = pkt_pull(pkt, sizeof(*gre)); | ||||||
|  | 		if (!gre) return; | ||||||
|  | 		proto = be16_to_cpu(gre->proto); | ||||||
|  | 		if (proto != 0x6558) return; | ||||||
|  | 		goto inside_tunnel; | ||||||
|  | 	} | ||||||
|  |  | ||||||
| 	if (proto != IPPROTO_UDP) | 	if (proto != IPPROTO_UDP) | ||||||
| 		return; | 		return; | ||||||
|  |  | ||||||
| @@ -217,11 +232,37 @@ prepare_filter_cmd(char *buf, int len, const char *dev, int prio, bool add, bool | |||||||
| 			add ? "add" : "del", dev, egress ? "e" : "in", prio); | 			add ? "add" : "del", dev, egress ? "e" : "in", prio); | ||||||
| } | } | ||||||
|  |  | ||||||
|  | #define MATCH_GRE_ETH_IP_UDP_DHCP_67 \ | ||||||
|  | 	" match u16 0x6558 0xffff at 22 " \ | ||||||
|  | 	" match u16 0x0800 0xffff at 36 " \ | ||||||
|  | 	" match u8 17 0xff at 47 " \ | ||||||
|  | 	" match u16 67 0xffff at 58 " | ||||||
|  |  | ||||||
|  | #define MATCH_GRE_ETH_VLAN_IP_UDP_DHCP_67 \ | ||||||
|  | 	" match u16 0x6558 0xffff at 22 " \ | ||||||
|  | 	" match u16 0x8100 0xffff at 36 " \ | ||||||
|  | 	" match u16 0x0800 0xffff at 40 " \ | ||||||
|  | 	" match u8 17 0xff at 51 " \ | ||||||
|  | 	" match u16 67 0xffff at 62 " | ||||||
|  |  | ||||||
|  | #define MATCH_GRE_ETH_IP_UDP_DHCP_68 \ | ||||||
|  | 	" match u16 0x6558 0xffff at 22 " \ | ||||||
|  | 	" match u16 0x0800 0xffff at 36 " \ | ||||||
|  | 	" match u8 17 0xff at 47 " \ | ||||||
|  | 	" match u16 68 0xffff at 58 " | ||||||
|  |  | ||||||
|  | #define MATCH_GRE_ETH_VLAN_IP_UDP_DHCP_68 \ | ||||||
|  | 	" match u16 0x6558 0xffff at 22 " \ | ||||||
|  | 	" match u16 0x8100 0xffff at 36 " \ | ||||||
|  | 	" match u16 0x0800 0xffff at 40 " \ | ||||||
|  | 	" match u8 17 0xff at 51 " \ | ||||||
|  | 	" match u16 68 0xffff at 62 " | ||||||
|  |  | ||||||
| static void | static void | ||||||
| dhcpsnoop_dev_attach_filters(struct device *dev, bool egress) | dhcpsnoop_dev_attach_filters(struct device *dev, bool egress) | ||||||
| { | { | ||||||
| 	int prio = DHCPSNOOP_PRIO_BASE; | 	int prio = DHCPSNOOP_PRIO_BASE; | ||||||
| 	char buf[256]; | 	char buf[350]; | ||||||
| 	int ofs; | 	int ofs; | ||||||
|  |  | ||||||
| 	ofs = prepare_filter_cmd(buf, sizeof(buf), dev->ifname, prio++, true, egress); | 	ofs = prepare_filter_cmd(buf, sizeof(buf), dev->ifname, prio++, true, egress); | ||||||
| @@ -244,6 +285,32 @@ dhcpsnoop_dev_attach_filters(struct device *dev, bool egress) | |||||||
| 			 " flowid 1:1 action mirred ingress mirror dev " DHCPSNOOP_IFB_NAME); | 			 " flowid 1:1 action mirred ingress mirror dev " DHCPSNOOP_IFB_NAME); | ||||||
| 	dhcpsnoop_run_cmd(buf, false); | 	dhcpsnoop_run_cmd(buf, false); | ||||||
|  |  | ||||||
|  | 	/* GRE */ | ||||||
|  | 	ofs = prepare_filter_cmd(buf, sizeof(buf), dev->ifname, prio++, true, egress); | ||||||
|  | 	APPEND(buf, ofs, " protocol ip u32 match ip protocol 47 0xff" | ||||||
|  | 			 MATCH_GRE_ETH_IP_UDP_DHCP_67 | ||||||
|  | 			 " flowid 1:1 action mirred ingress mirror dev " DHCPSNOOP_IFB_NAME); | ||||||
|  | 	dhcpsnoop_run_cmd(buf, false); | ||||||
|  |  | ||||||
|  | 	ofs = prepare_filter_cmd(buf, sizeof(buf), dev->ifname, prio++, true, egress); | ||||||
|  | 	APPEND(buf, ofs, " protocol ip u32 match ip protocol 47 0xff" | ||||||
|  | 			 MATCH_GRE_ETH_IP_UDP_DHCP_68 | ||||||
|  | 			 " flowid 1:1 action mirred ingress mirror dev " DHCPSNOOP_IFB_NAME); | ||||||
|  | 	dhcpsnoop_run_cmd(buf, false); | ||||||
|  |  | ||||||
|  | 	ofs = prepare_filter_cmd(buf, sizeof(buf), dev->ifname, prio++, true, egress); | ||||||
|  | 	APPEND(buf, ofs, " protocol ip u32 match ip protocol 47 0xff " | ||||||
|  | 			 MATCH_GRE_ETH_VLAN_IP_UDP_DHCP_67 | ||||||
|  | 			 " flowid 1:1 action mirred ingress mirror dev " DHCPSNOOP_IFB_NAME); | ||||||
|  | 	dhcpsnoop_run_cmd(buf, false); | ||||||
|  |  | ||||||
|  | 	ofs = prepare_filter_cmd(buf, sizeof(buf), dev->ifname, prio++, true, egress); | ||||||
|  | 	APPEND(buf, ofs, " protocol ip u32 match ip protocol 47 0xff" | ||||||
|  | 			 MATCH_GRE_ETH_VLAN_IP_UDP_DHCP_68 | ||||||
|  | 			 " flowid 1:1 action mirred ingress mirror dev " DHCPSNOOP_IFB_NAME); | ||||||
|  | 	dhcpsnoop_run_cmd(buf, false); | ||||||
|  |  | ||||||
|  | 	/* IPv6 */ | ||||||
| 	ofs = prepare_filter_cmd(buf, sizeof(buf), dev->ifname, prio++, true, egress); | 	ofs = prepare_filter_cmd(buf, sizeof(buf), dev->ifname, prio++, true, egress); | ||||||
| 	APPEND(buf, ofs, " protocol ipv6 u32 match ip6 sport 546 0xfffe" | 	APPEND(buf, ofs, " protocol ipv6 u32 match ip6 sport 546 0xfffe" | ||||||
| 			 " flowid 1:1 action mirred ingress mirror dev " DHCPSNOOP_IFB_NAME); | 			 " flowid 1:1 action mirred ingress mirror dev " DHCPSNOOP_IFB_NAME); | ||||||
| @@ -261,7 +328,7 @@ dhcpsnoop_dev_cleanup_filters(struct device *dev, bool egress) | |||||||
| 	char buf[128]; | 	char buf[128]; | ||||||
| 	int i; | 	int i; | ||||||
|  |  | ||||||
| 	for (i = DHCPSNOOP_PRIO_BASE; i < DHCPSNOOP_PRIO_BASE + 6; i++) { | 	for (i = DHCPSNOOP_PRIO_BASE; i < DHCPSNOOP_PRIO_BASE + 10; i++) { | ||||||
| 		prepare_filter_cmd(buf, sizeof(buf), dev->ifname, i, false, egress); | 		prepare_filter_cmd(buf, sizeof(buf), dev->ifname, i, false, egress); | ||||||
| 		dhcpsnoop_run_cmd(buf, true); | 		dhcpsnoop_run_cmd(buf, true); | ||||||
| 	} | 	} | ||||||
|   | |||||||
| @@ -68,11 +68,11 @@ out: | |||||||
| int main(int argc, char **argv) | int main(int argc, char **argv) | ||||||
| { | { | ||||||
| 	ulog_open(ULOG_STDIO | ULOG_SYSLOG, LOG_DAEMON, "udhcpsnoop"); | 	ulog_open(ULOG_STDIO | ULOG_SYSLOG, LOG_DAEMON, "udhcpsnoop"); | ||||||
|  |  | ||||||
| 	uloop_init(); | 	uloop_init(); | ||||||
| 	dhcpsnoop_ubus_init(); | 	dhcpsnoop_ubus_init(); | ||||||
| 	dhcpsnoop_dev_init(); | 	dhcpsnoop_dev_init(); | ||||||
|  |  | ||||||
|  | 	ulog_threshold(LOG_INFO); | ||||||
| 	uloop_run(); | 	uloop_run(); | ||||||
|  |  | ||||||
| 	dhcpsnoop_ubus_done(); | 	dhcpsnoop_ubus_done(); | ||||||
|   | |||||||
| @@ -13,7 +13,7 @@ define Package/uspot | |||||||
|   SECTION:=net |   SECTION:=net | ||||||
|   CATEGORY:=Network |   CATEGORY:=Network | ||||||
|   TITLE:=hotspot daemon |   TITLE:=hotspot daemon | ||||||
|   DEPENDS:=+spotfilter +uhttpd-mod-ucode +libradcli |   DEPENDS:=+spotfilter +uhttpd-mod-ucode +libradcli +iptables-mod-conntrack-extra +conntrack | ||||||
| endef | endef | ||||||
|  |  | ||||||
| define Package/uspot/install | define Package/uspot/install | ||||||
|   | |||||||
| @@ -32,11 +32,15 @@ function get_idle_timeout(mac) { | |||||||
| } | } | ||||||
|  |  | ||||||
| function get_session_timeout(mac) { | function get_session_timeout(mac) { | ||||||
| 	if (clients[mac]?.session_timeout) | 	if (clients[mac]?.session) | ||||||
| 		return clients[mac].session_timeout; | 		return clients[mac].session; | ||||||
| 	return session_timeout; | 	return session_timeout; | ||||||
| } | } | ||||||
|  |  | ||||||
|  | function radius_available(mac) { | ||||||
|  | 	return !!clients[mac]?.radius; | ||||||
|  | } | ||||||
|  |  | ||||||
| function radius_init(mac, payload) { | function radius_init(mac, payload) { | ||||||
| 	for (let key in [ 'server', 'acct_server', 'acct_session', 'client_ip', 'called_station', 'calling_station', 'nas_ip', 'nas_id', 'username' ]) | 	for (let key in [ 'server', 'acct_server', 'acct_session', 'client_ip', 'called_station', 'calling_station', 'nas_ip', 'nas_id', 'username' ]) | ||||||
| 		if (clients[mac].radius[key]) | 		if (clients[mac].radius[key]) | ||||||
| @@ -52,16 +56,15 @@ function radius_call(mac, payload) { | |||||||
| 	system('/usr/bin/radius-client /tmp/acct' + mac + '.json'); | 	system('/usr/bin/radius-client /tmp/acct' + mac + '.json'); | ||||||
| } | } | ||||||
|  |  | ||||||
| function radius_stop(mac) { | function radius_stop(mac, payload) { | ||||||
|  | 	if (!radius_available(mac)) | ||||||
|  | 		return; | ||||||
| 	debug(mac, 'stopping accounting'); | 	debug(mac, 'stopping accounting'); | ||||||
|  | 	ubus.call('spotfilter', 'client_set', payload); | ||||||
| 	let payload = { | 	system('conntrack -D -s ' + clients[mac].ip4addr  + ' -m 2'); | ||||||
| 		acct: true, | 	if (clients[mac].accounting) | ||||||
| 		acct_type: 8, | 		clients[mac].timeout.cancel(); | ||||||
| 		terminate_cause: 0, | 	delete clients[mac]; | ||||||
| 	}; |  | ||||||
| 	radius_init(mac, payload); |  | ||||||
| 	radius_call(mac, payload); |  | ||||||
| } | } | ||||||
|  |  | ||||||
| function radius_acct(mac, payload) { | function radius_acct(mac, payload) { | ||||||
| @@ -82,12 +85,16 @@ function radius_acct(mac, payload) { | |||||||
| 	payload.input_gigawords = state.bytes_ul >> 32; | 	payload.input_gigawords = state.bytes_ul >> 32; | ||||||
| 	payload.output_packets = state.packets_dl; | 	payload.output_packets = state.packets_dl; | ||||||
| 	payload.input_packets = state.packets_ul; | 	payload.input_packets = state.packets_ul; | ||||||
|  | 	if (state.data?.radius?.reply?.Class) | ||||||
|  | 		payload.class = state.data.radius.reply.Class; | ||||||
|  |  | ||||||
| 	radius_call(mac, payload); | 	radius_call(mac, payload); | ||||||
| 	return true; | 	return true; | ||||||
| } | } | ||||||
|  |  | ||||||
| function radius_idle_time(mac) { | function radius_idle_time(mac) { | ||||||
|  | 	if (!radius_available(mac)) | ||||||
|  | 		return; | ||||||
| 	let payload = { | 	let payload = { | ||||||
| 		acct_type: 2, | 		acct_type: 2, | ||||||
| 		terminate_cause: 4, | 		terminate_cause: 4, | ||||||
| @@ -96,6 +103,8 @@ function radius_idle_time(mac) { | |||||||
| } | } | ||||||
|  |  | ||||||
| function radius_session_time(mac) { | function radius_session_time(mac) { | ||||||
|  | 	if (!radius_available(mac)) | ||||||
|  | 		return; | ||||||
| 	let payload = { | 	let payload = { | ||||||
| 		acct_type: 2, | 		acct_type: 2, | ||||||
| 		terminate_cause: 5, | 		terminate_cause: 5, | ||||||
| @@ -103,7 +112,19 @@ function radius_session_time(mac) { | |||||||
| 	radius_acct(mac, payload); | 	radius_acct(mac, payload); | ||||||
| } | } | ||||||
|  |  | ||||||
|  | function radius_logoff(mac) { | ||||||
|  | 	if (!radius_available(mac)) | ||||||
|  | 		return; | ||||||
|  | 	let payload = { | ||||||
|  | 		acct_type: 2, | ||||||
|  | 		terminate_cause: 1, | ||||||
|  | 	}; | ||||||
|  | 	radius_acct(mac, payload); | ||||||
|  | } | ||||||
|  |  | ||||||
| function radius_disconnect(mac) { | function radius_disconnect(mac) { | ||||||
|  | 	if (!radius_available(mac)) | ||||||
|  | 		return; | ||||||
| 	let payload = { | 	let payload = { | ||||||
| 		acct_type: 2, | 		acct_type: 2, | ||||||
| 		terminate_cause: 1, | 		terminate_cause: 1, | ||||||
| @@ -112,6 +133,8 @@ function radius_disconnect(mac) { | |||||||
| } | } | ||||||
|  |  | ||||||
| function radius_interim(mac) { | function radius_interim(mac) { | ||||||
|  | 	if (!radius_available(mac)) | ||||||
|  | 		return; | ||||||
| 	let payload = { | 	let payload = { | ||||||
| 		acct_type: 3, | 		acct_type: 3, | ||||||
| 	}; | 	}; | ||||||
| @@ -126,17 +149,32 @@ function client_add(mac, state) { | |||||||
| 	if (state.state != 1) | 	if (state.state != 1) | ||||||
| 		return; | 		return; | ||||||
|  |  | ||||||
| 	let interval = (state.data?.radius?.reply['Acct-Interim-Interval'] || acct_interval) * 1000; | 	let interval = acct_interval * 1000; | ||||||
| 	let idle = (state.data?.radius?.reply['Idle-Timeout'] || idle_timeout); | 	let idle = idle_timeout; | ||||||
| 	let session = (state.data?.radius?.reply['Session-Timeout'] || session_timeout); | 	let session = session_timeout; | ||||||
| 	let accounting = (config.radius?.acct_server && config.radius?.acct_secret); | 	let accounting = (config.radius?.acct_server && config.radius?.acct_secret); | ||||||
|  | 	let max_total = 0; | ||||||
|  |  | ||||||
|  | 	if (state.data?.radius?.reply) { | ||||||
|  | 		interval = (state.data?.radius?.reply['Acct-Interim-Interval'] || acct_interval) * 1000; | ||||||
|  | 		idle = (state.data?.radius?.reply['Idle-Timeout'] || idle_timeout); | ||||||
|  | 		session = (state.data?.radius?.reply['Session-Timeout'] || session_timeout); | ||||||
|  | 		max_total = (state.data?.radius?.reply['ChilliSpot-Max-Total-Octets'] || 0); | ||||||
|  | 	} | ||||||
|  |  | ||||||
| 	clients[mac] = { | 	clients[mac] = { | ||||||
| 		accounting, | 		accounting, | ||||||
| 		radius: state.data.radius.request, |  | ||||||
| 		interval, | 		interval, | ||||||
|  | 		session, | ||||||
| 		idle, | 		idle, | ||||||
|  | 		max_total, | ||||||
| 	}; | 	}; | ||||||
|  | 	if (state.ip4addr) | ||||||
|  | 		clients[mac].ip4addr = state.ip4addr; | ||||||
|  | 	if (state.ip6addr) | ||||||
|  | 		clients[mac].ip6addr = state.ip6addr; | ||||||
|  | 	if (state.data?.radius?.request) | ||||||
|  | 		clients[mac].radius= state.data.radius.request; | ||||||
| 	syslog(mac, 'adding client'); | 	syslog(mac, 'adding client'); | ||||||
| 	if (accounting) | 	if (accounting) | ||||||
| 		clients[mac].timeout = uloop.timer(interval, () => radius_interim(mac)); | 		clients[mac].timeout = uloop.timer(interval, () => radius_interim(mac)); | ||||||
| @@ -144,33 +182,34 @@ function client_add(mac, state) { | |||||||
|  |  | ||||||
| function client_remove(mac, reason) { | function client_remove(mac, reason) { | ||||||
| 	syslog(mac, reason); | 	syslog(mac, reason); | ||||||
| 	if (clients[mac]) { | 	radius_stop(mac, { | ||||||
| 		radius_stop(mac); | 		interface: "hotspot", | ||||||
| 		if (clients[mac].accounting) | 		address: mac | ||||||
| 			clients[mac].timeout.cancel(); | 	}); | ||||||
| 		delete clients[mac]; |  | ||||||
| 	} |  | ||||||
| 	ubus.call('spotfilter', 'client_remove', { |  | ||||||
| 			interface: "hotspot", |  | ||||||
| 			address: mac |  | ||||||
| 		}); |  | ||||||
| } | } | ||||||
|  |  | ||||||
| function client_timeout(mac) { | function client_flush(mac) { | ||||||
| 	syslog(mac, 'session timeout'); | 	syslog(mac, 'logoff event'); | ||||||
| 	if (clients[mac]) { | 	radius_stop(mac, { | ||||||
| 		radius_stop(mac); | 		interface: 'hotspot', | ||||||
| 		if (clients[mac].accounting) | 		address: mac, | ||||||
| 			clients[mac].timeout.cancel(); | 		state: 0, | ||||||
| 		delete clients[mac]; | 		dns_state: 1, | ||||||
| 	} | 		accounting: [], | ||||||
| 	ubus.call('spotfilter', 'client_set', { | 		flush: true | ||||||
| 			interface: "hotspot", | 	}); | ||||||
| 			state: 0, | } | ||||||
| 			address: mac, |  | ||||||
| 			accounting: [], | function client_timeout(mac, reason) { | ||||||
| 			flush: true, | 	syslog(mac, reason); | ||||||
| 		}); | 	radius_stop(mac, { | ||||||
|  | 		interface: "hotspot", | ||||||
|  | 		state: 0, | ||||||
|  | 		dns_state: 1, | ||||||
|  | 		address: mac, | ||||||
|  | 		accounting: [], | ||||||
|  | 		flush: true, | ||||||
|  | 	}); | ||||||
| } | } | ||||||
|  |  | ||||||
| uloop.init(); | uloop.init(); | ||||||
| @@ -183,29 +222,42 @@ uloop.timer(1000, function() { | |||||||
| 		if (!clients[k]) | 		if (!clients[k]) | ||||||
| 			client_add(k, v); | 			client_add(k, v); | ||||||
|  |  | ||||||
| 	for (let k, v in clients) | 	for (let k, v in clients) { | ||||||
|  | 		if (list[k].data?.logoff) { | ||||||
|  | 			radius_logoff(k); | ||||||
|  | 			client_flush(k); | ||||||
|  | 			continue; | ||||||
|  | 		} | ||||||
|  |  | ||||||
| 		if (!list[k] || !list[k].state) { | 		if (!list[k] || !list[k].state) { | ||||||
| 			radius_disconnect(k); | 			radius_disconnect(k); | ||||||
| 			client_remove(k, 'disconnect event'); | 			client_remove(k, 'disconnect event'); | ||||||
|  | 			continue; | ||||||
| 		} | 		} | ||||||
|  |  | ||||||
| 	for (let k, v in list) { | 		if (list[k].idle > get_idle_timeout(k)) { | ||||||
| 		if (v.idle > get_idle_timeout(k)) { |  | ||||||
| 			if (clients[k]) | 			if (clients[k]) | ||||||
| 				radius_idle_time(k); | 				radius_idle_time(k); | ||||||
| 			client_remove(k, 'idle event'); | 			client_remove(k, 'idle event'); | ||||||
|  | 			continue; | ||||||
| 		} | 		} | ||||||
| 		let timeout = get_session_timeout(k); | 		let timeout = get_session_timeout(k); | ||||||
| 		if (timeout && ((t - v.data.connect) > timeout)) { | 		if (timeout && ((t - list[k].data.connect) > timeout)) { | ||||||
| 			if (clients[k]) | 			if (clients[k]) | ||||||
| 				radius_session_time(k); | 				radius_session_time(k); | ||||||
| 			client_timeout(k); | 			client_timeout(k, 'session timeout'); | ||||||
|  | 			continue; | ||||||
|  | 		} | ||||||
|  | 		if (clients[k].max_total) { | ||||||
|  | 			let total = list[k].bytes_ul + list[k].bytes_dl; | ||||||
|  | 			if (total >= clients[k].max_total) { | ||||||
|  | 				radius_session_time(k); | ||||||
|  | 				client_timeout(k, 'max octets reached'); | ||||||
|  | 			} | ||||||
| 		} | 		} | ||||||
| 	} | 	} | ||||||
|  |  | ||||||
| 	this.set(5000); | 	this.set(1000); | ||||||
| }); | }); | ||||||
|  |  | ||||||
| uloop.run(); | uloop.run(); | ||||||
|   | |||||||
| @@ -46,7 +46,6 @@ return { | |||||||
| 		case 'aa-bb-cc-dd-ee-ff': | 		case 'aa-bb-cc-dd-ee-ff': | ||||||
| 		case 'AA-BB-CC-DD-EE-FF': | 		case 'AA-BB-CC-DD-EE-FF': | ||||||
| 			mac = replace(mac, ':', '-'); | 			mac = replace(mac, ':', '-'); | ||||||
| 			warn('uspot: ' + ctx.env.REMOTE_ADDR + ' - ' + msg + '\n'); |  | ||||||
| 			break; | 			break; | ||||||
| 		} | 		} | ||||||
|  |  | ||||||
| @@ -112,7 +111,7 @@ return { | |||||||
| 	}, | 	}, | ||||||
|  |  | ||||||
| 	// put a client back into pre-auth state | 	// put a client back into pre-auth state | ||||||
| 	logoff: function(ctx, data) { | 	logoff: function(ctx, uam) { | ||||||
| 		this.syslog(ctx, 'logging client off'); | 		this.syslog(ctx, 'logging client off'); | ||||||
| 		ctx.ubus.call('spotfilter', 'client_set', { | 		ctx.ubus.call('spotfilter', 'client_set', { | ||||||
| 			interface: 'hotspot', | 			interface: 'hotspot', | ||||||
| @@ -120,9 +119,15 @@ return { | |||||||
| 			state: 0, | 			state: 0, | ||||||
| 			dns_state: 1, | 			dns_state: 1, | ||||||
| 			accounting: [], | 			accounting: [], | ||||||
| 			flush: true, | 			data: { | ||||||
|  | 				logoff : 1 | ||||||
|  | 			} | ||||||
| 		}); | 		}); | ||||||
| 		include('logoff.uc', ctx); |  | ||||||
|  | 		if (uam) | ||||||
|  | 			include('redir.uc', { redir_location: this.uam_url(ctx, 'logoff') }); | ||||||
|  | 		else | ||||||
|  | 			include('logoff.uc', ctx); | ||||||
| 	}, | 	}, | ||||||
|  |  | ||||||
| 	// generate the default radius auth payload | 	// generate the default radius auth payload | ||||||
| @@ -140,7 +145,7 @@ return { | |||||||
| 			acct_server: sprintf('%s:%s:%s', this.config.radius.acct_server, this.config.radius.acct_port, this.config.radius.acct_secret), | 			acct_server: sprintf('%s:%s:%s', this.config.radius.acct_server, this.config.radius.acct_port, this.config.radius.acct_secret), | ||||||
| 			acct_session, | 			acct_session, | ||||||
| 			client_ip: ctx.env.REMOTE_ADDR, | 			client_ip: ctx.env.REMOTE_ADDR, | ||||||
| 			called_station: this.config.uam.nasmac, | 			called_station: this.config.uam.nasmac + ':' + ctx.ssid, | ||||||
| 			calling_station: this.format_mac(ctx.mac), | 			calling_station: this.format_mac(ctx.mac), | ||||||
| 			nas_ip: ctx.env.SERVER_ADDR, | 			nas_ip: ctx.env.SERVER_ADDR, | ||||||
| 			nas_id: this.config.uam.nasid | 			nas_id: this.config.uam.nasid | ||||||
| @@ -148,11 +153,30 @@ return { | |||||||
| 	}, | 	}, | ||||||
|  |  | ||||||
| 	radius_call: function(ctx, payload) { | 	radius_call: function(ctx, payload) { | ||||||
| 		let cfg = fs.open('/tmp/auth' + ctx.mac + '.json', 'w'); | 		let type = payload.acct ? 'acct' : 'auth'; | ||||||
|  | 		let cfg = fs.open('/tmp/' + type + ctx.mac + '.json', 'w'); | ||||||
| 		cfg.write(payload); | 		cfg.write(payload); | ||||||
| 		cfg.close(); | 		cfg.close(); | ||||||
|  |  | ||||||
| 		return this.fs_popen('/usr/bin/radius-client /tmp/auth' + ctx.mac + '.json'); | 		return this.fs_popen('/usr/bin/radius-client /tmp/' + type + ctx.mac + '.json'); | ||||||
|  | 	}, | ||||||
|  |  | ||||||
|  | 	uam_url: function(ctx, res) { | ||||||
|  | 		let uam_url = this.config.uam.uam_server + | ||||||
|  | 			'?res=' + res + | ||||||
|  | 			'&uamip=' + ctx.env.SERVER_ADDR + | ||||||
|  | 			'&uamport=' + this.config.uam.uam_port + | ||||||
|  | 			'&challenge=' + this.uam.md5(this.config.uam.challenge, ctx.format_mac) + | ||||||
|  | 			'&mac=' + ctx.format_mac + | ||||||
|  | 			'&ip=' + ctx.env.REMOTE_ADDR + | ||||||
|  | 			'&called=' + this.config.uam.nasmac + | ||||||
|  | 			'&nasid=' + this.config.uam.nasid + | ||||||
|  | 			'&ssid=' + ctx.ssid; | ||||||
|  | 		if (ctx.query_string?.redir) | ||||||
|  | 			uam_url += '&userurl=' + ctx.query_string.redir; | ||||||
|  | 		if (this.config.uam.uam_secret) | ||||||
|  | 			uam_url += '&md=' + this.uam.md5(uam_url, this.config.uam.uam_secret); | ||||||
|  | 		return uam_url; | ||||||
| 	}, | 	}, | ||||||
|  |  | ||||||
| 	handle_request: function(env, uam) { | 	handle_request: function(env, uam) { | ||||||
| @@ -195,6 +219,7 @@ return { | |||||||
| 					ssid: hapd.ssid || 'unknown' | 					ssid: hapd.ssid || 'unknown' | ||||||
| 				} | 				} | ||||||
| 			}); | 			}); | ||||||
|  | 			connected.data.ssid = hapd.ssid; | ||||||
| 		} | 		} | ||||||
| 		ctx.device = connected.device; | 		ctx.device = connected.device; | ||||||
| 		ctx.ssid = connected.data.ssid; | 		ctx.ssid = connected.data.ssid; | ||||||
|   | |||||||
							
								
								
									
										3
									
								
								feeds/ucentral/uspot/files/usr/share/uspot/firewall.ipt
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										3
									
								
								feeds/ucentral/uspot/files/usr/share/uspot/firewall.ipt
									
									
									
									
									
										Normal file
									
								
							| @@ -0,0 +1,3 @@ | |||||||
|  | *mangle | ||||||
|  | -A POSTROUTING -m mark --mark 0x2 -j CONNMARK --set-mark 0x2 | ||||||
|  | COMMIT | ||||||
| @@ -12,7 +12,7 @@ function auth_client(ctx) { | |||||||
| 	let password; | 	let password; | ||||||
| 	let payload = portal.radius_init(ctx); | 	let payload = portal.radius_init(ctx); | ||||||
|  |  | ||||||
| 	payload.logoff_url = sprintf('http://%s:3990/logoff', ctx.env.SERVER_ADDR); | 	payload.logoff_url = sprintf('http://%s:3990/', ctx.env.SERVER_ADDR); | ||||||
| 	if (ctx.query_string.username && ctx.query_string.response) { | 	if (ctx.query_string.username && ctx.query_string.response) { | ||||||
| 		let challenge = uam.md5(portal.config.uam.challenge, ctx.format_mac); | 		let challenge = uam.md5(portal.config.uam.challenge, ctx.format_mac); | ||||||
|  |  | ||||||
| @@ -30,21 +30,29 @@ function auth_client(ctx) { | |||||||
|  |  | ||||||
|         let radius = portal.radius_call(ctx, payload); |         let radius = portal.radius_call(ctx, payload); | ||||||
| 	if (radius['access-accept']) { | 	if (radius['access-accept']) { | ||||||
|  | 		if (portal.config.uam.final_redirect_url == 'uam') | ||||||
|  | 			ctx.query_string.userurl = portal.uam_url(ctx, 'success'); | ||||||
| 		portal.allow_client(ctx, { radius: { reply: radius.reply, request: payload } } ); | 		portal.allow_client(ctx, { radius: { reply: radius.reply, request: payload } } ); | ||||||
|  |  | ||||||
| 		payload = portal.radius_init(ctx, payload.acct_session); | 		payload = portal.radius_init(ctx, payload.acct_session); | ||||||
| 		payload.acct = true; | 		payload.acct = true; | ||||||
| 		payload.username = ctx.query_string.username; | 		payload.username = ctx.query_string.username; | ||||||
| 		payload.acct_type = 1; | 		payload.acct_type = 1; | ||||||
|  | 		if (radius.reply.Class) | ||||||
|  | 			payload.class = radius.reply.Class; | ||||||
| 		portal.radius_call(ctx, payload); | 		portal.radius_call(ctx, payload); | ||||||
| 		return; | 		return; | ||||||
| 	} | 	} | ||||||
| 	include('error.uc', ctx); |  | ||||||
|  | 	if (portal.config.uam.final_redirect_url == 'uam') | ||||||
|  | 		include('redir.uc', { redir_location: portal.uam_url(ctx, 'reject') }); | ||||||
|  | 	else | ||||||
|  | 		include('error.uc', ctx); | ||||||
| } | } | ||||||
|  |  | ||||||
| // disconnect client | // disconnect client | ||||||
| function deauth_client(ctx) { | function deauth_client(ctx) { | ||||||
| 	portal.logoff(ctx); | 	portal.logoff(ctx, true); | ||||||
| } | } | ||||||
|  |  | ||||||
| global.handle_request = function(env) { | global.handle_request = function(env) { | ||||||
| @@ -54,6 +62,7 @@ global.handle_request = function(env) { | |||||||
| 	case '/logon': | 	case '/logon': | ||||||
| 		auth_client(ctx); | 		auth_client(ctx); | ||||||
| 		break; | 		break; | ||||||
|  | 	case '/logout': | ||||||
| 	case '/logoff': | 	case '/logoff': | ||||||
| 		deauth_client(ctx); | 		deauth_client(ctx); | ||||||
| 		break; | 		break; | ||||||
|   | |||||||
| @@ -19,18 +19,7 @@ function request_start(ctx) { | |||||||
| 		include('radius.uc', ctx); | 		include('radius.uc', ctx); | ||||||
| 		return; | 		return; | ||||||
| 	case 'uam': | 	case 'uam': | ||||||
| 		ctx.redir_location = portal.config.uam.uam_server + | 		ctx.redir_location = portal.uam_url(ctx, 'notyet'); | ||||||
| 			'?res=notyet' + |  | ||||||
| 			'&uamip=' + ctx.env.SERVER_ADDR + |  | ||||||
| 			'&uamport=' + portal.config.uam.uam_port + |  | ||||||
| 			'&challenge=' + portal.uam.md5(portal.config.uam.challenge, ctx.format_mac) + |  | ||||||
| 			'&mac=' + ctx.format_mac + |  | ||||||
| 			'&ip=' + ctx.env.REMOTE_ADDR + |  | ||||||
| 			'&called=' + portal.config.uam.nasmac + |  | ||||||
| 			'&nasid=' + portal.config.uam.nasid + |  | ||||||
| 			'&ssid=' + ctx.ssid; |  | ||||||
| 		if (portal.config.uam.uam_secret) |  | ||||||
| 			ctx.redir_location += '&md=' + portal.uam.md5(ctx.redir_location, portal.config.uam.uam_secret); |  | ||||||
| 		include('redir.uc', ctx); | 		include('redir.uc', ctx); | ||||||
| 		return; | 		return; | ||||||
| 	default: | 	default: | ||||||
|   | |||||||
| @@ -32,6 +32,7 @@ enum { | |||||||
|         RADIUS_INPUT_PACKETS, |         RADIUS_INPUT_PACKETS, | ||||||
|         RADIUS_OUTPUT_PACKETS, |         RADIUS_OUTPUT_PACKETS, | ||||||
|         RADIUS_LOGOFF_URL, |         RADIUS_LOGOFF_URL, | ||||||
|  |         RADIUS_CLASS, | ||||||
|         __RADIUS_MAX, |         __RADIUS_MAX, | ||||||
| }; | }; | ||||||
|  |  | ||||||
| @@ -59,6 +60,7 @@ static const struct blobmsg_policy radius_policy[__RADIUS_MAX] = { | |||||||
|         [RADIUS_INPUT_PACKETS] = { .name = "input_packets", .type = BLOBMSG_TYPE_INT32 }, |         [RADIUS_INPUT_PACKETS] = { .name = "input_packets", .type = BLOBMSG_TYPE_INT32 }, | ||||||
|         [RADIUS_OUTPUT_PACKETS] = { .name = "output_packets", .type = BLOBMSG_TYPE_INT32 }, |         [RADIUS_OUTPUT_PACKETS] = { .name = "output_packets", .type = BLOBMSG_TYPE_INT32 }, | ||||||
|         [RADIUS_LOGOFF_URL] = { .name = "logoff_url", .type = BLOBMSG_TYPE_STRING }, |         [RADIUS_LOGOFF_URL] = { .name = "logoff_url", .type = BLOBMSG_TYPE_STRING }, | ||||||
|  |         [RADIUS_CLASS] = { .name = "class", .type = BLOBMSG_TYPE_STRING }, | ||||||
| }; | }; | ||||||
|  |  | ||||||
| static struct blob_buf b = {}; | static struct blob_buf b = {}; | ||||||
| @@ -251,6 +253,10 @@ radius(void) | |||||||
| 			return result(rh, 0, NULL); | 			return result(rh, 0, NULL); | ||||||
| 	} | 	} | ||||||
|  |  | ||||||
|  | 	if (tb[RADIUS_CLASS]) | ||||||
|  | 		if (rc_avpair_add(rh, &send, PW_CLASS, blobmsg_get_string(tb[RADIUS_CLASS]), -1, 0) == NULL) | ||||||
|  | 			return result(rh, 0, NULL); | ||||||
|  |  | ||||||
| 	val = 19; | 	val = 19; | ||||||
| 	if (rc_avpair_add(rh, &send, PW_NAS_PORT_TYPE, &val, 4, 0) == NULL) | 	if (rc_avpair_add(rh, &send, PW_NAS_PORT_TYPE, &val, 4, 0) == NULL) | ||||||
| 		return result(rh, 0, NULL); | 		return result(rh, 0, NULL); | ||||||
|   | |||||||
							
								
								
									
										27
									
								
								feeds/ucentral/usteer2/Makefile
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										27
									
								
								feeds/ucentral/usteer2/Makefile
									
									
									
									
									
										Normal file
									
								
							| @@ -0,0 +1,27 @@ | |||||||
|  | include $(TOPDIR)/rules.mk | ||||||
|  |  | ||||||
|  | PKG_NAME:=usteer2 | ||||||
|  | PKG_RELEASE:=1 | ||||||
|  | PKG_LICENSE:=ISC | ||||||
|  |  | ||||||
|  | PKG_MAINTAINER:=John Crispin <john@phrozen.org> | ||||||
|  |  | ||||||
|  | include $(INCLUDE_DIR)/package.mk | ||||||
|  |  | ||||||
|  | define Package/usteer2 | ||||||
|  |   SECTION:=utils | ||||||
|  |   CATEGORY:=Utilities | ||||||
|  |   DEPENDS:=+ucrun | ||||||
|  |   TITLE:=wifi client steering | ||||||
|  | endef | ||||||
|  |  | ||||||
|  | define Build/Compile/Default | ||||||
|  |  | ||||||
|  | endef | ||||||
|  | Build/Compile = $(Build/Compile/Default) | ||||||
|  |  | ||||||
|  | define Package/usteer2/install | ||||||
|  | 	$(CP) ./files/* $(1)/ | ||||||
|  | endef | ||||||
|  |  | ||||||
|  | $(eval $(call BuildPackage,usteer2)) | ||||||
							
								
								
									
										9
									
								
								feeds/ucentral/usteer2/files/etc/config/usteer2
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										9
									
								
								feeds/ucentral/usteer2/files/etc/config/usteer2
									
									
									
									
									
										Normal file
									
								
							| @@ -0,0 +1,9 @@ | |||||||
|  | config base | ||||||
|  | 	option station_update 1000 | ||||||
|  | 	option station_expiry 120 | ||||||
|  |  | ||||||
|  | config policy | ||||||
|  | 	option name snr | ||||||
|  | 	option min_snr_kick_delay 5 | ||||||
|  | 	option kick_reason 5 | ||||||
|  | 	option interval 1000 | ||||||
							
								
								
									
										13
									
								
								feeds/ucentral/usteer2/files/etc/init.d/usteer2
									
									
									
									
									
										Executable file
									
								
							
							
						
						
									
										13
									
								
								feeds/ucentral/usteer2/files/etc/init.d/usteer2
									
									
									
									
									
										Executable file
									
								
							| @@ -0,0 +1,13 @@ | |||||||
|  | #!/bin/sh /etc/rc.common | ||||||
|  |  | ||||||
|  | START=99 | ||||||
|  | STOP=01 | ||||||
|  |  | ||||||
|  | USE_PROCD=1 | ||||||
|  |  | ||||||
|  | start_service() { | ||||||
|  | 	procd_open_instance | ||||||
|  | 	procd_set_param command /usr/bin/usteer.uc | ||||||
|  | 	procd_set_param respawn 3600 5 0 | ||||||
|  | 	procd_close_instance | ||||||
|  | } | ||||||
							
								
								
									
										75
									
								
								feeds/ucentral/usteer2/files/usr/bin/usteer.uc
									
									
									
									
									
										Executable file
									
								
							
							
						
						
									
										75
									
								
								feeds/ucentral/usteer2/files/usr/bin/usteer.uc
									
									
									
									
									
										Executable file
									
								
							| @@ -0,0 +1,75 @@ | |||||||
|  | #!/usr/bin/ucrun | ||||||
|  |  | ||||||
|  | push(REQUIRE_SEARCH_PATH, '/usr/share/usteer/*.uc'); | ||||||
|  |  | ||||||
|  | global.ulog = { | ||||||
|  | 	identity: 'usteer', | ||||||
|  | 	channels: [ 'stdio', 'syslog' ], | ||||||
|  | }; | ||||||
|  |  | ||||||
|  | global.ubus = { | ||||||
|  | 	object: 'usteer2', | ||||||
|  |  | ||||||
|  | 	connect: function() { | ||||||
|  | 		printf('connected to ubus\n'); | ||||||
|  | 	}, | ||||||
|  |  | ||||||
|  | 	methods: { | ||||||
|  | 		interfaces: { | ||||||
|  | 			cb: function(msg) { | ||||||
|  | 				return global.local.status(); | ||||||
|  | 			} | ||||||
|  | 		}, | ||||||
|  |  | ||||||
|  | 		stations: { | ||||||
|  | 			cb: function(msg) { | ||||||
|  | 				return global.station.list(msg); | ||||||
|  | 			} | ||||||
|  | 		}, | ||||||
|  |  | ||||||
|  | 		status: { | ||||||
|  | 			cb: function(msg) { | ||||||
|  | 				return global.station.status(); | ||||||
|  | 			} | ||||||
|  | 		}, | ||||||
|  |  | ||||||
|  | 		command: { | ||||||
|  | 			cb: function(msg) { | ||||||
|  | 				return global.command.handle(msg); | ||||||
|  | 			} | ||||||
|  | 		}, | ||||||
|  |  | ||||||
|  | 		get_beacon_request: { | ||||||
|  | 			cb: function(msg) { | ||||||
|  | 				let val = global.station.list(msg); | ||||||
|  | 				return val?.beacon_report || {}; | ||||||
|  | 			} | ||||||
|  | 		}, | ||||||
|  |  | ||||||
|  | 		policy: { | ||||||
|  | 			cb: function(msg) { | ||||||
|  | 				return global.policy.status(msg); | ||||||
|  | 			}, | ||||||
|  | 		}, | ||||||
|  | 	}, | ||||||
|  | }; | ||||||
|  |  | ||||||
|  | global.start = function() { | ||||||
|  | 	try { | ||||||
|  | 		global.uci = require('uci').cursor(); | ||||||
|  | 		global.ubus.conn = require('ubus').connect(); | ||||||
|  |  | ||||||
|  | 		for (let module in [ 'config', 'local', 'station', 'command', 'policy' ]) { | ||||||
|  | 			printf('loading ' + module + '\n'); | ||||||
|  | 			global[module] = require(module); | ||||||
|  | 			if (exists(global[module], 'init')) | ||||||
|  | 				global[module].init(); | ||||||
|  | 		} | ||||||
|  | 	} catch(e) { | ||||||
|  | 		printf('exception %s\n', e); | ||||||
|  | 	} | ||||||
|  | }; | ||||||
|  |  | ||||||
|  | global.stop = function() { | ||||||
|  | 	ulog_info('stopping\n'); | ||||||
|  | }; | ||||||
							
								
								
									
										35
									
								
								feeds/ucentral/usteer2/files/usr/share/usteer/command.uc
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										35
									
								
								feeds/ucentral/usteer2/files/usr/share/usteer/command.uc
									
									
									
									
									
										Normal file
									
								
							| @@ -0,0 +1,35 @@ | |||||||
|  | function result(error, text, data) { | ||||||
|  | 	return { | ||||||
|  | 		error: error, | ||||||
|  | 		text: text || 'unknown', | ||||||
|  | 		...(data ? { data } : {}), | ||||||
|  | 	}; | ||||||
|  | } | ||||||
|  |  | ||||||
|  | const actions = { | ||||||
|  | 	// ubus call usteer2 command '{"action": "kick", "mac": "1c:57:dc:37:3c:b1", "params": {"reason": 5, "ban_time": 30}}' | ||||||
|  | 	kick: function(msg) { | ||||||
|  | 		if (global.station.kick(msg.mac, msg.params?.reason, msg.params?.ban_time)) | ||||||
|  | 			return result(1, 'station ' + msg.mac + ' is unknown'); | ||||||
|  |  | ||||||
|  | 		return result(0, 'station ' + msg.mac + ' was kicked'); | ||||||
|  | 	}, | ||||||
|  |  | ||||||
|  | 	// ubus call usteer2 command '{"action": "beacon_request", "mac": "1c:57:dc:37:3c:b1", "params": {"channel": 36}}' | ||||||
|  | 	// ubus call usteer2 get_beacon_request '{"mac": "1c:57:dc:37:3c:b1"}' | ||||||
|  | 	beacon_request: function(msg) { | ||||||
|  | 		if (!global.station.beacon_request(msg.mac, msg.params?.channel, msg.params?.op_class, msg.param?.duration)) | ||||||
|  | 			return result(1, 'station ' + msg.mac + ' is unknown'); | ||||||
|  |  | ||||||
|  | 		return result(0, 'station ' + msg.mac + ' beacon-request sent'); | ||||||
|  | 	}, | ||||||
|  | }; | ||||||
|  |  | ||||||
|  | return { | ||||||
|  | 	handle: function(msg) { | ||||||
|  | 		if (!actions[msg.action]) | ||||||
|  | 			return result(1, 'unknown action ' + msg.action); | ||||||
|  |  | ||||||
|  | 		return actions[msg.action](msg); | ||||||
|  | 	}, | ||||||
|  | }; | ||||||
							
								
								
									
										10
									
								
								feeds/ucentral/usteer2/files/usr/share/usteer/config.uc
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										10
									
								
								feeds/ucentral/usteer2/files/usr/share/usteer/config.uc
									
									
									
									
									
										Normal file
									
								
							| @@ -0,0 +1,10 @@ | |||||||
|  | return { | ||||||
|  | 	station_update: 1000, | ||||||
|  | 	station_expiry: 120, | ||||||
|  |  | ||||||
|  | 	init: function() { | ||||||
|  | 		let options = uci.get_all('usteer2', '@base[-1]'); | ||||||
|  | 		for (let key in options) | ||||||
|  | 			this[key] = options[key]; | ||||||
|  | 	}, | ||||||
|  | }; | ||||||
							
								
								
									
										142
									
								
								feeds/ucentral/usteer2/files/usr/share/usteer/local.uc
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										142
									
								
								feeds/ucentral/usteer2/files/usr/share/usteer/local.uc
									
									
									
									
									
										Normal file
									
								
							| @@ -0,0 +1,142 @@ | |||||||
|  | let nl80211 = require("nl80211"); | ||||||
|  | let def = nl80211.const; | ||||||
|  | let subscriber; | ||||||
|  | let state = {}; | ||||||
|  | let hapd = {}; | ||||||
|  | let handlers = {}; | ||||||
|  |  | ||||||
|  | function channel_survey(dev) { | ||||||
|  | 	/* trigger the nl80211 call that gathers channel survey data */ | ||||||
|  | 	let res = nl80211.request(def.NL80211_CMD_GET_SURVEY, def.NLM_F_DUMP, { dev }); | ||||||
|  |  | ||||||
|  | 	if (!res) { | ||||||
|  | 		ulog_err(sprintf('failed to update survey for %s', dev)); | ||||||
|  | 		return; | ||||||
|  | 	} | ||||||
|  |  | ||||||
|  | 	/* iterate over the result and filter out the correct channel */ | ||||||
|  | 	for (let survey in res) { | ||||||
|  | 		if (survey?.survey_info?.frequency != hapd[dev].freq) | ||||||
|  | 			continue; | ||||||
|  | 		if (survey.survey_info.noise) | ||||||
|  | 			hapd[dev].noise = survey.survey_info.noise; | ||||||
|  | 		if (survey.survey_info.time && survey.survey_info.busy) { | ||||||
|  | 			let time = survey.survey_info.time - (state[dev].time || 0); | ||||||
|  | 			let busy = survey.survey_info.busy - (state[dev].busy || 0); | ||||||
|  | 			state[dev].time = survey.survey_info.time; | ||||||
|  | 			state[dev].busy = survey.survey_info.busy; | ||||||
|  |  | ||||||
|  | 			let load = (100 * busy) / time; | ||||||
|  | 			if (hapd[dev].load) | ||||||
|  | 				hapd[dev].load = 0.85 * hapd[dev].load + 0.15 * load; | ||||||
|  | 			else | ||||||
|  | 				hapd[dev].load = load; | ||||||
|  | 		} | ||||||
|  | 	} | ||||||
|  | } | ||||||
|  |  | ||||||
|  | function hapd_update() { | ||||||
|  | 	/* todo: prefilter frequency */ | ||||||
|  | 	for (let key in state) | ||||||
|  | 		channel_survey(key); | ||||||
|  | 	return 5000; | ||||||
|  | } | ||||||
|  |  | ||||||
|  | function hapd_subunsub(path, sub) { | ||||||
|  | 	/* check if this is a hostapd instance */ | ||||||
|  | 	let name = split(path, '.'); | ||||||
|  |  | ||||||
|  | 	if (length(name) != 2 || name[0] != 'hostapd') | ||||||
|  | 		return; | ||||||
|  | 	name = name[1]; | ||||||
|  |  | ||||||
|  | 	ulog_info(sprintf('%s %s\n', sub ? 'add' : 'remove', path)); | ||||||
|  |  | ||||||
|  | 	/* the hostapd instance disappeared */ | ||||||
|  | 	if (!sub) { | ||||||
|  | 		delete hapd[name]; | ||||||
|  | 		delete state[name]; | ||||||
|  | 		return; | ||||||
|  | 	} | ||||||
|  |  | ||||||
|  | 	/* gather initial data from hostapd */ | ||||||
|  | 	let status = global.ubus.conn.call(path, 'get_status'); | ||||||
|  | 	if (!status) | ||||||
|  | 		return; | ||||||
|  |  | ||||||
|  | 	let cfg = uci.get_all('usteer2', status.uci_section); | ||||||
|  | 	if (!cfg) | ||||||
|  | 		return; | ||||||
|  |  | ||||||
|  |  | ||||||
|  | 	/* subscibe to hostapd */ | ||||||
|  | 	subscriber.subscribe(path); | ||||||
|  |  | ||||||
|  | 	/* tell hostapd to wait for a reply before answering probe requests */ | ||||||
|  | 	//global.ubus.conn.call(path, 'notify_response', { 'notify_response': 1 }); | ||||||
|  |  | ||||||
|  | 	/* tell hostapd to enable rrm/roaming */ | ||||||
|  | 	global.ubus.conn.call(path, 'bss_mgmt_enable', { 'neighbor_report': 1, 'beacon_report': 1, 'bss_transition': 1 }); | ||||||
|  |  | ||||||
|  | 	/* instantiate state */ | ||||||
|  | 	hapd[name] = { }; | ||||||
|  | 	state[name] = { }; | ||||||
|  |  | ||||||
|  | 	for (let prop in [ 'ssid', 'bssid', 'freq', 'channel', 'op_class', 'uci_section' ]) | ||||||
|  | 		if (status[prop]) | ||||||
|  | 			hapd[name][prop] = status[prop]; | ||||||
|  | 	hapd[name].config = cfg; | ||||||
|  |  | ||||||
|  | 	/* ask hostapd for the local neighbourhood report data */ | ||||||
|  | 	let rrm = global.ubus.conn.call(path, 'rrm_nr_get_own'); | ||||||
|  | 	if (rrm && rrm.value) | ||||||
|  | 		hapd[name].rrm_nr = rrm.value; | ||||||
|  |  | ||||||
|  | 	/* trigger an initial channel survey */ | ||||||
|  | 	channel_survey(name); | ||||||
|  | } | ||||||
|  |  | ||||||
|  | function hapd_listener(event, msg) { | ||||||
|  | 	hapd_subunsub(msg.path, event == 'ubus.object.add'); | ||||||
|  | } | ||||||
|  |  | ||||||
|  | function hapd_handle_event(req) { | ||||||
|  | 	/* iterate over all handlers for this event type, if 1 or more handlers replied with false, do not reply to the notification */ | ||||||
|  | 	let reply = true; | ||||||
|  | 	for (let handler in handlers[req.type]) | ||||||
|  | 		if (!handler(req.type, req.data)) | ||||||
|  | 			reply = false; | ||||||
|  | 	if (!reply) | ||||||
|  | 		return; | ||||||
|  | 	req.reply(); | ||||||
|  | } | ||||||
|  |  | ||||||
|  | return { | ||||||
|  | 	status: function() { | ||||||
|  | 		return hapd; | ||||||
|  | 	}, | ||||||
|  |  | ||||||
|  | 	init: function() { | ||||||
|  | 		subscriber = global.ubus.conn.subscriber( | ||||||
|  | 			hapd_handle_event, | ||||||
|  | 			function(msg) { | ||||||
|  | //				printf('2 %.J\n', msg); | ||||||
|  | 			}); | ||||||
|  |  | ||||||
|  | 		/* register a callback that will monitor hostapd instances spawning and disappearing */ | ||||||
|  | 		global.ubus.conn.listener('ubus.object.add', hapd_listener); | ||||||
|  | 		global.ubus.conn.listener('ubus.object.remove', hapd_listener); | ||||||
|  |  | ||||||
|  | 		/* iterade over all existing hostapd instances and subscribe to them */ | ||||||
|  | 		for (let path in global.ubus.conn.list()) | ||||||
|  | 			hapd_subunsub(path, true); | ||||||
|  |  | ||||||
|  | 		uloop_timeout(hapd_update, 5000); | ||||||
|  | 	}, | ||||||
|  |  | ||||||
|  | 	register_handler: function(event, handler) { | ||||||
|  | 		/* a policy requested to be notified of action frames, register the callback */ | ||||||
|  | 		handlers[event] ??= []; | ||||||
|  | 		push(handlers[event], handler); | ||||||
|  | 	}, | ||||||
|  | }; | ||||||
							
								
								
									
										36
									
								
								feeds/ucentral/usteer2/files/usr/share/usteer/policy.uc
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										36
									
								
								feeds/ucentral/usteer2/files/usr/share/usteer/policy.uc
									
									
									
									
									
										Normal file
									
								
							| @@ -0,0 +1,36 @@ | |||||||
|  | let policies = {}; | ||||||
|  | return { | ||||||
|  | 	init: function() { | ||||||
|  | 		let config = global.uci.get_all('usteer2'); | ||||||
|  | 		for (let section in config) { | ||||||
|  | 			if (config[section]['.type'] != 'policy' || !config[section].name) | ||||||
|  | 				continue; | ||||||
|  | 			let policy = require(`policy_${config[section].name}`); | ||||||
|  | 			if (type(policy) != 'object' || type(policy.init) != 'function') { | ||||||
|  | 				ulog_info('failed to load policy "%s"\n', config[section].name); | ||||||
|  | 				continue; | ||||||
|  | 			} | ||||||
|  | 			try { | ||||||
|  | 				policy.init(config[section]); | ||||||
|  | 			} catch(e) { | ||||||
|  | 				ulog_info('failed to initialze policy "%s"\n', config[section].name); | ||||||
|  | 				continue; | ||||||
|  | 			} | ||||||
|  | 			ulog_info('loaded policy "%s"\n', config[section].name); | ||||||
|  | 			policies[config[section].name] = policy; | ||||||
|  | 		} | ||||||
|  | 	}, | ||||||
|  |  | ||||||
|  | 	status: function(msg) { | ||||||
|  | 		/* if no specific policies state was requested, dump the list of loaded policies */ | ||||||
|  | 		if (msg?.name === null) | ||||||
|  | 			return { policies: keys(policies) }; | ||||||
|  |  | ||||||
|  | 		/* check if the requested policy exists and dump its state */ | ||||||
|  | 		if (policies[msg.name]) | ||||||
|  | 			return policies[msg.name].status(msg); | ||||||
|  |  | ||||||
|  | 		/* return an empty dictionary */ | ||||||
|  | 		return {}; | ||||||
|  | 	}, | ||||||
|  | }; | ||||||
							
								
								
									
										91
									
								
								feeds/ucentral/usteer2/files/usr/share/usteer/policy_snr.uc
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										91
									
								
								feeds/ucentral/usteer2/files/usr/share/usteer/policy_snr.uc
									
									
									
									
									
										Normal file
									
								
							| @@ -0,0 +1,91 @@ | |||||||
|  | let config = { | ||||||
|  | 	/* how many seconds must a client be below the thershold before we kick it */ | ||||||
|  | 	min_snr_kick_delay: 5, | ||||||
|  | 	/* the reson code sent when triggering the deauth (IEEE Std 802.11-2016, 9.4.1.7, Table 9-45) */ | ||||||
|  | 	kick_reason: 5, | ||||||
|  | 	/* the periodicity for checking client kick conditions */ | ||||||
|  | 	interval: 1000, | ||||||
|  | }; | ||||||
|  |  | ||||||
|  | /* counter of how often a station was kicked */ | ||||||
|  | let kick_count = 0; | ||||||
|  |  | ||||||
|  | let foo = 0; | ||||||
|  |  | ||||||
|  | function snr_update() { | ||||||
|  | 	try { | ||||||
|  | 		let iface = global.local.status(); | ||||||
|  | 		let stations = global.station.list(); | ||||||
|  | 		let now = time(); | ||||||
|  |  | ||||||
|  | 		/* iterate over all stations and kick anything that had a signal worse than the threshold for too long */ | ||||||
|  | 		for (let addr in stations) { | ||||||
|  | 			let station = stations[addr]; | ||||||
|  | 			if (!station.signal || !station.device) | ||||||
|  | 				continue; | ||||||
|  | 			let device = iface[station.device].config; | ||||||
|  |  | ||||||
|  | 			if (!device?.client_kick_rssi) | ||||||
|  | 				continue; | ||||||
|  |  | ||||||
|  | 			if (0) { | ||||||
|  | 				foo++; | ||||||
|  | 				if (foo > 10) | ||||||
|  | 					station.signal = -80; | ||||||
|  | 				printf(`snr check ${addr} ${station.seen} ${station.signal} ${device.client_kick_rssi}\n`); | ||||||
|  | 			} | ||||||
|  | 			printf(`${addr} ${station.signal} ${device.client_kick_rssi}\n`); | ||||||
|  |  | ||||||
|  | 			/* ignore old stations and ones that have a good signal */ | ||||||
|  | 			if (now - station.seen > 2 || station.signal >= device.client_kick_rssi) { | ||||||
|  | 				station.snr_kick_timer = 0; | ||||||
|  | 				continue; | ||||||
|  | 			} | ||||||
|  |  | ||||||
|  | 			/* find out how long the station had a bad signal for */ | ||||||
|  | 			if (!station.snr_kick_timer) | ||||||
|  | 				station.snr_kick_timer = now; | ||||||
|  | 			if (now - station.snr_kick_timer < config.min_snr_kick_delay) | ||||||
|  | 				continue; | ||||||
|  |  | ||||||
|  | 			printf(`${now - station.seen}\n`); | ||||||
|  | 			if ((now - station.seen) > 2) | ||||||
|  | 				return; | ||||||
|  |  | ||||||
|  | 			/* kick the station and ban it for the configured timeout */ | ||||||
|  | 			ulog_info(`kick ${addr} as signal (${station.signal}) is too low\n`); | ||||||
|  | 			global.station.kick(addr, config.kick_reason, device.client_kick_ban_time); | ||||||
|  | 			kick_count++; | ||||||
|  | 		} | ||||||
|  | 	} catch(e) { | ||||||
|  | 		printf(`snr exception ${e}\n`); | ||||||
|  | 	} | ||||||
|  |  | ||||||
|  | 	return config.interval; | ||||||
|  | } | ||||||
|  |  | ||||||
|  | function probe_handler(type, data) { | ||||||
|  | 	/* only send a probe request if the signal is good enough */ | ||||||
|  | 	return (data.signal > config.min_connect_snr) | ||||||
|  | } | ||||||
|  |  | ||||||
|  | return { | ||||||
|  | 	init: function(data) { | ||||||
|  | 		/* load config and override defaults if they were set in UCI */ | ||||||
|  | 		for (let key in config) | ||||||
|  | 			if (data[key]) | ||||||
|  | 				config[key] = +data[key]; | ||||||
|  |  | ||||||
|  | 		/* register a callback that will inspect probe-requests and prevent a reply if SNR is too low */ | ||||||
|  | 		//global.local.register_handler('probe', probe_handler); | ||||||
|  |  | ||||||
|  | 		/* register the timer that periodically checks if a client should be kicked */ | ||||||
|  | 		uloop_timeout(snr_update, config.interval); | ||||||
|  | 	}, | ||||||
|  |  | ||||||
|  | 	status: function(data) { | ||||||
|  | 		/* dump the status of this policy */ | ||||||
|  | 		return { config, kick_count }; | ||||||
|  | 	}, | ||||||
|  |  | ||||||
|  | }; | ||||||
							
								
								
									
										201
									
								
								feeds/ucentral/usteer2/files/usr/share/usteer/station.uc
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										201
									
								
								feeds/ucentral/usteer2/files/usr/share/usteer/station.uc
									
									
									
									
									
										Normal file
									
								
							| @@ -0,0 +1,201 @@ | |||||||
|  | let stations = {}; | ||||||
|  |  | ||||||
|  | function station_add(device, addr, data, seen) { | ||||||
|  | 	/* only honour stations that are authenticated */ | ||||||
|  | 	if (!data.auth || !data.assoc) | ||||||
|  | 		return; | ||||||
|  |  | ||||||
|  | 	/* if the station is new, add the initial entry */ | ||||||
|  | 	if (!stations[addr]) { | ||||||
|  | 		ulog_info(`add station ${ addr }\n`); | ||||||
|  |  | ||||||
|  | 		/* extract the rrm bits and give them meaningful names */ | ||||||
|  | 		let rrm = { | ||||||
|  | 			link_measure: !!(data.rrm[0] & 0x1), | ||||||
|  | 			beacon_passive_measure: !!(data.rrm[0] & 0x10), | ||||||
|  | 			beacon_active_measure: !!(data.rrm[0] & 0x20), | ||||||
|  | 			beacon_table_measure: !!(data.rrm[0] & 0x40), | ||||||
|  | 			statistics_measure: !!(data.rrm[1] & 0x8), | ||||||
|  | 		}; | ||||||
|  |  | ||||||
|  | 		/* add the new station */ | ||||||
|  | 		stations[addr] = { | ||||||
|  | 			rrm, | ||||||
|  | 			beacon_report: {}, | ||||||
|  | 		}; | ||||||
|  | 	} | ||||||
|  |  | ||||||
|  | 	/* update device, seen and signal data */ | ||||||
|  | 	stations[addr].device = device; | ||||||
|  | 	stations[addr].seen = seen; | ||||||
|  | 	if (data.signal) | ||||||
|  | 		stations[addr].signal = data.signal; | ||||||
|  | } | ||||||
|  |  | ||||||
|  | function station_del(addr) { | ||||||
|  | 	ulog_info(`deleting ${ addr }\n`); | ||||||
|  | 	delete stations[addr]; | ||||||
|  | } | ||||||
|  |  | ||||||
|  | function stations_update() { | ||||||
|  | 	try { | ||||||
|  | 		/* lets not call time() multiple times */ | ||||||
|  | 		let seen = time(); | ||||||
|  |  | ||||||
|  | 		/* iterate over all ssids and ask hapd for the list of associations */ | ||||||
|  | 		for (let device in global.local.status()) { | ||||||
|  | 			let clients = global.ubus.conn.call(`hostapd.${ device}`, 'get_clients'); | ||||||
|  |  | ||||||
|  | 			for (let client in clients.clients) | ||||||
|  | 				if (clients.clients[client].auth) | ||||||
|  | 					station_add(device, client, clients.clients[client], seen); | ||||||
|  | 				else | ||||||
|  | 					station_del(client); | ||||||
|  | 		} | ||||||
|  |  | ||||||
|  | 		/* purge all stations that have not been seen in a while */ | ||||||
|  | 		for (let station in stations) { | ||||||
|  | 			if (seen - stations[station].seen <= +global.config.station_expiry) | ||||||
|  | 				continue; | ||||||
|  | 			station_del(station); | ||||||
|  | 		} | ||||||
|  |  | ||||||
|  | 	} catch (e) { | ||||||
|  | 		printf('%.J', e); | ||||||
|  | 	} | ||||||
|  |  | ||||||
|  | 	/* restart the timer */ | ||||||
|  | 	return +global.config.station_update; | ||||||
|  | } | ||||||
|  |  | ||||||
|  | function beacon_report(type, report) { | ||||||
|  | 	/* make sure that the station exists */ | ||||||
|  | 	if (!stations[report.address]) { | ||||||
|  | 		ulog_err(`beacon report on unknown station ${report.address}\n`); | ||||||
|  | 		return false; | ||||||
|  | 	} | ||||||
|  |  | ||||||
|  | 	/* store the report */ | ||||||
|  | 	stations[report.address].beacon_report[report.bssid] = { | ||||||
|  | 		seen: time(), | ||||||
|  | 		channel: report.channel, | ||||||
|  | 		rcpi: report.rcpi, | ||||||
|  | 		rsni: report.rsni, | ||||||
|  | 	}; | ||||||
|  | } | ||||||
|  |  | ||||||
|  | function probe_handler(type, data) { | ||||||
|  | 	/* track non-associated stations SNR */ | ||||||
|  | 	stations[data.address] = { | ||||||
|  | 		signal: data.signal, | ||||||
|  | 		connected: false, | ||||||
|  | 		seen: time(), | ||||||
|  | 	}; | ||||||
|  | 	return true; | ||||||
|  | } | ||||||
|  |  | ||||||
|  | function disassoc_handler(type, data) { | ||||||
|  | 	station_del(data.address); | ||||||
|  |  | ||||||
|  | 	return true; | ||||||
|  | } | ||||||
|  |  | ||||||
|  | return { | ||||||
|  | 	init: function() { | ||||||
|  | 		/* register the mgmt frame handlers */ | ||||||
|  | 		global.local.register_handler('beacon-report', beacon_report); | ||||||
|  | 		//global.local.register_handler('probe', probe_handler); | ||||||
|  | 		global.local.register_handler('disassoc', disassoc_handler); | ||||||
|  |  | ||||||
|  | 		/* initial probe of associated stations */ | ||||||
|  | 		uloop_timeout(stations_update, 100); | ||||||
|  | 	}, | ||||||
|  |  | ||||||
|  | 	status: function() { | ||||||
|  | 		let ret = { }; | ||||||
|  | 		let now = time(); | ||||||
|  |  | ||||||
|  | 		/* get the list of our local APs */ | ||||||
|  | 		let local = global.local.status(); | ||||||
|  |  | ||||||
|  | 		/* iterate over all APs and aggregate their associations */ | ||||||
|  | 		for (let device in local) { | ||||||
|  | 			/* iterate over all known stations */ | ||||||
|  | 			for (let addr, station in stations) { | ||||||
|  | 				/* match for the current AP */ | ||||||
|  | 				if (station.device != device) | ||||||
|  | 					continue; | ||||||
|  |  | ||||||
|  | 				/* add the station info to the return data */ | ||||||
|  | 				ret[addr] = { | ||||||
|  | 					[device]: { | ||||||
|  | 						signal: station.signal, | ||||||
|  | 						rrm: station.rrm, | ||||||
|  | 						last_seen: now - station.seen, | ||||||
|  | 					}, | ||||||
|  | 				}; | ||||||
|  |  | ||||||
|  | 				if (length(station.beacon_report)) | ||||||
|  | 					ret[addr][device].beacon_report = station.beacon_report; | ||||||
|  | 			} | ||||||
|  | 		} | ||||||
|  | 		return ret; | ||||||
|  | 	}, | ||||||
|  |  | ||||||
|  | 	beacon_request: function(addr, channel, mode, op_class, duration) { | ||||||
|  | 		let station = stations[addr]; | ||||||
|  |  | ||||||
|  | 		/* make sure that the station exists */ | ||||||
|  | 		if (!station) { | ||||||
|  | 			ulog_err(`beacon request on unknown station ${addr}`); | ||||||
|  | 			return false; | ||||||
|  | 		} | ||||||
|  |  | ||||||
|  | 		/* make sure that the station supports active beacon requests */ | ||||||
|  | 		if (!station.rrm?.beacon_active_measure) { | ||||||
|  | 			ulog_err(`${addr} does not support beacon requests`); | ||||||
|  | 			return false; | ||||||
|  | 		} | ||||||
|  |  | ||||||
|  | 		station.beacon_report = {}; | ||||||
|  | 		let payload = { | ||||||
|  | 			addr, | ||||||
|  | 			channel, | ||||||
|  | 			mode: mode || 1, | ||||||
|  | 			op_class: op_class || 128, | ||||||
|  | 			duration: duration || 100, | ||||||
|  | 		}; | ||||||
|  | 		global.ubus.conn.call(`hostapd.${station.device}`, 'rrm_beacon_req', payload); | ||||||
|  |  | ||||||
|  | 		return true; | ||||||
|  | 	}, | ||||||
|  |  | ||||||
|  | 	kick: function(addr, reason, ban_time) { | ||||||
|  | 		if (!exists(stations, addr)) | ||||||
|  | 			return -1; | ||||||
|  |  | ||||||
|  | 		let payload = { | ||||||
|  | 			addr, | ||||||
|  | 			reason: reason || 5, | ||||||
|  | 			deauth: 1 | ||||||
|  | 		}; | ||||||
|  |  | ||||||
|  | 		if (ban_time) | ||||||
|  | 			payload.ban_time = ban_time * 1000; | ||||||
|  |  | ||||||
|  | 		/* tell hostapd to kick a station via ubus */ | ||||||
|  | 		global.ubus.conn.call(`hostapd.${stations[addr].device}`, 'del_client', payload); | ||||||
|  |  | ||||||
|  | 		return 0; | ||||||
|  | 	}, | ||||||
|  |  | ||||||
|  | 	list: function(msg) { | ||||||
|  | 		if (msg?.mac) | ||||||
|  | 			return stations[msg.mac] || {}; | ||||||
|  | 		return stations; | ||||||
|  | 	}, | ||||||
|  |  | ||||||
|  | 	steer: function(addr, imminent, neighbors) { | ||||||
|  |  | ||||||
|  | 	}, | ||||||
|  | }; | ||||||
| @@ -115,6 +115,11 @@ define Package/ath11k-firmware-qcn9000/install | |||||||
| 		$(1)/lib/firmware/ath11k/QCN9074/hw1.0/ | 		$(1)/lib/firmware/ath11k/QCN9074/hw1.0/ | ||||||
| endef | endef | ||||||
|  |  | ||||||
|  | define Package/ath11k-wifi-yuncore-ax840/install | ||||||
|  | 	$(INSTALL_DIR) $(1)/lib/firmware/ath11k/IPQ6018/hw1.0/ | ||||||
|  | 	$(INSTALL_DATA) ./board-2.bin.IPQ6018 $(1)/lib/firmware/ath11k/IPQ6018/hw1.0/board-2.bin | ||||||
|  | endef | ||||||
|  |  | ||||||
| $(eval $(call BuildPackage,ath11k-firmware-ipq50xx)) | $(eval $(call BuildPackage,ath11k-firmware-ipq50xx)) | ||||||
| $(eval $(call BuildPackage,ath11k-firmware-ipq50xx-spruce)) | $(eval $(call BuildPackage,ath11k-firmware-ipq50xx-spruce)) | ||||||
| $(eval $(call BuildPackage,ath11k-firmware-ipq60xx)) | $(eval $(call BuildPackage,ath11k-firmware-ipq60xx)) | ||||||
|   | |||||||
| @@ -40,12 +40,14 @@ ALLWIFIBOARDS:= \ | |||||||
| 	indio-um-310ax-v1 \ | 	indio-um-310ax-v1 \ | ||||||
| 	indio-um-510axp-v1 \ | 	indio-um-510axp-v1 \ | ||||||
| 	indio-um-510axm-v1 \ | 	indio-um-510axm-v1 \ | ||||||
|  | 	muxi-ap3220l \ | ||||||
| 	plasmacloud-pax1800 \ | 	plasmacloud-pax1800 \ | ||||||
| 	wallys-dr6018 \ | 	wallys-dr6018 \ | ||||||
| 	wallys-dr6018-v4 \ | 	wallys-dr6018-v4 \ | ||||||
| 	tplink-ex227 \ | 	tplink-ex227 \ | ||||||
| 	tplink-ex447 \ | 	tplink-ex447 \ | ||||||
| 	yuncore-ax840 \ | 	yuncore-ax840 \ | ||||||
|  | 	yuncore-fap650 \ | ||||||
| 	meshpp-s618 | 	meshpp-s618 | ||||||
|  |  | ||||||
| ALLWIFIPACKAGES:=$(foreach BOARD,$(ALLWIFIBOARDS),ath11k-wifi-$(BOARD)) | ALLWIFIPACKAGES:=$(foreach BOARD,$(ALLWIFIBOARDS),ath11k-wifi-$(BOARD)) | ||||||
| @@ -252,6 +254,8 @@ $(eval $(call generate-ath11k-wifi-package,tplink-ex227,TP-Link EX227)) | |||||||
| $(eval $(call generate-ath11k-wifi-package,tplink-ex447,TP-Link EX447)) | $(eval $(call generate-ath11k-wifi-package,tplink-ex447,TP-Link EX447)) | ||||||
| $(eval $(call generate-ath11k-wifi-package,yuncore-ax840,YunCore AX840)) | $(eval $(call generate-ath11k-wifi-package,yuncore-ax840,YunCore AX840)) | ||||||
| $(eval $(call generate-ath11k-wifi-package,meshpp-s618,Mesh++ S618)) | $(eval $(call generate-ath11k-wifi-package,meshpp-s618,Mesh++ S618)) | ||||||
|  | $(eval $(call generate-ath11k-wifi-package,muxi-ap3220l,MUXI AP3220L)) | ||||||
|  | $(eval $(call generate-ath11k-wifi-package,yuncore-fap650,YunCore FAP650)) | ||||||
|  |  | ||||||
| $(foreach PACKAGE,$(ALLWIFIPACKAGES),$(eval $(call BuildPackage,$(PACKAGE)))) | $(foreach PACKAGE,$(ALLWIFIPACKAGES),$(eval $(call BuildPackage,$(PACKAGE)))) | ||||||
| $(eval $(call BuildPackage,ath11k-wifi-qcom-ipq5018)) | $(eval $(call BuildPackage,ath11k-wifi-qcom-ipq5018)) | ||||||
|   | |||||||
										
											Binary file not shown.
										
									
								
							
										
											Binary file not shown.
										
									
								
							
							
								
								
									
										
											BIN
										
									
								
								feeds/wifi-ax/ath11k-wifi/board-muxi-ap3220l.bin.IPQ5018
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										
											BIN
										
									
								
								feeds/wifi-ax/ath11k-wifi/board-muxi-ap3220l.bin.IPQ5018
									
									
									
									
									
										Normal file
									
								
							
										
											Binary file not shown.
										
									
								
							
							
								
								
									
										
											BIN
										
									
								
								feeds/wifi-ax/ath11k-wifi/board-muxi-ap3220l.bin.QCN6122
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										
											BIN
										
									
								
								feeds/wifi-ax/ath11k-wifi/board-muxi-ap3220l.bin.QCN6122
									
									
									
									
									
										Normal file
									
								
							
										
											Binary file not shown.
										
									
								
							
							
								
								
									
										
											BIN
										
									
								
								feeds/wifi-ax/ath11k-wifi/board-yuncore-fap650.bin.IPQ6018
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										
											BIN
										
									
								
								feeds/wifi-ax/ath11k-wifi/board-yuncore-fap650.bin.IPQ6018
									
									
									
									
									
										Normal file
									
								
							
										
											Binary file not shown.
										
									
								
							| @@ -117,6 +117,7 @@ hostapd_common_add_device_config() { | |||||||
| 	config_add_int rssi_reject_assoc_rssi | 	config_add_int rssi_reject_assoc_rssi | ||||||
| 	config_add_int rssi_ignore_probe_request | 	config_add_int rssi_ignore_probe_request | ||||||
| 	config_add_int maxassoc | 	config_add_int maxassoc | ||||||
|  | 	config_add_boolean maxassoc_ignore_probe | ||||||
|  |  | ||||||
| 	config_add_string acs_chan_bias | 	config_add_string acs_chan_bias | ||||||
| 	config_add_boolean acs_exclude_dfs | 	config_add_boolean acs_exclude_dfs | ||||||
| @@ -138,7 +139,8 @@ hostapd_prepare_device_config() { | |||||||
| 	json_get_vars country country3 country_ie beacon_int:100 dtim_period:2 doth require_mode legacy_rates \ | 	json_get_vars country country3 country_ie beacon_int:100 dtim_period:2 doth require_mode legacy_rates \ | ||||||
| 		acs_chan_bias local_pwr_constraint spectrum_mgmt_required airtime_mode cell_density \ | 		acs_chan_bias local_pwr_constraint spectrum_mgmt_required airtime_mode cell_density \ | ||||||
| 		rts_threshold beacon_rate rssi_reject_assoc_rssi rssi_ignore_probe_request maxassoc \ | 		rts_threshold beacon_rate rssi_reject_assoc_rssi rssi_ignore_probe_request maxassoc \ | ||||||
| 		multiple_bssid he_co_locate rnr_beacon ema acs_exclude_dfs | 		multiple_bssid he_co_locate rnr_beacon ema acs_exclude_dfs \ | ||||||
|  | 		maxassoc_ignore_probe | ||||||
|  |  | ||||||
| 	hostapd_set_log_options base_cfg | 	hostapd_set_log_options base_cfg | ||||||
|  |  | ||||||
| @@ -245,6 +247,7 @@ hostapd_prepare_device_config() { | |||||||
| 	append base_cfg "dtim_period=$dtim_period" "$N" | 	append base_cfg "dtim_period=$dtim_period" "$N" | ||||||
| 	[ "$airtime_mode" -gt 0 ] && append base_cfg "airtime_mode=$airtime_mode" "$N" | 	[ "$airtime_mode" -gt 0 ] && append base_cfg "airtime_mode=$airtime_mode" "$N" | ||||||
| 	[ -n "$maxassoc" ] && append base_cfg "iface_max_num_sta=$maxassoc" "$N" | 	[ -n "$maxassoc" ] && append base_cfg "iface_max_num_sta=$maxassoc" "$N" | ||||||
|  | 	[ "$maxassoc_ignore_probe" -gt 0 ] && append base_cfg "no_probe_resp_if_max_sta=1" "$N" | ||||||
| 	[ "$rnr_beacon" -gt 0 ] && append base_cfg "rnr_beacon=$rnr_beacon" "$N" | 	[ "$rnr_beacon" -gt 0 ] && append base_cfg "rnr_beacon=$rnr_beacon" "$N" | ||||||
| 	[ "$he_co_locate" -gt 0 ] && append base_cfg "he_co_locate=$he_co_locate" "$N" | 	[ "$he_co_locate" -gt 0 ] && append base_cfg "he_co_locate=$he_co_locate" "$N" | ||||||
| 	[ "$multiple_bssid" -gt 0 ] && append base_cfg "multiple_bssid=$multiple_bssid" "$N" | 	[ "$multiple_bssid" -gt 0 ] && append base_cfg "multiple_bssid=$multiple_bssid" "$N" | ||||||
| @@ -392,6 +395,10 @@ hostapd_common_add_bss_config() { | |||||||
| 	config_add_string fils_dhcp | 	config_add_string fils_dhcp | ||||||
|  |  | ||||||
| 	config_add_boolean ratelimit | 	config_add_boolean ratelimit | ||||||
|  |  | ||||||
|  | 	config_add_string uci_section | ||||||
|  |  | ||||||
|  | 	config_add_boolean dynamic_probe_resp | ||||||
| } | } | ||||||
|  |  | ||||||
| hostapd_set_vlan_file() { | hostapd_set_vlan_file() { | ||||||
| @@ -545,11 +552,13 @@ append_radius_server() { | |||||||
| 	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 \ | ||||||
| 		ownip radius_client_addr \ | 		dynamic_ownip ownip radius_client_addr \ | ||||||
| 		eap_reauth_period request_cui \ | 		eap_reauth_period request_cui \ | ||||||
| 		erp_domain mobility_domain \ | 		erp_domain mobility_domain \ | ||||||
| 		fils_realm fils_dhcp | 		fils_realm fils_dhcp | ||||||
|  |  | ||||||
|  | 	set_default dynamic_ownip 1 | ||||||
|  |  | ||||||
| 	# legacy compatibility | 	# legacy compatibility | ||||||
| 	[ -n "$auth_server" ] || json_get_var auth_server server | 	[ -n "$auth_server" ] || json_get_var auth_server server | ||||||
| 	[ -n "$auth_port" ] || json_get_var auth_port port | 	[ -n "$auth_port" ] || json_get_var auth_port port | ||||||
| @@ -598,7 +607,12 @@ append_radius_server() { | |||||||
| 	} | 	} | ||||||
| 	json_for_each_item append_radius_auth_req_attr radius_auth_req_attr | 	json_for_each_item append_radius_auth_req_attr radius_auth_req_attr | ||||||
|  |  | ||||||
| 	[ -n "$ownip" ] && append bss_conf "own_ip_addr=$ownip" "$N" | 	if [ -n "$ownip" ]; then | ||||||
|  | 		append bss_conf "own_ip_addr=$ownip" "$N" | ||||||
|  | 	elif [ "$dynamic_ownip" -gt 0 ]; then | ||||||
|  | 		append bss_conf "dynamic_own_ip_addr=$dynamic_ownip" "$N" | ||||||
|  | 	fi | ||||||
|  |  | ||||||
| 	[ -n "$radius_client_addr" ] && append bss_conf "radius_client_addr=$radius_client_addr" "$N" | 	[ -n "$radius_client_addr" ] && append bss_conf "radius_client_addr=$radius_client_addr" "$N" | ||||||
| 	[ "$macfilter" = radius ] && append bss_conf "macaddr_acl=2" "$N" | 	[ "$macfilter" = radius ] && append bss_conf "macaddr_acl=2" "$N" | ||||||
| } | } | ||||||
| @@ -627,7 +641,7 @@ hostapd_set_bss_options() { | |||||||
| 		airtime_bss_weight airtime_bss_limit airtime_sta_weight \ | 		airtime_bss_weight airtime_bss_limit airtime_sta_weight \ | ||||||
| 		multicast_to_unicast_all proxy_arp per_sta_vif \ | 		multicast_to_unicast_all proxy_arp per_sta_vif \ | ||||||
| 		eap_server eap_user_file ca_cert server_cert private_key private_key_passwd server_id \ | 		eap_server eap_user_file ca_cert server_cert private_key private_key_passwd server_id \ | ||||||
| 		vendor_elements fils | 		vendor_elements fils uci_section dynamic_probe_resp | ||||||
|  |  | ||||||
| 	set_default fils 0 | 	set_default fils 0 | ||||||
| 	set_default isolate 0 | 	set_default isolate 0 | ||||||
| @@ -650,6 +664,7 @@ hostapd_set_bss_options() { | |||||||
| 	set_default airtime_bss_weight 0 | 	set_default airtime_bss_weight 0 | ||||||
| 	set_default airtime_bss_limit 0 | 	set_default airtime_bss_limit 0 | ||||||
| 	set_default eap_server 0 | 	set_default eap_server 0 | ||||||
|  | 	set_default dynamic_probe_resp 0 | ||||||
|  |  | ||||||
| 	/usr/sbin/hostapd -vfils || fils=0 | 	/usr/sbin/hostapd -vfils || fils=0 | ||||||
|  |  | ||||||
| @@ -675,6 +690,7 @@ hostapd_set_bss_options() { | |||||||
| 	append bss_conf "preamble=$short_preamble" "$N" | 	append bss_conf "preamble=$short_preamble" "$N" | ||||||
| 	append bss_conf "wmm_enabled=$wmm" "$N" | 	append bss_conf "wmm_enabled=$wmm" "$N" | ||||||
| 	append bss_conf "ignore_broadcast_ssid=$hidden" "$N" | 	append bss_conf "ignore_broadcast_ssid=$hidden" "$N" | ||||||
|  | 	append bss_conf "dynamic_probe_resp=$dynamic_probe_resp" "$N" | ||||||
| 	append bss_conf "uapsd_advertisement_enabled=$uapsd" "$N" | 	append bss_conf "uapsd_advertisement_enabled=$uapsd" "$N" | ||||||
| 	append bss_conf "utf8_ssid=$utf8_ssid" "$N" | 	append bss_conf "utf8_ssid=$utf8_ssid" "$N" | ||||||
| 	append bss_conf "multi_ap=$multi_ap" "$N" | 	append bss_conf "multi_ap=$multi_ap" "$N" | ||||||
| @@ -689,7 +705,9 @@ hostapd_set_bss_options() { | |||||||
| 		[ -n "$wpa_strict_rekey" ] && append bss_conf "wpa_strict_rekey=$wpa_strict_rekey" "$N" | 		[ -n "$wpa_strict_rekey" ] && append bss_conf "wpa_strict_rekey=$wpa_strict_rekey" "$N" | ||||||
| 	} | 	} | ||||||
|  |  | ||||||
| 	[ -n "$nasid" ] && append bss_conf "nas_identifier=$nasid" "$N" | 	set_default nasid "${macaddr//\:}" | ||||||
|  | 	append bss_conf "nas_identifier=$nasid" "$N" | ||||||
|  |  | ||||||
| 	[ -n "$acct_server" ] && { | 	[ -n "$acct_server" ] && { | ||||||
| 		append bss_conf "acct_server_addr=$acct_server" "$N" | 		append bss_conf "acct_server_addr=$acct_server" "$N" | ||||||
| 		append bss_conf "acct_server_port=$acct_port" "$N" | 		append bss_conf "acct_server_port=$acct_port" "$N" | ||||||
| @@ -907,7 +925,6 @@ hostapd_set_bss_options() { | |||||||
| 			append bss_conf "ft_psk_generate_local=$ft_psk_generate_local" "$N" | 			append bss_conf "ft_psk_generate_local=$ft_psk_generate_local" "$N" | ||||||
| 			append bss_conf "ft_over_ds=$ft_over_ds" "$N" | 			append bss_conf "ft_over_ds=$ft_over_ds" "$N" | ||||||
| 			append bss_conf "reassociation_deadline=$reassociation_deadline" "$N" | 			append bss_conf "reassociation_deadline=$reassociation_deadline" "$N" | ||||||
| 			[ -n "$nasid" ] || append bss_conf "nas_identifier=${macaddr//\:}" "$N" |  | ||||||
|  |  | ||||||
| 			if [ "$skip_kh_setup" -eq "0" ]; then | 			if [ "$skip_kh_setup" -eq "0" ]; then | ||||||
| 				json_get_vars r0_key_lifetime r1_key_holder pmk_r1_push | 				json_get_vars r0_key_lifetime r1_key_holder pmk_r1_push | ||||||
| @@ -1152,6 +1169,8 @@ hostapd_set_bss_options() { | |||||||
| 		append bss_conf "per_sta_vif=$per_sta_vif" "$N" | 		append bss_conf "per_sta_vif=$per_sta_vif" "$N" | ||||||
| 	fi | 	fi | ||||||
|  |  | ||||||
|  | 	[ -n "$uci_section" ] && append bss_conf "uci_section=$uci_section" "$N" | ||||||
|  |  | ||||||
| 	json_get_values opts hostapd_bss_options | 	json_get_values opts hostapd_bss_options | ||||||
| 	for val in $opts; do | 	for val in $opts; do | ||||||
| 		append bss_conf "$val" "$N" | 		append bss_conf "$val" "$N" | ||||||
|   | |||||||
| @@ -120,7 +120,7 @@ Index: hostapd-2021-02-20-59e9794c/src/ap/sta_info.c | |||||||
|  	else |  	else | ||||||
|  #endif /* CONFIG_P2P */ |  #endif /* CONFIG_P2P */ | ||||||
| -		os_snprintf(buf, sizeof(buf), MACSTR, MAC2STR(sta->addr)); | -		os_snprintf(buf, sizeof(buf), MACSTR, MAC2STR(sta->addr)); | ||||||
| +		os_snprintf(buf, sizeof(buf), MACSTR " %d %d", MAC2STR(sta->addr), sta->bandwidth[0] / 1000, sta->bandwidth[1] / 1000); | +		os_snprintf(buf, sizeof(buf), MACSTR " %d %d", MAC2STR(sta->addr), sta->bandwidth[0] / 1000000, sta->bandwidth[1] / 1000000); | ||||||
|   |   | ||||||
|  	if (hapd->sta_authorized_cb) |  	if (hapd->sta_authorized_cb) | ||||||
|  		hapd->sta_authorized_cb(hapd->sta_authorized_cb_ctx, |  		hapd->sta_authorized_cb(hapd->sta_authorized_cb_ctx, | ||||||
|   | |||||||
							
								
								
									
										109
									
								
								feeds/wifi-ax/hostapd/patches/760-dynamic_own_ip.patch
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										109
									
								
								feeds/wifi-ax/hostapd/patches/760-dynamic_own_ip.patch
									
									
									
									
									
										Normal file
									
								
							| @@ -0,0 +1,109 @@ | |||||||
|  | --- a/src/ap/ap_config.h | ||||||
|  | +++ b/src/ap/ap_config.h | ||||||
|  | @@ -311,6 +311,7 @@ struct hostapd_bss_config { | ||||||
|  |  	unsigned int eap_sim_db_timeout; | ||||||
|  |  	int eap_server_erp; /* Whether ERP is enabled on internal EAP server */ | ||||||
|  |  	struct hostapd_ip_addr own_ip_addr; | ||||||
|  | +	int dynamic_own_ip_addr; | ||||||
|  |  	char *nas_identifier; | ||||||
|  |  	struct hostapd_radius_servers *radius; | ||||||
|  |  	int acct_interim_interval; | ||||||
|  | --- a/src/radius/radius_client.c | ||||||
|  | +++ b/src/radius/radius_client.c | ||||||
|  | @@ -163,6 +163,8 @@ struct radius_client_data { | ||||||
|  |  	 */ | ||||||
|  |  	void *ctx; | ||||||
|  |   | ||||||
|  | +	struct hostapd_ip_addr local_ip; | ||||||
|  | + | ||||||
|  |  	/** | ||||||
|  |  	 * conf - RADIUS client configuration (list of RADIUS servers to use) | ||||||
|  |  	 */ | ||||||
|  | @@ -720,6 +722,30 @@ static void radius_client_list_add(struc | ||||||
|  |   | ||||||
|  |   | ||||||
|  |  /** | ||||||
|  | + * radius_client_send - Get local address for the RADIUS auth socket | ||||||
|  | + * @radius: RADIUS client context from radius_client_init() | ||||||
|  | + * @addr: pointer to store the address | ||||||
|  | + * | ||||||
|  | + * This function returns the local address for the connection to the RADIUS | ||||||
|  | + * auth server. It also opens the socket if it's not available yet. | ||||||
|  | + */ | ||||||
|  | +int radius_client_get_local_addr(struct radius_client_data *radius, | ||||||
|  | +				 struct hostapd_ip_addr *addr) | ||||||
|  | +{ | ||||||
|  | +	struct hostapd_radius_servers *conf = radius->conf; | ||||||
|  | + | ||||||
|  | +	if (conf->auth_server && radius->auth_sock < 0) | ||||||
|  | +		radius_client_init_auth(radius); | ||||||
|  | + | ||||||
|  | +	if (radius->auth_sock < 0) | ||||||
|  | +		return -1; | ||||||
|  | + | ||||||
|  | +	memcpy(addr, &radius->local_ip, sizeof(*addr)); | ||||||
|  | + | ||||||
|  | +	return 0; | ||||||
|  | +} | ||||||
|  | + | ||||||
|  | +/** | ||||||
|  |   * radius_client_send - Send a RADIUS request | ||||||
|  |   * @radius: RADIUS client context from radius_client_init() | ||||||
|  |   * @msg: RADIUS message to be sent | ||||||
|  | @@ -1238,6 +1264,10 @@ radius_change_server(struct radius_clien | ||||||
|  |  			wpa_printf(MSG_DEBUG, "RADIUS local address: %s:%u", | ||||||
|  |  				   inet_ntoa(claddr.sin_addr), | ||||||
|  |  				   ntohs(claddr.sin_port)); | ||||||
|  | +			if (auth) { | ||||||
|  | +				radius->local_ip.af = AF_INET; | ||||||
|  | +				radius->local_ip.u.v4 = claddr.sin_addr; | ||||||
|  | +			} | ||||||
|  |  		} | ||||||
|  |  		break; | ||||||
|  |  #ifdef CONFIG_IPV6 | ||||||
|  | @@ -1249,6 +1279,10 @@ radius_change_server(struct radius_clien | ||||||
|  |  				   inet_ntop(AF_INET6, &claddr6.sin6_addr, | ||||||
|  |  					     abuf, sizeof(abuf)), | ||||||
|  |  				   ntohs(claddr6.sin6_port)); | ||||||
|  | +			if (auth) { | ||||||
|  | +				radius->local_ip.af = AF_INET6; | ||||||
|  | +				radius->local_ip.u.v6 = claddr6.sin6_addr; | ||||||
|  | +			} | ||||||
|  |  		} | ||||||
|  |  		break; | ||||||
|  |  	} | ||||||
|  | --- a/src/radius/radius_client.h | ||||||
|  | +++ b/src/radius/radius_client.h | ||||||
|  | @@ -249,6 +249,8 @@ int radius_client_register(struct radius | ||||||
|  |  void radius_client_set_interim_error_cb(struct radius_client_data *radius, | ||||||
|  |  					void (*cb)(const u8 *addr, void *ctx), | ||||||
|  |  					void *ctx); | ||||||
|  | +int radius_client_get_local_addr(struct radius_client_data *radius, | ||||||
|  | +				 struct hostapd_ip_addr * addr); | ||||||
|  |  int radius_client_send(struct radius_client_data *radius, | ||||||
|  |  		       struct radius_msg *msg, | ||||||
|  |  		       RadiusType msg_type, const u8 *addr); | ||||||
|  | --- a/src/ap/ieee802_1x.c | ||||||
|  | +++ b/src/ap/ieee802_1x.c | ||||||
|  | @@ -535,6 +535,10 @@ int add_common_radius_attr(struct hostap | ||||||
|  |  	struct hostapd_radius_attr *attr; | ||||||
|  |  	int len; | ||||||
|  |   | ||||||
|  | +	if (hapd->conf->dynamic_own_ip_addr) | ||||||
|  | +		radius_client_get_local_addr(hapd->radius, | ||||||
|  | +					     &hapd->conf->own_ip_addr); | ||||||
|  | + | ||||||
|  |  	if (!hostapd_config_get_radius_attr(req_attr, | ||||||
|  |  					    RADIUS_ATTR_NAS_IP_ADDRESS) && | ||||||
|  |  	    hapd->conf->own_ip_addr.af == AF_INET && | ||||||
|  | --- a/hostapd/config_file.c | ||||||
|  | +++ b/hostapd/config_file.c | ||||||
|  | @@ -2681,6 +2681,8 @@ static int hostapd_config_fill(struct ho | ||||||
|  |  	} else if (os_strcmp(buf, "iapp_interface") == 0) { | ||||||
|  |  		wpa_printf(MSG_INFO, "DEPRECATED: iapp_interface not used"); | ||||||
|  |  #endif /* CONFIG_IAPP */ | ||||||
|  | +	} else if (os_strcmp(buf, "dynamic_own_ip_addr") == 0) { | ||||||
|  | +		bss->dynamic_own_ip_addr = atoi(pos); | ||||||
|  |  	} else if (os_strcmp(buf, "own_ip_addr") == 0) { | ||||||
|  |  		if (hostapd_parse_ip_addr(pos, &bss->own_ip_addr)) { | ||||||
|  |  			wpa_printf(MSG_ERROR, | ||||||
| @@ -1,76 +1,298 @@ | |||||||
| Index: hostapd-2021-02-20-59e9794c/src/ap/hostapd.c | --- a/src/radius/radius_das.h | ||||||
| =================================================================== | +++ b/src/radius/radius_das.h | ||||||
| --- hostapd-2021-02-20-59e9794c.orig/src/ap/hostapd.c | @@ -44,6 +44,7 @@ struct radius_das_attrs { | ||||||
| +++ hostapd-2021-02-20-59e9794c/src/ap/hostapd.c |  struct radius_das_conf { | ||||||
| @@ -862,7 +862,6 @@ static int hostapd_das_nas_mismatch(stru |  	int port; | ||||||
|  	return 0; |  	const u8 *shared_secret; | ||||||
|  } | +	const u8 *nas_identifier; | ||||||
|   |  	size_t shared_secret_len; | ||||||
| - |  	const struct hostapd_ip_addr *client_addr; | ||||||
|  static struct sta_info * hostapd_das_find_sta(struct hostapd_data *hapd, |  	unsigned int time_window; | ||||||
|  					      struct radius_das_attrs *attr, | --- a/src/ap/hostapd.c | ||||||
|  					      int *multi) | +++ b/src/ap/hostapd.c | ||||||
| @@ -1050,6 +1049,24 @@ static int hostapd_das_disconnect_pmksa( | @@ -1367,6 +1367,7 @@ static int hostapd_setup_bss(struct host | ||||||
|  } |  		struct radius_das_conf das_conf; | ||||||
|  |  		os_memset(&das_conf, 0, sizeof(das_conf)); | ||||||
|  |  		das_conf.port = conf->radius_das_port; | ||||||
|  | +		das_conf.nas_identifier = conf->nas_identifier; | ||||||
|  |  		das_conf.shared_secret = conf->radius_das_shared_secret; | ||||||
|  |  		das_conf.shared_secret_len = | ||||||
|  |  			conf->radius_das_shared_secret_len; | ||||||
|  | --- a/src/radius/radius_das.c | ||||||
|  | +++ b/src/radius/radius_das.c | ||||||
|  | @@ -12,13 +12,26 @@ | ||||||
|  |  #include "utils/common.h" | ||||||
|  |  #include "utils/eloop.h" | ||||||
|  |  #include "utils/ip_addr.h" | ||||||
|  | +#include "utils/list.h" | ||||||
|  |  #include "radius.h" | ||||||
|  |  #include "radius_das.h" | ||||||
|   |   | ||||||
|   |   | ||||||
| +static struct hostapd_data * ap_get_hapd(struct hostapd_data *hapd, struct radius_das_attrs *attr) | -struct radius_das_data { | ||||||
| +{ | +static struct dl_list das_ports = DL_LIST_HEAD_INIT(das_ports); | ||||||
| +	size_t i; |  | ||||||
| +	int multi; |  | ||||||
| + | + | ||||||
| +	for (i = 0; i < hapd->iface->num_bss; i++) { | +struct radius_das_port { | ||||||
| +		if (!hapd->iface->bss[i]->iface->bss[i]->radius_das) | +	struct dl_list list; | ||||||
| +			continue; | +	struct dl_list das_data; | ||||||
| +		if (hapd->conf->radius_das_port !=hapd->iface->bss[i]->iface->bss[i]->conf->radius_das_port) | + | ||||||
| +			continue; | +	int port; | ||||||
| +		if (hostapd_das_find_sta(hapd, attr, &multi)) |  	int sock; | ||||||
| +			return hapd->iface->bss[i]; | +}; | ||||||
|  | + | ||||||
|  | +struct radius_das_data { | ||||||
|  | +	struct dl_list list; | ||||||
|  | +	struct radius_das_port *port; | ||||||
|  |  	u8 *shared_secret; | ||||||
|  | +	u8 *nas_identifier; | ||||||
|  |  	size_t shared_secret_len; | ||||||
|  |  	struct hostapd_ip_addr client_addr; | ||||||
|  |  	unsigned int time_window; | ||||||
|  | @@ -378,56 +391,17 @@ fail: | ||||||
|  |  } | ||||||
|  |   | ||||||
|  |   | ||||||
|  | -static void radius_das_receive(int sock, void *eloop_ctx, void *sock_ctx) | ||||||
|  | +static void | ||||||
|  | +radius_das_receive_msg(struct radius_das_data *das, struct radius_msg *msg, | ||||||
|  | +		       struct sockaddr *from, socklen_t fromlen, | ||||||
|  | +		       char *abuf, int from_port) | ||||||
|  |  { | ||||||
|  | -	struct radius_das_data *das = eloop_ctx; | ||||||
|  | -	u8 buf[1500]; | ||||||
|  | -	union { | ||||||
|  | -		struct sockaddr_storage ss; | ||||||
|  | -		struct sockaddr_in sin; | ||||||
|  | -#ifdef CONFIG_IPV6 | ||||||
|  | -		struct sockaddr_in6 sin6; | ||||||
|  | -#endif /* CONFIG_IPV6 */ | ||||||
|  | -	} from; | ||||||
|  | -	char abuf[50]; | ||||||
|  | -	int from_port = 0; | ||||||
|  | -	socklen_t fromlen; | ||||||
|  | -	int len; | ||||||
|  | -	struct radius_msg *msg, *reply = NULL; | ||||||
|  | +	struct radius_msg *reply = NULL; | ||||||
|  |  	struct radius_hdr *hdr; | ||||||
|  |  	struct wpabuf *rbuf; | ||||||
|  | +	struct os_time now; | ||||||
|  |  	u32 val; | ||||||
|  |  	int res; | ||||||
|  | -	struct os_time now; | ||||||
|  | - | ||||||
|  | -	fromlen = sizeof(from); | ||||||
|  | -	len = recvfrom(sock, buf, sizeof(buf), 0, | ||||||
|  | -		       (struct sockaddr *) &from.ss, &fromlen); | ||||||
|  | -	if (len < 0) { | ||||||
|  | -		wpa_printf(MSG_ERROR, "DAS: recvfrom: %s", strerror(errno)); | ||||||
|  | -		return; | ||||||
|  | -	} | ||||||
|  | - | ||||||
|  | -	os_strlcpy(abuf, inet_ntoa(from.sin.sin_addr), sizeof(abuf)); | ||||||
|  | -	from_port = ntohs(from.sin.sin_port); | ||||||
|  | - | ||||||
|  | -	wpa_printf(MSG_DEBUG, "DAS: Received %d bytes from %s:%d", | ||||||
|  | -		   len, abuf, from_port); | ||||||
|  | -	if (das->client_addr.u.v4.s_addr && | ||||||
|  | -	    das->client_addr.u.v4.s_addr != from.sin.sin_addr.s_addr) { | ||||||
|  | -		wpa_printf(MSG_DEBUG, "DAS: Drop message from unknown client"); | ||||||
|  | -		return; | ||||||
|  | -	} | ||||||
|  | - | ||||||
|  | -	msg = radius_msg_parse(buf, len); | ||||||
|  | -	if (msg == NULL) { | ||||||
|  | -		wpa_printf(MSG_DEBUG, "DAS: Parsing incoming RADIUS packet " | ||||||
|  | -			   "from %s:%d failed", abuf, from_port); | ||||||
|  | -		return; | ||||||
|  | -	} | ||||||
|  | - | ||||||
|  | -	if (wpa_debug_level <= MSG_MSGDUMP) | ||||||
|  | -		radius_msg_dump(msg); | ||||||
|  |   | ||||||
|  |  	if (radius_msg_verify_das_req(msg, das->shared_secret, | ||||||
|  |  				       das->shared_secret_len, | ||||||
|  | @@ -494,9 +468,8 @@ static void radius_das_receive(int sock, | ||||||
|  |  			radius_msg_dump(reply); | ||||||
|  |   | ||||||
|  |  		rbuf = radius_msg_get_buf(reply); | ||||||
|  | -		res = sendto(das->sock, wpabuf_head(rbuf), | ||||||
|  | -			     wpabuf_len(rbuf), 0, | ||||||
|  | -			     (struct sockaddr *) &from.ss, fromlen); | ||||||
|  | +		res = sendto(das->port->sock, wpabuf_head(rbuf), | ||||||
|  | +			     wpabuf_len(rbuf), 0, from, fromlen); | ||||||
|  |  		if (res < 0) { | ||||||
|  |  			wpa_printf(MSG_ERROR, "DAS: sendto(to %s:%d): %s", | ||||||
|  |  				   abuf, from_port, strerror(errno)); | ||||||
|  | @@ -508,6 +481,72 @@ fail: | ||||||
|  |  	radius_msg_free(reply); | ||||||
|  |  } | ||||||
|  |   | ||||||
|  | +static void radius_das_receive(int sock, void *eloop_ctx, void *sock_ctx) | ||||||
|  | +{ | ||||||
|  | +	struct radius_das_port *p = eloop_ctx; | ||||||
|  | +	struct radius_das_data *das; | ||||||
|  | +	u8 buf[1500]; | ||||||
|  | +	union { | ||||||
|  | +		struct sockaddr_storage ss; | ||||||
|  | +		struct sockaddr_in sin; | ||||||
|  | +#ifdef CONFIG_IPV6 | ||||||
|  | +		struct sockaddr_in6 sin6; | ||||||
|  | +#endif /* CONFIG_IPV6 */ | ||||||
|  | +	} from; | ||||||
|  | +	struct radius_msg *msg; | ||||||
|  | +	size_t nasid_len = 0; | ||||||
|  | +	u8 *nasid_buf = NULL; | ||||||
|  | +	char abuf[50]; | ||||||
|  | +	int from_port = 0; | ||||||
|  | +	socklen_t fromlen; | ||||||
|  | +	int found = 0; | ||||||
|  | +	int len; | ||||||
|  | + | ||||||
|  | +	fromlen = sizeof(from); | ||||||
|  | +	len = recvfrom(sock, buf, sizeof(buf), 0, | ||||||
|  | +		       (struct sockaddr *) &from.ss, &fromlen); | ||||||
|  | +	if (len < 0) { | ||||||
|  | +		wpa_printf(MSG_ERROR, "DAS: recvfrom: %s", strerror(errno)); | ||||||
|  | +		return; | ||||||
| +	} | +	} | ||||||
| +	return hapd; | + | ||||||
|  | +	os_strlcpy(abuf, inet_ntoa(from.sin.sin_addr), sizeof(abuf)); | ||||||
|  | +	from_port = ntohs(from.sin.sin_port); | ||||||
|  | + | ||||||
|  | +	msg = radius_msg_parse(buf, len); | ||||||
|  | +	if (msg == NULL) { | ||||||
|  | +		wpa_printf(MSG_DEBUG, "DAS: Parsing incoming RADIUS packet " | ||||||
|  | +			   "from %s:%d failed", abuf, from_port); | ||||||
|  | +		return; | ||||||
|  | +	} | ||||||
|  | + | ||||||
|  | +	wpa_printf(MSG_DEBUG, "DAS: Received %d bytes from %s:%d", | ||||||
|  | +		   len, abuf, from_port); | ||||||
|  | + | ||||||
|  | +	if (wpa_debug_level <= MSG_MSGDUMP) | ||||||
|  | +		radius_msg_dump(msg); | ||||||
|  | + | ||||||
|  | +	radius_msg_get_attr_ptr(msg, RADIUS_ATTR_NAS_IDENTIFIER, | ||||||
|  | +				&nasid_buf, &nasid_len, NULL); | ||||||
|  | +	dl_list_for_each(das, &p->das_data, struct radius_das_data, list) { | ||||||
|  | +		if (das->client_addr.u.v4.s_addr && | ||||||
|  | +		    das->client_addr.u.v4.s_addr != from.sin.sin_addr.s_addr) | ||||||
|  | +			continue; | ||||||
|  | + | ||||||
|  | +		if (das->nas_identifier && nasid_buf && | ||||||
|  | +		    (nasid_len != os_strlen(das->nas_identifier) || | ||||||
|  | +		     os_memcmp(das->nas_identifier, nasid_buf, nasid_len) != 0)) | ||||||
|  | +			continue; | ||||||
|  | + | ||||||
|  | +		found = 1; | ||||||
|  | +		radius_das_receive_msg(das, msg, (struct sockaddr *)&from.ss, | ||||||
|  | +				       fromlen, abuf, from_port); | ||||||
|  | +	} | ||||||
|  | + | ||||||
|  | +	if (!found) | ||||||
|  | +		wpa_printf(MSG_DEBUG, "DAS: Drop message from unknown client"); | ||||||
| +} | +} | ||||||
| + | + | ||||||
| + |   | ||||||
| + |  static int radius_das_open_socket(int port) | ||||||
|  static enum radius_das_res |  | ||||||
|  hostapd_das_disconnect(void *ctx, struct radius_das_attrs *attr) |  | ||||||
|  { |  { | ||||||
| @@ -1057,6 +1074,10 @@ hostapd_das_disconnect(void *ctx, struct | @@ -533,6 +572,49 @@ static int radius_das_open_socket(int po | ||||||
|  	struct sta_info *sta; |  } | ||||||
|  	int multi; |  | ||||||
|   |   | ||||||
| +	hapd = ap_get_hapd(hapd, attr); |   | ||||||
| +	if (!hapd) | +static struct radius_das_port * | ||||||
| +		return RADIUS_DAS_SESSION_NOT_FOUND; | +radius_das_open_port(int port) | ||||||
|  | +{ | ||||||
|  | +	struct radius_das_port *p; | ||||||
| + | + | ||||||
|  	if (hostapd_das_nas_mismatch(hapd, attr)) | +	dl_list_for_each(p, &das_ports, struct radius_das_port, list) { | ||||||
|  		return RADIUS_DAS_NAS_MISMATCH; | +		if (p->port == port) | ||||||
|   | +			return p; | ||||||
| @@ -1096,6 +1117,10 @@ hostapd_das_coa(void *ctx, struct radius | +	} | ||||||
|  	struct sta_info *sta; |  | ||||||
|  	int multi; |  | ||||||
|   |  | ||||||
| +	hapd = ap_get_hapd(hapd, attr); |  | ||||||
| +	if (!hapd) |  | ||||||
| +		return RADIUS_DAS_SESSION_NOT_FOUND; |  | ||||||
| + | + | ||||||
|  	if (hostapd_das_nas_mismatch(hapd, attr)) | +	p = os_zalloc(sizeof(*p)); | ||||||
|  		return RADIUS_DAS_NAS_MISMATCH; | +	if (p == NULL) | ||||||
|  | +		return NULL; | ||||||
|  | + | ||||||
|  | +	dl_list_init(&p->das_data); | ||||||
|  | +	p->port = port; | ||||||
|  | +	p->sock = radius_das_open_socket(port); | ||||||
|  | +	if (p->sock < 0) | ||||||
|  | +		goto free_port; | ||||||
|  | + | ||||||
|  | +	if (eloop_register_read_sock(p->sock, radius_das_receive, p, NULL)) | ||||||
|  | +		goto close_port; | ||||||
|  | + | ||||||
|  | +	dl_list_add(&das_ports, &p->list); | ||||||
|  | + | ||||||
|  | +	return p; | ||||||
|  | + | ||||||
|  | +close_port: | ||||||
|  | +	close(p->sock); | ||||||
|  | +free_port: | ||||||
|  | +	os_free(p); | ||||||
|  | + | ||||||
|  | +	return NULL; | ||||||
|  | +} | ||||||
|  | + | ||||||
|  | +static void radius_das_close_port(struct radius_das_port *p) | ||||||
|  | +{ | ||||||
|  | +	dl_list_del(&p->list); | ||||||
|  | +	eloop_unregister_read_sock(p->sock); | ||||||
|  | +	close(p->sock); | ||||||
|  | +	free(p); | ||||||
|  | +} | ||||||
|  | + | ||||||
|  |  struct radius_das_data * | ||||||
|  |  radius_das_init(struct radius_das_conf *conf) | ||||||
|  |  { | ||||||
|  | @@ -553,6 +635,8 @@ radius_das_init(struct radius_das_conf * | ||||||
|  |  	das->ctx = conf->ctx; | ||||||
|  |  	das->disconnect = conf->disconnect; | ||||||
|  |  	das->coa = conf->coa; | ||||||
|  | +	if (conf->nas_identifier) | ||||||
|  | +		das->nas_identifier = os_strdup(conf->nas_identifier); | ||||||
|   |   | ||||||
| Index: hostapd-2021-02-20-59e9794c/src/radius/radius_das.c |  	os_memcpy(&das->client_addr, conf->client_addr, | ||||||
| =================================================================== |  		  sizeof(das->client_addr)); | ||||||
| --- hostapd-2021-02-20-59e9794c.orig/src/radius/radius_das.c | @@ -565,19 +649,15 @@ radius_das_init(struct radius_das_conf * | ||||||
| +++ hostapd-2021-02-20-59e9794c/src/radius/radius_das.c |  	} | ||||||
| @@ -568,10 +568,9 @@ radius_das_init(struct radius_das_conf * |  	das->shared_secret_len = conf->shared_secret_len; | ||||||
|   |   | ||||||
|  	das->sock = radius_das_open_socket(conf->port); | -	das->sock = radius_das_open_socket(conf->port); | ||||||
|  	if (das->sock < 0) { | -	if (das->sock < 0) { | ||||||
| -		wpa_printf(MSG_ERROR, "Failed to open UDP socket for RADIUS " | +	das->port = radius_das_open_port(conf->port); | ||||||
| +		wpa_printf(MSG_ERROR, "Failed to open UDP socket for RADIUS - reusing existing port " | +	if (!das->port) { | ||||||
|  |  		wpa_printf(MSG_ERROR, "Failed to open UDP socket for RADIUS " | ||||||
|  			   "DAS"); |  			   "DAS"); | ||||||
| -		radius_das_deinit(das); |  		radius_das_deinit(das); | ||||||
| -		return NULL; |  		return NULL; | ||||||
| +		return das; |  | ||||||
|  	} |  	} | ||||||
|   |   | ||||||
|  	if (eloop_register_read_sock(das->sock, radius_das_receive, das, NULL)) | -	if (eloop_register_read_sock(das->sock, radius_das_receive, das, NULL)) | ||||||
|  | -	{ | ||||||
|  | -		radius_das_deinit(das); | ||||||
|  | -		return NULL; | ||||||
|  | -	} | ||||||
|  | +	dl_list_add(&das->port->das_data, &das->list); | ||||||
|  |   | ||||||
|  |  	return das; | ||||||
|  |  } | ||||||
|  | @@ -588,11 +668,14 @@ void radius_das_deinit(struct radius_das | ||||||
|  |  	if (das == NULL) | ||||||
|  |  		return; | ||||||
|  |   | ||||||
|  | -	if (das->sock >= 0) { | ||||||
|  | -		eloop_unregister_read_sock(das->sock); | ||||||
|  | -		close(das->sock); | ||||||
|  | +	if (das->port) { | ||||||
|  | +		dl_list_del(&das->list); | ||||||
|  | + | ||||||
|  | +		if (dl_list_empty(&das->port->das_data)) | ||||||
|  | +			radius_das_close_port(das->port); | ||||||
|  |  	} | ||||||
|  |   | ||||||
|  | +	os_free(das->nas_identifier); | ||||||
|  |  	os_free(das->shared_secret); | ||||||
|  |  	os_free(das); | ||||||
|  |  } | ||||||
|   | |||||||
							
								
								
									
										51
									
								
								feeds/wifi-ax/hostapd/patches/901-cfg-section.patch
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										51
									
								
								feeds/wifi-ax/hostapd/patches/901-cfg-section.patch
									
									
									
									
									
										Normal file
									
								
							| @@ -0,0 +1,51 @@ | |||||||
|  | Index: hostapd-2021-02-20-59e9794c/hostapd/config_file.c | ||||||
|  | =================================================================== | ||||||
|  | --- hostapd-2021-02-20-59e9794c.orig/hostapd/config_file.c | ||||||
|  | +++ hostapd-2021-02-20-59e9794c/hostapd/config_file.c | ||||||
|  | @@ -2366,6 +2366,8 @@ static int hostapd_config_fill(struct ho | ||||||
|  |  			return 1; | ||||||
|  |  		} | ||||||
|  |  		conf->driver = driver; | ||||||
|  | +	} else if (os_strcmp(buf, "uci_section") == 0) { | ||||||
|  | +		bss->uci_section = os_strdup(pos); | ||||||
|  |  	} else if (os_strcmp(buf, "driver_params") == 0) { | ||||||
|  |  		os_free(conf->driver_params); | ||||||
|  |  		conf->driver_params = os_strdup(pos); | ||||||
|  | Index: hostapd-2021-02-20-59e9794c/src/ap/ap_config.h | ||||||
|  | =================================================================== | ||||||
|  | --- hostapd-2021-02-20-59e9794c.orig/src/ap/ap_config.h | ||||||
|  | +++ hostapd-2021-02-20-59e9794c/src/ap/ap_config.h | ||||||
|  | @@ -279,6 +279,7 @@ struct hostapd_bss_config { | ||||||
|  |  	char snoop_iface[IFNAMSIZ + 1]; | ||||||
|  |  	char vlan_bridge[IFNAMSIZ + 1]; | ||||||
|  |  	char wds_bridge[IFNAMSIZ + 1]; | ||||||
|  | +	char *uci_section; | ||||||
|  |   | ||||||
|  |  	char *config_id; | ||||||
|  |   | ||||||
|  | Index: hostapd-2021-02-20-59e9794c/src/ap/ubus.c | ||||||
|  | =================================================================== | ||||||
|  | --- hostapd-2021-02-20-59e9794c.orig/src/ap/ubus.c | ||||||
|  | +++ hostapd-2021-02-20-59e9794c/src/ap/ubus.c | ||||||
|  | @@ -467,6 +467,9 @@ hostapd_bss_get_status(struct ubus_conte | ||||||
|  |  			hapd->iface->cac_started ? hapd->iface->dfs_cac_ms / 1000 - now.sec : 0); | ||||||
|  |  	blobmsg_close_table(&b, dfs_table); | ||||||
|  |   | ||||||
|  | +	if (hapd->conf->uci_section) | ||||||
|  | +		blobmsg_add_string(&b, "uci_section", hapd->conf->uci_section); | ||||||
|  | + | ||||||
|  |  	ubus_send_reply(ctx, req, b.head); | ||||||
|  |   | ||||||
|  |  	return 0; | ||||||
|  | Index: hostapd-2021-02-20-59e9794c/src/ap/ap_config.c | ||||||
|  | =================================================================== | ||||||
|  | --- hostapd-2021-02-20-59e9794c.orig/src/ap/ap_config.c | ||||||
|  | +++ hostapd-2021-02-20-59e9794c/src/ap/ap_config.c | ||||||
|  | @@ -785,6 +785,7 @@ void hostapd_config_free_bss(struct host | ||||||
|  |  	os_free(conf->radius_req_attr_sqlite); | ||||||
|  |  	os_free(conf->rsn_preauth_interfaces); | ||||||
|  |  	os_free(conf->ctrl_interface); | ||||||
|  | +	os_free(conf->uci_section); | ||||||
|  |  	os_free(conf->config_id); | ||||||
|  |  	os_free(conf->ca_cert); | ||||||
|  |  	os_free(conf->server_cert); | ||||||
							
								
								
									
										49
									
								
								feeds/wifi-ax/hostapd/patches/999-probe-request.patch
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										49
									
								
								feeds/wifi-ax/hostapd/patches/999-probe-request.patch
									
									
									
									
									
										Normal file
									
								
							| @@ -0,0 +1,49 @@ | |||||||
|  | Index: hostapd-2021-02-20-59e9794c/hostapd/config_file.c | ||||||
|  | =================================================================== | ||||||
|  | --- hostapd-2021-02-20-59e9794c.orig/hostapd/config_file.c | ||||||
|  | +++ hostapd-2021-02-20-59e9794c/hostapd/config_file.c | ||||||
|  | @@ -3339,6 +3339,8 @@ static int hostapd_config_fill(struct ho | ||||||
|  |  		bss->ignore_broadcast_ssid = atoi(pos); | ||||||
|  |  	} else if (os_strcmp(buf, "no_probe_resp_if_max_sta") == 0) { | ||||||
|  |  		bss->no_probe_resp_if_max_sta = atoi(pos); | ||||||
|  | +	} else if (os_strcmp(buf, "dynamic_probe_resp") == 0) { | ||||||
|  | +		bss->dynamic_probe_resp = atoi(pos); | ||||||
|  |  #ifdef CONFIG_WEP | ||||||
|  |  	} else if (os_strcmp(buf, "wep_default_key") == 0) { | ||||||
|  |  		bss->ssid.wep.idx = atoi(pos); | ||||||
|  | Index: hostapd-2021-02-20-59e9794c/src/ap/ap_config.h | ||||||
|  | =================================================================== | ||||||
|  | --- hostapd-2021-02-20-59e9794c.orig/src/ap/ap_config.h | ||||||
|  | +++ hostapd-2021-02-20-59e9794c/src/ap/ap_config.h | ||||||
|  | @@ -460,6 +460,7 @@ struct hostapd_bss_config { | ||||||
|  |  	int ap_max_inactivity; | ||||||
|  |  	int ignore_broadcast_ssid; | ||||||
|  |  	int no_probe_resp_if_max_sta; | ||||||
|  | +	int dynamic_probe_resp; | ||||||
|  |   | ||||||
|  |  	int wmm_enabled; | ||||||
|  |  	int wmm_uapsd; | ||||||
|  | Index: hostapd-2021-02-20-59e9794c/src/ap/beacon.c | ||||||
|  | =================================================================== | ||||||
|  | --- hostapd-2021-02-20-59e9794c.orig/src/ap/beacon.c | ||||||
|  | +++ hostapd-2021-02-20-59e9794c/src/ap/beacon.c | ||||||
|  | @@ -920,7 +920,8 @@ void handle_probe_req(struct hostapd_dat | ||||||
|  |  	} | ||||||
|  |  #endif /* CONFIG_P2P */ | ||||||
|  |   | ||||||
|  | -	if (hapd->conf->ignore_broadcast_ssid && elems.ssid_len == 0 && | ||||||
|  | +	if (!hapd->conf->dynamic_probe_resp && | ||||||
|  | +	    hapd->conf->ignore_broadcast_ssid && elems.ssid_len == 0 && | ||||||
|  |  	    elems.ssid_list_len == 0 && elems.short_ssid_list_len == 0) { | ||||||
|  |  		wpa_printf(MSG_MSGDUMP, "Probe Request from " MACSTR " for " | ||||||
|  |  			   "broadcast SSID ignored", MAC2STR(mgmt->sa)); | ||||||
|  | @@ -967,7 +968,8 @@ void handle_probe_req(struct hostapd_dat | ||||||
|  |  		return; | ||||||
|  |  	} | ||||||
|  |   | ||||||
|  | -	if (hapd->conf->ignore_broadcast_ssid && res == WILDCARD_SSID_MATCH) { | ||||||
|  | +	if (!hapd->conf->dynamic_probe_resp && | ||||||
|  | +	    hapd->conf->ignore_broadcast_ssid && res == WILDCARD_SSID_MATCH) { | ||||||
|  |  		wpa_printf(MSG_MSGDUMP, "Probe Request from " MACSTR " for " | ||||||
|  |  			   "broadcast SSID ignored", MAC2STR(mgmt->sa)); | ||||||
|  |  		return; | ||||||
| @@ -2,11 +2,22 @@ Index: backports-20210222_001-4.4.60-b157d2276/drivers/net/wireless/ath/ath11k/q | |||||||
| =================================================================== | =================================================================== | ||||||
| --- backports-20210222_001-4.4.60-b157d2276.orig/drivers/net/wireless/ath/ath11k/qmi.c | --- backports-20210222_001-4.4.60-b157d2276.orig/drivers/net/wireless/ath/ath11k/qmi.c | ||||||
| +++ backports-20210222_001-4.4.60-b157d2276/drivers/net/wireless/ath/ath11k/qmi.c | +++ backports-20210222_001-4.4.60-b157d2276/drivers/net/wireless/ath/ath11k/qmi.c | ||||||
| @@ -3161,6 +3161,12 @@ out_req: | @@ -3161,6 +3161,23 @@ out_req: | ||||||
|  	return ret; |  	return ret; | ||||||
|  } |  } | ||||||
|   |   | ||||||
| +static const struct firmware *fw_macs; | +static const struct firmware *fw_macs; | ||||||
|  | +static int fw_macs_num = 0; | ||||||
|  | + | ||||||
|  | +int ath11k_get_custom_macs_num(int num) | ||||||
|  | +{ | ||||||
|  | +	int ret = fw_macs_num; | ||||||
|  | + | ||||||
|  | +	fw_macs_num += num; | ||||||
|  | + | ||||||
|  | +	return ret; | ||||||
|  | +} | ||||||
|  | + | ||||||
| +const struct firmware* ath11k_get_custom_macs(void) | +const struct firmware* ath11k_get_custom_macs(void) | ||||||
| +{ | +{ | ||||||
| +	return fw_macs; | +	return fw_macs; | ||||||
| @@ -15,7 +26,7 @@ Index: backports-20210222_001-4.4.60-b157d2276/drivers/net/wireless/ath/ath11k/q | |||||||
|  static int ath11k_qmi_load_bdf_qmi(struct ath11k_base *ab) |  static int ath11k_qmi_load_bdf_qmi(struct ath11k_base *ab) | ||||||
|  { |  { | ||||||
|  	char filename[ATH11K_QMI_MAX_BDF_FILE_NAME_SIZE]; |  	char filename[ATH11K_QMI_MAX_BDF_FILE_NAME_SIZE]; | ||||||
| @@ -3188,6 +3194,8 @@ static int ath11k_qmi_load_bdf_qmi(struc | @@ -3188,6 +3205,8 @@ static int ath11k_qmi_load_bdf_qmi(struc | ||||||
|  		goto out; |  		goto out; | ||||||
|  	} |  	} | ||||||
|   |   | ||||||
| @@ -36,11 +47,12 @@ Index: backports-20210222_001-4.4.60-b157d2276/drivers/net/wireless/ath/ath11k/w | |||||||
|   |   | ||||||
|  struct wmi_tlv_policy { |  struct wmi_tlv_policy { | ||||||
|  	size_t min_len; |  	size_t min_len; | ||||||
| @@ -7278,11 +7279,14 @@ mem_free: | @@ -7268,11 +7269,15 @@ mem_free: | ||||||
|  	return ret; |  	return ret; | ||||||
|  } |  } | ||||||
|   |   | ||||||
| +const struct firmware* ath11k_get_custom_macs(void); | +const struct firmware* ath11k_get_custom_macs(void); | ||||||
|  | +int ath11k_get_custom_macs_num(int num); | ||||||
| + | + | ||||||
|  static int ath11k_wmi_tlv_rdy_parse(struct ath11k_base *ab, u16 tag, u16 len, |  static int ath11k_wmi_tlv_rdy_parse(struct ath11k_base *ab, u16 tag, u16 len, | ||||||
|  				    const void *ptr, void *data) |  				    const void *ptr, void *data) | ||||||
| @@ -51,17 +63,18 @@ Index: backports-20210222_001-4.4.60-b157d2276/drivers/net/wireless/ath/ath11k/w | |||||||
|  	struct wmi_mac_addr *addr_list; |  	struct wmi_mac_addr *addr_list; | ||||||
|  	struct ath11k_pdev *pdev; |  	struct ath11k_pdev *pdev; | ||||||
|  	u32 num_mac_addr; |  	u32 num_mac_addr; | ||||||
| @@ -7307,6 +7311,19 @@ static int ath11k_wmi_tlv_rdy_parse(stru | @@ -7297,6 +7302,20 @@ static int ath11k_wmi_tlv_rdy_parse(stru | ||||||
|  		addr_list = (struct wmi_mac_addr *)ptr; |  		addr_list = (struct wmi_mac_addr *)ptr; | ||||||
|  		num_mac_addr = rdy_parse->num_extra_mac_addr; |  		num_mac_addr = rdy_parse->num_extra_mac_addr; | ||||||
|   |   | ||||||
| +		fw_entry = ath11k_get_custom_macs(); | +		fw_entry = ath11k_get_custom_macs(); | ||||||
| +		if (fw_entry) { | +		if (fw_entry) { | ||||||
|  | +			int num = ath11k_get_custom_macs_num(ab->num_radios); | ||||||
| +			printk("applying ath11k-macs\n"); | +			printk("applying ath11k-macs\n"); | ||||||
| +			if (fw_entry->size >= (ab->num_radios * 6)) { | +			if (fw_entry->size >= ((num + ab->num_radios) * 6)) { | ||||||
| +				for (i = 0; i < ab->num_radios; i++) { | +				for (i = 0; i < ab->num_radios; i++) { | ||||||
| +					pdev = &ab->pdevs[i]; | +					pdev = &ab->pdevs[i]; | ||||||
| +		                        ether_addr_copy(pdev->mac_addr, &fw_entry->data[i * 6]); | +		                        ether_addr_copy(pdev->mac_addr, &fw_entry->data[(num + i) * 6]); | ||||||
| +				} | +				} | ||||||
| +			} | +			} | ||||||
| +			ab->pdevs_macaddr_valid = true; | +			ab->pdevs_macaddr_valid = true; | ||||||
|   | |||||||
| @@ -0,0 +1,12 @@ | |||||||
|  | Index: backports-20210222_001-4.4.60-b157d2276/drivers/net/wireless/ath/ath11k/mac.c | ||||||
|  | =================================================================== | ||||||
|  | --- backports-20210222_001-4.4.60-b157d2276.orig/drivers/net/wireless/ath/ath11k/mac.c | ||||||
|  | +++ backports-20210222_001-4.4.60-b157d2276/drivers/net/wireless/ath/ath11k/mac.c | ||||||
|  | @@ -9356,6 +9356,7 @@ static int __ath11k_mac_register(struct | ||||||
|  |  	wiphy_ext_feature_set(ar->hw->wiphy, NL80211_EXT_FEATURE_CQM_RSSI_LIST); | ||||||
|  |  	wiphy_ext_feature_set(ar->hw->wiphy, NL80211_EXT_FEATURE_STA_TX_PWR); | ||||||
|  |  	wiphy_ext_feature_set(ar->hw->wiphy, NL80211_EXT_FEATURE_BSS_COLOR); | ||||||
|  | +	wiphy_ext_feature_set(ar->hw->wiphy, NL80211_EXT_FEATURE_CAN_REPLACE_PTK0); | ||||||
|  |   | ||||||
|  |  	if (test_bit(WMI_TLV_SERVICE_SCAN_PHYMODE_SUPPORT, | ||||||
|  |  		     ar->ab->wmi_ab.svc_map)) | ||||||
| @@ -17,7 +17,7 @@ index 3f75411a43..7cf16e68e0 100644 | |||||||
|  	mount_root |  	mount_root | ||||||
|  	boot_run_hook preinit_mount_root |  	boot_run_hook preinit_mount_root | ||||||
| -	[ -f /sysupgrade.tgz ] && { | -	[ -f /sysupgrade.tgz ] && { | ||||||
| +	(tar tf /sysupgrade.tgz | grep ucentral) 2> /dev/null | +	(tar tzf /sysupgrade.tgz | grep -q ucentral) 2> /dev/null | ||||||
| +	[ $? -eq 0 ] && { | +	[ $? -eq 0 ] && { | ||||||
|  		echo "- config restore -" |  		echo "- config restore -" | ||||||
|  		cp /etc/passwd /etc/group /etc/shadow /tmp |  		cp /etc/passwd /etc/group /etc/shadow /tmp | ||||||
|   | |||||||
| @@ -1,22 +1,23 @@ | |||||||
| From c5b68d334fa19e5fa0632d9d361cb613b1384b75 Mon Sep 17 00:00:00 2001 | From 65e3d7cb239d85ed3b3ac142a9a53523b7343fe2 Mon Sep 17 00:00:00 2001 | ||||||
| From: John Crispin <john@phrozen.org> | From: John Crispin <john@phrozen.org> | ||||||
| Date: Mon, 13 Jun 2022 13:33:31 +0200 | Date: Mon, 13 Jun 2022 13:33:31 +0200 | ||||||
| Subject: [PATCH] dnsmasq: ignore dhcp on the ifb-dhcp interface | Subject: [PATCH] dnsmasq: ignore dhcp on the ifb-dhcp interface | ||||||
|  |  | ||||||
| Signed-off-by: John Crispin <john@phrozen.org> | Signed-off-by: John Crispin <john@phrozen.org> | ||||||
| --- | --- | ||||||
|  package/network/services/dnsmasq/files/dnsmasq.init | 1 + |  package/network/services/dnsmasq/files/dnsmasq.init | 2 ++ | ||||||
|  1 file changed, 1 insertion(+) |  1 file changed, 2 insertions(+) | ||||||
|  |  | ||||||
| diff --git a/package/network/services/dnsmasq/files/dnsmasq.init b/package/network/services/dnsmasq/files/dnsmasq.init | diff --git a/package/network/services/dnsmasq/files/dnsmasq.init b/package/network/services/dnsmasq/files/dnsmasq.init | ||||||
| index dacd476cd4..d00485da90 100644 | index 205bfb4cf6..415a6b013d 100644 | ||||||
| --- a/package/network/services/dnsmasq/files/dnsmasq.init | --- a/package/network/services/dnsmasq/files/dnsmasq.init | ||||||
| +++ b/package/network/services/dnsmasq/files/dnsmasq.init | +++ b/package/network/services/dnsmasq/files/dnsmasq.init | ||||||
| @@ -1108,6 +1108,7 @@ dnsmasq_start() | @@ -1106,6 +1106,8 @@ dnsmasq_start() | ||||||
|  		[ -n "$BOOT" ] || config_foreach filter_dnsmasq dhcp dhcp_add "$cfg" |  		[ -n "$BOOT" ] || config_foreach filter_dnsmasq dhcp dhcp_add "$cfg" | ||||||
|  	fi |  	fi | ||||||
|   |   | ||||||
| +	xappend "except-interface=ifb-dhcp" | +	xappend "except-interface=ifb-dhcp" | ||||||
|  | +	xappend "except-interface=spotfilter-ifb" | ||||||
|   |   | ||||||
|  	echo >> $CONFIGFILE_TMP |  	echo >> $CONFIGFILE_TMP | ||||||
|  	config_foreach filter_dnsmasq cname dhcp_cname_add "$cfg" |  	config_foreach filter_dnsmasq cname dhcp_cname_add "$cfg" | ||||||
|   | |||||||
| @@ -0,0 +1,22 @@ | |||||||
|  | From 7b703f7557779fa47bb17dc692bd6140d89a3cdc Mon Dec 5 02:58:36 2022 +0000 | ||||||
|  | From: Sohail Ahmad <sohail@indionetworks.com> | ||||||
|  | Date: Mon Dec 5 02:58:36 2022 +0000 | ||||||
|  | Subject: [PATCH] dnsmasq: enabled EDNS configuration options- CPE ID and subnet | ||||||
|  |  | ||||||
|  | Signed-off-by: Sohail Ahmad <sohail@indionetworks.com> | ||||||
|  |  | ||||||
|  | diff --git a/package/network/services/dnsmasq/files/dnsmasq.init b/package/network/services/dnsmasq/files/dnsmasq.init | ||||||
|  | index d154d2566d..bacb9cc669 100644 | ||||||
|  | --- a/package/network/services/dnsmasq/files/dnsmasq.init | ||||||
|  | +++ b/package/network/services/dnsmasq/files/dnsmasq.init | ||||||
|  | @@ -964,6 +964,10 @@ dnsmasq_start() | ||||||
|  |  	append_parm "$cfg" "max_cache_ttl" "--max-cache-ttl" | ||||||
|  |  	append_parm "$cfg" "pxe_prompt" "--pxe-prompt" | ||||||
|  |  	append_parm "$cfg" "tftp_unique_root" "--tftp-unique-root" | ||||||
|  | + | ||||||
|  | +	append_parm "$cfg" "addcpe" "--add-cpe-id" | ||||||
|  | +	append_parm "$cfg" "addsubnet" "--add-subnet" | ||||||
|  | + | ||||||
|  |  	config_list_foreach "$cfg" "pxe_service" append_pxe_service | ||||||
|  |  	config_get DOMAIN "$cfg" domain | ||||||
|  |   | ||||||
| @@ -1,16 +1,16 @@ | |||||||
| From 1749748819caa03e249e8a5df1311498550cbd3b Mon Sep 17 00:00:00 2001 | From c931a11e400ddf501f6796c62ba512195a1561ce Mon Sep 17 00:00:00 2001 | ||||||
| From: John Crispin <john@phrozen.org> | From: John Crispin <john@phrozen.org> | ||||||
| Date: Sat, 18 Jul 2020 08:53:44 +0200 | Date: Sat, 18 Jul 2020 08:53:44 +0200 | ||||||
| Subject: [PATCH 68/83] ipq807x: add the Qualcomm AX target support | Subject: [PATCH] ipq807x: add the Qualcomm AX target support | ||||||
|  |  | ||||||
| Signed-off-by: John Crispin <john@phrozen.org> | Signed-off-by: John Crispin <john@phrozen.org> | ||||||
| --- | --- | ||||||
|  config/Config-kernel.in                   |  9 ++++++ |  config/Config-kernel.in                   |  9 ++++++ | ||||||
|  include/image.mk                          |  6 +++- |  include/image.mk                          |  6 +++- | ||||||
|  include/kernel-version.mk                 |  2 +- |  include/kernel-version.mk                 |  2 +- | ||||||
|  |  package/boot/uboot-envtools/Makefile      |  5 --- | ||||||
|  package/boot/uboot-envtools/files/ipq807x | 37 +++++++++++++++++++++++ |  package/boot/uboot-envtools/files/ipq807x | 37 +++++++++++++++++++++++ | ||||||
|  toolchain/kernel-headers/Makefile         |  8 +++++ |  5 files changed, 52 insertions(+), 7 deletions(-) | ||||||
|  5 files changed, 60 insertions(+), 2 deletions(-) |  | ||||||
|  create mode 100644 package/boot/uboot-envtools/files/ipq807x |  create mode 100644 package/boot/uboot-envtools/files/ipq807x | ||||||
|  |  | ||||||
| diff --git a/config/Config-kernel.in b/config/Config-kernel.in | diff --git a/config/Config-kernel.in b/config/Config-kernel.in | ||||||
| @@ -70,13 +70,29 @@ index c7aba61cd7..efecf2f919 100644 | |||||||
|  LINUX_KERNEL_HASH-4.14.193 = 0b0fb41d4430e1a42738b341cbfd2f41951aa5cd02acabbd53f076119c8b9f03 |  LINUX_KERNEL_HASH-4.14.193 = 0b0fb41d4430e1a42738b341cbfd2f41951aa5cd02acabbd53f076119c8b9f03 | ||||||
|  LINUX_KERNEL_HASH-5.4.158 = 6e018fecdc8fc24553756e582d83b82d65b10a6b03ef36262a24911f839b8d59 |  LINUX_KERNEL_HASH-5.4.158 = 6e018fecdc8fc24553756e582d83b82d65b10a6b03ef36262a24911f839b8d59 | ||||||
|  LINUX_KERNEL_HASH-5.10.27 = d99dc9662951299c53a0a8d8c8d0a72a16ff861d20e927c0f9b14f63282d69d9 |  LINUX_KERNEL_HASH-5.10.27 = d99dc9662951299c53a0a8d8c8d0a72a16ff861d20e927c0f9b14f63282d69d9 | ||||||
|  | diff --git a/package/boot/uboot-envtools/Makefile b/package/boot/uboot-envtools/Makefile | ||||||
|  | index a9eccec0ce..0696c81bea 100644 | ||||||
|  | --- a/package/boot/uboot-envtools/Makefile | ||||||
|  | +++ b/package/boot/uboot-envtools/Makefile | ||||||
|  | @@ -58,11 +58,6 @@ MAKE_FLAGS += \ | ||||||
|  |  	no-dot-config-targets=envtools \ | ||||||
|  |  	envtools | ||||||
|  |   | ||||||
|  | -define Package/uboot-envtools/conffiles | ||||||
|  | -/etc/config/ubootenv | ||||||
|  | -/etc/fw_env.config | ||||||
|  | -endef | ||||||
|  | - | ||||||
|  |  define Package/uboot-envtools/install | ||||||
|  |  	$(INSTALL_DIR) $(1)/usr/sbin | ||||||
|  |  	$(INSTALL_BIN) $(PKG_BUILD_DIR)/tools/env/fw_printenv $(1)/usr/sbin | ||||||
| diff --git a/package/boot/uboot-envtools/files/ipq807x b/package/boot/uboot-envtools/files/ipq807x | diff --git a/package/boot/uboot-envtools/files/ipq807x b/package/boot/uboot-envtools/files/ipq807x | ||||||
| new file mode 100644 | new file mode 100644 | ||||||
| index 0000000000..6c429f1852 | index 0000000000..84ed73f288 | ||||||
| --- /dev/null | --- /dev/null | ||||||
| +++ b/package/boot/uboot-envtools/files/ipq807x | +++ b/package/boot/uboot-envtools/files/ipq807x | ||||||
| @@ -0,0 +1,37 @@ | @@ -0,0 +1,37 @@ | ||||||
| +[ -e /etc/config/ubootenv ] && exit 0 | +[ -e /etc/config/ubootenv ] && rm /etc/config/ubootenv | ||||||
| + | + | ||||||
| +touch /etc/config/ubootenv | +touch /etc/config/ubootenv | ||||||
| + | + | ||||||
|   | |||||||
							
								
								
									
										301
									
								
								patches/ramips/0017-ramips-add-support-for-YunCore-FAP640.patch
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										301
									
								
								patches/ramips/0017-ramips-add-support-for-YunCore-FAP640.patch
									
									
									
									
									
										Normal file
									
								
							| @@ -0,0 +1,301 @@ | |||||||
|  | From dbd1fbf93aa42f4bd69ec6af4c4741229f5d7005 Mon Sep 17 00:00:00 2001 | ||||||
|  | From: Volodymyr Puiul <volodymyr.puiul@gmail.com> | ||||||
|  | Date: Thu, 8 Dec 2022 15:20:40 +0100 | ||||||
|  | Subject: [PATCH] ramips: add support for YunCore FAP640 | ||||||
|  |  | ||||||
|  | It is an in-wall 802.11ax (Wi-Fi 6) router, based on MediaTek MT7621A. | ||||||
|  |  | ||||||
|  | Specifications: | ||||||
|  | - SoC: MT7621AT (880MHz, 2 Cores) | ||||||
|  | - RAM: 128 MB | ||||||
|  | - Flash: 16 MB SPI | ||||||
|  | - Wi-Fi: | ||||||
|  |     - MT7915DN + MT7905DAN: 2.4/5 GHz | ||||||
|  | - Ethernet: 5x1GiE via MT7530, 1xWAN with POE and 4xLAN | ||||||
|  | - UART: J4 (115200 baud) | ||||||
|  |     - Pinout: [3V3] (TXD) (RXD) (GND) | ||||||
|  | - Power: 802.11af/at PoE; | ||||||
|  |  | ||||||
|  | - Bootloader: U-Boot | ||||||
|  | - Buttons: | ||||||
|  |     - Reset | ||||||
|  | - LEDs: | ||||||
|  |     - Status - RGB controlled by | ||||||
|  |       - GPIO 14 LOW - green color | ||||||
|  |       - GPIO 15 LOW- red color | ||||||
|  |       - GPIO 16 LOW - blue color | ||||||
|  |     - WAN - gren color, controlled by switch GPIO 12 LOW | ||||||
|  |     - LAN1 - gren color, controlled by switch GPIO 9 HIGH | ||||||
|  |     - LAN2 - gren color, controlled by switch GPIO 6 LOW | ||||||
|  |     - LAN3 - gren color, controlled by switch GPIO 3 LOW | ||||||
|  |     - LAN4 - gren color, controlled by switch GPIO 0 LOW | ||||||
|  |  | ||||||
|  | Installation: | ||||||
|  | OEM firmware is based on LEDE with custom UI and support standard sysupgrade | ||||||
|  | variant of firmware. However it requires "*.ubin" extension for sysupgrade file. | ||||||
|  | Always select "Factory reset" switch on upgrade to OpenWRT, otherwise | ||||||
|  | router will not boot. | ||||||
|  |  | ||||||
|  | MAC addresses with OEM firmware: | ||||||
|  | vendor   source | ||||||
|  | lan      factory 0x4 (label) | ||||||
|  | 5g       factory 0x4 (label) | ||||||
|  | 2g       label with flipped bits bit in 1-st byte and bits 5, 6, 7 in | ||||||
|  |   4-th byte | ||||||
|  |  | ||||||
|  | Example | ||||||
|  | label:  44:xx:xx:b7:xx:xx | ||||||
|  | lan:    44:xx:xx:b7:xx:xx | ||||||
|  | 2g      46:xx:xx:c7:xx:xx | ||||||
|  | 5g      44:xx:xx:b7:xx:xx | ||||||
|  |  | ||||||
|  | Signed-off-by: Volodymyr Puiul <volodymyr.puiul@gmail.com> | ||||||
|  | --- | ||||||
|  |  .../ramips/dts/mt7621_yuncore_fap640.dts      | 198 ++++++++++++++++++ | ||||||
|  |  target/linux/ramips/image/mt7621.mk           |  10 + | ||||||
|  |  .../etc/hotplug.d/ieee80211/10_fix_wifi_mac   |   5 + | ||||||
|  |  3 files changed, 213 insertions(+) | ||||||
|  |  create mode 100644 target/linux/ramips/dts/mt7621_yuncore_fap640.dts | ||||||
|  |  | ||||||
|  | diff --git a/target/linux/ramips/dts/mt7621_yuncore_fap640.dts b/target/linux/ramips/dts/mt7621_yuncore_fap640.dts | ||||||
|  | new file mode 100644 | ||||||
|  | index 0000000000..b48546d825 | ||||||
|  | --- /dev/null | ||||||
|  | +++ b/target/linux/ramips/dts/mt7621_yuncore_fap640.dts | ||||||
|  | @@ -0,0 +1,198 @@ | ||||||
|  | +// SPDX-License-Identifier: GPL-2.0-or-later OR MIT | ||||||
|  | + | ||||||
|  | +#include "mt7621.dtsi" | ||||||
|  | + | ||||||
|  | +#include <dt-bindings/gpio/gpio.h> | ||||||
|  | +#include <dt-bindings/input/input.h> | ||||||
|  | + | ||||||
|  | +/ { | ||||||
|  | +	compatible = "yuncore,fap640", "mediatek,mt7621-soc"; | ||||||
|  | +	model = "YunCore FAP640"; | ||||||
|  | + | ||||||
|  | +	aliases { | ||||||
|  | +		led-boot = &led_status_blue; | ||||||
|  | +		led-failsafe = &led_status_red; | ||||||
|  | +		led-running = &led_status_green; | ||||||
|  | +		led-upgrade = &led_status_red; | ||||||
|  | +		label-mac-device = &gmac0; | ||||||
|  | +	}; | ||||||
|  | + | ||||||
|  | +	chosen { | ||||||
|  | +		bootargs = "console=ttyS0,115200"; | ||||||
|  | +	}; | ||||||
|  | + | ||||||
|  | +	leds { | ||||||
|  | +		compatible = "gpio-leds"; | ||||||
|  | + | ||||||
|  | +		led_status_green: status_green { | ||||||
|  | +			label = "green:status"; | ||||||
|  | +			gpios = <&gpio 14 GPIO_ACTIVE_LOW>; | ||||||
|  | +		}; | ||||||
|  | + | ||||||
|  | +		led_status_red: status_red { | ||||||
|  | +			label = "red:status"; | ||||||
|  | +			gpios = <&gpio 15 GPIO_ACTIVE_LOW>; | ||||||
|  | +		}; | ||||||
|  | + | ||||||
|  | +		led_status_blue: status_blue { | ||||||
|  | +			label = "blue:status"; | ||||||
|  | +			gpios = <&gpio 16 GPIO_ACTIVE_LOW>; | ||||||
|  | +		}; | ||||||
|  | + | ||||||
|  | +		wan { | ||||||
|  | +			label = "green:wan"; | ||||||
|  | +			gpios = <&switch0 12 GPIO_ACTIVE_LOW>; | ||||||
|  | +			linux,default-trigger = "mt7530-0:04:link"; | ||||||
|  | +		}; | ||||||
|  | + | ||||||
|  | +		lan1 { | ||||||
|  | +			label = "green:lan1"; | ||||||
|  | +			gpios = <&switch0 9 GPIO_ACTIVE_HIGH>; | ||||||
|  | +			linux,default-trigger = "mt7530-0:03:link"; | ||||||
|  | +		}; | ||||||
|  | + | ||||||
|  | +		lan2 { | ||||||
|  | +			label = "green:lan2"; | ||||||
|  | +			gpios = <&switch0 6 GPIO_ACTIVE_LOW>; | ||||||
|  | +			linux,default-trigger = "mt7530-0:02:link"; | ||||||
|  | +		}; | ||||||
|  | + | ||||||
|  | +		lan3 { | ||||||
|  | +			label = "green:lan3"; | ||||||
|  | +			gpios = <&switch0 3 GPIO_ACTIVE_LOW>; | ||||||
|  | +			linux,default-trigger = "mt7530-0:01:link"; | ||||||
|  | +		}; | ||||||
|  | + | ||||||
|  | +		lan4 { | ||||||
|  | +			label = "green:lan4"; | ||||||
|  | +			gpios = <&switch0 0 GPIO_ACTIVE_LOW>; | ||||||
|  | +			linux,default-trigger = "mt7530-0:00:link"; | ||||||
|  | +		}; | ||||||
|  | +	}; | ||||||
|  | + | ||||||
|  | +	watchdog { | ||||||
|  | +		compatible = "linux,wdt-gpio"; | ||||||
|  | +		gpios = <&gpio 0 GPIO_ACTIVE_LOW>; | ||||||
|  | +		hw_algo = "toggle"; | ||||||
|  | +		hw_margin_ms = <200>; | ||||||
|  | +		always-running; | ||||||
|  | +	}; | ||||||
|  | + | ||||||
|  | +	keys { | ||||||
|  | +		compatible = "gpio-keys"; | ||||||
|  | + | ||||||
|  | +		reset { | ||||||
|  | +			label = "reset"; | ||||||
|  | +			gpios = <&gpio 18 GPIO_ACTIVE_LOW>; | ||||||
|  | +			linux,code = <KEY_RESTART>; | ||||||
|  | +		}; | ||||||
|  | +	}; | ||||||
|  | +}; | ||||||
|  | + | ||||||
|  | +&spi0 { | ||||||
|  | +	status = "okay"; | ||||||
|  | + | ||||||
|  | +	flash@0 { | ||||||
|  | +		compatible = "jedec,spi-nor"; | ||||||
|  | +		reg = <0>; | ||||||
|  | +		spi-max-frequency = <80000000>; | ||||||
|  | +		m25p,fast-read; | ||||||
|  | + | ||||||
|  | +		partitions { | ||||||
|  | +			compatible = "fixed-partitions"; | ||||||
|  | +			#address-cells = <1>; | ||||||
|  | +			#size-cells = <1>; | ||||||
|  | + | ||||||
|  | +			partition@0 { | ||||||
|  | +				label = "Bootloader"; | ||||||
|  | +				reg = <0x0 0x30000>; | ||||||
|  | +				read-only; | ||||||
|  | +			}; | ||||||
|  | + | ||||||
|  | +			partition@30000 { | ||||||
|  | +				label = "Config"; | ||||||
|  | +				reg = <0x30000 0x10000>; | ||||||
|  | +				read-only; | ||||||
|  | +			}; | ||||||
|  | + | ||||||
|  | +			/* range 0x40000 to 0x50000 is empty in vendor | ||||||
|  | +			 * firmware, so we do not use it either | ||||||
|  | +			 */ | ||||||
|  | + | ||||||
|  | +			factory: partition@50000 { | ||||||
|  | +				label = "Factory"; | ||||||
|  | +				reg = <0x50000 0x40000>; | ||||||
|  | +				read-only; | ||||||
|  | +			}; | ||||||
|  | + | ||||||
|  | +			partition@90000 { | ||||||
|  | +				compatible = "denx,uimage"; | ||||||
|  | +				label = "firmware"; | ||||||
|  | +				reg = <0x90000 0xf60000>; | ||||||
|  | +			}; | ||||||
|  | + | ||||||
|  | +			partition@ff0000 { | ||||||
|  | +				label = "certificates"; | ||||||
|  | +				reg = <0xff0000 0x10000>; | ||||||
|  | +			}; | ||||||
|  | +		}; | ||||||
|  | +	}; | ||||||
|  | +}; | ||||||
|  | + | ||||||
|  | +&pcie { | ||||||
|  | +	status = "okay"; | ||||||
|  | +}; | ||||||
|  | + | ||||||
|  | +&pcie1 { | ||||||
|  | +	wifi@0,0 { | ||||||
|  | +		compatible = "mediatek,mt76"; | ||||||
|  | +		reg = <0x0000 0 0 0 0>; | ||||||
|  | +		mediatek,mtd-eeprom = <&factory 0x0>; | ||||||
|  | +		mediatek,disable-radar-background; | ||||||
|  | +	}; | ||||||
|  | +}; | ||||||
|  | + | ||||||
|  | +&gmac0 { | ||||||
|  | +	mtd-mac-address = <&factory 0x4>; | ||||||
|  | +}; | ||||||
|  | + | ||||||
|  | +&switch0 { | ||||||
|  | +	gpio-controller; | ||||||
|  | +	#gpio-cells = <2>; | ||||||
|  | + | ||||||
|  | +	ports { | ||||||
|  | +		port@0 { | ||||||
|  | +			status = "okay"; | ||||||
|  | +			label = "lan4"; | ||||||
|  | +		}; | ||||||
|  | + | ||||||
|  | +		port@1 { | ||||||
|  | +			status = "okay"; | ||||||
|  | +			label = "lan3"; | ||||||
|  | +		}; | ||||||
|  | + | ||||||
|  | +		port@2 { | ||||||
|  | +			status = "okay"; | ||||||
|  | +			label = "lan2"; | ||||||
|  | +		}; | ||||||
|  | + | ||||||
|  | +		port@3 { | ||||||
|  | +			status = "okay"; | ||||||
|  | +			label = "lan1"; | ||||||
|  | +		}; | ||||||
|  | + | ||||||
|  | +		port@4 { | ||||||
|  | +			status = "okay"; | ||||||
|  | +			label = "wan"; | ||||||
|  | +			mtd-mac-address = <&factory 0x4>; | ||||||
|  | +			mtd-mac-address-increment = <1>; | ||||||
|  | +		}; | ||||||
|  | +	}; | ||||||
|  | +}; | ||||||
|  | + | ||||||
|  | +&state_default { | ||||||
|  | +	gpio { | ||||||
|  | +		groups = "jtag", "wdt"; | ||||||
|  | +		function = "gpio"; | ||||||
|  | +	}; | ||||||
|  | +}; | ||||||
|  | diff --git a/target/linux/ramips/image/mt7621.mk b/target/linux/ramips/image/mt7621.mk | ||||||
|  | index 9e1eed024b..a528a257d4 100644 | ||||||
|  | --- a/target/linux/ramips/image/mt7621.mk | ||||||
|  | +++ b/target/linux/ramips/image/mt7621.mk | ||||||
|  | @@ -1637,6 +1637,16 @@ define Device/youku_yk-l2 | ||||||
|  |  endef | ||||||
|  |  TARGET_DEVICES += youku_yk-l2 | ||||||
|  |   | ||||||
|  | +define Device/yuncore_fap640 | ||||||
|  | +  $(Device/dsa-migration) | ||||||
|  | +  $(Device/uimage-lzma-loader) | ||||||
|  | +  IMAGE_SIZE := 15808k | ||||||
|  | +  DEVICE_VENDOR := YunCore | ||||||
|  | +  DEVICE_MODEL := FAP640 | ||||||
|  | +  DEVICE_PACKAGES := kmod-mt7915e | ||||||
|  | +endef | ||||||
|  | +TARGET_DEVICES += yuncore_fap640 | ||||||
|  | + | ||||||
|  |  define Device/zbtlink_zbt-we1326 | ||||||
|  |    $(Device/dsa-migration) | ||||||
|  |    $(Device/uimage-lzma-loader) | ||||||
|  | diff --git a/target/linux/ramips/mt7621/base-files/etc/hotplug.d/ieee80211/10_fix_wifi_mac b/target/linux/ramips/mt7621/base-files/etc/hotplug.d/ieee80211/10_fix_wifi_mac | ||||||
|  | index 157e706534..be7b226c32 100644 | ||||||
|  | --- a/target/linux/ramips/mt7621/base-files/etc/hotplug.d/ieee80211/10_fix_wifi_mac | ||||||
|  | +++ b/target/linux/ramips/mt7621/base-files/etc/hotplug.d/ieee80211/10_fix_wifi_mac | ||||||
|  | @@ -38,4 +38,9 @@ case "$board" in | ||||||
|  |  		[ "$PHYNBR" = "0" ] && macaddr_add $hw_mac_addr 1 > /sys${DEVPATH}/macaddress | ||||||
|  |  		[ "$PHYNBR" = "1" ] && macaddr_add $hw_mac_addr 2 > /sys${DEVPATH}/macaddress | ||||||
|  |  		;; | ||||||
|  | +	yuncore,fap640) | ||||||
|  | +		hw_mac_addr="$(mtd_get_mac_binary Factory 0x4)" | ||||||
|  | +		[ "$PHYNBR" = "0" ] && macaddr_setbit_la "$hw_mac_addr" > /sys${DEVPATH}/macaddress | ||||||
|  | +		[ "$PHYNBR" = "1" ] && echo -n "$hw_mac_addr" > /sys${DEVPATH}/macaddress | ||||||
|  | +		;; | ||||||
|  |  esac | ||||||
|  | --  | ||||||
|  | 2.25.1 | ||||||
|  |  | ||||||
| @@ -137,7 +137,7 @@ index 0000000000..f2f4a933d7 | |||||||
| + 	else | + 	else | ||||||
| + #endif /* CONFIG_P2P */ | + #endif /* CONFIG_P2P */ | ||||||
| +-		os_snprintf(buf, sizeof(buf), MACSTR, MAC2STR(sta->addr)); | +-		os_snprintf(buf, sizeof(buf), MACSTR, MAC2STR(sta->addr)); | ||||||
| ++		os_snprintf(buf, sizeof(buf), MACSTR " %d %d", MAC2STR(sta->addr), sta->bandwidth[0] / 1000, sta->bandwidth[1] / 1000); | ++		os_snprintf(buf, sizeof(buf), MACSTR " %d %d", MAC2STR(sta->addr), sta->bandwidth[0] / 1000000, sta->bandwidth[1] / 1000000); | ||||||
| +  | +  | ||||||
| + 	if (hapd->sta_authorized_cb) | + 	if (hapd->sta_authorized_cb) | ||||||
| + 		hapd->sta_authorized_cb(hapd->sta_authorized_cb_ctx, | + 		hapd->sta_authorized_cb(hapd->sta_authorized_cb_ctx, | ||||||
|   | |||||||
							
								
								
									
										116
									
								
								patches/wifi/0019-hostapd-add-uci_section-to-status.patch
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										116
									
								
								patches/wifi/0019-hostapd-add-uci_section-to-status.patch
									
									
									
									
									
										Normal file
									
								
							| @@ -0,0 +1,116 @@ | |||||||
|  | From 2b9306b0b87758c9ec565f8c0dbbb55e5028b7ff Mon Sep 17 00:00:00 2001 | ||||||
|  | From: John Crispin <john@phrozen.org> | ||||||
|  | Date: Mon, 10 Oct 2022 11:14:57 +0200 | ||||||
|  | Subject: [PATCH] hostapd: add uci_section to status | ||||||
|  |  | ||||||
|  | Signed-off-by: John Crispin <john@phrozen.org> | ||||||
|  | --- | ||||||
|  |  .../network/services/hostapd/files/hostapd.sh |  6 ++- | ||||||
|  |  .../hostapd/patches/901-cfg-section.patch     | 51 +++++++++++++++++++ | ||||||
|  |  package/network/services/uhttpd/Makefile      |  1 + | ||||||
|  |  3 files changed, 57 insertions(+), 1 deletion(-) | ||||||
|  |  create mode 100644 package/network/services/hostapd/patches/901-cfg-section.patch | ||||||
|  |  | ||||||
|  | diff --git a/package/network/services/hostapd/files/hostapd.sh b/package/network/services/hostapd/files/hostapd.sh | ||||||
|  | index 3ac9e7b590..c308d1d2de 100644 | ||||||
|  | --- a/package/network/services/hostapd/files/hostapd.sh | ||||||
|  | +++ b/package/network/services/hostapd/files/hostapd.sh | ||||||
|  | @@ -392,6 +392,8 @@ hostapd_common_add_bss_config() { | ||||||
|  |  	config_add_string fils_dhcp | ||||||
|  |   | ||||||
|  |  	config_add_boolean ratelimit | ||||||
|  | + | ||||||
|  | +	config_add_string uci_section | ||||||
|  |  } | ||||||
|  |   | ||||||
|  |  hostapd_set_vlan_file() { | ||||||
|  | @@ -627,7 +629,7 @@ hostapd_set_bss_options() { | ||||||
|  |  		airtime_bss_weight airtime_bss_limit airtime_sta_weight \ | ||||||
|  |  		multicast_to_unicast_all proxy_arp per_sta_vif \ | ||||||
|  |  		eap_server eap_user_file ca_cert server_cert private_key private_key_passwd server_id \ | ||||||
|  | -		vendor_elements fils | ||||||
|  | +		vendor_elements fils uci_section | ||||||
|  |   | ||||||
|  |  	set_default fils 0 | ||||||
|  |  	set_default isolate 0 | ||||||
|  | @@ -1152,6 +1154,8 @@ hostapd_set_bss_options() { | ||||||
|  |  		append bss_conf "per_sta_vif=$per_sta_vif" "$N" | ||||||
|  |  	fi | ||||||
|  |   | ||||||
|  | +	[ -n "$uci_section" ] && append bss_conf "uci_section=$uci_section" "$N" | ||||||
|  | + | ||||||
|  |  	json_get_values opts hostapd_bss_options | ||||||
|  |  	for val in $opts; do | ||||||
|  |  		append bss_conf "$val" "$N" | ||||||
|  | diff --git a/package/network/services/hostapd/patches/901-cfg-section.patch b/package/network/services/hostapd/patches/901-cfg-section.patch | ||||||
|  | new file mode 100644 | ||||||
|  | index 0000000000..dcfdd658fe | ||||||
|  | --- /dev/null | ||||||
|  | +++ b/package/network/services/hostapd/patches/901-cfg-section.patch | ||||||
|  | @@ -0,0 +1,51 @@ | ||||||
|  | +Index: hostapd-2021-02-20-59e9794c/hostapd/config_file.c | ||||||
|  | +=================================================================== | ||||||
|  | +--- hostapd-2021-02-20-59e9794c.orig/hostapd/config_file.c | ||||||
|  | ++++ hostapd-2021-02-20-59e9794c/hostapd/config_file.c | ||||||
|  | +@@ -2366,6 +2366,8 @@ static int hostapd_config_fill(struct ho | ||||||
|  | + 			return 1; | ||||||
|  | + 		} | ||||||
|  | + 		conf->driver = driver; | ||||||
|  | ++	} else if (os_strcmp(buf, "uci_section") == 0) { | ||||||
|  | ++		bss->uci_section = os_strdup(pos); | ||||||
|  | + 	} else if (os_strcmp(buf, "driver_params") == 0) { | ||||||
|  | + 		os_free(conf->driver_params); | ||||||
|  | + 		conf->driver_params = os_strdup(pos); | ||||||
|  | +Index: hostapd-2021-02-20-59e9794c/src/ap/ap_config.h | ||||||
|  | +=================================================================== | ||||||
|  | +--- hostapd-2021-02-20-59e9794c.orig/src/ap/ap_config.h | ||||||
|  | ++++ hostapd-2021-02-20-59e9794c/src/ap/ap_config.h | ||||||
|  | +@@ -279,6 +279,7 @@ struct hostapd_bss_config { | ||||||
|  | + 	char snoop_iface[IFNAMSIZ + 1]; | ||||||
|  | + 	char vlan_bridge[IFNAMSIZ + 1]; | ||||||
|  | + 	char wds_bridge[IFNAMSIZ + 1]; | ||||||
|  | ++	char *uci_section; | ||||||
|  | +  | ||||||
|  | + 	char *config_id; | ||||||
|  | +  | ||||||
|  | +Index: hostapd-2021-02-20-59e9794c/src/ap/ubus.c | ||||||
|  | +=================================================================== | ||||||
|  | +--- hostapd-2021-02-20-59e9794c.orig/src/ap/ubus.c | ||||||
|  | ++++ hostapd-2021-02-20-59e9794c/src/ap/ubus.c | ||||||
|  | +@@ -467,6 +467,9 @@ hostapd_bss_get_status(struct ubus_conte | ||||||
|  | + 			hapd->iface->cac_started ? hapd->iface->dfs_cac_ms / 1000 - now.sec : 0); | ||||||
|  | + 	blobmsg_close_table(&b, dfs_table); | ||||||
|  | +  | ||||||
|  | ++	if (hapd->conf->uci_section) | ||||||
|  | ++		blobmsg_add_string(&b, "uci_section", hapd->conf->uci_section); | ||||||
|  | ++ | ||||||
|  | + 	ubus_send_reply(ctx, req, b.head); | ||||||
|  | +  | ||||||
|  | + 	return 0; | ||||||
|  | +Index: hostapd-2021-02-20-59e9794c/src/ap/ap_config.c | ||||||
|  | +=================================================================== | ||||||
|  | +--- hostapd-2021-02-20-59e9794c.orig/src/ap/ap_config.c | ||||||
|  | ++++ hostapd-2021-02-20-59e9794c/src/ap/ap_config.c | ||||||
|  | +@@ -785,6 +785,7 @@ void hostapd_config_free_bss(struct host | ||||||
|  | + 	os_free(conf->radius_req_attr_sqlite); | ||||||
|  | + 	os_free(conf->rsn_preauth_interfaces); | ||||||
|  | + 	os_free(conf->ctrl_interface); | ||||||
|  | ++	os_free(conf->uci_section); | ||||||
|  | + 	os_free(conf->config_id); | ||||||
|  | + 	os_free(conf->ca_cert); | ||||||
|  | + 	os_free(conf->server_cert); | ||||||
|  | diff --git a/package/network/services/uhttpd/Makefile b/package/network/services/uhttpd/Makefile | ||||||
|  | index 0ae076ca8b..a3fd2a84d9 100644 | ||||||
|  | --- a/package/network/services/uhttpd/Makefile | ||||||
|  | +++ b/package/network/services/uhttpd/Makefile | ||||||
|  | @@ -12,6 +12,7 @@ PKG_RELEASE:=1 | ||||||
|  |   | ||||||
|  |  PKG_SOURCE_PROTO:=git | ||||||
|  |  PKG_SOURCE_URL=$(PROJECT_GIT)/project/uhttpd.git | ||||||
|  | +PKG_MIRROR_HASH:=90f737663d8495b891f0364342efb06f548a82c26ddb1595e42752f7cecdccee | ||||||
|  |  PKG_SOURCE_DATE:=2022-06-01 | ||||||
|  |  PKG_SOURCE_VERSION:=e3395cd90bed9b7b9fc319e79528fedcc0d947fe | ||||||
|  |  PKG_MAINTAINER:=Felix Fietkau <nbd@nbd.name> | ||||||
|  | --  | ||||||
|  | 2.25.1 | ||||||
|  |  | ||||||
							
								
								
									
										103
									
								
								patches/wifi/0020-hostapd-add-uci-section.patch
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										103
									
								
								patches/wifi/0020-hostapd-add-uci-section.patch
									
									
									
									
									
										Normal file
									
								
							| @@ -0,0 +1,103 @@ | |||||||
|  | From 518549798a9bdd7a62d324a9127a296cf3aa4a94 Mon Sep 17 00:00:00 2001 | ||||||
|  | From: John Crispin <john@phrozen.org> | ||||||
|  | Date: Wed, 16 Nov 2022 16:38:23 +0100 | ||||||
|  | Subject: [PATCH 20/21] hostapd: add uci-section | ||||||
|  |  | ||||||
|  | Signed-off-by: John Crispin <john@phrozen.org> | ||||||
|  | --- | ||||||
|  |  .../network/services/hostapd/files/hostapd.sh |  6 ++- | ||||||
|  |  .../hostapd/patches/901-cfg-section.patch     | 51 +++++++++++++++++++ | ||||||
|  |  2 files changed, 56 insertions(+), 1 deletion(-) | ||||||
|  |  create mode 100644 package/network/services/hostapd/patches/901-cfg-section.patch | ||||||
|  |  | ||||||
|  | diff --git a/package/network/services/hostapd/files/hostapd.sh b/package/network/services/hostapd/files/hostapd.sh | ||||||
|  | index 3ac9e7b590..c308d1d2de 100644 | ||||||
|  | --- a/package/network/services/hostapd/files/hostapd.sh | ||||||
|  | +++ b/package/network/services/hostapd/files/hostapd.sh | ||||||
|  | @@ -392,6 +392,8 @@ hostapd_common_add_bss_config() { | ||||||
|  |  	config_add_string fils_dhcp | ||||||
|  |   | ||||||
|  |  	config_add_boolean ratelimit | ||||||
|  | + | ||||||
|  | +	config_add_string uci_section | ||||||
|  |  } | ||||||
|  |   | ||||||
|  |  hostapd_set_vlan_file() { | ||||||
|  | @@ -627,7 +629,7 @@ hostapd_set_bss_options() { | ||||||
|  |  		airtime_bss_weight airtime_bss_limit airtime_sta_weight \ | ||||||
|  |  		multicast_to_unicast_all proxy_arp per_sta_vif \ | ||||||
|  |  		eap_server eap_user_file ca_cert server_cert private_key private_key_passwd server_id \ | ||||||
|  | -		vendor_elements fils | ||||||
|  | +		vendor_elements fils uci_section | ||||||
|  |   | ||||||
|  |  	set_default fils 0 | ||||||
|  |  	set_default isolate 0 | ||||||
|  | @@ -1152,6 +1154,8 @@ hostapd_set_bss_options() { | ||||||
|  |  		append bss_conf "per_sta_vif=$per_sta_vif" "$N" | ||||||
|  |  	fi | ||||||
|  |   | ||||||
|  | +	[ -n "$uci_section" ] && append bss_conf "uci_section=$uci_section" "$N" | ||||||
|  | + | ||||||
|  |  	json_get_values opts hostapd_bss_options | ||||||
|  |  	for val in $opts; do | ||||||
|  |  		append bss_conf "$val" "$N" | ||||||
|  | diff --git a/package/network/services/hostapd/patches/901-cfg-section.patch b/package/network/services/hostapd/patches/901-cfg-section.patch | ||||||
|  | new file mode 100644 | ||||||
|  | index 0000000000..dcfdd658fe | ||||||
|  | --- /dev/null | ||||||
|  | +++ b/package/network/services/hostapd/patches/901-cfg-section.patch | ||||||
|  | @@ -0,0 +1,51 @@ | ||||||
|  | +Index: hostapd-2021-02-20-59e9794c/hostapd/config_file.c | ||||||
|  | +=================================================================== | ||||||
|  | +--- hostapd-2021-02-20-59e9794c.orig/hostapd/config_file.c | ||||||
|  | ++++ hostapd-2021-02-20-59e9794c/hostapd/config_file.c | ||||||
|  | +@@ -2366,6 +2366,8 @@ static int hostapd_config_fill(struct ho | ||||||
|  | + 			return 1; | ||||||
|  | + 		} | ||||||
|  | + 		conf->driver = driver; | ||||||
|  | ++	} else if (os_strcmp(buf, "uci_section") == 0) { | ||||||
|  | ++		bss->uci_section = os_strdup(pos); | ||||||
|  | + 	} else if (os_strcmp(buf, "driver_params") == 0) { | ||||||
|  | + 		os_free(conf->driver_params); | ||||||
|  | + 		conf->driver_params = os_strdup(pos); | ||||||
|  | +Index: hostapd-2021-02-20-59e9794c/src/ap/ap_config.h | ||||||
|  | +=================================================================== | ||||||
|  | +--- hostapd-2021-02-20-59e9794c.orig/src/ap/ap_config.h | ||||||
|  | ++++ hostapd-2021-02-20-59e9794c/src/ap/ap_config.h | ||||||
|  | +@@ -279,6 +279,7 @@ struct hostapd_bss_config { | ||||||
|  | + 	char snoop_iface[IFNAMSIZ + 1]; | ||||||
|  | + 	char vlan_bridge[IFNAMSIZ + 1]; | ||||||
|  | + 	char wds_bridge[IFNAMSIZ + 1]; | ||||||
|  | ++	char *uci_section; | ||||||
|  | +  | ||||||
|  | + 	char *config_id; | ||||||
|  | +  | ||||||
|  | +Index: hostapd-2021-02-20-59e9794c/src/ap/ubus.c | ||||||
|  | +=================================================================== | ||||||
|  | +--- hostapd-2021-02-20-59e9794c.orig/src/ap/ubus.c | ||||||
|  | ++++ hostapd-2021-02-20-59e9794c/src/ap/ubus.c | ||||||
|  | +@@ -467,6 +467,9 @@ hostapd_bss_get_status(struct ubus_conte | ||||||
|  | + 			hapd->iface->cac_started ? hapd->iface->dfs_cac_ms / 1000 - now.sec : 0); | ||||||
|  | + 	blobmsg_close_table(&b, dfs_table); | ||||||
|  | +  | ||||||
|  | ++	if (hapd->conf->uci_section) | ||||||
|  | ++		blobmsg_add_string(&b, "uci_section", hapd->conf->uci_section); | ||||||
|  | ++ | ||||||
|  | + 	ubus_send_reply(ctx, req, b.head); | ||||||
|  | +  | ||||||
|  | + 	return 0; | ||||||
|  | +Index: hostapd-2021-02-20-59e9794c/src/ap/ap_config.c | ||||||
|  | +=================================================================== | ||||||
|  | +--- hostapd-2021-02-20-59e9794c.orig/src/ap/ap_config.c | ||||||
|  | ++++ hostapd-2021-02-20-59e9794c/src/ap/ap_config.c | ||||||
|  | +@@ -785,6 +785,7 @@ void hostapd_config_free_bss(struct host | ||||||
|  | + 	os_free(conf->radius_req_attr_sqlite); | ||||||
|  | + 	os_free(conf->rsn_preauth_interfaces); | ||||||
|  | + 	os_free(conf->ctrl_interface); | ||||||
|  | ++	os_free(conf->uci_section); | ||||||
|  | + 	os_free(conf->config_id); | ||||||
|  | + 	os_free(conf->ca_cert); | ||||||
|  | + 	os_free(conf->server_cert); | ||||||
|  | --  | ||||||
|  | 2.25.1 | ||||||
|  |  | ||||||
							
								
								
									
										108
									
								
								patches/wifi/0021-hostapd-add-dynamic_probe_resp.patch
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										108
									
								
								patches/wifi/0021-hostapd-add-dynamic_probe_resp.patch
									
									
									
									
									
										Normal file
									
								
							| @@ -0,0 +1,108 @@ | |||||||
|  | From 4688450129baef1b5e495256947075f992778a1f Mon Sep 17 00:00:00 2001 | ||||||
|  | From: John Crispin <john@phrozen.org> | ||||||
|  | Date: Wed, 16 Nov 2022 16:40:01 +0100 | ||||||
|  | Subject: [PATCH 21/21] hostapd: add dynamic_probe_resp | ||||||
|  |  | ||||||
|  | Signed-off-by: John Crispin <john@phrozen.org> | ||||||
|  | --- | ||||||
|  |  .../network/services/hostapd/files/hostapd.sh |  6 ++- | ||||||
|  |  .../hostapd/patches/999-probe-request.patch   | 49 +++++++++++++++++++ | ||||||
|  |  2 files changed, 54 insertions(+), 1 deletion(-) | ||||||
|  |  create mode 100644 package/network/services/hostapd/patches/999-probe-request.patch | ||||||
|  |  | ||||||
|  | diff --git a/package/network/services/hostapd/files/hostapd.sh b/package/network/services/hostapd/files/hostapd.sh | ||||||
|  | index c308d1d2de..8362158cb0 100644 | ||||||
|  | --- a/package/network/services/hostapd/files/hostapd.sh | ||||||
|  | +++ b/package/network/services/hostapd/files/hostapd.sh | ||||||
|  | @@ -394,6 +394,8 @@ hostapd_common_add_bss_config() { | ||||||
|  |  	config_add_boolean ratelimit | ||||||
|  |   | ||||||
|  |  	config_add_string uci_section | ||||||
|  | + | ||||||
|  | +	config_add_boolean dynamic_probe_resp | ||||||
|  |  } | ||||||
|  |   | ||||||
|  |  hostapd_set_vlan_file() { | ||||||
|  | @@ -629,7 +631,7 @@ hostapd_set_bss_options() { | ||||||
|  |  		airtime_bss_weight airtime_bss_limit airtime_sta_weight \ | ||||||
|  |  		multicast_to_unicast_all proxy_arp per_sta_vif \ | ||||||
|  |  		eap_server eap_user_file ca_cert server_cert private_key private_key_passwd server_id \ | ||||||
|  | -		vendor_elements fils uci_section | ||||||
|  | +		vendor_elements fils uci_section dynamic_probe_resp | ||||||
|  |   | ||||||
|  |  	set_default fils 0 | ||||||
|  |  	set_default isolate 0 | ||||||
|  | @@ -652,6 +654,7 @@ hostapd_set_bss_options() { | ||||||
|  |  	set_default airtime_bss_weight 0 | ||||||
|  |  	set_default airtime_bss_limit 0 | ||||||
|  |  	set_default eap_server 0 | ||||||
|  | +	set_default dynamic_probe_resp 0 | ||||||
|  |   | ||||||
|  |  	/usr/sbin/hostapd -vfils || fils=0 | ||||||
|  |   | ||||||
|  | @@ -677,6 +680,7 @@ hostapd_set_bss_options() { | ||||||
|  |  	append bss_conf "preamble=$short_preamble" "$N" | ||||||
|  |  	append bss_conf "wmm_enabled=$wmm" "$N" | ||||||
|  |  	append bss_conf "ignore_broadcast_ssid=$hidden" "$N" | ||||||
|  | +	append bss_conf "dynamic_probe_resp=$dynamic_probe_resp" "$N" | ||||||
|  |  	append bss_conf "uapsd_advertisement_enabled=$uapsd" "$N" | ||||||
|  |  	append bss_conf "utf8_ssid=$utf8_ssid" "$N" | ||||||
|  |  	append bss_conf "multi_ap=$multi_ap" "$N" | ||||||
|  | diff --git a/package/network/services/hostapd/patches/999-probe-request.patch b/package/network/services/hostapd/patches/999-probe-request.patch | ||||||
|  | new file mode 100644 | ||||||
|  | index 0000000000..3b79338c2f | ||||||
|  | --- /dev/null | ||||||
|  | +++ b/package/network/services/hostapd/patches/999-probe-request.patch | ||||||
|  | @@ -0,0 +1,49 @@ | ||||||
|  | +Index: hostapd-2021-02-20-59e9794c/hostapd/config_file.c | ||||||
|  | +=================================================================== | ||||||
|  | +--- hostapd-2021-02-20-59e9794c.orig/hostapd/config_file.c | ||||||
|  | ++++ hostapd-2021-02-20-59e9794c/hostapd/config_file.c | ||||||
|  | +@@ -3339,6 +3339,8 @@ static int hostapd_config_fill(struct ho | ||||||
|  | + 		bss->ignore_broadcast_ssid = atoi(pos); | ||||||
|  | + 	} else if (os_strcmp(buf, "no_probe_resp_if_max_sta") == 0) { | ||||||
|  | + 		bss->no_probe_resp_if_max_sta = atoi(pos); | ||||||
|  | ++	} else if (os_strcmp(buf, "dynamic_probe_resp") == 0) { | ||||||
|  | ++		bss->dynamic_probe_resp = atoi(pos); | ||||||
|  | + #ifdef CONFIG_WEP | ||||||
|  | + 	} else if (os_strcmp(buf, "wep_default_key") == 0) { | ||||||
|  | + 		bss->ssid.wep.idx = atoi(pos); | ||||||
|  | +Index: hostapd-2021-02-20-59e9794c/src/ap/ap_config.h | ||||||
|  | +=================================================================== | ||||||
|  | +--- hostapd-2021-02-20-59e9794c.orig/src/ap/ap_config.h | ||||||
|  | ++++ hostapd-2021-02-20-59e9794c/src/ap/ap_config.h | ||||||
|  | +@@ -460,6 +460,7 @@ struct hostapd_bss_config { | ||||||
|  | + 	int ap_max_inactivity; | ||||||
|  | + 	int ignore_broadcast_ssid; | ||||||
|  | + 	int no_probe_resp_if_max_sta; | ||||||
|  | ++	int dynamic_probe_resp; | ||||||
|  | +  | ||||||
|  | + 	int wmm_enabled; | ||||||
|  | + 	int wmm_uapsd; | ||||||
|  | +Index: hostapd-2021-02-20-59e9794c/src/ap/beacon.c | ||||||
|  | +=================================================================== | ||||||
|  | +--- hostapd-2021-02-20-59e9794c.orig/src/ap/beacon.c | ||||||
|  | ++++ hostapd-2021-02-20-59e9794c/src/ap/beacon.c | ||||||
|  | +@@ -920,7 +920,8 @@ void handle_probe_req(struct hostapd_dat | ||||||
|  | + 	} | ||||||
|  | + #endif /* CONFIG_P2P */ | ||||||
|  | +  | ||||||
|  | +-	if (hapd->conf->ignore_broadcast_ssid && elems.ssid_len == 0 && | ||||||
|  | ++	if (!hapd->conf->dynamic_probe_resp && | ||||||
|  | ++	    hapd->conf->ignore_broadcast_ssid && elems.ssid_len == 0 && | ||||||
|  | + 	    elems.ssid_list_len == 0 && elems.short_ssid_list_len == 0) { | ||||||
|  | + 		wpa_printf(MSG_MSGDUMP, "Probe Request from " MACSTR " for " | ||||||
|  | + 			   "broadcast SSID ignored", MAC2STR(mgmt->sa)); | ||||||
|  | +@@ -967,7 +968,8 @@ void handle_probe_req(struct hostapd_dat | ||||||
|  | + 		return; | ||||||
|  | + 	} | ||||||
|  | +  | ||||||
|  | +-	if (hapd->conf->ignore_broadcast_ssid && res == WILDCARD_SSID_MATCH) { | ||||||
|  | ++	if (!hapd->conf->dynamic_probe_resp && | ||||||
|  | ++	    hapd->conf->ignore_broadcast_ssid && res == WILDCARD_SSID_MATCH) { | ||||||
|  | + 		wpa_printf(MSG_MSGDUMP, "Probe Request from " MACSTR " for " | ||||||
|  | + 			   "broadcast SSID ignored", MAC2STR(mgmt->sa)); | ||||||
|  | + 		return; | ||||||
|  | --  | ||||||
|  | 2.25.1 | ||||||
|  |  | ||||||
							
								
								
									
										43
									
								
								patches/wifi/0022-hostapd-add-maxassoc_ignore_probe.patch
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										43
									
								
								patches/wifi/0022-hostapd-add-maxassoc_ignore_probe.patch
									
									
									
									
									
										Normal file
									
								
							| @@ -0,0 +1,43 @@ | |||||||
|  | From 7a647260b6ec314fe4c52449bb6fe0a39026e9d9 Mon Sep 17 00:00:00 2001 | ||||||
|  | From: John Crispin <john@phrozen.org> | ||||||
|  | Date: Tue, 29 Nov 2022 14:29:15 +0100 | ||||||
|  | Subject: [PATCH] hostapd: add maxassoc_ignore_probe | ||||||
|  |  | ||||||
|  | Signed-off-by: John Crispin <john@phrozen.org> | ||||||
|  | --- | ||||||
|  |  package/network/services/hostapd/files/hostapd.sh | 5 ++++- | ||||||
|  |  1 file changed, 4 insertions(+), 1 deletion(-) | ||||||
|  |  | ||||||
|  | diff --git a/package/network/services/hostapd/files/hostapd.sh b/package/network/services/hostapd/files/hostapd.sh | ||||||
|  | index 8362158cb0..fa0dbfb754 100644 | ||||||
|  | --- a/package/network/services/hostapd/files/hostapd.sh | ||||||
|  | +++ b/package/network/services/hostapd/files/hostapd.sh | ||||||
|  | @@ -117,6 +117,7 @@ hostapd_common_add_device_config() { | ||||||
|  |  	config_add_int rssi_reject_assoc_rssi | ||||||
|  |  	config_add_int rssi_ignore_probe_request | ||||||
|  |  	config_add_int maxassoc | ||||||
|  | +	config_add_boolean maxassoc_ignore_probe | ||||||
|  |   | ||||||
|  |  	config_add_string acs_chan_bias | ||||||
|  |  	config_add_boolean acs_exclude_dfs | ||||||
|  | @@ -138,7 +139,8 @@ hostapd_prepare_device_config() { | ||||||
|  |  	json_get_vars country country3 country_ie beacon_int:100 dtim_period:2 doth require_mode legacy_rates \ | ||||||
|  |  		acs_chan_bias local_pwr_constraint spectrum_mgmt_required airtime_mode cell_density \ | ||||||
|  |  		rts_threshold beacon_rate rssi_reject_assoc_rssi rssi_ignore_probe_request maxassoc \ | ||||||
|  | -		multiple_bssid he_co_locate rnr_beacon ema acs_exclude_dfs | ||||||
|  | +		multiple_bssid he_co_locate rnr_beacon ema acs_exclude_dfs \ | ||||||
|  | +		maxassoc_ignore_probe | ||||||
|  |   | ||||||
|  |  	hostapd_set_log_options base_cfg | ||||||
|  |   | ||||||
|  | @@ -245,6 +247,7 @@ hostapd_prepare_device_config() { | ||||||
|  |  	append base_cfg "dtim_period=$dtim_period" "$N" | ||||||
|  |  	[ "$airtime_mode" -gt 0 ] && append base_cfg "airtime_mode=$airtime_mode" "$N" | ||||||
|  |  	[ -n "$maxassoc" ] && append base_cfg "iface_max_num_sta=$maxassoc" "$N" | ||||||
|  | +	[ "$maxassoc_ignore_probe" -gt 0 ] && append base_cfg "no_probe_resp_if_max_sta=1" "$N" | ||||||
|  |  	[ "$rnr_beacon" -gt 0 ] && append base_cfg "rnr_beacon=$rnr_beacon" "$N" | ||||||
|  |  	[ "$he_co_locate" -gt 0 ] && append base_cfg "he_co_locate=$he_co_locate" "$N" | ||||||
|  |  	[ "$multiple_bssid" -gt 0 ] && append base_cfg "multiple_bssid=$multiple_bssid" "$N" | ||||||
|  | --  | ||||||
|  | 2.25.1 | ||||||
|  |  | ||||||
							
								
								
									
										12
									
								
								profiles/hfcl_ion4x.yml
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										12
									
								
								profiles/hfcl_ion4x.yml
									
									
									
									
									
										Normal file
									
								
							| @@ -0,0 +1,12 @@ | |||||||
|  | --- | ||||||
|  | profile: hfcl_ion4x | ||||||
|  | target: ipq807x | ||||||
|  | subtarget: ipq60xx | ||||||
|  | description: Build image for the HFCL ION 4X | ||||||
|  | image: bin/targets/ipq807x/ipq60xx/openwrt-ipq807x-hfcl_ion4x-squashfs-sysupgrade.tar | ||||||
|  | feeds: | ||||||
|  |   - name: ipq807x | ||||||
|  |     path: ../../feeds/ipq807x | ||||||
|  | include: | ||||||
|  |   - wifi-ax | ||||||
|  |   - ucentral-ap | ||||||
							
								
								
									
										12
									
								
								profiles/hfcl_ion4x_2.yml
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										12
									
								
								profiles/hfcl_ion4x_2.yml
									
									
									
									
									
										Normal file
									
								
							| @@ -0,0 +1,12 @@ | |||||||
|  | --- | ||||||
|  | profile: hfcl_ion4x_2 | ||||||
|  | target: ipq807x | ||||||
|  | subtarget: ipq60xx | ||||||
|  | description: Build image for the HFCL ION 4X_2 | ||||||
|  | image: bin/targets/ipq807x/ipq60xx/openwrt-ipq807x-hfcl_ion4x_2-squashfs-sysupgrade.tar | ||||||
|  | feeds: | ||||||
|  |   - name: ipq807x | ||||||
|  |     path: ../../feeds/ipq807x | ||||||
|  | include: | ||||||
|  |   - wifi-ax | ||||||
|  |   - ucentral-ap | ||||||
| @@ -1,9 +1,9 @@ | |||||||
| --- | --- | ||||||
| profile: indio_um-310ax-v1  | profile: indio_um-310ax-v1 | ||||||
| target: ipq807x | target: ipq807x | ||||||
| subtarget: ipq60xx | subtarget: ipq60xx | ||||||
| description: Build image for the Indio UM-310AX V1  | description: Build image for the Indio UM-310AX V1 | ||||||
| image: bin/targets/ipq807x/ipq60xx/openwrt-ipq807x-indio-um-310ax-v1-squashfs-sysupgrade.tar | image: bin/targets/ipq807x/ipq60xx/openwrt-ipq807x-indio_um-310ax-v1-squashfs-sysupgrade.tar | ||||||
| feeds: | feeds: | ||||||
|   - name: ipq807x |   - name: ipq807x | ||||||
|     path: ../../feeds/ipq807x |     path: ../../feeds/ipq807x | ||||||
|   | |||||||
| @@ -1,9 +1,9 @@ | |||||||
| --- | --- | ||||||
| profile: indio_um-510axm-v1  | profile: indio_um-510axm-v1 | ||||||
| target: ipq807x | target: ipq807x | ||||||
| subtarget: ipq60xx | subtarget: ipq60xx | ||||||
| description: Build image for the Indio UM-510AXM V1  | description: Build image for the Indio UM-510AXM V1 | ||||||
| image: bin/targets/ipq807x/ipq60xx/openwrt-ipq807x-indio-um-510axm-v1-squashfs-sysupgrade.tar | image: bin/targets/ipq807x/ipq60xx/openwrt-ipq807x-indio_um-510axm-v1-squashfs-sysupgrade.tar | ||||||
| feeds: | feeds: | ||||||
|   - name: ipq807x |   - name: ipq807x | ||||||
|     path: ../../feeds/ipq807x |     path: ../../feeds/ipq807x | ||||||
|   | |||||||
| @@ -1,9 +1,9 @@ | |||||||
| --- | --- | ||||||
| profile: indio_um-510axp-v1  | profile: indio_um-510axp-v1 | ||||||
| target: ipq807x | target: ipq807x | ||||||
| subtarget: ipq60xx | subtarget: ipq60xx | ||||||
| description: Build image for the Indio UM-510AXP V1  | description: Build image for the Indio UM-510AXP V1 | ||||||
| image: bin/targets/ipq807x/ipq60xx/openwrt-ipq807x-indio-um-510axp-v1-squashfs-sysupgrade.tar | image: bin/targets/ipq807x/ipq60xx/openwrt-ipq807x-indio_um-510axp-v1-squashfs-sysupgrade.tar | ||||||
| feeds: | feeds: | ||||||
|   - name: ipq807x |   - name: ipq807x | ||||||
|     path: ../../feeds/ipq807x |     path: ../../feeds/ipq807x | ||||||
|   | |||||||
| @@ -43,11 +43,14 @@ packages: | |||||||
|   - ucentral-schema |   - ucentral-schema | ||||||
|   - ucentral-wifi |   - ucentral-wifi | ||||||
|   - ucentral-tools |   - ucentral-tools | ||||||
|  |   - usteer2 | ||||||
|  |   - ucrun | ||||||
|   - ucode |   - ucode | ||||||
|   - unetd |   - unetd | ||||||
|   - udhcpsnoop |   - udhcpsnoop | ||||||
|   - udnssnoop |   - udnssnoop | ||||||
|   - usteer |   - usteer | ||||||
|  |   - usteer2 | ||||||
|   - ustp |   - ustp | ||||||
|   - libustream-openssl |   - libustream-openssl | ||||||
|   - udevmand |   - udevmand | ||||||
|   | |||||||
							
								
								
									
										8
									
								
								profiles/yuncore_fap640.yml
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										8
									
								
								profiles/yuncore_fap640.yml
									
									
									
									
									
										Normal file
									
								
							| @@ -0,0 +1,8 @@ | |||||||
|  | --- | ||||||
|  | profile: yuncore_fap640 | ||||||
|  | target: ramips | ||||||
|  | subtarget: mt7621 | ||||||
|  | description: Build image for the Yuncore FAP640 | ||||||
|  | image: bin/targets/ramips/mt7621/openwrt-ramips-mt7621-yuncore_fap640-squashfs-sysupgrade.bin | ||||||
|  | include: | ||||||
|  |   - ucentral-ap | ||||||
							
								
								
									
										12
									
								
								profiles/yuncore_fap650.yml
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										12
									
								
								profiles/yuncore_fap650.yml
									
									
									
									
									
										Normal file
									
								
							| @@ -0,0 +1,12 @@ | |||||||
|  | --- | ||||||
|  | profile: yuncore_fap650 | ||||||
|  | target: ipq807x | ||||||
|  | subtarget: ipq60xx | ||||||
|  | description: Build image for the YunCore FAP650 | ||||||
|  | image: bin/targets/ipq807x/ipq60xx/openwrt-ipq807x-yuncore_fap650-squashfs-sysupgrade.tar | ||||||
|  | feeds: | ||||||
|  |   - name: ipq807x | ||||||
|  |     path: ../../feeds/ipq807x | ||||||
|  | include: | ||||||
|  |   - wifi-ax | ||||||
|  |   - ucentral-ap | ||||||
		Reference in New Issue
	
	Block a user