Compare commits

...

120 Commits

Author SHA1 Message Date
jaspreetsachdev
4c21f5c4b6 Merge pull request #462 from Telecominfraproject/main
Fixes for WIFI-9962 and others
2022-07-01 00:58:45 -04:00
jaspreetsachdev
cf657dbd94 Merge pull request #461 from Telecominfraproject/next
Next
2022-06-30 17:34:02 -04:00
jaspreetsachdev
33c9876760 Merge pull request #460 from Telecominfraproject/release/v2.6.0
Release/v2.6.0
2022-06-30 17:30:42 -04:00
John Crispin
4d6d7405d6 ucentral-schema: update to latest HEAD
9691cc6 improve custom config handling
b4a3a56 add support for OWE encryption

Fixes: WIFI-9811
Signed-off-by: John Crispin <john@phrozen.org>
2022-06-30 12:19:41 +02:00
John Crispin
e249701c34 profile: add bind-dig to default package selection
This makes openroaming NAPTR work

Fixes: WIFI-9962
Signed-off-by: John Crispin <john@phrozen.org>
2022-06-30 12:19:41 +02:00
John Crispin
0d50975152 hostapd: backport OWE patches
Fixes: WIFI-9811
Signed-off-by: John Crispin <john@phrozen.org>
2022-06-30 12:19:41 +02:00
John Crispin
6d87847d15 radius-gw-proxy: update to latest HEAD
Fixes: WIFI-9620
Signed-off-by: John Crispin <john@phrozen.org>
2022-06-30 12:19:41 +02:00
jaspreetsachdev
eebe021780 Merge pull request #459 from Telecominfraproject/main
ucentral-client: update to latest HEAD
2022-06-23 15:02:37 -04:00
John Crispin
c6e0384f21 ucentral-client: update to latest HEAD
68fe6c2 fix the ping command

Signed-off-by: John Crispin <john@phrozen.org>
2022-06-23 14:06:26 +02:00
jaspreetsachdev
23ae850f72 Merge pull request #458 from Telecominfraproject/main
Fixes for WIFI-7687, WIFI-9620
2022-06-22 08:59:02 -04:00
John Crispin
708cf2dec6 ucentral-schema: update to latest HEAD
fc8fdcf point radsec proxy at the correct radius accounting server
886a650 Add missing paramters to uC state schema
c8b15b7 chain the radius vendor attributes inside a single AVP

Fixes: WIFI-7687
Fixes: WIFI-9620
Signed-off-by: John Crispin <john@phrozen.org>
2022-06-22 11:06:35 +02:00
John Crispin
a95745d95b ucentral-client: update to latest HEAD
62efd45 add radius-proxy RX path

Fixes: WIFI-9620
Signed-off-by: John Crispin <john@phrozen.org>
2022-06-22 11:06:21 +02:00
John Crispin
83ccea0abf radius-gw-proxy: add RX path support
Fixes: WIFI-9620
Signed-off-by: John Crispin <john@phrozen.org>
2022-06-22 11:02:16 +02:00
John Crispin
bfeaf89238 ucentral-schema: update to latest HEAD
548ce37 point radsec proxy at the correct radius accounting server
c49ce29 Add missing paramters to uC state schema
1c55872 chain the radius vendor attributes inside a single AVP

Signed-off-by: John Crispin <john@phrozen.org>
2022-06-20 19:24:29 +02:00
jaspreetsachdev
7439217b3c Merge pull request #456 from Telecominfraproject/main
Merging Fixes for WIFI-9630 and others
2022-06-17 09:32:12 -04:00
John Crispin
ae2377f4d2 ucentral-schema: update to latest HEAD
4df0373 renderer: quote wireless encryption key

Fixes: WIFI-9630
Signed-off-by: John Crispin <john@phrozen.org>
2022-06-16 16:37:37 +02:00
John Crispin
b81d0aaf0e ipq40xx: add dual boot support for ecw5211
Fixes: WIFI-7712
Signed-off-by: John Crispin <john@phrozen.org>
2022-06-16 12:47:13 +02:00
John Crispin
1546bef93f ucentral-schema: update to latest HEAD
1d7e565 optimize the bridge/uci config for gre tunnels

Signed-off-by: John Crispin <john@phrozen.org>
2022-06-16 12:44:53 +02:00
Stijn Tintel
32b1aade42 ipq807x: force ext4 creation in emmc_do_upgrade
Running mkfs.ext4 on a partition that already contains an ext4
filesystem asks for input:

  mke2fs 1.45.6 (20-Mar-2020)
  /dev/mmcblk0p9 contains a ext4 file system
          created on Sat Jun 11 12:23:42 2022
  Proceed anyway? (y,N) y

This breaks the ability to run sysupgrade non-interactively. Add the -F
switch to force ext4 creation to fix this.

Fixes: WIFI-9419
Signed-off-by: Stijn Tintel <stijn@linux-ipv6.be>
2022-06-15 12:42:34 +02:00
Stijn Tintel
2a92b75fe1 ipq807x: silence dd errors in do_flash_emmc
Running dd if=/dev/zero to a partition will always throw an ENOSPC error
when reaching the end of the partition. Silence those errors to avoid
confusion.

Signed-off-by: Stijn Tintel <stijn@linux-ipv6.be>
2022-06-15 12:42:34 +02:00
John Crispin
cb30d9e20a ipq807x: add motorola q14 support
Fixes: WIFI-8040
Signed-off-by: John Crispin <john@phrozen.org>
2022-06-15 12:42:34 +02:00
John Crispin
588206b93b ucentral-schema: update to latest HEAD
417fcc4 fix selection of radius proxy ip

Fixes: WIFI-9461
Signed-off-by: John Crispin <john@phrozen.org>
2022-06-13 14:57:48 +02:00
John Crispin
6399649038 ipq807x: improve dual boot on eap101/2
inverse the logic that figures out if we want to set upgrade_available.

Fixes: WIFI-7712
Signed-off-by: John Crispin <john@phrozen.org>
2022-06-13 14:57:48 +02:00
John Crispin
aa3cb95233 wireguard-tools: do not select the kernel module
unetd will select the correct kernel module.

Fixes: WIFI-7571
Signed-off-by: John Crispin <john@phrozen.org>
2022-06-13 14:57:48 +02:00
John Crispin
3ea06dac40 dhcpsnoop: update code
* Update to latest version of dhcpsnoop
* always snoop all upstream interfaces
* add snooped leases to state

Fixes: WIFI-7838
Signed-off-by: John Crispin <john@phrozen.org>
2022-06-13 14:57:21 +02:00
jaspreetsachdev
a70dda4a8e Merge pull request #453 from Telecominfraproject/main
Merge Main to release/v2.6.0
2022-06-09 15:43:49 -04:00
John Crispin
a01f1add81 ipq807x: disable Q14 image generation
Fixes: WIFI-7570
Signed-off-by: John Crispin <john@phrozen.org>
2022-06-09 14:06:39 +02:00
Felix Fietkau
57849591d7 ipq807x: backport act_mirred changes
Fixes: WIFI-7838
Signed-off-by: Felix Fietkau <nbd@nbd.name>
2022-06-09 14:06:25 +02:00
John Crispin
b4a09e7167 ucentral-schema: update to latest HEAD
96324e2 fix a typo inside the state handler

Fixes: WIFI-7838
Signed-off-by: John Crispin <john@phrozen.org>
2022-06-09 14:05:34 +02:00
John Crispin
96bb8b1372 ucentral-schema: update to latest HEAD
6974baa add data model support for wireguard overlay networks

Fixes: WIFI-7571
Signed-off-by: John Crispin <john@phrozen.org>
2022-06-09 14:05:24 +02:00
John Crispin
99ea9da785 ipq807x: add kmod-wireguard backport package
Fixes: WIFI-7571
Signed-off-by: John Crispin <john@phrozen.org>
2022-06-09 14:05:00 +02:00
John Crispin
bfe7fadfc5 ucentral-schema: update to latest HEAD
Signed-off-by: John Crispin <john@phrozen.org>
2022-06-09 14:04:04 +02:00
John Crispin
ad1dcc4f45 radius-gw-proxy: fix compile error on gcc5
Fixes: WIFI-7570
Signed-off-by: John Crispin <john@phrozen.org>
2022-06-09 14:03:53 +02:00
John Crispin
f371c789d0 ipq807x: revert all 11.5 changes
Fixes: WIFI-7570
Signed-off-by: John Crispin <john@phrozen.org>
2022-06-09 14:03:42 +02:00
John Crispin
386eca1f65 wifi-ax: revert all ath11.5 changes
Fixes: WIFI-7570
Signed-off-by: John Crispin <john@phrozen.org>
2022-06-09 14:03:05 +02:00
John Crispin
8b9047952d ipq807x: make USB work on wallys-dr6018 and disable sdhci
Fixes: WIFI-9306
Signed-off-by: John Crispin <john@phrozen.org>
2022-06-09 14:01:49 +02:00
John Crispin
5a105ef06e hostapd: make psk2-radius work on wifi-5 devices
Signed-off-by: John Crispin <john@phrozen.org>
2022-06-09 13:59:43 +02:00
John Crispin
c60dc1e045 wifi-ax: disable encap offloading in WDS / STA mode
Fixes: WIFI-9305
Signed-off-by: John Crispin <john@phrozen.org>
2022-06-09 13:58:06 +02:00
John Crispin
1e1bd19429 ucentral-schema: update to latest HEAD
bfa2647 make sure that vxlan tunnels endup inside a bridge

Fixes: WIFI-9121
Signed-off-by: John Crispin <john@phrozen.org>
2022-05-30 08:26:51 +02:00
John Crispin
cfe07f6e15 ipq807x: backport the skb->cb fix from upstream
This was causing sporadic proxy_arp failures.

Fixes: WIFI-7154
Signed-off-by: John Crispin <john@phrozen.org>
2022-05-30 06:03:02 +02:00
John Crispin
a64039db20 mac80211-qca: properly rebase a patch
The patch had a line skew due to a bad rebase.

Fixes: WIFI-7570
Signed-off-by: John Crispin <john@phrozen.org>
2022-05-29 18:11:58 +02:00
John Crispin
7f81ddb8cc ucentral-schema: update to latest HEAD
27f451b add script command handler

Fixes: WIFI-9120
Signed-off-by: John Crispin <john@phrozen.org>
2022-05-29 18:11:58 +02:00
John Crispin
3c0d495334 ucode: package the uloop library
Fixes: WIFI-9120
Signed-off-by: John Crispin <john@phrozen.org>
2022-05-29 17:33:14 +02:00
John Crispin
38a7c54cce ucentral-client: update to latest HEAD
a4671bb fix an error reported by CI
a82c3f0 add handling for the "script" command

Fixes: WIFI-9120
Signed-off-by: John Crispin <john@phrozen.org>
2022-05-29 17:31:00 +02:00
Jianhui Zhao
1aead07444 ath11k-wifi: update GL-AXT1800 BDF
Fixes: WIFI-8042
Signed-off-by: Jianhui Zhao <jianhui.zhao@gl-inet.com>
2022-05-29 10:31:54 +02:00
John Crispin
d2f44cbb12 ucentral-schema: update to latest HEAD
d1c7ab8 add ip-collide handler

Fixes: WIFI-7830
Fixes: WIFI-7989
Signed-off-by: John Crispin <john@phrozen.org>
2022-05-29 10:30:45 +02:00
John Crispin
43d7ca31d6 wifi-ax/mac80211: make the 11.4 ath11k work inside the v5.4 kernel
Fixes: WIFI-7570
Signed-off-by: John Crispin <john@phrozen.org>
2022-05-27 10:05:52 +02:00
John Crispin
0985c573b0 ipq807x: fix MAC assign on cig-wf19* units
The mtd offset changed in the v5.4 kernel causing MAC lookup to fail.

Fixes: WIFI-7997
Signed-off-by: John Crispin <john@phrozen.org>
2022-05-27 07:34:07 +02:00
John Crispin
d9ed861c1d ipq807x: add support for wallytech dr6018(-v4)
Fixes: WIFI-7570
Signed-off-by: John Crispin <john@phrozen.org>
2022-05-26 16:20:34 +02:00
John Crispin
8ef9989147 ipq807x: fix a null pointer crash in ip_tunnel
Fixes: WIFI-7571
Signed-off-by: John Crispin <john@phrozen.org>
2022-05-26 09:51:07 +02:00
John Crispin
7d5eab4bf3 libnl-tine: update to latest HEAD
Fixes: WIFI-7571
Signed-off-by: John Crispin <john@phrozen.org>
2022-05-26 09:50:34 +02:00
John Crispin
5e03e04bbd unetd: add wireshark overlay service
Fixes: WIFI-7571
Signed-off-by: John Crispin <john@phrozen.org>
2022-05-26 09:30:11 +02:00
John Crispin
6fabaeca53 kernel-headers: make sure that the QSDK v5.4 kernel has access to the wireshark headers
Fixes: WIFI-7571
Signed-off-by: John Crispin <john@phrozen.org>
2022-05-26 09:28:59 +02:00
John Crispin
be4ca445f5 netifd: update to latest HEAD
Fixes: WIFI-7571
Signed-off-by: John Crispin <john@phrozen.org>
2022-05-26 09:28:36 +02:00
John Crispin
e99c8b27e1 libubox: update to latest HEAD
Fixes: WIFI-7571
Signed-off-by: John Crispin <john@phrozen.org>
2022-05-26 09:28:11 +02:00
John Crispin
e9055b4f08 ucentral-schema: update to latest HEAD
6d83248 add missing radsec features

Fixes: WIFI-7077
Signed-off-by: John Crispin <john@phrozen.org>
2022-05-26 09:13:23 +02:00
John Crispin
cfcafb676b ipq807x: backport the wireguard patches from the generic folder
Signed-off-by: John Crispin <john@phrozen.org>
2022-05-24 17:28:11 +02:00
GL.iNet-Xinfa.Deng
899b4d6bfd ipq807x: fix gl-ax1800 switch button high active level
The active status of the switch button in the DTS configuration
is the opposite of that marked on the product housing.

The switch button should be activated at high GPIO level.

Fixes: WIFI-8042
Signed-off-by: GL.iNet-Xinfa.Deng <xinfa.deng@gl-inet.com>
2022-05-24 15:07:19 +02:00
John Crispin
2003632ddb ucentral-schema: update to latest HEAD
db15ed7 third-party services were not getting shut down properly

Fixes: WIFI-6907
Signed-off-by: John Crispin <john@phrozen.org>
2022-05-24 14:05:14 +02:00
John Crispin
d4a14106b7 radius_gw_proxy: add support for a radius/gateway proxy
This will allow the AP to send radius requests via the websocket
to the gateway for routing to the correct AAA.

Fixes: WIFI-7328
Signed-off-by: John Crispin <john@phrozen.org>
2022-05-24 14:05:14 +02:00
John Crispin
85af9d7e0b ipq807x: add motorola q14 support
Fixes: WIFI-8040
Signed-off-by: John Crispin <john@phrozen.org>
2022-05-24 14:05:06 +02:00
John Crispin
d4442efbfe ipq807x: disable bluetooth on eap102
this causes units to take several minutes if the nrf8 chip has not been flashed yet

Signed-off-by: John Crispin <john@phrozen.org>
2022-05-20 15:37:10 +02:00
John Crispin
3a26ae2695 ipq807x: re-add patches that got lost during the v5.4 update
Signed-off-by: John Crispin <john@phrozen.org>
2022-05-20 15:36:42 +02:00
John Crispin
09af596e85 ipq807x: fix the lan port on EAP102
Signed-off-by: John Crispin <john@phrozen.org>
2022-05-20 15:36:20 +02:00
John Crispin
5985187316 .github: remove wallys cypress from CI until bootloop on v5.4 is resolved
Signed-off-by: John Crispin <john@phrozen.org>
2022-05-20 12:12:22 +02:00
John Crispin
33ac83a309 wifi-ax: enable fils_discovery and multiple_ssid by default on 6g band
Signed-off-by: John Crispin <john@phrozen.org>
2022-05-20 11:29:36 +02:00
John Crispin
921c1b553d ipq807x: enable ethernet LEDs on wf196
Signed-off-by: John Crispin <john@phrozen.org>
2022-05-20 11:29:11 +02:00
Jianhui Zhao
d160507230 ipq807x: fix dts for gl-ax1800
Signed-off-by: Jianhui Zhao <jianhui.zhao@gl-inet.com>
2022-05-19 13:16:26 +02:00
Jianhui Zhao
7368620fd2 ipq807x: bump glinet ax1800/axt1800 to ath11.5/v5.4
Signed-off-by: Jianhui Zhao <jianhui.zhao@gl-inet.com>
2022-05-19 11:21:21 +02:00
John Crispin
a910e297a3 ucentral-schema: update to latest HEAD
7ead16a add device serial as an additional TLV inside radius requests

Signed-off-by: John Crispin <john@phrozen.org>
2022-05-18 13:02:32 +02:00
John Crispin
f819bb8753 wifi-ax: update hostapd to latest 11.5-cs
Signed-off-by: John Crispin <john@phrozen.org>
2022-05-18 10:59:06 +02:00
John Crispin
cc0d4bded2 ipq807x: bump wf194c4 to ath11.5/v5.4
Signed-off-by: John Crispin <john@phrozen.org>
2022-05-17 07:45:33 +02:00
Felix Fietkau
e3b2b7f232 ipq807x: enable threaded napi on ethernet
Signed-off-by: Felix Fietkau <nbd@nbd.name>
2022-05-17 07:45:32 +02:00
Felix Fietkau
c8dde50eba ath11k: enable threaded napi support
Signed-off-by: Felix Fietkau <nbd@nbd.name>
2022-05-17 07:45:32 +02:00
Felix Fietkau
3c355f96eb ipq807x: backport threaded NAPI support
Signed-off-by: Felix Fietkau <nbd@nbd.name>
2022-05-17 07:45:32 +02:00
John Crispin
93dd24ef6e qca-nss-fw: update maple firmware
Signed-off-by: John Crispin <john@phrozen.org>
2022-05-17 07:45:32 +02:00
John Crispin
107bc8ef65 ucentral-schema: update to latest HEAD
a18efc1 add psk2-radius support

Signed-off-by: John Crispin <john@phrozen.org>
2022-05-17 07:45:32 +02:00
John Crispin
9a8278afcc hostapd: add psk2-radius support
Signed-off-by: John Crispin <john@phrozen.org>
2022-05-17 07:45:32 +02:00
John Crispin
1c48765913 ipq807x: add the diagchar module
This is required for FTM to correctly work

Signed-off-by: John Crispin <john@phrozen.org>
2022-05-17 07:45:32 +02:00
John Crispin
c6a45184fd ipq807x: fix buildsystem for ath11.5-csu
Signed-off-by: John Crispin <john@phrozen.org>
2022-05-17 07:45:32 +02:00
John Crispin
18d5b8cba7 batman-adv: drop v4.4 backport
Signed-off-by: John Crispin <john@phrozen.org>
2022-05-17 07:45:32 +02:00
John Crispin
65c08ade18 ath11k-wifi: update to ath11.5-cs
Signed-off-by: John Crispin <john@phrozen.org>
2022-05-17 07:45:32 +02:00
John Crispin
3f6fee91e9 ath11k-firmware: update to ath11.5-cs
Signed-off-by: John Crispin <john@phrozen.org>
2022-05-17 07:45:32 +02:00
John Crispin
d29c4e49b3 mac80211-qsdk: update to ath11.5-cs
Signed-off-by: John Crispin <john@phrozen.org>
2022-05-17 07:45:32 +02:00
John Crispin
f162000749 qca-thermald-10.4: drop legacy package
Signed-off-by: John Crispin <john@phrozen.org>
2022-05-17 07:45:32 +02:00
John Crispin
c804333bc0 kmod-sched-cake: drop legacy v4.4 backport
Signed-off-by: John Crispin <john@phrozen.org>
2022-05-17 07:45:32 +02:00
John Crispin
449795db97 ipq807x: update to ath11.5-cs
Signed-off-by: John Crispin <john@phrozen.org>
2022-05-17 07:45:31 +02:00
John Crispin
af92a2c7aa qca-nss-clients: update to ath11.5-cs
Signed-off-by: John Crispin <john@phrozen.org>
2022-05-12 14:31:52 +02:00
John Crispin
b68affdf6a qca-nss-dp: update to ath11.5-cs
Signed-off-by: John Crispin <john@phrozen.org>
2022-05-12 14:31:33 +02:00
John Crispin
7a95f9ac2d qca-nss-drv: update to ath11.5-cs
Signed-off-by: John Crispin <john@phrozen.org>
2022-05-12 14:31:16 +02:00
John Crispin
8b5d9d84de qca-ssdk-shell: update to ath11.5-cs
Signed-off-by: John Crispin <john@phrozen.org>
2022-05-12 14:30:59 +02:00
John Crispin
93d93c7708 qsdk-ssdk: update to ath11.5-cs
Signed-off-by: John Crispin <john@phrozen.org>
2022-05-12 14:30:21 +02:00
John Crispin
b35232ab4a wifi-ax: enable fils_discovery and multiple_ssid by default on 6g band
Signed-off-by: John Crispin <john@phrozen.org>
2022-05-12 11:51:06 +02:00
John Crispin
770a2bdd36 wifi-ax: add ftm package as default selection
Signed-off-by: John Crispin <john@phrozen.org>
2022-05-12 11:46:21 +02:00
John Crispin
9650f8eaa8 iwinfo: fix 6e channel calculation
Signed-off-by: John Crispin <john@phrozen.org>
2022-05-12 11:45:30 +02:00
John Crispin
63ab76bb30 ucentral-schema: add various 6e fixes
ba2bc69 fix wifi 6e channel calculation

Signed-off-by: John Crispin <john@phrozen.org>
2022-05-12 11:39:58 +02:00
John Crispin
fcb21ca0b6 ucentral-schema: add a sample wifi 6e config file
Signed-off-by: John Crispin <john@phrozen.org>
2022-05-06 12:44:35 +02:00
John Crispin
d6d5422152 ipq40xx: add indio UM510/550AC support
Signed-off-by: John Crispin <john@phrozen.org>
2022-05-06 09:08:59 +02:00
John Crispin
5b970a3f12 .github: add Indio UM-305ax to the CI job
Signed-off-by: John Crispin <john@phrozen.org>
2022-05-05 10:38:59 +02:00
Matthew Hagan
a4a7c1f9f3 usteer: uchannel.uc: check host_info exists
If another host has not set a status, for example when autochannel is
disabled, it will not show host_info when remote_hosts is called. This
fix adds a check for this condition.

Signed-off-by: Matthew Hagan <mnhagan88@gmail.com>
2022-05-05 09:50:35 +02:00
John Crispin
5cbac23e3f ramips: disable switch/bridge offload
This is breaking win10 laptops when vlan_filtering is enabled

Signed-off-by: John Crispin <john@phrozen.org>
2022-05-04 17:09:53 +02:00
John Crispin
172c0d3690 bpf.mk: backport a fix that unbreaks bpf compile on armv7
Signed-off-by: John Crispin <john@phrozen.org>
2022-05-03 07:44:34 +02:00
John Crispin
535f41d58b hostapd: fix phy level max-assoc settings
Signed-off-by: John Crispin <john@phrozen.org>
2022-05-02 08:47:12 +02:00
John Crispin
2be18091a4 proxy_arp: backport skb->cb fix from upstream kernel
this caused proxy_arp to misbehave

Signed-off-by: John Crispin <john@phrozen.org>
2022-04-26 12:24:51 +02:00
John Crispin
73f42e3c6f ipq807x: enable dual boot on HFCL ION4X*
Signed-off-by: John Crispin <john@phrozen.org>
2022-04-26 07:59:41 +02:00
John Crispin
cff778d8ca treewide: update ucode to work with latest interpreter
Signed-off-by: John Crispin <john@phrozen.org>
2022-04-26 07:59:41 +02:00
John Crispin
94d4498a2d ucode: update to latest HEAD
Signed-off-by: John Crispin <john@phrozen.org>
2022-04-26 07:59:41 +02:00
John Crispin
eb0ab17f58 ipq807x: enable dual boot on EdgeCore devices
Signed-off-by: John Crispin <john@phrozen.org>
2022-04-21 11:18:58 +02:00
John Crispin
1ab99d50b2 certificates: add support for finding certificates on dual boot devices
Signed-off-by: John Crispin <john@phrozen.org>
2022-04-21 11:18:58 +02:00
Johann Hoffmann
dfeddc0d89 x86: add CI workflows
Signed-off-by: Johann Hoffmann <johann.hoffmann@mailbox.org>
2022-04-21 11:18:58 +02:00
Johann Hoffmann
efde86be9d x86: add vm images
Signed-off-by: Johann Hoffmann <johann.hoffmann@mailbox.org>
2022-04-21 11:18:58 +02:00
John Crispin
739e8c12fb ramips: fix actiontect web7200 wifi macs
Signed-off-by: John Crispin <john@phrozen.org>
2022-04-21 11:18:58 +02:00
John Crispin
3fdbbff9f7 ucentral-schema: update to latest HEAD
4829132 properly honour mac addresses that are inside board.json
ba9a2ee various 6G improvements
0a05052 interface: fix wan side STA-only interfaces

Signed-off-by: John Crispin <john@phrozen.org>
2022-04-21 11:18:58 +02:00
Sohail Ahmad
0a56755bef ramips: Support for Indio UM-305AX AP
Signed-off-by: Sohail Ahmad <sohail@indionetworks.com>
2022-04-21 11:18:58 +02:00
John Crispin
c35290772d ipq40xx: add certificate partition to cig-wf610
Signed-off-by: John Crispin <john@phrozen.org>
2022-04-19 10:28:15 +02:00
John Crispin
cedcbcbc2b ratelimit: fix ratelimit for multiple bss
The function looking up the rate was leaking a local variable into the global space

Signed-off-by: John Crispin <john@phrozen.org>
2022-04-19 07:40:58 +02:00
Stijn Tintel
9de96deca8 usteer: rename uptime to executed in uchannel.uc state
The uptime value in the uchannel state contains the uptime at the time
the script was last executed. This is a rather confusing name, and
possibly this is what lead to WIFI-7613. Rename it to executed to avoid
confusion in the future.

Keep the original name in the usteerd node status, as it is unclear what
impact this has, and could lead to breakage elsewhere.

Signed-off-by: Stijn Tintel <stijn@linux-ipv6.be>
2022-04-19 06:35:42 +02:00
Stijn Tintel
19dbb1d5e3 usteer: fix uchannel.uc script
Once the uchannel.uc script sets its status to waiting, it becomes
defunct. The next invocation of the script will compare uptime to
state.uptime, and if the difference is less than 12h, it will change
state.uptime to the current uptime and return. As the script runs every
5 minutes, the difference will always be less than 12h.

Fix this by comparing uptime against state.changed rather than
state.uptime.

Fixes: WIFI-7613
Fixes: 670bc9d2e2 ("ucentral: development update")
Signed-off-by: Stijn Tintel <stijn@linux-ipv6.be>
2022-04-19 06:35:42 +02:00
Stijn Tintel
83b6ccf562 usteer: fix init script
The uchannel instance of the usteer init script contains a typo, causing
the following error when autochannel is enabled:

/etc/rc.common: line 147: procd_close_instancea: not found

Fixes: WIFI-7577
Fixes: c467a62af3 ("usteer: update to latest HEAD")
Signed-off-by: Stijn Tintel <stijn@linux-ipv6.be>
2022-04-19 06:35:12 +02:00
Owen Anderson
ea86593835 profiles: Fixed typo in cig_wf610d profile name
Signed-off-by: Owen Anderson <owen.anderson@netexperience.com>
2022-04-19 06:33:24 +02:00
111 changed files with 7584 additions and 428 deletions

View File

@@ -0,0 +1,39 @@
name: Create AMI from firmware image in S3 bucket
inputs:
firmware_image_name:
description: Name of the firmware image
required: true
firmware_image_s3_bucket:
description: Name of the S3 bucket where the image resides
required: true
runs:
using: "composite"
steps:
- name: Import snapshot based on firmware image
id: import_snapshot
shell: bash
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')
- name: Wait for import task to complete and get snapshot ID
id: get_snapshot_id
shell: bash
run: |
IMPORT_TASK_STATUS=""
while [[ $IMPORT_TASK_STATUS != 'completed' ]]; do
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."
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')
- name: Tag snapshot with image name
shell: bash
run: |
aws ec2 create-tags --resources ${{ steps.get_snapshot_id.outputs.id }} --tags 'Key=Name,Value=${{ inputs.firmware_image_name }}'
- name: Register AMI based on snapshot
shell: bash
run: |
aws ec2 register-image --name '${{ inputs.firmware_image_name }}' --root-device-name /dev/xvda --block-device-mappings 'DeviceName=/dev/xvda,Ebs={SnapshotId=${{ steps.get_snapshot_id.outputs.id }}}'

View File

@@ -1,5 +1,13 @@
name: Build OpenWrt/uCentral images
env:
AWS_DEFAULT_OUTPUT: json
AWS_DEFAULT_REGION: us-east-1
AWS_S3_BUCKET_NAME: ucentral-ap-firmware
AWS_ACCOUNT_ID: ${{ secrets.UCENTRAL_S3_ACCOUNT_ID }}
AWS_ACCESS_KEY_ID: ${{ secrets.UCENTRAL_S3_ACCESS_KEY_ID }}
AWS_SECRET_ACCESS_KEY: ${{ secrets.UCENTRAL_S3_ACCESS_KEY_SECRET }}
on:
push:
branches: [ main, next, staging-* ]
@@ -8,10 +16,12 @@ on:
jobs:
build:
runs-on: ubuntu-latest
outputs:
x64_vm_image_name: ${{ steps.package_and_upload_image.outputs.x64_vm_image_name }}
strategy:
fail-fast: false
matrix:
target: ['actiontec_web7200', 'cig_wf188n', 'cig_wf194c', 'cig_wf194c4', 'cig_wf196', 'cig_wf160d', 'cig_wf808', 'cybertan_eww622-a1', 'edgecore_eap101', 'edgecore_eap102', 'edgecore_eap104', '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', 'linksys_ea6350-v4', 'linksys_e8450-ubi', 'linksys_ea8300', 'tp-link_ec420-g1', 'tplink_ex227', 'tplink_ex228', 'tplink_ex447', 'udaya_a5-id2', 'wallys_dr40x9', 'wallys_dr6018', 'wallys_dr6018_v4' ]
target: ['actiontec_web7200', 'cig_wf188n', 'cig_wf194c', 'cig_wf194c4', 'cig_wf196', 'cig_wf610d', 'cig_wf808', 'cybertan_eww622-a1', 'edgecore_eap101', 'edgecore_eap102', 'edgecore_eap104', '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', 'tp-link_ec420-g1', 'tplink_ex227', 'tplink_ex228', 'tplink_ex447', 'udaya_a5-id2', 'wallys_dr40x9', 'x64_vm' ]
steps:
- uses: actions/checkout@v2
@@ -24,17 +34,12 @@ jobs:
make -j TARGET=${{ matrix.target }}
- name: Package and upload image for ${{ matrix.target }}
id: package_and_upload_image
env:
GH_BUILD_USERNAME: ${{ secrets.GH_BUILD_USERNAME }}
GH_BUILD_PASSWORD: ${{ secrets.GH_BUILD_PASSWORD }}
ARTIFACTORY_USERNAME: cicd-indoor-main
ARTIFACTORY_PASSWORD: ${{ secrets.ARTIFACTORY_PASSWORD }}
AWS_S3_BUCKET_NAME: ucentral-ap-firmware
AWS_DEFAULT_OUTPUT: json
AWS_DEFAULT_REGION: us-east-1
AWS_ACCOUNT_ID: ${{ secrets.UCENTRAL_S3_ACCOUNT_ID }}
AWS_ACCESS_KEY_ID: ${{ secrets.UCENTRAL_S3_ACCESS_KEY_ID }}
AWS_SECRET_ACCESS_KEY: ${{ secrets.UCENTRAL_S3_ACCESS_KEY_SECRET }}
run: |
LOWERCASE_TARGET=`echo ${{ matrix.target }} | tr '[:upper:]' '[:lower:]'`
HASH=$(git rev-parse --short HEAD)
@@ -66,6 +71,10 @@ jobs:
[ -f openwrt/tmp/image-file ] && aws s3 cp --acl public-read --content-type "application/json" "latest-upgrade.json" "s3://$AWS_S3_BUCKET_NAME/$JSON_NAME"
[ -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
echo ::set-output name=x64_vm_image_name::"$(echo $IMG_NAME)"
fi
trigger-testing:
runs-on: ubuntu-latest
needs: build
@@ -78,3 +87,16 @@ jobs:
repository: Telecominfraproject/wlan-testing
event-type: new-ap-release
client-payload: '{"ref": "${GITHUB_REF#refs/tags/}", "sha": "${{ github.sha }}"}'
create-x64_vm-ami:
runs-on: ubuntu-latest
needs: build
if: startsWith(github.ref, 'refs/tags/v')
steps:
- uses: actions/checkout@v2
- name: Use create-ami-from-image composite action
uses: ./.github/actions/create-ami-from-image
with:
firmware_image_name: ${{ needs.build.outputs.x64_vm_image_name }}
firmware_image_s3_bucket: ${{ env.AWS_S3_BUCKET_NAME }}

View File

@@ -1,10 +1,88 @@
name: Test x64_vm build and AMI creation
env:
AWS_DEFAULT_OUTPUT: json
AWS_DEFAULT_REGION: us-east-1
AWS_S3_BUCKET_NAME: ucentral-ap-firmware
AWS_ACCOUNT_ID: ${{ secrets.UCENTRAL_S3_ACCOUNT_ID }}
AWS_ACCESS_KEY_ID: ${{ secrets.UCENTRAL_S3_ACCESS_KEY_ID }}
AWS_SECRET_ACCESS_KEY: ${{ secrets.UCENTRAL_S3_ACCESS_KEY_SECRET }}
on:
workflow_dispatch:
jobs:
build:
runs-on: ubuntu-latest
outputs:
x64_vm_image_name: ${{ steps.package_and_upload_image.outputs.x64_vm_image_name }}
strategy:
fail-fast: false
matrix:
target: ['x64_vm']
steps:
- run: echo 'Test x64_vm build and AMI creation'
- uses: actions/checkout@v2
- name: Build image for ${{ matrix.target }}
id: build
run: |
git config --global user.email "you@example.com"
git config --global user.name "Your Name"
make -j TARGET=${{ matrix.target }}
- name: Package and upload image for ${{ matrix.target }}
id: package_and_upload_image
env:
GH_BUILD_USERNAME: ${{ secrets.GH_BUILD_USERNAME }}
GH_BUILD_PASSWORD: ${{ secrets.GH_BUILD_PASSWORD }}
ARTIFACTORY_USERNAME: cicd-indoor-main
ARTIFACTORY_PASSWORD: ${{ secrets.ARTIFACTORY_PASSWORD }}
run: |
LOWERCASE_TARGET=`echo ${{ matrix.target }} | tr '[:upper:]' '[:lower:]'`
HASH=$(git rev-parse --short HEAD)
if [[ ${GITHUB_REF} == "refs/heads/"* ]]
then
REF=$(echo ${GITHUB_REF#refs/heads/} | tr '/' '-')
IS_RELEASE="false"
else
REF=$(echo ${GITHUB_REF#refs/tags/} | tr '/' '-')
IS_RELEASE="true"
fi
BASENAME="$(date +%Y%m%d)-$LOWERCASE_TARGET-$REF-$HASH"
TAR_NAME="$BASENAME.tar.gz"
IMG_NAME="$BASENAME-upgrade.bin";
JSON_NAME="$BASENAME.json";
tar cfz "$TAR_NAME" -C openwrt/bin/targets/ .
curl -s -u $GH_BUILD_USERNAME:$GH_BUILD_PASSWORD -T "$TAR_NAME" "https://tip.jfrog.io/artifactory/tip-wlan-ap-firmware/uCentral/$LOWERCASE_TARGET/"$TAR_NAME""
IMG_NAME="$BASENAME-upgrade.bin";
TIP_VERSION="$(grep DISTRIB_TIP= openwrt/tmp/openwrt_release | cut -d\' -f2)"
echo -e "{\n\t\"image\":\""${IMG_NAME}"\",\n\t\"revision\": \""${TIP_VERSION}"\",\n\t\"timestamp\":\""$(date +%s)"\",\n\t\"compatible\": \""${LOWERCASE_TARGET}"\"\n}" > latest-upgrade.json
[ -f openwrt/tmp/image-file ] && curl -s -u $GH_BUILD_USERNAME:$GH_BUILD_PASSWORD -T "openwrt/$(cat openwrt/tmp/image-file)" "https://tip.jfrog.io/artifactory/tip-wlan-ap-firmware/uCentral/$LOWERCASE_TARGET/"$IMG_NAME""
[ -f openwrt/tmp/image-file ] && curl -s -u $GH_BUILD_USERNAME:$GH_BUILD_PASSWORD -T "latest-upgrade.json" "https://tip.jfrog.io/artifactory/tip-wlan-ap-firmware/uCentral/$LOWERCASE_TARGET/latest-upgrade.json"
[ -f openwrt/tmp/image-file ] && aws s3 cp --acl public-read --content-type "application/octet-stream" "openwrt/$(cat openwrt/tmp/image-file)" "s3://$AWS_S3_BUCKET_NAME/$IMG_NAME"
[ -f openwrt/tmp/image-file ] && aws s3api put-object-tagging --bucket "$AWS_S3_BUCKET_NAME" --key "$IMG_NAME" --tagging "{\"TagSet\":[{\"Key\":\"release\",\"Value\":\"$IS_RELEASE\"}]}"
[ -f openwrt/tmp/image-file ] && aws s3 cp --acl public-read --content-type "application/json" "latest-upgrade.json" "s3://$AWS_S3_BUCKET_NAME/$JSON_NAME"
[ -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
echo ::set-output name=x64_vm_image_name::"$(echo $IMG_NAME)"
fi
create-x64_vm-ami:
runs-on: ubuntu-latest
needs: build
steps:
- uses: actions/checkout@v2
with:
ref: WIFI-7206-add-workflow-to-build-virtual-ap-image
- name: Use create-ami-from-image composite action
uses: ./.github/actions/create-ami-from-image
with:
firmware_image_name: ${{ needs.build.outputs.x64_vm_image_name }}
firmware_image_s3_bucket: ${{ env.AWS_S3_BUCKET_NAME }}

View File

@@ -33,6 +33,7 @@ qcom_setup_interfaces()
edgecore,eap106|\
qcom,ipq5018-mp03.3|\
yuncore,ax840|\
motorola,q14|\
sercomm,wallaby)
ucidef_set_interface_lan "eth0"
ucidef_set_interface_wan "eth1"

View File

@@ -107,13 +107,22 @@ ath11k/IPQ5018/hw1.0/caldata.bin)
case "$board" in
cybertan,eww622-a1|\
edgecore,eap104|\
motorola,q14|\
qcom,ipq5018-mp03.1)
caldata_extract "0:ART" 0x1000 0x20000
;;
esac
;;
ath11k/qcn6122/hw1.0/caldata_1.bin)
case "$board" in
motorola,q14)
caldata_extract "0:ART" 0x26800 0x20000
;;
esac
;;
ath11k/qcn6122/hw1.0/caldata_2.bin)
case "$board" in
motorola,q14|\
edgecore,eap104)
caldata_extract "0:ART" 0x4c000 0x20000
;;

View File

@@ -19,4 +19,12 @@ boot() {
ssdk_sh debug phy set 8 0x4004c441 0x8
;;
esac
case "$(board_name)" in
cig,wf196)
# setup the leds
ssdk_sh debug phy set 0 0x401ec431 0xc00f
ssdk_sh debug phy set 0 0x401ec430 0x806f
;;
esac
}

View File

@@ -4,13 +4,15 @@ START=99
boot() {
case "$(board_name)" in
hfcl,ion4xe|\
hfcl,ion4xi)
fw_setenv boot_count 0
;;
edgecore,eap101|\
edgecore,eap102)
avail=$(fw_printenv -n upgrade_available)
[ ${avail} -eq 0 ] || {
fw_setenv bootcount 0
fw_setenv upgrade_available 0
}
[ "${avail}" -eq 1 ] || fw_setenv upgrade_available 1
fw_setenv bootcount 0
;;
esac
}

View File

@@ -1,5 +1,8 @@
. /lib/functions/system.sh
RAMFS_COPY_BIN='fw_printenv fw_setenv'
RAMFS_COPY_DATA='/etc/fw_env.config /var/lock/fw_printenv.lock'
qca_do_upgrade() {
local tar_file="$1"
@@ -16,6 +19,50 @@ qca_do_upgrade() {
fi
}
find_mmc_part() {
local DEVNAME PARTNAME
if grep -q "$1" /proc/mtd; then
echo "" && return 0
fi
for DEVNAME in /sys/block/mmcblk*/mmcblk*p*; do
PARTNAME=$(grep PARTNAME ${DEVNAME}/uevent | cut -f2 -d'=')
[ "$PARTNAME" = "$1" ] && echo "/dev/$(basename $DEVNAME)" && return 0
done
}
do_flash_emmc() {
local tar_file=$1
local emmcblock=$(find_mmc_part $2)
local board_dir=$3
local part=$4
[ -z "$emmcblock" ] && {
echo failed to find $2
return
}
echo erase $4
dd if=/dev/zero of=${emmcblock} 2> /dev/null
echo flash $4
tar Oxf $tar_file ${board_dir}/$part | dd of=${emmcblock}
}
emmc_do_upgrade() {
local tar_file="$1"
local board_dir=$(tar tf $tar_file | grep -m 1 '^sysupgrade-.*/$')
board_dir=${board_dir%/}
do_flash_emmc $tar_file '0:HLOS' $board_dir kernel
do_flash_emmc $tar_file 'rootfs' $board_dir root
local emmcblock="$(find_mmc_part "rootfs_data")"
if [ -e "$emmcblock" ]; then
mkfs.ext4 -F "$emmcblock"
fi
}
platform_check_image() {
local magic_long="$(get_magic_long "$1")"
board=$(board_name)
@@ -39,6 +86,7 @@ platform_check_image() {
tplink,ex227|\
tplink,ex447|\
yuncore,ax840|\
motorola,q14|\
qcom,ipq6018-cp01|\
qcom,ipq807x-hk01|\
qcom,ipq807x-hk14|\
@@ -59,6 +107,9 @@ platform_do_upgrade() {
cig,wf188)
qca_do_upgrade $1
;;
motorola,q14)
emmc_do_upgrade $1
;;
cig,wf188n|\
cig,wf194c|\
cig,wf194c4|\
@@ -67,8 +118,6 @@ platform_do_upgrade() {
edgecore,eap104|\
glinet,ax1800|\
glinet,axt1800|\
hfcl,ion4xi|\
hfcl,ion4xe|\
qcom,ipq6018-cp01|\
qcom,ipq807x-hk01|\
qcom,ipq807x-hk14|\
@@ -80,12 +129,36 @@ platform_do_upgrade() {
tplink,ex227)
nand_upgrade_tar "$1"
;;
edgecore,eap106|\
edgecore,eap102|\
edgecore,eap101)
hfcl,ion4xi|\
hfcl,ion4xe)
if grep -q rootfs_1 /proc/cmdline; then
CI_UBIPART="rootfs"
fw_setenv primary 0 || exit 1
else
CI_UBIPART="rootfs_1"
fw_setenv primary 1 || exit 1
fi
nand_upgrade_tar "$1"
;;
edgecore,eap106)
CI_UBIPART="rootfs1"
[ "$(find_mtd_chardev rootfs)" ] && CI_UBIPART="rootfs"
nand_upgrade_tar "$1"
;;
edgecore,eap101|\
edgecore,eap102)
if [ "$(find_mtd_chardev rootfs)" ]; then
CI_UBIPART="rootfs"
else
if grep -q rootfs1 /proc/cmdline; then
CI_UBIPART="rootfs2"
fw_setenv active 2 || exit 1
else
CI_UBIPART="rootfs1"
fw_setenv active 1 || exit 1
fi
fi
nand_upgrade_tar "$1"
;;
esac
}

View File

@@ -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-q14.dts"
/ {
pmuv8: pmu {
compatible = "arm,cortex-a7-pmu";
};
};

View File

@@ -0,0 +1,886 @@
/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 = "Motorola Q14";
compatible = "motorola,q14", "qcom,ipq5018-mp03.5-c1", "qcom,ipq5018";
interrupt-parent = <&intc>;
aliases {
sdhc1 = &sdhc_1; /* SDC1 eMMC slot */
serial0 = &blsp1_uart1;
serial1 = &blsp1_uart2;
ethernet0 = "/soc/dp1";
ethernet1 = "/soc/dp2";
};
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 {
serial@78af000 {
status = "ok";
};
blsp1_uart2: serial@78b0000 {
pinctrl-0 = <&blsp1_uart_pins>;
pinctrl-names = "default";
};
qpic_bam: dma@7984000{
status = "ok";
};
nand: qpic-nand@79b0000 {
status = "disabled";
};
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>;
pinctrl-names = "default";
phy-reset-gpio = <&tlmm 39 0>;
ethernet-phy@0 {
reg = <28>;
};
};
ess-instance {
num_devices = <0x1>;
ess-switch@0x39c00000 {
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>;
mdiobus = <&mdio0>;
};
port@1 {
port_id = <2>;
phy_address = <0x1c>;
mdiobus = <&mdio1>;
port_mac_sel = "QGMAC_PORT";
};
};
led_source@0 {
source = <0>;
mode = "normal";
speed = "all";
blink_en = "enable";
active = "high";
};
};
};
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 = <28>;
mdio-bus = <&mdio1>;
local-mac-address = [000000000000];
phy-mode = "sgmii";
};
qcom,test@0 {
status = "ok";
};
nss-macsec1 {
compatible = "qcom,nss-macsec";
phy_addr = <0x1c>;
mdiobus = <&mdio1>;
};
lpass: lpass@0xA000000{
status = "disabled";
};
pcm: pcm@0xA3C0000{
pinctrl-0 = <&audio_pins>;
pinctrl-names = "default";
status = "disabled";
};
pcm_lb: pcm_lb@0 {
status = "disabled";
};
};
thermal-zones {
status = "ok";
};
};
&sdhc_1 {
pinctrl-0 = <&emmc_pins>;
pinctrl-names = "default";
qcom,clk-rates = <400000 25000000 50000000 100000000 \
192000000 384000000>;
qcom,bus-speed-mode = "HS200_1p8v", "DDR_1p8v";
qcom,nonremovable;
status = "ok";
};
&tlmm {
pinctrl-0 = <&blsp0_uart_pins &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", "gpio24", "gpio26";
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;
};
};
emmc_pins: emmc_pins {
emmc_clk {
pins = "gpio9";
function = "sdc1_clk";
drive-strength = <8>;
bias-disable;
};
emmc_cmd {
pins = "gpio8";
function = "sdc1_cmd";
drive-strength = <8>;
bias-pull-up;
};
emmc_data_0 {
pins = "gpio7";
function = "sdc10";
drive-strength = <8>;
bias-disable;
};
emmc_data_1 {
pins = "gpio6";
function = "sdc11";
drive-strength = <8>;
bias-disable;
};
emmc_data_2 {
pins = "gpio5";
function = "sdc12";
drive-strength = <8>;
bias-disable;
};
emmc_data_3 {
pins = "gpio4";
function = "sdc13";
drive-strength = <8>;
bias-disable;
};
};
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;
};
};
i2c_pins: i2c_pins {
i2c_scl {
pins = "gpio25";
function = "blsp2_i2c1";
drive-strength = <8>;
bias-disable;
};
i2c_sda {
pins = "gpio26";
function = "blsp2_i2c1";
drive-strength = <8>;
bias-disable;
};
};
button_pins: button_pins {
wps_button {
pins = "gpio38";
function = "gpio";
drive-strength = <8>;
bias-pull-up;
};
reset_button {
pins = "gpio31";
function = "gpio";
drive-strength = <8>;
bias-pull-up;
};
};
audio_pins: audio_pinmux {
mux_1 {
pins = "gpio24";
function = "audio_rxbclk";
drive-strength = <8>;
bias-pull-down;
};
mux_2 {
pins = "gpio25";
function = "audio_rxfsync";
drive-strength = <8>;
bias-pull-down;
};
mux_3 {
pins = "gpio26";
function = "audio_rxd";
drive-strength = <8>;
bias-pull-down;
};
mux_4 {
pins = "gpio27";
function = "audio_txmclk";
drive-strength = <8>;
bias-pull-down;
};
mux_5 {
pins = "gpio28";
function = "audio_txbclk";
drive-strength = <8>;
bias-pull-down;
};
mux_6 {
pins = "gpio29";
function = "audio_txfsync";
drive-strength = <8>;
bias-pull-down;
};
mux_7 {
pins = "gpio30";
function = "audio_txd";
drive-strength = <8>;
bias-pull-down;
};
};
};
&soc {
gpio_keys {
compatible = "gpio-keys";
pinctrl-0 = <&button_pins>;
pinctrl-names = "default";
button@1 {
label = "wps";
linux,code = <KEY_WPS_BUTTON>;
gpios = <&tlmm 38 GPIO_ACTIVE_LOW>;
linux,input-type = <1>;
debounce-interval = <60>;
};
button@2 {
label = "reset";
linux,code = <KEY_RESTART>;
gpios = <&tlmm 31 GPIO_ACTIVE_LOW>;
linux,input-type = <1>;
debounce-interval = <60>;
};
};
};
&usb3 {
status = "ok";
device-power-gpio = <&tlmm 24 1>;
};
&eud {
status = "ok";
};
&pcie_x1 {
status = "ok";
perst-gpio = <&tlmm 18 1>;
};
&pcie_x2 {
status = "ok";
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 = "ok";
};
&pcie_x2phy {
status = "ok";
};
&pcie_x1_rp {
status = "ok";
mhi_0: qcom,mhi@0 {
reg = <0 0 0 0 0 >;
};
};
&pcie_x2_rp {
status = "ok";
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 = <0x1 0x4 0x3 0x0F 0x0 0x0>,
<0x2 0x4 0x2 0x12 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
};
};
&i2c_0 {
pinctrl-0 = <&i2c_pins>;
pinctrl-names = "default";
status = "disabled";
};
&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>;
nss-radio-priority = <0>;
#endif
mem-region = <&q6_ipq5018_data>;
qcom,caldb-size = <0x200000>;
status = "ok";
};
&wifi1 {
/* QCN6122 5G */
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>;
nss-radio-priority = <1>;
#endif
mem-region = <&q6_qcn6122_data1>;
qcom,caldb-size = <0x500000>;
status = "ok";
};
&wifi2 {
/* QCN6122 6G */
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 = <0xb0>;
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>;
nss-radio-priority = <1>;
#endif
mem-region = <&q6_qcn6122_data2>;
qcom,caldb-size = <0x500000>;
status = "ok";
};

View File

@@ -18,6 +18,17 @@ define Device/edgecore_eap104
endef
TARGET_DEVICES += edgecore_eap104
define Device/motorola_q14
DEVICE_TITLE := Motorola Q14
DEVICE_DTS := qcom-ipq5018-q14
SUPPORTED_DEVICES := motorola,q14
DEVICE_PACKAGES := ath11k-wifi-motorola-q14 ath11k-firmware-ipq50xx-spruce ath11k-firmware-qcn6122
DEVICE_DTS_CONFIG := config@mp03.5-c1
IMAGES := sysupgrade.tar mmc-factory.bin
IMAGE/mmc-factory.bin := append-ubi | qsdk-ipq-factory-mmc
endef
TARGET_DEVICES += motorola_q14
define Device/qcom_mp03_1
DEVICE_TITLE := Qualcomm Maple 03.1
DEVICE_DTS := qcom-ipq5018-mp03.1

View File

@@ -1,16 +1,5 @@
KERNEL_LOADADDR := 0x41008000
define Device/cig_wf188
DEVICE_TITLE := Cigtech WF-188
DEVICE_DTS := qcom-ipq6018-cig-wf188
DEVICE_DTS_CONFIG := config@cp03-c1
SUPPORTED_DEVICES := cig,wf188
IMAGES := sysupgrade.tar
IMAGE/sysupgrade.tar/squashfs := append-rootfs | pad-rootfs | sysupgrade-tar rootfs=$$$$@ | append-metadata
DEVICE_PACKAGES := ath11k-wifi-cig-wf188 uboot-env
endef
TARGET_DEVICES += cig_wf188
define Device/cig_wf188n
DEVICE_TITLE := Cigtech WF-188n
DEVICE_DTS := qcom-ipq6018-cig-wf188n
@@ -43,7 +32,7 @@ define Device/edgecore_eap101
DEVICE_DTS := qcom-ipq6018-edgecore-eap101
DEVICE_DTS_CONFIG := config@cp01-c1
SUPPORTED_DEVICES := edgecore,eap101
DEVICE_PACKAGES := ath11k-wifi-edgecore-eap101 uboot-envtools
DEVICE_PACKAGES := ath11k-wifi-edgecore-eap101 uboot-envtools -kmod-usb-dwc3-of-simple kmod-usb-dwc3-qcom kmod-usb3 kmod-usb2
endef
TARGET_DEVICES += edgecore_eap101
@@ -52,7 +41,7 @@ define Device/wallys_dr6018
DEVICE_DTS := qcom-ipq6018-wallys-dr6018
DEVICE_DTS_CONFIG := config@cp01-c4
SUPPORTED_DEVICES := wallys,dr6018
DEVICE_PACKAGES := ath11k-wifi-wallys-dr6018 uboot-envtools
DEVICE_PACKAGES := ath11k-wifi-wallys-dr6018 uboot-envtools -kmod-usb-dwc3-of-simple kmod-usb-dwc3-qcom kmod-usb3 kmod-usb2
endef
TARGET_DEVICES += wallys_dr6018
@@ -87,7 +76,7 @@ define Device/glinet_axt1800
DEVICE_DTS := qcom-ipq6018-gl-axt1800
SUPPORTED_DEVICES := glinet,axt1800
DEVICE_DTS_CONFIG := config@cp03-c1
DEVICE_PACKAGES := ath11k-wifi-gl-ax1800 -kmod-usb-dwc3-of-simple kmod-usb-dwc3-qcom kmod-usb3
DEVICE_PACKAGES := ath11k-wifi-gl-axt1800 -kmod-usb-dwc3-of-simple kmod-usb-dwc3-qcom kmod-usb3
endef
TARGET_DEVICES += glinet_axt1800

View File

@@ -0,0 +1,36 @@
From fd65e5a95d08389444e8591a20538b3edece0e15 Mon Sep 17 00:00:00 2001
From: Nikolay Aleksandrov <nikolay@cumulusnetworks.com>
Date: Fri, 31 Jul 2020 19:26:16 +0300
Subject: [PATCH] net: bridge: clear bridge's private skb space on xmit
We need to clear all of the bridge private skb variables as they can be
stale due to the packet being recirculated through the stack and then
transmitted through the bridge device. Similar memset is already done on
bridge's input. We've seen cases where proxyarp_replied was 1 on routed
multicast packets transmitted through the bridge to ports with neigh
suppress which were getting dropped. Same thing can in theory happen with
the port isolation bit as well.
Fixes: 821f1b21cabb ("bridge: add new BR_NEIGH_SUPPRESS port flag to suppress arp and nd flood")
Signed-off-by: Nikolay Aleksandrov <nikolay@cumulusnetworks.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
---
net/bridge/br_device.c | 2 ++
1 file changed, 2 insertions(+)
diff --git a/net/bridge/br_device.c b/net/bridge/br_device.c
index 8c7b78f8bc23..9a2fb4aa1a10 100644
--- a/net/bridge/br_device.c
+++ b/net/bridge/br_device.c
@@ -36,6 +36,8 @@ netdev_tx_t br_dev_xmit(struct sk_buff *skb, struct net_device *dev)
const unsigned char *dest;
u16 vid = 0;
+ memset(skb->cb, 0, sizeof(struct br_input_skb_cb));
+
rcu_read_lock();
nf_ops = rcu_dereference(nf_br_ops);
if (nf_ops && nf_ops->br_dev_xmit_hook(skb)) {
--
2.25.1

View File

@@ -0,0 +1,75 @@
From: Shmulik Ladkani <shmulik.ladkani@gmail.com>
Date: Thu, 13 Oct 2016 09:06:41 +0300
Subject: [PATCH] net/sched: act_mirred: Rename tcfm_ok_push to
tcfm_mac_header_xmit and make it a bool
'tcfm_ok_push' specifies whether a mac_len sized push is needed upon
egress to the target device (if action is performed at ingress).
Rename it to 'tcfm_mac_header_xmit' as this is actually an attribute of
the target device (and use a bool instead of int).
This allows to decouple the attribute from the action to be taken.
Signed-off-by: Shmulik Ladkani <shmulik.ladkani@gmail.com>
Acked-by: Jamal Hadi Salim <jhs@mojatatu.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
---
--- a/include/net/tc_act/tc_mirred.h
+++ b/include/net/tc_act/tc_mirred.h
@@ -7,7 +7,7 @@ struct tcf_mirred {
struct tcf_common common;
int tcfm_eaction;
int tcfm_ifindex;
- int tcfm_ok_push;
+ bool tcfm_mac_header_xmit;
struct net_device __rcu *tcfm_dev;
struct list_head tcfm_list;
};
--- a/net/sched/act_mirred.c
+++ b/net/sched/act_mirred.c
@@ -55,10 +55,11 @@ static int tcf_mirred_init(struct net *n
int bind)
{
struct nlattr *tb[TCA_MIRRED_MAX + 1];
+ bool mac_header_xmit = false;
struct tc_mirred *parm;
struct tcf_mirred *m;
struct net_device *dev;
- int ret, ok_push = 0;
+ int ret;
if (nla == NULL)
return -EINVAL;
@@ -86,10 +87,10 @@ static int tcf_mirred_init(struct net *n
case ARPHRD_IPGRE:
case ARPHRD_VOID:
case ARPHRD_NONE:
- ok_push = 0;
+ mac_header_xmit = false;
break;
default:
- ok_push = 1;
+ mac_header_xmit = true;
break;
}
} else {
@@ -123,7 +124,7 @@ static int tcf_mirred_init(struct net *n
dev_put(rcu_dereference_protected(m->tcfm_dev, 1));
dev_hold(dev);
rcu_assign_pointer(m->tcfm_dev, dev);
- m->tcfm_ok_push = ok_push;
+ m->tcfm_mac_header_xmit = mac_header_xmit;
}
if (ret == ACT_P_CREATED) {
@@ -169,7 +170,7 @@ static int tcf_mirred(struct sk_buff *sk
goto out;
if (!(at & AT_EGRESS)) {
- if (m->tcfm_ok_push)
+ if (m->tcfm_mac_header_xmit)
skb_push_rcsum(skb2, skb->mac_len);
}

View File

@@ -0,0 +1,36 @@
From: Shmulik Ladkani <shmulik.ladkani@gmail.com>
Date: Thu, 13 Oct 2016 09:06:42 +0300
Subject: [PATCH] net/sched: act_mirred: Refactor detection whether dev needs
xmit at mac header
Move detection logic that tests whether device expects skb data to point
at mac_header upon xmit into a function.
Signed-off-by: Shmulik Ladkani <shmulik.ladkani@gmail.com>
Acked-by: Jamal Hadi Salim <jhs@mojatatu.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
---
--- a/net/sched/act_mirred.c
+++ b/net/sched/act_mirred.c
@@ -80,19 +80,7 @@ static int tcf_mirred_init(struct net *n
dev = __dev_get_by_index(net, parm->ifindex);
if (dev == NULL)
return -ENODEV;
- switch (dev->type) {
- case ARPHRD_TUNNEL:
- case ARPHRD_TUNNEL6:
- case ARPHRD_SIT:
- case ARPHRD_IPGRE:
- case ARPHRD_VOID:
- case ARPHRD_NONE:
- mac_header_xmit = false;
- break;
- default:
- mac_header_xmit = true;
- break;
- }
+ mac_header_xmit = dev_is_mac_header_xmit(dev);
} else {
dev = NULL;
}

View File

@@ -0,0 +1,125 @@
From: Shmulik Ladkani <shmulik.ladkani@gmail.com>
Date: Thu, 13 Oct 2016 09:06:44 +0300
Subject: [PATCH] net/sched: act_mirred: Implement ingress actions
Up until now, 'action mirred' supported only egress actions (either
TCA_EGRESS_REDIR or TCA_EGRESS_MIRROR).
This patch implements the corresponding ingress actions
TCA_INGRESS_REDIR and TCA_INGRESS_MIRROR.
This allows attaching filters whose target is to hand matching skbs into
the rx processing of a specified device.
Signed-off-by: Shmulik Ladkani <shmulik.ladkani@gmail.com>
Cc: Jamal Hadi Salim <jhs@mojatatu.com>
Cc: Eric Dumazet <eric.dumazet@gmail.com>
Cc: Cong Wang <xiyou.wangcong@gmail.com>
Tested-by: Jamal Hadi Salim <jhs@mojatatu.com>
Acked-by: Jamal Hadi Salim <jhs@mojatatu.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
---
--- a/net/sched/act_mirred.c
+++ b/net/sched/act_mirred.c
@@ -33,6 +33,25 @@
static LIST_HEAD(mirred_list);
static DEFINE_SPINLOCK(mirred_list_lock);
+static bool tcf_mirred_is_act_redirect(int action)
+{
+ return action == TCA_EGRESS_REDIR || action == TCA_INGRESS_REDIR;
+}
+
+static u32 tcf_mirred_act_direction(int action)
+{
+ switch (action) {
+ case TCA_EGRESS_REDIR:
+ case TCA_EGRESS_MIRROR:
+ return AT_EGRESS;
+ case TCA_INGRESS_REDIR:
+ case TCA_INGRESS_MIRROR:
+ return AT_INGRESS;
+ default:
+ BUG();
+ }
+}
+
static void tcf_mirred_release(struct tc_action *a, int bind)
{
struct tcf_mirred *m = to_mirred(a);
@@ -72,6 +91,8 @@ static int tcf_mirred_init(struct net *n
switch (parm->eaction) {
case TCA_EGRESS_MIRROR:
case TCA_EGRESS_REDIR:
+ case TCA_INGRESS_REDIR:
+ case TCA_INGRESS_MIRROR:
break;
default:
return -EINVAL;
@@ -129,9 +150,12 @@ static int tcf_mirred(struct sk_buff *sk
struct tcf_result *res)
{
struct tcf_mirred *m = a->priv;
+ bool m_mac_header_xmit;
struct net_device *dev;
struct sk_buff *skb2;
- int retval, err;
+ int retval, err = 0;
+ int m_eaction;
+ int mac_len;
u32 at;
tcf_lastuse_update(&m->tcf_tm);
@@ -139,6 +163,8 @@ static int tcf_mirred(struct sk_buff *sk
bstats_cpu_update(this_cpu_ptr(m->common.cpu_bstats), skb);
rcu_read_lock();
+ m_mac_header_xmit = READ_ONCE(m->tcfm_mac_header_xmit);
+ m_eaction = READ_ONCE(m->tcfm_eaction);
retval = READ_ONCE(m->tcf_action);
dev = rcu_dereference(m->tcfm_dev);
if (unlikely(!dev)) {
@@ -157,24 +183,37 @@ static int tcf_mirred(struct sk_buff *sk
if (!skb2)
goto out;
- if (!(at & AT_EGRESS)) {
- if (m->tcfm_mac_header_xmit)
+ /* If action's target direction differs than filter's direction,
+ * and devices expect a mac header on xmit, then mac push/pull is
+ * needed.
+ */
+ if (at != tcf_mirred_act_direction(m_eaction) && m_mac_header_xmit) {
+ if (at & AT_EGRESS) {
+ /* caught at egress, act ingress: pull mac */
+ mac_len = skb_network_header(skb) - skb_mac_header(skb);
+ skb_pull_rcsum(skb2, mac_len);
+ } else {
+ /* caught at ingress, act egress: push mac */
skb_push_rcsum(skb2, skb->mac_len);
+ }
}
/* mirror is always swallowed */
- if (m->tcfm_eaction != TCA_EGRESS_MIRROR)
+ if (tcf_mirred_is_act_redirect(m_eaction))
skb2->tc_verd = SET_TC_FROM(skb2->tc_verd, at);
skb2->skb_iif = skb->dev->ifindex;
skb2->dev = dev;
skb_sender_cpu_clear(skb2);
- err = dev_queue_xmit(skb2);
+ if (tcf_mirred_act_direction(m_eaction) & AT_EGRESS)
+ err = dev_queue_xmit(skb2);
+ else
+ err = netif_receive_skb(skb2);
if (err) {
out:
qstats_overlimit_inc(this_cpu_ptr(m->common.cpu_qstats));
- if (m->tcfm_eaction != TCA_EGRESS_MIRROR)
+ if (tcf_mirred_is_act_redirect(m_eaction))
retval = TC_ACT_SHOT;
}
rcu_read_unlock();

View File

@@ -0,0 +1,55 @@
#
# Copyright (C) 2016-2019 Jason A. Donenfeld <Jason@zx2c4.com>
# Copyright (C) 2016 Baptiste Jonglez <openwrt@bitsofnetworks.org>
# Copyright (C) 2016-2017 Dan Luedtke <mail@danrl.com>
#
# This is free software, licensed under the GNU General Public License v2.
# See /LICENSE for more information.
include $(TOPDIR)/rules.mk
include $(INCLUDE_DIR)/kernel.mk
PKG_NAME:=wireguard-backport
PKG_VERSION:=1.0.20211208
PKG_RELEASE:=1
PKG_SOURCE:=wireguard-linux-compat-$(PKG_VERSION).tar.xz
PKG_SOURCE_URL:=https://git.zx2c4.com/wireguard-linux-compat/snapshot/
PKG_HASH:=c0e607138a17daac656f508d8e63ea3737b5221fa5d9288191ddeb099f5a3b92
PKG_LICENSE:=GPL-2.0
PKG_LICENSE_FILES:=COPYING
PKG_BUILD_DIR:=$(KERNEL_BUILD_DIR)/wireguard-linux-compat-$(PKG_VERSION)
PKG_BUILD_PARALLEL:=1
PKG_USE_MIPS16:=0
# WireGuard's makefile needs this to know where to build the kernel module
export KERNELDIR:=$(LINUX_DIR)
include $(INCLUDE_DIR)/package.mk
include $(INCLUDE_DIR)/kernel-defaults.mk
include $(INCLUDE_DIR)/package-defaults.mk
define Build/Compile
$(MAKE) $(KERNEL_MAKEOPTS) M="$(PKG_BUILD_DIR)/src" modules
endef
define KernelPackage/wireguard-backport
SECTION:=kernel
CATEGORY:=Kernel modules
SUBMENU:=Network Support
TITLE:=WireGuard kernel module
DEPENDS:=+IPV6:kmod-udptunnel6 +kmod-udptunnel4
FILES:= $(PKG_BUILD_DIR)/src/wireguard.$(LINUX_KMOD_SUFFIX)
AUTOLOAD:=$(call AutoProbe,wireguard)
endef
define KernelPackage/wireguard-backport/description
$(call Package/wireguard/Default/description)
This package provides the kernel module for WireGuard.
endef
$(eval $(call KernelPackage,wireguard-backport))

View File

@@ -0,0 +1,29 @@
Index: wireguard-linux-compat-1.0.20211208/src/compat/compat.h
===================================================================
--- wireguard-linux-compat-1.0.20211208.orig/src/compat/compat.h
+++ wireguard-linux-compat-1.0.20211208/src/compat/compat.h
@@ -11,6 +11,8 @@
#include <linux/types.h>
#include <generated/utsrelease.h>
+#define fallthrough
+
#ifdef RHEL_MAJOR
#if RHEL_MAJOR == 7
#define ISRHEL7
@@ -686,15 +688,6 @@ struct __compat_dummy_container { char d
#define genl_dump_check_consistent(a, b) genl_dump_check_consistent(a, b, &genl_family)
#endif
-#if LINUX_VERSION_CODE < KERNEL_VERSION(4, 13, 0) && !defined(ISRHEL7)
-static inline void *skb_put_data(struct sk_buff *skb, const void *data, unsigned int len)
-{
- void *tmp = skb_put(skb, len);
- memcpy(tmp, data, len);
- return tmp;
-}
-#endif
-
#if LINUX_VERSION_CODE < KERNEL_VERSION(3, 19, 0) && !defined(ISRHEL7)
#define napi_complete_done(n, work_done) napi_complete(n)
#endif

View File

@@ -2,6 +2,17 @@
START=80
copy_certificates() {
[ -f /certificates/dev-id ] || return
cp /certificates/*.pem /etc/ucentral/
cp /certificates/dev-id /etc/ucentral/
chown root.network /etc/ucentral/*.pem
chmod 0440 root.network /etc/ucentral/*.pem
chmod 0400 /etc/ucentral/dev-id
exit 0
}
boot() {
[ -f /etc/ucentral/dev-id ] && return
. /lib/functions.sh
@@ -17,11 +28,49 @@ boot() {
[ -e /dev/ubi1 ] && mount -t ubifs ubi1:certificates /certificates
fi
fi
[ -f /certificates/dev-id ] && {
cp /certificates/*.pem /etc/ucentral/
cp /certificates/dev-id /etc/ucentral/
chown root.network /etc/ucentral/*.pem
chmod 0440 root.network /etc/ucentral/*.pem
chmod 0400 /etc/ucentral/dev-id
}
copy_certificates
# if we get here no valid certificates were found
. /lib/functions.sh
local PART_NAME
case "$(board_name)" in
actiontec,web7200)
if grep -q bootselect=0 /proc/cmdline; then
PART_NAME=firmware2
else
PART_NAME=firmware1
fi
;;
edgecore,ecw5211|\
edgecore,eap101|\
edgecore,eap102)
if grep -q rootfs1 /proc/cmdline; then
PART_NAME=rootfs2
else
PART_NAME=rootfs1
fi
;;
hfcl,ion4xi|\
hfcl,ion4xe)
if grep -q rootfs_1 /proc/cmdline; then
PART_NAME=rootfs
else
PART_NAME=rootfs_1
fi
;;
*)
return 1
;;
esac
local MTD=$(find_mtd_index $PART_NAME)
[ -z "$MTD" ] && return 1
ubiattach -m $MTD -d 3
[ -e /dev/ubi3 ] && mount -t ubifs ubi3:certificates /certificates
copy_certificates
}

View File

@@ -8,13 +8,13 @@ PROG=/usr/bin/ucode
start_service() {
[ -f /etc/ucentral/capabilities.json ] || {
mkdir -p /etc/ucentral/
ucode -m ubus -E board=/etc/board.json /usr/share/ucentral/capabilities.uc > /etc/ucentral/capabilities.json
/usr/share/ucentral/capabilities.uc
}
/usr/share/ucentral/ucentral.uc /etc/ucentral/ucentral.cfg.0000000001 > /dev/null
procd_open_instance
procd_set_param command "$PROG" -m uci -m fs -i /usr/share/ucentral/firstcontact.uc
procd_set_param command "$PROG" -l uci -l fs /usr/share/ucentral/firstcontact.uc
procd_set_param respawn 1 10 0
procd_close_instance
}

View File

@@ -1,4 +1,3 @@
{%
let devid;
let fd = fs.open("/etc/ucentral/dev-id", "r");
if (!fd) {
@@ -62,4 +61,3 @@ system("/etc/init.d/firstcontact disable");
system("reload_config");
system("/etc/init.d/ucentral start");
system("/etc/init.d/firstcontact stop");
%}

View File

@@ -0,0 +1,25 @@
include $(TOPDIR)/rules.mk
PKG_NAME:=radius-gw-proxy
PKG_RELEASE:=1
PKG_LICENSE:=BSD-3-Clause
PKG_MAINTAINER:=John Crispin <john@phrozen.org>
include $(INCLUDE_DIR)/package.mk
include $(INCLUDE_DIR)/cmake.mk
define Package/radius-gw-proxy
SECTION:=ucentral
CATEGORY:=uCentral
TITLE:=uCentral Gateway radius-gw-proxy
DEPENDS:=+libubox +libubus
endef
define Package/radius-gw-proxy/install
$(INSTALL_DIR) $(1)/usr/sbin
$(INSTALL_BIN) $(PKG_BUILD_DIR)/radius-gw-proxy $(1)/usr/sbin/
$(CP) ./files/* $(1)
endef
$(eval $(call BuildPackage,radius-gw-proxy))

View File

@@ -0,0 +1,11 @@
#!/bin/sh /etc/rc.common
START=99
USE_PROCD=1
start_service() {
procd_open_instance
procd_set_param command "/usr/sbin/radius-gw-proxy"
procd_close_instance
}

View File

@@ -0,0 +1,30 @@
cmake_minimum_required(VERSION 2.6)
PROJECT(radius-gw-proxy C)
ADD_DEFINITIONS(-Wall -Werror)
IF(CMAKE_C_COMPILER_VERSION VERSION_GREATER 6)
ADD_DEFINITIONS(-Wextra -Werror=implicit-function-declaration)
ADD_DEFINITIONS(-Wformat -Werror=format-security -Werror=format-nonliteral)
ENDIF()
ADD_DEFINITIONS(-Os -std=gnu99 -g3 -Wmissing-declarations -Wno-unused-parameter -Wno-strict-aliasing)
SET(CMAKE_SHARED_LIBRARY_LINK_C_FLAGS "")
SET(SOURCES main.c ubus.c)
FIND_LIBRARY(ubus NAMES ubus)
FIND_LIBRARY(ubox NAMES ubox)
FIND_PATH(ubox_include_dir libubox/uloop.h)
FIND_PATH(ubus_include_dir NAMES libubus.h)
INCLUDE_DIRECTORIES(${ubox_include_dir} ${ubus_include_dir})
ADD_EXECUTABLE(radius-gw-proxy ${SOURCES})
TARGET_LINK_LIBRARIES(radius-gw-proxy ${ubox} ${ubus})
INSTALL(TARGETS radius-gw-proxy
RUNTIME DESTINATION sbin
)

View File

@@ -0,0 +1,363 @@
/* SPDX-License-Identifier: BSD-3-Clause */
#define _GNU_SOURCE
#include <sys/types.h>
#include <sys/socket.h>
#include <netinet/in.h>
#include <net/if.h>
#include <arpa/inet.h>
#include <errno.h>
#include <unistd.h>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <libubox/uloop.h>
#include <libubox/usock.h>
#include <libubox/ulog.h>
#include <libubus.h>
#include "ubus.h"
#define RAD_PROX_BUFLEN (4 * 1024)
#define TLV_NAS_IP 4
#define TLV_PROXY_STATE 33
struct radius_socket {
struct uloop_fd fd;
enum socket_type type;
};
struct radius_header {
uint8_t code;
uint8_t id;
uint16_t len;
char auth[16];
char avp[];
};
struct radius_tlv {
uint8_t id;
uint8_t len;
char data[];
};
struct radius_proxy_state_key {
char id[256];
enum socket_type type;
};
struct radius_proxy_state {
struct avl_node avl;
struct radius_proxy_state_key key;
int port;
};
static struct radius_socket *sock_auth;
static struct radius_socket *sock_acct;
static struct radius_socket *sock_dae;
static int
avl_memcmp(const void *k1, const void *k2, void *ptr)
{
return memcmp(k1, k2, sizeof(struct radius_proxy_state_key));
}
static AVL_TREE(radius_proxy_states, avl_memcmp, false, NULL);
static struct blob_buf b;
static void
radius_proxy_state_add(char *id, int port, enum socket_type type)
{
struct radius_proxy_state *station;
struct radius_proxy_state_key key = { .type = type };
strcpy(key.id, id);
station = avl_find_element(&radius_proxy_states, &key, station, avl);
if (!station) {
ULOG_INFO("new station/port, adding to avl tree\n");
station = malloc(sizeof(*station));
memset(station, 0, sizeof(*station));
strcpy(station->key.id, id);
station->key.type = type;
station->avl.key = &station->key;
avl_insert(&radius_proxy_states, &station->avl);
}
station->port = port;
}
static char *
b64enc(char *src, int len)
{
char *dst;
int ret;
if (!src)
return NULL;
dst = malloc(len * 4);
ret = b64_encode(src, len, dst, len * 4);
if (ret < 1) {
free(dst);
return NULL;
}
return dst;
}
static char *
b64dec(char *src, int *ret)
{
int len = strlen(src);
char *dst = malloc(len);
*ret = b64_decode(src, dst, len);
if (*ret < 0)
return NULL;
return dst;
}
static void
radius_forward_gw(char *buf, enum socket_type type)
{
struct radius_header *hdr = (struct radius_header *) buf;
struct ubus_request async = { };
char *data = b64enc(buf, ntohs(hdr->len));
if (!data || !ucentral)
return;
blob_buf_init(&b, 0);
switch (type) {
case RADIUS_AUTH:
blobmsg_add_string(&b, "radius", "auth");
break;
case RADIUS_ACCT:
blobmsg_add_string(&b, "radius", "acct");
break;
case RADIUS_DAS:
blobmsg_add_string(&b, "radius", "coa");
break;
default:
return;
}
blobmsg_add_string(&b, "data", data);
ubus_invoke_async(&conn.ctx, ucentral, "radius", b.head, &async);
ubus_abort_request(&conn.ctx, &async);
free(data);
}
static int
radius_parse(char *buf, int len, int port, enum socket_type type, int tx)
{
struct radius_header *hdr = (struct radius_header *) buf;
struct radius_tlv *proxy_state = NULL;
char proxy_state_str[256] = {};
void *avp = hdr->avp;
int len_orig = ntohs(hdr->len);
uint8_t localhost[] = { 0x7f, 0, 0, 1 };
if (len_orig != len) {
ULOG_ERR("invalid header length, %d %d\n", len_orig, len);
return -1;
}
printf("\tcode:%d, id:%d, len:%d\n", hdr->code, hdr->id, len_orig);
len -= sizeof(*hdr);
while (len > 0) {
struct radius_tlv *tlv = (struct radius_tlv *)avp;
if (len < tlv->len) {
ULOG_ERR("invalid TLV length\n");
return -1;
}
if (tlv->id == TLV_PROXY_STATE)
proxy_state = tlv;
if (type == RADIUS_DAS && tlv->id == TLV_NAS_IP && tlv->len == 6)
memcpy(tlv->data, &localhost, 4);
printf("\tID:%d, len:%d\n", tlv->id, tlv->len);
avp += tlv->len;
len -= tlv->len;
}
if (type == RADIUS_DAS) {
if (tx) {
radius_forward_gw(buf, type);
} else {
struct sockaddr_in dest;
memset(&dest, 0, sizeof(dest));
dest.sin_family = AF_INET;
dest.sin_port = htons(3799);
inet_pton(AF_INET, "127.0.0.1", &(dest.sin_addr.s_addr));
if (sendto(sock_dae->fd.fd, buf, len_orig,
MSG_DONTWAIT, (struct sockaddr*)&dest, sizeof(dest)) < 0)
ULOG_ERR("failed to deliver DAS frame to localhost\n");
}
return 0;
}
if (!proxy_state) {
ULOG_ERR("no proxy_state found\n");
return -1;
}
memcpy(proxy_state_str, proxy_state->data, proxy_state->len - 2);
printf("\tfowarding to %s, prox_state:%s\n", tx ? "gateway" : "hostapd", proxy_state_str);
if (tx) {
radius_proxy_state_add(proxy_state_str, port, type);
radius_forward_gw(buf, type);
} else {
struct radius_proxy_state *proxy = avl_find_element(&radius_proxy_states, proxy_state, proxy, avl);
struct radius_proxy_state_key key = {};
struct sockaddr_in dest;
struct radius_socket *sock;
switch(type) {
case RADIUS_AUTH:
sock = sock_auth;
break;
case RADIUS_ACCT:
sock = sock_acct;
break;
default:
ULOG_ERR("bad socket type\n");
return -1;
}
strcpy(key.id, proxy_state_str);
key.type = type;
proxy = avl_find_element(&radius_proxy_states, &key, proxy, avl);
if (!proxy) {
ULOG_ERR("unknown proxy_state, dropping frame\n");
return -1;
}
memset(&dest, 0, sizeof(dest));
dest.sin_family = AF_INET;
dest.sin_port = proxy->port;
inet_pton(AF_INET, "127.0.0.1", &(dest.sin_addr.s_addr));
if (sendto(sock->fd.fd, buf, len_orig,
MSG_DONTWAIT, (struct sockaddr*)&dest, sizeof(dest)) < 0)
ULOG_ERR("failed to deliver frame to localhost\n");
}
return 0;
}
void
gateway_recv(char *data, enum socket_type type)
{
int len = 0;
char *frame;
frame = b64dec(data, &len);
if (!frame) {
ULOG_ERR("failed to b64_decode frame\n");
return;
}
radius_parse(frame, len, 0, type, 0);
free(frame);
}
static void
sock_recv(struct uloop_fd *u, unsigned int events)
{
static char buf[RAD_PROX_BUFLEN];
static char cmsg_buf[( CMSG_SPACE(sizeof(struct in_pktinfo)) + sizeof(int)) + 1];
static struct sockaddr_in sin;
char addr_str[INET_ADDRSTRLEN];
static struct iovec iov = {
.iov_base = buf,
.iov_len = sizeof(buf)
};
static struct msghdr msg = {
.msg_name = &sin,
.msg_namelen = sizeof(sin),
.msg_iov = &iov,
.msg_iovlen = 1,
.msg_control = cmsg_buf,
.msg_controllen = sizeof(cmsg_buf),
};
struct radius_socket *sock = container_of(u, struct radius_socket, fd);
int len;
do {
len = recvmsg(u->fd, &msg, 0);
if (len < 0) {
switch (errno) {
case EAGAIN:
return;
case EINTR:
continue;
default:
perror("recvmsg");
uloop_fd_delete(u);
return;
}
}
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);
radius_parse(buf, len, sin.sin_port, sock->type, 1);
} while (1);
}
static struct radius_socket *
sock_open(char *port, enum socket_type type)
{
struct radius_socket *sock = malloc(sizeof(*sock));
if (!sock)
return NULL;
memset(sock, 0, sizeof(*sock));
sock->fd.fd = usock(USOCK_UDP | USOCK_SERVER | USOCK_NONBLOCK |
USOCK_NUMERIC | USOCK_IPV4ONLY,
"127.0.0.1", port);
if (sock->fd.fd < 0) {
perror("usock");
free(sock);
return NULL;
}
sock->type = type;
sock->fd.cb = sock_recv;
uloop_fd_add(&sock->fd, ULOOP_READ);
return sock;
}
int main(int argc, char **argv)
{
ulog_open(ULOG_STDIO | ULOG_SYSLOG, LOG_DAEMON, "radius-gw-proxy");
uloop_init();
ubus_init();
sock_auth = sock_open("1812", RADIUS_AUTH);
sock_acct = sock_open("1813", RADIUS_ACCT);
sock_dae = sock_open("1814", RADIUS_DAS);
uloop_run();
uloop_end();
ubus_deinit();
return 0;
}

View File

@@ -0,0 +1,124 @@
/* SPDX-License-Identifier: BSD-3-Clause */
#include <string.h>
#include <libubox/ulog.h>
#include <libubus.h>
#include "ubus.h"
struct ubus_auto_conn conn;
uint32_t ucentral;
enum {
RADIUS_TYPE,
RADIUS_DATA,
__RADIUS_MAX,
};
static const struct blobmsg_policy frame_policy[__RADIUS_MAX] = {
[RADIUS_TYPE] = { .name = "radius", .type = BLOBMSG_TYPE_STRING },
[RADIUS_DATA] = { .name = "data", .type = BLOBMSG_TYPE_STRING },
};
static int ubus_frame_cb(struct ubus_context *ctx,
struct ubus_object *obj,
struct ubus_request_data *req,
const char *method, struct blob_attr *msg)
{
struct blob_attr *tb[__RADIUS_MAX] = {};
enum socket_type type;
char *radius, *data;
blobmsg_parse(frame_policy, __RADIUS_MAX, tb, blobmsg_data(msg), blobmsg_data_len(msg));
if (!tb[RADIUS_TYPE] || !tb[RADIUS_DATA])
return UBUS_STATUS_INVALID_ARGUMENT;
radius = blobmsg_get_string(tb[RADIUS_TYPE]);
data = blobmsg_get_string(tb[RADIUS_DATA]);
if (!strcmp(radius, "auth"))
type = RADIUS_AUTH;
else if (!strcmp(radius, "acct"))
type = RADIUS_ACCT;
else if (!strcmp(radius, "coa"))
type = RADIUS_DAS;
else
return UBUS_STATUS_INVALID_ARGUMENT;
gateway_recv(data, type);
return UBUS_STATUS_OK;
}
static const struct ubus_method ucentral_methods[] = {
UBUS_METHOD("frame", ubus_frame_cb, frame_policy),
};
static struct ubus_object_type ubus_object_type =
UBUS_OBJECT_TYPE("radius.proxy", ucentral_methods);
struct ubus_object ubus_object = {
.name = "radius.proxy",
.type = &ubus_object_type,
.methods = ucentral_methods,
.n_methods = ARRAY_SIZE(ucentral_methods),
};
static void
ubus_event_handler_cb(struct ubus_context *ctx, struct ubus_event_handler *ev,
const char *type, struct blob_attr *msg)
{
enum {
EVENT_ID,
EVENT_PATH,
__EVENT_MAX
};
static const struct blobmsg_policy status_policy[__EVENT_MAX] = {
[EVENT_ID] = { .name = "id", .type = BLOBMSG_TYPE_INT32 },
[EVENT_PATH] = { .name = "path", .type = BLOBMSG_TYPE_STRING },
};
struct blob_attr *tb[__EVENT_MAX];
char *path;
uint32_t id;
blobmsg_parse(status_policy, __EVENT_MAX, tb, blob_data(msg), blob_len(msg));
if (!tb[EVENT_ID] || !tb[EVENT_PATH])
return;
path = blobmsg_get_string(tb[EVENT_PATH]);
id = blobmsg_get_u32(tb[EVENT_ID]);
if (strcmp(path, "ucentral"))
return;
if (!strcmp("ubus.object.remove", type))
ucentral = 0;
else
ucentral = id;
}
static struct ubus_event_handler ubus_event_handler = { .cb = ubus_event_handler_cb };
static void
ubus_connect_handler(struct ubus_context *ctx)
{
ubus_add_object(ctx, &ubus_object);
ubus_register_event_handler(ctx, &ubus_event_handler, "ubus.object.add");
ubus_register_event_handler(ctx, &ubus_event_handler, "ubus.object.remove");
ubus_lookup_id(ctx, "ucentral", &ucentral);
}
void ubus_init(void)
{
memset(&conn, 0, sizeof(conn));
ucentral = 0;
conn.cb = ubus_connect_handler;
ubus_auto_connect(&conn);
}
void ubus_deinit(void)
{
ubus_auto_shutdown(&conn);
}

View File

@@ -0,0 +1,13 @@
enum socket_type {
RADIUS_AUTH = 0,
RADIUS_ACCT,
RADIUS_DAS
};
extern struct ubus_auto_conn conn;
extern uint32_t ucentral;
void ubus_init(void);
void ubus_deinit(void);
void gateway_recv(char *data, enum socket_type type);

View File

@@ -101,6 +101,7 @@ deliface() {
found=0
find_ssid() {
local ssid
config_get ssid $1 ssid
[ "$ssid" == "$2" ] || return
found=1
@@ -119,7 +120,7 @@ addiface() {
echo -n startup > /tmp/ratelimit.$iface
sleep 2
ssid=$(ubus call network.wireless status | jsonfilter -e '@[*].interfaces[@.ifname="'"$iface"'"].config.ssid')
ssid=$(ubus call hostapd.$iface get_status | jsonfilter -e '@.ssid')
[ -z "$ssid" ] && {
rm /tmp/ratelimit.$iface
logger "ratelimit: failed to lookup ssid"

View File

@@ -3,11 +3,11 @@ include $(TOPDIR)/rules.mk
PKG_NAME:=ucentral-client
PKG_RELEASE:=1
PKG_SOURCE_URL=https://github.com/blogic/ucentral-client.git
PKG_MIRROR_HASH:=37a1b7393cf5d15dbcd4840d9ffb2b16bf5b43cdd5c0da955c744bfc10211cbc
PKG_SOURCE_URL=https://github.com/Telecominfraproject/wlan-ucentral-client.git
PKG_MIRROR_HASH:=2fc20dd3b5c8a7d93e17a843a2feaa823a6f8e902fdca96df62aa3f12efdfbaa
PKG_SOURCE_PROTO:=git
PKG_SOURCE_DATE:=2022-01-10
PKG_SOURCE_VERSION:=6cb4485ab49c5ab9244fb55af9fd0e1801f154f4
PKG_SOURCE_DATE:=2022-06-22
PKG_SOURCE_VERSION:=68fe6c21f2c2643de79ecd5558a51ffb84168f75
PKG_LICENSE:=BSD-3-Clause
PKG_MAINTAINER:=John Crispin <john@phrozen.org>
@@ -19,7 +19,7 @@ define Package/ucentral-client
SECTION:=ucentral
CATEGORY:=uCentral
TITLE:=OpenWrt uCentral websocket client
DEPENDS:=+ucode +ucode-mod-fs +ucode-mod-ubus +ucode-mod-uci +ucode-mod-math +ucode-mod-resolv \
DEPENDS:=+ucode +ucode-mod-fs +ucode-mod-ubus +ucode-mod-uci +ucode-mod-math +ucode-mod-resolv +ucode-mod-uloop \
+libubox +libwebsockets-openssl +libblobmsg-json +libubus
endef

View File

@@ -21,7 +21,7 @@ start_service() {
mkdir -p /tmp/ucentral/
ucode -m fs -i /usr/share/ucentral/crashlog.uc
ucode -l fs /usr/share/ucentral/crashlog.uc
. /lib/functions.sh
cp /etc/config-shadow/ucentral /etc/config/

View File

@@ -3,11 +3,11 @@ include $(TOPDIR)/rules.mk
PKG_NAME:=ucentral-schema
PKG_RELEASE:=1
PKG_SOURCE_URL=https://github.com/blogic/ucentral-schema.git
PKG_MIRROR_HASH:=af89f22de096e860cfe5295837507d288d7c919d1cb61d7deca012895ed80321
PKG_SOURCE_URL=https://github.com/Telecominfraproject/wlan-ucentral-schema.git
PKG_MIRROR_HASH:=3603ddd26026d3a5b0febe7fbae22fd28fd6d7370793ecf979561d8886be2af4
PKG_SOURCE_PROTO:=git
PKG_SOURCE_DATE:=2022-01-17
PKG_SOURCE_VERSION:=7015febc04ad70a956b1ad79f2911bbdc24458a5
PKG_SOURCE_DATE:=2022-05-29
PKG_SOURCE_VERSION:=9691cc6860c25ba7d62142846da44bd09c17acc0
PKG_MAINTAINER:=John Crispin <john@phrozen.org>
PKG_LICENSE:=BSD-3-Clause

View File

@@ -8,7 +8,7 @@ PROG=/usr/bin/ucode
start_service() {
local interval=$(uci get onlinecheck.@config[-1].check_interval)
procd_open_instance
procd_set_param command "$PROG" -m uci -m fs -i /usr/share/ucentral/onlinecheck.uc
procd_set_param command "$PROG" -l uci -l fs /usr/share/ucentral/onlinecheck.uc
procd_set_param respawn 1 $interval 0
procd_close_instance
}

View File

@@ -1,23 +1,12 @@
{
"uuid": 2,
"radios": [
{
"band": "6G",
"country": "CA",
"channel-mode": "HE",
"channel-width": 80
},
{
"band": "5G",
"country": "CA",
"channel-mode": "HE",
"channel-width": 80
},
{
"band": "2G",
"country": "CA",
"channel-mode": "HE",
"channel-width": 80
"channel-width": 20,
"channel": 1
}
],
@@ -44,8 +33,27 @@
},
"tunnel": {
"proto": "gre",
"peer-address": "50.210.104.108"
}
"peer-address": "192.168.178.59"
},
"ipv4": {
"addressing": "static",
"subnet": "192.168.2.2/24",
"gateway": "192.168.2.1"
},
"ssids": [
{
"name": "OpenWifi-GRE",
"wifi-bands": [
"2G"
],
"bss-mode": "ap",
"encryption": {
"proto": "psk2",
"key": "OpenWifi",
"ieee80211w": "optional"
}
}
]
},
{
"name": "LAN",
@@ -69,19 +77,15 @@
},
"ssids": [
{
"name": "Maverick",
"name": "OpenWifi-GRE-NAT",
"wifi-bands": [
"5G",
"2G"
],
"bss-mode": "ap",
"encryption": {
"proto": "none",
"proto": "psk2",
"key": "OpenWifi",
"ieee80211w": "optional"
},
"roaming": {
"message-exchange": "ds",
"generate-psk": true
}
}
]

View File

@@ -0,0 +1,91 @@
{
"uuid": 2,
"radios": [
{
"band": "2G",
"country": "CA",
"channel-mode": "HE",
"channel-width": 20,
"channel": 6
}
],
"interfaces": [
{
"name": "WAN",
"role": "upstream",
"services": [ "ssh" ],
"ethernet": [
{
"select-ports": [
"WAN*"
]
}
],
"ipv4": {
"addressing": "dynamic"
},
"ssids": [
{
"name": "OpenWifi",
"wifi-bands": [
"2G"
],
"bss-mode": "ap",
"encryption": {
"proto": "psk2-radius",
"ieee80211w": "optional"
},
"radius": {
"authentication": {
"host": "192.168.50.30",
"port": 1812,
"secret": "secret"
},
"accounting": {
"host": "192.168.50.30",
"port": 1813,
"secret": "secret"
}
}
}
]
},
{
"name": "LAN",
"role": "downstream",
"services": [ "ssh" ],
"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": {
"ssh": {
"port": 22
}
}
}

View File

@@ -0,0 +1,91 @@
{
"uuid": 2,
"radios": [
{
"band": "5G",
"country": "CA",
"channel-mode": "HE",
"channel-width": 80,
"channel": 36
}
],
"interfaces": [
{
"name": "WAN",
"role": "upstream",
"ethernet": [
{
"select-ports": [
"WAN*"
]
}
],
"ipv4": {
"addressing": "dynamic"
},
"ssids": [
{
"name": "OpenWifi",
"wifi-bands": [
"2G", "5G"
],
"bss-mode": "ap",
"encryption": {
"proto": "wpa2",
"ieee80211w": "optional"
},
"radius": {
"authentication": {
"host": "192.168.178.192",
"port": 1812,
"secret": "secret"
},
"accounting": {
"host": "192.168.178.192",
"port": 1813,
"secret": "secret"
}
},
"services": [ "radius-gw-proxy" ]
}
]
},
{
"name": "LAN",
"role": "downstream",
"services": [ "ssh" ],
"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": {
"ssh": {
"port": 22
}
}
}

View File

@@ -103,14 +103,29 @@
"radius-proxy": {
"realms": [
{
"realm": "test",
"protocol": "radsec",
"realm": [ "radsec1", "radsec2" ],
"host": "192.168.1.10",
"secret": "secret",
"ca-certificate": "Zm9vbwo=",
"certificate": "Zm9vbwo=",
"private-key": "Zm9vbwo="
}, {
"realm": "*",
"protocol": "radius",
"realm": [ "radius1", "radius2" ],
"auth-server": "192.168.1.11",
"auth-port": 1812,
"auth-secret": "secret",
"acct-server": "192.168.1.11",
"acct-port": 1813,
"acct-secret": "secret"
}, {
"protocol": "block",
"realm": [ "block1", "block2" ],
"message": "Access Denied"
}, {
"protocol": "radsec",
"realm": [ "*" ],
"auto-discover": true,
"use-local-certificates": true
}

View File

@@ -1,23 +1,11 @@
{
"uuid": 2,
"radios": [
{
"band": "6G",
"country": "CA",
"channel-mode": "HE",
"channel-width": 80
},
{
"band": "5G",
"country": "CA",
"channel-mode": "HE",
"channel-width": 80
},
{
"band": "2G",
"country": "CA",
"channel-mode": "HE",
"channel-width": 80
"channel": 1
}
],
@@ -49,13 +37,31 @@
},
"ipv4": {
"addressing": "static",
"subnet": "10.0.0.1/24"
}
"subnet": "10.0.0.2/24",
"gateway": "10.0.0.1"
},
"ssids": [
{
"name": "OpenWifi-VXLAN",
"wifi-bands": [
"2G"
],
"bss-mode": "ap",
"encryption": {
"proto": "psk2",
"key": "OpenWifi",
"ieee80211w": "optional"
}
}
]
},
{
"name": "LAN",
"role": "downstream",
"services": [ "ssh" ],
"vlan": {
"id": 100
},
"ethernet": [
{
"select-ports": [
@@ -74,19 +80,15 @@
},
"ssids": [
{
"name": "Maverick",
"name": "OpenWifi-VXLAN",
"wifi-bands": [
"5G",
"2G"
],
"bss-mode": "ap",
"encryption": {
"proto": "none",
"proto": "psk2",
"key": "OpenWifi",
"ieee80211w": "optional"
},
"roaming": {
"message-exchange": "ds",
"generate-psk": true
}
}
]

View File

@@ -0,0 +1,123 @@
{
"uuid": 2,
"radios": [
{
"band": "2G",
"country": "US",
"channel-mode": "HE",
"channel-width": 20,
"channel": "auto"
}, {
"band": "5G",
"country": "US",
"channel-mode": "HE",
"channel-width": 80,
"channel": 36
}, {
"band": "6G",
"country": "US",
"channel-mode": "HE",
"channel-width": 80,
"channel": 33
}
],
"interfaces": [
{
"name": "WAN",
"role": "upstream",
"services": [ "lldp" ],
"ethernet": [
{
"select-ports": [
"WAN*"
]
}
],
"ipv4": {
"addressing": "dynamic"
},
"ssids": [
{
"name": "OpenWifi2",
"wifi-bands": [
"2G"
],
"bss-mode": "ap",
"encryption": {
"proto": "psk2",
"key": "OpenWifi",
"ieee80211w": "optional"
},
"rrm": {
"reduced-neighbor-reporting": true
}
}, {
"name": "OpenWifi5",
"wifi-bands": [
"5G"
],
"bss-mode": "ap",
"encryption": {
"proto": "psk2",
"key": "OpenWifi",
"ieee80211w": "optional"
},
"rrm": {
"reduced-neighbor-reporting": true
}
}, {
"name": "OpenWifi6",
"wifi-bands": [
"6G"
],
"bss-mode": "ap",
"encryption": {
"proto": "sae",
"key": "OpenWifi",
"ieee80211w": "required"
}
}
]
},
{
"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
}
}
}

View File

@@ -1,4 +1,4 @@
#!/usr/bin/ucode -R
#!/usr/bin/ucode
let nl = require("nl80211");
let def = nl.const;

View File

@@ -1,4 +1 @@
[ ifup = "$ACTION" ] && {
ip-collide
[ $? -eq 0 ] || ubus call ucentral send '{"msg": "ip/domain collision detected", "severity": 3}'
}
[ ifup = "$ACTION" ] && /usr/share/ucentral/ip-collide.uc

View File

@@ -12,13 +12,13 @@ PKG_RELEASE:=1
PKG_SOURCE_PROTO:=git
PKG_SOURCE_URL=https://github.com/jow-/ucode.git
PKG_MIRROR_HASH:=376b89c35967d3761acb192af9fb6b7b20dbcc50d03c8ed851751d2376bf26b4
PKG_SOURCE_DATE:=2021-07-30
PKG_SOURCE_VERSION:=8fd4746da31b945a6259ac846f7cf8dcfef0b1ef
PKG_SOURCE_DATE:=2022-04-07
PKG_SOURCE_VERSION:=33f1e0b0926e973fb5ae445e9a995848762143bb
PKG_MIRROR_HASH:=e419678244c5402c739e3a200d6d1d7cd6989a711c73744bc68b2d5b76bae33a
PKG_MAINTAINER:=Jo-Philipp Wich <jo@mein.io>
PKG_LICENSE:=ISC
PKG_ABI_VERSION:=20210730
PKG_ABI_VERSION:=20220322
include $(INCLUDE_DIR)/package.mk
include $(INCLUDE_DIR)/cmake.mk
@@ -33,7 +33,7 @@ endef
define Package/ucode
$(Package/ucode/default)
DEPENDS:=+libucode
DEPENDS:=+libucode
endef
define Package/ucode/description
@@ -65,17 +65,6 @@ define Package/ucode-mod-fs/description
endef
define Package/ucode-mod-resolv
$(Package/ucode/default)
TITLE+= (resolv module)
DEPENDS:=ucode
endef
define Package/ucode-mod-resolv/description
The resolv plugin module allows making DNS resolves.
endef
define Package/ucode-mod-math
$(Package/ucode/default)
TITLE+= (math module)
@@ -87,6 +76,50 @@ define Package/ucode-mod-math/description
endef
define Package/ucode-mod-nl80211
$(Package/ucode/default)
TITLE+= (nl80211 module)
DEPENDS:=ucode +libnl-tiny +kmod-mac80211
endef
define Package/ucode-mod-nl80211/description
The nl80211 plugin provides access to the Linux wireless 802.11 netlink API.
endef
define Package/ucode-mod-resolv
$(Package/ucode/default)
TITLE+= (resolv module)
DEPENDS:=ucode
endef
define Package/ucode-mod-resolv/description
The resolv plugin implements simple DNS resolving.
endef
define Package/ucode-mod-rtnl
$(Package/ucode/default)
TITLE+= (rtnl module)
DEPENDS:=ucode +libnl-tiny
endef
define Package/ucode-mod-rtnl/description
The rtnl plugin provides access to the Linux routing netlink API.
endef
define Package/ucode-mod-struct
$(Package/ucode/default)
TITLE+= (struct module)
DEPENDS:=ucode
endef
define Package/ucode-mod-struct/description
The struct plugin implemnts Python 3 compatible struct.pack/unpack functionality.
endef
define Package/ucode-mod-ubus
$(Package/ucode/default)
TITLE+= (ubus module)
@@ -109,40 +142,16 @@ define Package/ucode-mod-uci/description
The uci module allows templates to read and modify uci configuration.
endef
define Package/ucode-mod-nl80211
define Package/ucode-mod-uloop
$(Package/ucode/default)
TITLE+= (nl80211 module)
DEPENDS:=ucode +libnl-tiny +kmod-mac80211
TITLE+= (uloop module)
DEPENDS:=ucode +libubox
endef
define Package/ucode-mod-nl80211/description
The nl80211 module allows templates to send and receive nl80211 messages..
define Package/ucode-mod-uloop/description
The uloop module allows templates to run a main loop.
endef
define Package/ucode-mod-struct
$(Package/ucode/default)
TITLE+= (struct module)
DEPENDS:=ucode
endef
define Package/ucode-mod-struct/description
The struct module allows templates to unpack binary buffers.
endef
define Package/ucode-mod-rtnl
$(Package/ucode/default)
TITLE+= (rtnl module)
DEPENDS:=ucode +libnl-tiny
endef
define Package/ucode-mod-struct/description
The rtnl module allows templates to send and receive rtnl messages..
endef
define Build/Prepare
$(Build/Prepare/Default)
$(CP) $(STAGING_DIR)/usr/include/mac80211/uapi/linux/nl80211.h $(PKG_BUILD_DIR)/nl80211_copy.h
@@ -157,7 +166,7 @@ endef
define Package/ucode/install
$(INSTALL_DIR) $(1)/usr/bin
$(INSTALL_BIN) $(PKG_INSTALL_DIR)/usr/bin/ucode $(1)/usr/bin/ucode
$(CP) $(PKG_INSTALL_DIR)/usr/bin/u* $(1)/usr/bin/
endef
define Package/libucode/install
@@ -170,14 +179,29 @@ define Package/ucode-mod-fs/install
$(INSTALL_BIN) $(PKG_INSTALL_DIR)/usr/lib/ucode/fs.so $(1)/usr/lib/ucode/
endef
define Package/ucode-mod-math/install
$(INSTALL_DIR) $(1)/usr/lib/ucode
$(INSTALL_BIN) $(PKG_INSTALL_DIR)/usr/lib/ucode/math.so $(1)/usr/lib/ucode/
endef
define Package/ucode-mod-nl80211/install
$(INSTALL_DIR) $(1)/usr/lib/ucode
$(INSTALL_BIN) $(PKG_INSTALL_DIR)/usr/lib/ucode/nl80211.so $(1)/usr/lib/ucode/
endef
define Package/ucode-mod-resolv/install
$(INSTALL_DIR) $(1)/usr/lib/ucode
$(INSTALL_BIN) $(PKG_INSTALL_DIR)/usr/lib/ucode/resolv.so $(1)/usr/lib/ucode/
endef
define Package/ucode-mod-math/install
define Package/ucode-mod-rtnl/install
$(INSTALL_DIR) $(1)/usr/lib/ucode
$(INSTALL_BIN) $(PKG_INSTALL_DIR)/usr/lib/ucode/math.so $(1)/usr/lib/ucode/
$(INSTALL_BIN) $(PKG_INSTALL_DIR)/usr/lib/ucode/rtnl.so $(1)/usr/lib/ucode/
endef
define Package/ucode-mod-struct/install
$(INSTALL_DIR) $(1)/usr/lib/ucode
$(INSTALL_BIN) $(PKG_INSTALL_DIR)/usr/lib/ucode/struct.so $(1)/usr/lib/ucode/
endef
define Package/ucode-mod-ubus/install
@@ -190,29 +214,20 @@ define Package/ucode-mod-uci/install
$(INSTALL_BIN) $(PKG_INSTALL_DIR)/usr/lib/ucode/uci.so $(1)/usr/lib/ucode/
endef
define Package/ucode-mod-nl80211/install
define Package/ucode-mod-uloop/install
$(INSTALL_DIR) $(1)/usr/lib/ucode
$(INSTALL_BIN) $(PKG_INSTALL_DIR)/usr/lib/ucode/nl80211.so $(1)/usr/lib/ucode/
endef
define Package/ucode-mod-struct/install
$(INSTALL_DIR) $(1)/usr/lib/ucode
$(INSTALL_BIN) $(PKG_INSTALL_DIR)/usr/lib/ucode/struct.so $(1)/usr/lib/ucode/
endef
define Package/ucode-mod-rtnl/install
$(INSTALL_DIR) $(1)/usr/lib/ucode
$(INSTALL_BIN) $(PKG_INSTALL_DIR)/usr/lib/ucode/rtnl.so $(1)/usr/lib/ucode/
$(INSTALL_BIN) $(PKG_INSTALL_DIR)/usr/lib/ucode/uloop.so $(1)/usr/lib/ucode/
endef
$(eval $(call BuildPackage,ucode))
$(eval $(call BuildPackage,libucode))
$(eval $(call BuildPackage,ucode-mod-fs))
$(eval $(call BuildPackage,ucode-mod-resolv))
$(eval $(call BuildPackage,ucode-mod-math))
$(eval $(call BuildPackage,ucode-mod-nl80211))
$(eval $(call BuildPackage,ucode-mod-resolv))
$(eval $(call BuildPackage,ucode-mod-rtnl))
$(eval $(call BuildPackage,ucode-mod-struct))
$(eval $(call BuildPackage,ucode-mod-ubus))
$(eval $(call BuildPackage,ucode-mod-uci))
$(eval $(call BuildPackage,ucode-mod-nl80211))
$(eval $(call BuildPackage,ucode-mod-struct))
$(eval $(call BuildPackage,ucode-mod-rtnl))
$(eval $(call BuildPackage,ucode-mod-uloop))

View File

@@ -1,7 +1,7 @@
Index: ucode-2021-07-30-03b6a8ef/lib/nl80211.c
Index: ucode-2022-04-07-33f1e0b0/lib/nl80211.c
===================================================================
--- ucode-2021-07-30-03b6a8ef.orig/lib/nl80211.c
+++ ucode-2021-07-30-03b6a8ef/lib/nl80211.c
--- ucode-2022-04-07-33f1e0b0.orig/lib/nl80211.c
+++ ucode-2022-04-07-33f1e0b0/lib/nl80211.c
@@ -38,7 +38,7 @@ limitations under the License.
#include <netlink/genl/family.h>
#include <netlink/genl/ctrl.h>

View File

@@ -8,20 +8,20 @@ Subject: [PATCH] fixes
lib/rtnl.c | 1 +
2 files changed, 87 insertions(+), 6 deletions(-)
diff --git a/lib/nl80211.c b/lib/nl80211.c
index fc24fb8..3e21141 100644
--- a/lib/nl80211.c
+++ b/lib/nl80211.c
@@ -45,6 +45,8 @@ limitations under the License.
Index: ucode-2022-04-07-33f1e0b0/lib/nl80211.c
===================================================================
--- ucode-2022-04-07-33f1e0b0.orig/lib/nl80211.c
+++ ucode-2022-04-07-33f1e0b0/lib/nl80211.c
@@ -51,6 +51,8 @@ limitations under the License.
#define err_return(code, ...) do { set_error(code, __VA_ARGS__); return NULL; } while(0)
#define NL80211_ATTR_NOT_IMPLEMENTED 0x10000
+#define NL80211_ATTR_NOT_IMPLEMENTED 0x10000
+
static struct {
int code;
char *msg;
@@ -257,6 +259,14 @@ static const uc_nl_nested_spec_t nl80211_keys_nla = {
@@ -263,6 +265,14 @@ static const uc_nl_nested_spec_t nl80211
}
};
@@ -36,7 +36,7 @@ index fc24fb8..3e21141 100644
static const uc_nl_nested_spec_t nl80211_mesh_params_nla = {
.headsize = 0,
.nattrs = 29,
@@ -348,6 +358,14 @@ static const uc_nl_nested_spec_t nl80211_nan_func_nla = {
@@ -354,6 +364,14 @@ static const uc_nl_nested_spec_t nl80211
}
};
@@ -51,7 +51,7 @@ index fc24fb8..3e21141 100644
static const uc_nl_nested_spec_t nl80211_peer_measurements_peers_req_data_ftm_nla = {
.headsize = 0,
.nattrs = 13,
@@ -497,6 +515,26 @@ static const uc_nl_nested_spec_t nl80211_wiphy_bands_freqs_wmm_nla = {
@@ -503,6 +521,26 @@ static const uc_nl_nested_spec_t nl80211
}
};
@@ -78,7 +78,7 @@ index fc24fb8..3e21141 100644
static const uc_nl_nested_spec_t nl80211_wiphy_bands_freqs_nla = {
.headsize = 0,
.nattrs = 25,
@@ -538,6 +576,10 @@ static const uc_nl_nested_spec_t nl80211_wiphy_bands_rates_nla = {
@@ -544,6 +582,10 @@ static const uc_nl_nested_spec_t nl80211
}
};
@@ -89,35 +89,7 @@ index fc24fb8..3e21141 100644
static const uc_nl_nested_spec_t nl80211_wiphy_bands_iftype_data_nla = {
.headsize = 0,
.nattrs = 7,
@@ -645,13 +687,26 @@ static const uc_nl_nested_spec_t nl80211_bss_nla = {
static const uc_nl_nested_spec_t nl80211_sta_info_bitrate_nla = {
.headsize = 0,
- .nattrs = 5,
+ .nattrs = 18,
.attrs = {
{ NL80211_RATE_INFO_BITRATE, "bitrate", DT_U16, 0, NULL },
{ NL80211_RATE_INFO_BITRATE32, "bitrate32", DT_U32, 0, NULL },
{ NL80211_RATE_INFO_MCS, "mcs", DT_U8, 0, NULL },
{ NL80211_RATE_INFO_40_MHZ_WIDTH, "40_mhz_width", DT_FLAG, 0, NULL },
{ NL80211_RATE_INFO_SHORT_GI, "short_gi", DT_FLAG, 0, NULL },
+ { NL80211_RATE_INFO_VHT_MCS, "vht_mcs", DT_U8, 0, NULL },
+ { NL80211_RATE_INFO_VHT_NSS, "vht_nss", DT_U8, 0, NULL },
+ { NL80211_RATE_INFO_HE_MCS, "he_mcs", DT_U8, 0, NULL },
+ { NL80211_RATE_INFO_HE_NSS, "he_nss", DT_U8, 0, NULL },
+ { NL80211_RATE_INFO_HE_GI, "he_gi", DT_U8, 0, NULL },
+ { NL80211_RATE_INFO_HE_DCM, "he_dcm", DT_U8, 0, NULL },
+ { NL80211_RATE_INFO_HE_RU_ALLOC, "he_ru_alloc", DT_U8, 0, NULL },
+ { NL80211_RATE_INFO_40_MHZ_WIDTH, "width_40", DT_FLAG, 0, NULL },
+ { NL80211_RATE_INFO_80_MHZ_WIDTH, "width_80", DT_FLAG, 0, NULL },
+ { NL80211_RATE_INFO_80P80_MHZ_WIDTH, "width_80p80", DT_FLAG, 0, NULL },
+ { NL80211_RATE_INFO_160_MHZ_WIDTH, "width_160", DT_FLAG, 0, NULL },
+ { NL80211_RATE_INFO_10_MHZ_WIDTH, "width_10", DT_FLAG, 0, NULL },
+ { NL80211_RATE_INFO_5_MHZ_WIDTH, "width_5", DT_FLAG, 0, NULL },
}
};
@@ -695,9 +750,13 @@ static const uc_nl_nested_spec_t nl80211_bss_param_nla = {
@@ -714,6 +756,10 @@ static const uc_nl_nested_spec_t nl80211
}
};
@@ -127,77 +99,12 @@ index fc24fb8..3e21141 100644
+
static const uc_nl_nested_spec_t nl80211_sta_info_nla = {
.headsize = 0,
- .nattrs = 34,
+ .nattrs = 35,
.attrs = {
{ NL80211_STA_INFO_INACTIVE_TIME, "inactive_time", DT_U32, 0, NULL },
{ NL80211_STA_INFO_RX_BYTES, "rx_bytes", DT_U32, 0, NULL },
@@ -724,21 +783,37 @@ static const uc_nl_nested_spec_t nl80211_sta_info_nla = {
{ NL80211_STA_INFO_NONPEER_PM, "nonpeer_pm", DT_U32, 0, NULL },
{ NL80211_STA_INFO_CHAIN_SIGNAL, "chain_signal", DT_S8, DF_MULTIPLE|DF_AUTOIDX, NULL },
{ NL80211_STA_INFO_CHAIN_SIGNAL_AVG, "chain_signal_avg", DT_S8, DF_MULTIPLE|DF_AUTOIDX, NULL },
- { NL80211_STA_INFO_TID_STATS, "tid_stats", DT_NESTED, 0, &nl80211_tid_stats_nla },
+ { NL80211_STA_INFO_TID_STATS, "tid_stats", DT_NESTED, DF_MULTIPLE|DF_AUTOIDX, &nl80211_tid_stats_nla },
{ NL80211_STA_INFO_BSS_PARAM, "bss_param", DT_NESTED, 0, &nl80211_bss_param_nla },
{ NL80211_STA_INFO_RX_DURATION, "rx_duration", DT_U64, 0, NULL },
{ NL80211_STA_INFO_TX_DURATION, "tx_duration", DT_U64, 0, NULL },
- { NL80211_STA_INFO_ACK_SIGNAL, "ack_signal", DT_U8, 0, NULL },
- { NL80211_STA_INFO_ACK_SIGNAL_AVG, "ack_signal_avg", DT_U8, 0, NULL },
+ { NL80211_STA_INFO_ACK_SIGNAL, "ack_signal", DT_S8, 0, NULL },
+ { NL80211_STA_INFO_ACK_SIGNAL_AVG, "ack_signal_avg", DT_S8, 0, NULL },
{ NL80211_STA_INFO_AIRTIME_LINK_METRIC, "airtime_link_metric", DT_U32, 0, NULL },
{ NL80211_STA_INFO_CONNECTED_TO_AS, "connected_to_as", DT_BOOL, 0, NULL },
{ NL80211_STA_INFO_CONNECTED_TO_GATE, "connected_to_gate", DT_BOOL, 0, NULL },
+ { NL80211_STA_INFO_CONNECTED_TIME, "connected_time", DT_U32, 0, NULL },
+ }
+};
+
+static const uc_nl_nested_spec_t nl80211_survey_info_nla = {
+ .headsize = 0,
+ .nattrs = 8,
+ .attrs = {
+ { NL80211_SURVEY_INFO_FREQUENCY, "frequency", DT_U32, 0, NULL },
+ { NL80211_SURVEY_INFO_TIME, "time", DT_U64, 0, NULL },
+ { NL80211_SURVEY_INFO_TIME_TX, "time_tx", DT_U64, 0, NULL },
+ { NL80211_SURVEY_INFO_TIME_RX, "time_rx", DT_U64, 0, NULL },
+ { NL80211_SURVEY_INFO_TIME_BUSY, "busy", DT_U64, 0, NULL },
+ { NL80211_SURVEY_INFO_TIME_EXT_BUSY, "ext_busy", DT_U64, 0, NULL },
+ { NL80211_SURVEY_INFO_TIME_SCAN, "scan", DT_U64, 0, NULL },
+ { NL80211_SURVEY_INFO_NOISE, "noise", DT_U8, 0, NULL },
}
};
static const uc_nl_nested_spec_t nl80211_msg = {
.headsize = 0,
- .nattrs = 124,
+ .nattrs = 126,
.attrs = {
{ NL80211_ATTR_4ADDR, "4addr", DT_U8, 0, NULL },
{ NL80211_ATTR_AIRTIME_WEIGHT, "airtime_weight", DT_U16, 0, NULL },
@@ -864,6 +939,8 @@ static const uc_nl_nested_spec_t nl80211_msg = {
{ NL80211_ATTR_WPA_VERSIONS, "wpa_versions", DT_U32, 0, NULL },
{ NL80211_ATTR_SUPPORTED_IFTYPES, "supported_iftypes", DT_NESTED, 0, &nl80211_ifcomb_limit_types_nla },
{ NL80211_ATTR_SOFTWARE_IFTYPES, "software_iftypes", DT_NESTED, 0, &nl80211_ifcomb_limit_types_nla },
+ { NL80211_ATTR_MAX_AP_ASSOC_STA, "max_ap_assoc", DT_U16, 0, NULL },
+ { NL80211_ATTR_SURVEY_INFO, "survey_info", DT_NESTED, 0, &nl80211_survey_info_nla },
}
};
@@ -1044,6 +1121,9 @@ uc_nl_parse_attrs(struct nl_msg *msg, char *base, const uc_nl_attr_spec_t *attrs
bool exists;
for (i = 0; i < nattrs; i++) {
+ if (attrs[i].attr == NL80211_ATTR_NOT_IMPLEMENTED)
+ continue;
+
v = ucv_object_get(obj, attrs[i].key, &exists);
if (!exists)
diff --git a/lib/rtnl.c b/lib/rtnl.c
index b6a3e38..c1d2088 100644
--- a/lib/rtnl.c
+++ b/lib/rtnl.c
@@ -682,6 +682,7 @@ static const uc_nl_nested_spec_t link_msg = {
.nattrs = 35,
Index: ucode-2022-04-07-33f1e0b0/lib/rtnl.c
===================================================================
--- ucode-2022-04-07-33f1e0b0.orig/lib/rtnl.c
+++ ucode-2022-04-07-33f1e0b0/lib/rtnl.c
@@ -682,6 +682,7 @@ static const uc_nl_nested_spec_t link_ms
{ IFLA_UNSPEC, "type", DT_U16, 0, MEMBER(ifinfomsg, ifi_type) },
{ IFLA_UNSPEC, "dev", DT_NETDEV, 0, MEMBER(ifinfomsg, ifi_index) },
{ IFLA_UNSPEC, "flags", DT_FLAGS, 0, MEMBER(ifinfomsg, ifi_flags) },
@@ -205,6 +112,3 @@ index b6a3e38..c1d2088 100644
{ IFLA_ADDRESS, "address", DT_LLADDR, 0, NULL },
{ IFLA_BROADCAST, "broadcast", DT_LLADDR, 0, NULL },
{ IFLA_TXQLEN, "txqlen", DT_U32, 0, NULL },
--
2.25.1

View File

@@ -6,12 +6,6 @@ PKG_RELEASE:=1
PKG_LICENSE:=GPL-2.0
PKG_MAINTAINER:=John Crispin <john@phrozen.org>
PKG_SOURCE_URL=https://github.com/blogic/udhcpsnoop.git
PKG_MIRROR_HASH:=721f005e51c46b9381f3e5a6576b8a31afd3903ddb0e7b569d7337a57ca33dd2
PKG_SOURCE_PROTO:=git
PKG_SOURCE_DATE:=2021-04-12
PKG_SOURCE_VERSION:=b86639904147a40be32ac43cd89c21109ffc3543
include $(INCLUDE_DIR)/package.mk
include $(INCLUDE_DIR)/cmake.mk
@@ -19,13 +13,20 @@ define Package/udhcpsnoop
SECTION:=net
CATEGORY:=Network
TITLE:=DHCP Snooping Daemon
DEPENDS:=+libubox +libubus +libuci
DEPENDS:=+libubox +libubus +kmod-ifb +tc
endef
define Package/udhcpsnoop/install
$(INSTALL_DIR) \
$(1)/usr/sbin \
$(1)/etc/init.d \
$(1)/etc/config \
$(1)/etc/hotplug.d/net
$(INSTALL_DIR) $(1)/usr/sbin
$(INSTALL_BIN) $(PKG_BUILD_DIR)/udhcpsnoop $(1)/usr/sbin/
$(CP) ./files/* $(1)
$(INSTALL_BIN) ./files/dhcpsnoop.init $(1)/etc/init.d/dhcpsnoop
$(INSTALL_DATA) ./files/dhcpsnoop.conf $(1)/etc/config/dhcpsnoop
$(INSTALL_DATA) ./files/dhcpsnoop.hotplug $(1)/etc/hotplug.d/net/10-dhcpsnoop
endef
$(eval $(call BuildPackage,udhcpsnoop))

View File

@@ -0,0 +1,6 @@
#config device
# option disabled 1
# option name eth0
# option ingress 1
# option egress 1

View File

@@ -0,0 +1,2 @@
#!/bin/sh
ubus call dhcpsnoop check_devices

View File

@@ -0,0 +1,60 @@
#!/bin/sh /etc/rc.common
# Copyright (c) 2021 OpenWrt.org
START=40
USE_PROCD=1
PROG=/usr/sbin/udhcpsnoop
add_option() {
local type="$1"
local name="$2"
local default="$3"
config_get val "$cfg" "$name"
[ -n "$val" ] && json_add_$type "$name" "${val:-$default}"
}
add_device() {
local cfg="$1"
config_get_bool disabled "$cfg" disabled 0
[ "$disabled" -gt 0 ] && return
config_get name "$cfg" name
json_add_object "$name"
add_option boolean ingress 1
add_option boolean egress 1
json_close_object
}
reload_service() {
json_init
config_load dhcpsnoop
json_add_object devices
config_foreach add_device device
json_close_object
ubus call dhcpsnoop config "$(json_dump)"
}
service_triggers() {
procd_add_reload_trigger dhcpsnoop
}
start_service() {
procd_open_instance
procd_set_param command "$PROG"
procd_set_param respawn
procd_close_instance
}
service_started() {
ubus -t 10 wait_for dhcpsnoop
[ $? = 0 ] && reload_service
}

View File

@@ -1,4 +0,0 @@
config snooping
option enable 0
#list network lan
#list network wan

View File

@@ -1,22 +0,0 @@
#!/bin/sh /etc/rc.common
START=80
USE_PROCD=1
PROG=/usr/sbin/udhcpsnoop
service_triggers() {
procd_add_reload_trigger dhcpsnoop
}
start_service() {
[ "$(uci get dhcpsnoop.@snooping[-1].enable)" -eq 1 ] || return
procd_open_instance
procd_set_param command "$PROG"
procd_set_param respawn
procd_close_instance
}
reload_service() {
restart
}

View File

@@ -0,0 +1,16 @@
cmake_minimum_required(VERSION 3.10)
PROJECT(udhcpsnoop C)
INCLUDE(GNUInstallDirs)
ADD_DEFINITIONS(-Os -ggdb -Wall -Werror --std=gnu99 -Wmissing-declarations)
SET(CMAKE_SHARED_LIBRARY_LINK_C_FLAGS "")
SET(SOURCES main.c ubus.c dev.c dhcp.c cache.c)
SET(LIBS ubox ubus)
ADD_EXECUTABLE(udhcpsnoop ${SOURCES})
TARGET_LINK_LIBRARIES(udhcpsnoop ${LIBS})
INSTALL(TARGETS udhcpsnoop
RUNTIME DESTINATION ${CMAKE_INSTALL_SBINDIR}
)

View File

@@ -0,0 +1,77 @@
// SPDX-License-Identifier: GPL-2.0+
/*
* Copyright (C) 2022 Felix Fietkau <nbd@nbd.name>
*/
#include <libubox/avl.h>
#include "dhcpsnoop.h"
#include "msg.h"
#define MAC_FMT "%02x:%02x:%02x:%02x:%02x:%02x"
#define MAC_VAR(x) x[0], x[1], x[2], x[3], x[4], x[5]
#define IP_FMT "%d.%d.%d.%d"
#define IP_VAR(x) x[0], x[1], x[2], x[3]
struct mac {
struct avl_node avl;
uint8_t mac[6];
uint8_t ip[4];
struct uloop_timeout rebind;
};
static int
avl_mac_cmp(const void *k1, const void *k2, void *ptr)
{
return memcmp(k1, k2, 6);
}
static struct avl_tree mac_tree = AVL_TREE_INIT(mac_tree, avl_mac_cmp, false, NULL);
static void
cache_expire(struct uloop_timeout *t)
{
struct mac *mac = container_of(t, struct mac, rebind);
avl_delete(&mac_tree, &mac->avl);
free(mac);
}
void
cache_entry(void *_msg, uint32_t rebind)
{
struct dhcpv4_message *msg = (struct dhcpv4_message *) _msg;
struct mac *mac;
mac = avl_find_element(&mac_tree, msg->chaddr, mac, avl);
if (!mac) {
mac = malloc(sizeof(*mac));
if (!mac)
return;
memset(mac, 0, sizeof(*mac));
memcpy(mac->mac, msg->chaddr, 6);
mac->avl.key = mac->mac;
mac->rebind.cb = cache_expire;
avl_insert(&mac_tree, &mac->avl);
}
memcpy(mac->ip, &msg->yiaddr.s_addr, 4);
uloop_timeout_set(&mac->rebind, rebind * 1000);
}
void
cache_dump(struct blob_buf *b)
{
struct mac *mac;
avl_for_each_element(&mac_tree, mac, avl) {
char addr[18];
char ip[16];
snprintf(addr, sizeof(addr), MAC_FMT, MAC_VAR(mac->mac));
snprintf(ip, sizeof(ip), IP_FMT, IP_VAR(mac->ip));
blobmsg_add_string(b, addr, ip);
}
}

View File

@@ -0,0 +1,425 @@
// SPDX-License-Identifier: GPL-2.0+
/*
* Copyright (C) 2022 Felix Fietkau <nbd@nbd.name>
*/
#include <netinet/if_ether.h>
#include <netinet/in.h>
#include <netinet/ip.h>
#include <netinet/ip6.h>
#include <netinet/udp.h>
#include <netpacket/packet.h>
#include <net/if.h>
#include <sys/socket.h>
#include <sys/types.h>
#include <stdio.h>
#include <unistd.h>
#include <fcntl.h>
#include <libubox/vlist.h>
#include <libubox/avl-cmp.h>
#include "dhcpsnoop.h"
#define APPEND(_buf, _ofs, _format, ...) _ofs += snprintf(_buf + _ofs, sizeof(_buf) - _ofs, _format, ##__VA_ARGS__)
struct vlan_hdr {
uint16_t tci;
uint16_t proto;
};
struct packet {
void *buffer;
unsigned int len;
};
struct device {
struct vlist_node node;
char ifname[IFNAMSIZ + 1];
int ifindex;
bool ingress;
bool egress;
bool changed;
bool active;
};
static void dev_update_cb(struct vlist_tree *tree, struct vlist_node *node_new,
struct vlist_node *node_old);
static struct uloop_fd ufd;
static VLIST_TREE(devices, avl_strcmp, dev_update_cb, true, false);
static void *pkt_peek(struct packet *pkt, unsigned int len)
{
if (len > pkt->len)
return NULL;
return pkt->buffer;
}
static void *pkt_pull(struct packet *pkt, unsigned int len)
{
void *ret = pkt_peek(pkt, len);
if (!ret)
return NULL;
pkt->buffer += len;
pkt->len -= len;
return ret;
}
static bool
proto_is_vlan(uint16_t proto)
{
return proto == ETH_P_8021Q || proto == ETH_P_8021AD;
}
static void
dhcpsnoop_packet_cb(struct packet *pkt)
{
struct ethhdr *eth;
struct ip6_hdr *ip6;
struct ip *ip;
struct udphdr *udp;
uint16_t proto, port;
const char *type;
bool ipv6 = false;
uint32_t rebind = 0;
eth = pkt_pull(pkt, sizeof(*eth));
if (!eth)
return;
proto = be16_to_cpu(eth->h_proto);
if (proto_is_vlan(proto)) {
struct vlan_hdr *vlan;
vlan = pkt_pull(pkt, sizeof(*vlan));
if (!vlan)
return;
proto = be16_to_cpu(vlan->proto);
}
switch (proto) {
case ETH_P_IP:
ip = pkt_peek(pkt, sizeof(struct ip));
if (!ip)
return;
if (!pkt_pull(pkt, ip->ip_hl * 4))
return;
proto = ip->ip_p;
break;
case ETH_P_IPV6:
ip6 = pkt_pull(pkt, sizeof(*ip6));
if (!ip6)
return;
proto = ip6->ip6_nxt;
ipv6 = true;
break;
default:
return;
}
if (proto != IPPROTO_UDP)
return;
udp = pkt_pull(pkt, sizeof(struct udphdr));
if (!udp)
return;
port = ntohs(udp->uh_sport);
if (!ipv6)
type = dhcpsnoop_parse_ipv4(pkt->buffer, pkt->len, port, &rebind);
else
type = dhcpsnoop_parse_ipv6(pkt->buffer, pkt->len, port);
if (!type)
return;
dhcpsnoop_ubus_notify(type, pkt->buffer, pkt->len);
if (!ipv6 && !strcmp(type, "ack") && rebind)
cache_entry(pkt->buffer, rebind);
}
static void
dhcpsnoop_socket_cb(struct uloop_fd *fd, unsigned int events)
{
static uint8_t buf[8192];
struct packet pkt = {
.buffer = buf,
};
int len;
retry:
len = recvfrom(fd->fd, buf, sizeof(buf), MSG_DONTWAIT, NULL, NULL);
if (len < 0) {
if (errno == EINTR)
goto retry;
return;
}
if (!len)
return;
pkt.len = len;
dhcpsnoop_packet_cb(&pkt);
}
static int
dhcpsnoop_open_socket(void)
{
struct sockaddr_ll sll = {
.sll_family = AF_PACKET,
.sll_protocol = htons(ETH_P_ALL),
};
int sock;
sock = socket(PF_PACKET, SOCK_RAW, htons(ETH_P_ALL));
if (sock == -1) {
ULOG_ERR("failed to create raw socket: %s\n", strerror(errno));
return -1;
}
sll.sll_ifindex = if_nametoindex(DHCPSNOOP_IFB_NAME);
if (bind(sock, (struct sockaddr *)&sll, sizeof(sll))) {
ULOG_ERR("failed to bind socket to "DHCPSNOOP_IFB_NAME": %s\n",
strerror(errno));
goto error;
}
fcntl(sock, F_SETFL, fcntl(sock, F_GETFL) | O_NONBLOCK);
ufd.fd = sock;
ufd.cb = dhcpsnoop_socket_cb;
uloop_fd_add(&ufd, ULOOP_READ);
return 0;
error:
close(sock);
return -1;
}
static int
prepare_filter_cmd(char *buf, int len, const char *dev, int prio, bool add, bool egress)
{
return snprintf(buf, len, "tc filter %s dev '%s' %sgress prio %d",
add ? "add" : "del", dev, egress ? "e" : "in", prio);
}
static void
dhcpsnoop_dev_attach_filters(struct device *dev, bool egress)
{
int prio = DHCPSNOOP_PRIO_BASE;
char buf[256];
int ofs;
ofs = prepare_filter_cmd(buf, sizeof(buf), dev->ifname, prio++, true, egress);
APPEND(buf, ofs, " protocol ip u32 match ip sport 67 0xffff"
" 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 802.1Q u32 offset plus 4 match ip sport 67 0xffff"
" 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 sport 68 0xffff"
" 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 802.1Q u32 offset plus 4 match ip sport 68 0xffff"
" 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 ipv6 u32 match ip6 sport 546 0xfffe"
" 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 802.1Q u32 offset plus 4 match ip6 sport 546 0xfffe"
" flowid 1:1 action mirred ingress mirror dev " DHCPSNOOP_IFB_NAME);
dhcpsnoop_run_cmd(buf, false);
}
static void
dhcpsnoop_dev_cleanup_filters(struct device *dev, bool egress)
{
char buf[128];
int i;
for (i = DHCPSNOOP_PRIO_BASE; i < DHCPSNOOP_PRIO_BASE + 6; i++) {
prepare_filter_cmd(buf, sizeof(buf), dev->ifname, i, false, egress);
dhcpsnoop_run_cmd(buf, true);
}
}
static void
dhcpsnoop_dev_attach(struct device *dev)
{
char buf[64];
dev->active = true;
snprintf(buf, sizeof(buf), "tc qdisc add dev '%s' clsact", dev->ifname);
dhcpsnoop_run_cmd(buf, true);
if (dev->ingress)
dhcpsnoop_dev_attach_filters(dev, false);
if (dev->egress)
dhcpsnoop_dev_attach_filters(dev, true);
}
static void
dhcpsnoop_dev_cleanup(struct device *dev)
{
dev->active = false;
dhcpsnoop_dev_cleanup_filters(dev, true);
dhcpsnoop_dev_cleanup_filters(dev, false);
}
static void
__dhcpsnoop_dev_check(struct device *dev)
{
int ifindex;
ifindex = if_nametoindex(dev->ifname);
if (ifindex != dev->ifindex) {
dev->ifindex = ifindex;
dev->changed = true;
}
if (!dev->changed)
return;
dev->changed = false;
dhcpsnoop_dev_cleanup(dev);
if (ifindex)
dhcpsnoop_dev_attach(dev);
}
static void dev_update_cb(struct vlist_tree *tree, struct vlist_node *node_new,
struct vlist_node *node_old)
{
struct device *dev = NULL, *dev_free = NULL;
if (node_old && node_new) {
dev = container_of(node_old, struct device, node);
dev_free = container_of(node_new, struct device, node);
if (dev->ingress != dev_free->ingress ||
dev->egress != dev_free->egress)
dev->changed = true;
dev->ingress = dev_free->ingress;
dev->egress = dev_free->egress;
} else if (node_old) {
dev_free = container_of(node_old, struct device, node);
if (dev_free->active)
dhcpsnoop_dev_cleanup(dev_free);
} else if (node_new) {
dev = container_of(node_new, struct device, node);
}
if (dev)
__dhcpsnoop_dev_check(dev);
if (dev_free)
free(dev_free);
}
static void
dhcpsnoop_dev_config_add(struct blob_attr *data)
{
enum {
DEV_ATTR_INGRESS,
DEV_ATTR_EGRESS,
__DEV_ATTR_MAX
};
static const struct blobmsg_policy policy[__DEV_ATTR_MAX] = {
[DEV_ATTR_INGRESS] = { "ingress", BLOBMSG_TYPE_BOOL },
[DEV_ATTR_EGRESS] = { "egress", BLOBMSG_TYPE_BOOL },
};
struct blob_attr *tb[__DEV_ATTR_MAX];
struct blob_attr *cur;
struct device *dev;
int len;
if (blobmsg_type(data) != BLOBMSG_TYPE_TABLE)
return;
dev = calloc(1, sizeof(*dev));
len = snprintf(dev->ifname, sizeof(dev->ifname), "%s", blobmsg_name(data));
if (!len || len > IFNAMSIZ)
goto free;
blobmsg_parse(policy, ARRAY_SIZE(tb), tb, blobmsg_data(data), blobmsg_len(data));
if ((cur = tb[DEV_ATTR_INGRESS]) != NULL)
dev->ingress = blobmsg_get_bool(cur);
if ((cur = tb[DEV_ATTR_EGRESS]) != NULL)
dev->egress = blobmsg_get_bool(cur);
if (!dev->ingress && !dev->egress)
goto free;
vlist_add(&devices, &dev->node, dev->ifname);
return;
free:
free(dev);
return;
}
void dhcpsnoop_dev_config_update(struct blob_attr *data)
{
struct blob_attr *cur;
int rem;
vlist_update(&devices);
blobmsg_for_each_attr(cur, data, rem)
dhcpsnoop_dev_config_add(cur);
vlist_flush(&devices);
}
void dhcpsnoop_dev_check(void)
{
struct device *dev;
vlist_for_each_element(&devices, dev, node)
__dhcpsnoop_dev_check(dev);
}
int dhcpsnoop_dev_init(void)
{
dhcpsnoop_dev_done();
if (dhcpsnoop_run_cmd("ip link add "DHCPSNOOP_IFB_NAME" type ifb", false) ||
dhcpsnoop_run_cmd("ip link set dev "DHCPSNOOP_IFB_NAME" up", false) ||
dhcpsnoop_open_socket())
return -1;
return 0;
}
void dhcpsnoop_dev_done(void)
{
if (ufd.registered) {
uloop_fd_delete(&ufd);
close(ufd.fd);
}
dhcpsnoop_run_cmd("ip link del "DHCPSNOOP_IFB_NAME, true);
vlist_flush_all(&devices);
}

View File

@@ -0,0 +1,90 @@
// SPDX-License-Identifier: GPL-2.0+
/*
* Copyright (C) 2022 Felix Fietkau <nbd@nbd.name>
*/
#include "dhcpsnoop.h"
#include "msg.h"
const char *dhcpsnoop_parse_ipv4(const void *buf, size_t len, uint16_t port, uint32_t *rebind)
{
const struct dhcpv4_message *msg = buf;
const uint8_t *pos, *end;
char type = 0;
if (port != 67 && port != 68)
return NULL;
if (len < sizeof(*msg))
return NULL;
if (ntohl(msg->magic) != DHCPV4_MAGIC)
return NULL;
pos = msg->options;
end = buf + len;
while (pos < end) {
const uint8_t *opt = pos++;
if (*opt == DHCPV4_OPT_END)
break;
if (*opt == DHCPV4_OPT_PAD)
continue;
if (pos >= end || 1 + *pos > end - pos)
break;
pos += *pos + 1;
if (pos >= end)
break;
switch (*opt) {
case DHCPV4_OPT_MSG_TYPE:
if (!opt[1])
continue;
type = opt[2];
break;
case DHCPV4_OPT_REBIND:
if (!rebind || opt[1] != 4)
continue;
*rebind = *((uint32_t *) &opt[2]);
break;
}
}
switch(type) {
case DHCPV4_MSG_ACK:
return "ack";
case DHCPV4_MSG_DISCOVER:
return "discover";
case DHCPV4_MSG_OFFER:
return "offer";
case DHCPV4_MSG_REQUEST:
return "request";
}
return NULL;
}
const char *dhcpsnoop_parse_ipv6(const void *buf, size_t len, uint16_t port)
{
const struct dhcpv6_message *msg = buf;
if (port != 546 && port != 547)
return NULL;
switch(msg->msg_type) {
case DHCPV6_MSG_SOLICIT:
return "solicit";
case DHCPV6_MSG_REPLY:
return "reply";
case DHCPV6_MSG_RENEW:
return "renew";
default:
return NULL;
}
}

View File

@@ -0,0 +1,32 @@
// SPDX-License-Identifier: GPL-2.0+
/*
* Copyright (C) 2022 Felix Fietkau <nbd@nbd.name>
*/
#ifndef __DHCPSNOOP_H
#define __DHCPSNOOP_H
#include <libubox/blobmsg.h>
#include <libubox/ulog.h>
#include <libubox/uloop.h>
#define DHCPSNOOP_IFB_NAME "ifb-dhcp"
#define DHCPSNOOP_PRIO_BASE 0x100
int dhcpsnoop_run_cmd(char *cmd, bool ignore_error);
int dhcpsnoop_dev_init(void);
void dhcpsnoop_dev_done(void);
void dhcpsnoop_dev_config_update(struct blob_attr *data);
void dhcpsnoop_dev_check(void);
void dhcpsnoop_ubus_init(void);
void dhcpsnoop_ubus_done(void);
void dhcpsnoop_ubus_notify(const char *type, const uint8_t *msg, size_t len);
const char *dhcpsnoop_parse_ipv4(const void *buf, size_t len, uint16_t port, uint32_t *rebind);
const char *dhcpsnoop_parse_ipv6(const void *buf, size_t len, uint16_t port);
void cache_entry(void *msg, uint32_t rebind);
void cache_dump(struct blob_buf *b);
#endif

View File

@@ -0,0 +1,84 @@
// SPDX-License-Identifier: GPL-2.0+
/*
* Copyright (C) 2022 Felix Fietkau <nbd@nbd.name>
*/
#include <sys/wait.h>
#include <unistd.h>
#include <stdio.h>
#include "dhcpsnoop.h"
int dhcpsnoop_run_cmd(char *cmd, bool ignore_error)
{
char *argv[] = { "sh", "-c", cmd, NULL };
bool first = true;
int status = -1;
char buf[512];
int fds[2];
FILE *f;
int pid;
if (pipe(fds))
return -1;
pid = fork();
if (!pid) {
close(fds[0]);
if (fds[1] != STDOUT_FILENO)
dup2(fds[1], STDOUT_FILENO);
if (fds[1] != STDERR_FILENO)
dup2(fds[1], STDERR_FILENO);
if (fds[1] > STDERR_FILENO)
close(fds[1]);
execv("/bin/sh", argv);
exit(1);
}
if (pid < 0)
return -1;
close(fds[1]);
f = fdopen(fds[0], "r");
if (!f) {
close(fds[0]);
goto out;
}
while (fgets(buf, sizeof(buf), f) != NULL) {
if (!strlen(buf))
break;
if (ignore_error)
continue;
if (first) {
ULOG_WARN("Command: %s\n", cmd);
first = false;
}
ULOG_WARN("%s%s", buf, strchr(buf, '\n') ? "" : "\n");
}
fclose(f);
out:
while (waitpid(pid, &status, 0) < 0)
if (errno != EINTR)
break;
return status;
}
int main(int argc, char **argv)
{
ulog_open(ULOG_STDIO | ULOG_SYSLOG, LOG_DAEMON, "udhcpsnoop");
uloop_init();
dhcpsnoop_ubus_init();
dhcpsnoop_dev_init();
uloop_run();
dhcpsnoop_ubus_done();
dhcpsnoop_dev_done();
uloop_done();
return 0;
}

View File

@@ -0,0 +1,88 @@
/* SPDX-License-Identifier: BSD-3-Clause */
#ifndef __DHCPSNOOP_MSG_H
#define __DHCPSNOOP_MSG_H
#include <netinet/in.h>
#include <stdint.h>
enum dhcpv4_msg {
DHCPV4_MSG_DISCOVER = 1,
DHCPV4_MSG_OFFER = 2,
DHCPV4_MSG_REQUEST = 3,
DHCPV4_MSG_DECLINE = 4,
DHCPV4_MSG_ACK = 5,
DHCPV4_MSG_NAK = 6,
DHCPV4_MSG_RELEASE = 7,
DHCPV4_MSG_INFORM = 8,
DHCPV4_MSG_FORCERENEW = 9,
};
enum dhcpv4_opt {
DHCPV4_OPT_PAD = 0,
DHCPV4_OPT_NETMASK = 1,
DHCPV4_OPT_ROUTER = 3,
DHCPV4_OPT_DNSSERVER = 6,
DHCPV4_OPT_DOMAIN = 15,
DHCPV4_OPT_MTU = 26,
DHCPV4_OPT_BROADCAST = 28,
DHCPV4_OPT_NTPSERVER = 42,
DHCPV4_OPT_LEASETIME = 51,
DHCPV4_OPT_MESSAGE = 53,
DHCPV4_OPT_SERVERID = 54,
DHCPV4_OPT_REQOPTS = 55,
DHCPV4_OPT_RENEW = 58,
DHCPV4_OPT_REBIND = 59,
DHCPV4_OPT_IPADDRESS = 50,
DHCPV4_OPT_MSG_TYPE = 53,
DHCPV4_OPT_HOSTNAME = 12,
DHCPV4_OPT_REQUEST = 17,
DHCPV4_OPT_USER_CLASS = 77,
DHCPV4_OPT_AUTHENTICATION = 90,
DHCPV4_OPT_SEARCH_DOMAIN = 119,
DHCPV4_OPT_FORCERENEW_NONCE_CAPABLE = 145,
DHCPV4_OPT_END = 255,
};
struct dhcpv4_message {
uint8_t op;
uint8_t htype;
uint8_t hlen;
uint8_t hops;
uint32_t xid;
uint16_t secs;
uint16_t flags;
struct in_addr ciaddr;
struct in_addr yiaddr;
struct in_addr siaddr;
struct in_addr giaddr;
uint8_t chaddr[16];
char sname[64];
char file[128];
uint32_t magic;
uint8_t options[];
} __attribute__((packed));
#define DHCPV4_MAGIC 0x63825363
enum dhcpv6_opt {
DHCPV6_MSG_SOLICIT = 1,
DHCPV6_MSG_ADVERTISE = 2,
DHCPV6_MSG_REQUEST = 3,
DHCPV6_MSG_CONFIRM = 4,
DHCPV6_MSG_RENEW = 5,
DHCPV6_MSG_REBIND = 6,
DHCPV6_MSG_REPLY = 7,
DHCPV6_MSG_RELEASE = 8,
DHCPV6_MSG_DECLINE = 9,
DHCPV6_MSG_RECONFIGURE = 10,
DHCPV6_MSG_INFORMATION_REQUEST = 11,
DHCPV6_MSG_RELAY_FORW = 12,
DHCPV6_MSG_RELAY_REPL = 13,
};
struct dhcpv6_message {
uint8_t msg_type;
uint8_t transaction_id[3];
uint8_t options[];
} __attribute__((packed));
#endif

View File

@@ -0,0 +1,117 @@
// SPDX-License-Identifier: GPL-2.0+
/*
* Copyright (C) 2022 Felix Fietkau <nbd@nbd.name>
*/
#include <libubus.h>
#include "dhcpsnoop.h"
enum {
DS_CONFIG_DEVICES,
__DS_CONFIG_MAX
};
static const struct blobmsg_policy dhcpsnoop_config_policy[__DS_CONFIG_MAX] = {
[DS_CONFIG_DEVICES] = { "devices", BLOBMSG_TYPE_TABLE },
};
static struct blob_buf b;
static int
dhcpsnoop_ubus_config(struct ubus_context *ctx, struct ubus_object *obj,
struct ubus_request_data *req, const char *method,
struct blob_attr *msg)
{
struct blob_attr *tb[__DS_CONFIG_MAX];
blobmsg_parse(dhcpsnoop_config_policy, __DS_CONFIG_MAX, tb,
blobmsg_data(msg), blobmsg_len(msg));
dhcpsnoop_dev_config_update(tb[DS_CONFIG_DEVICES]);
dhcpsnoop_dev_check();
return 0;
}
static int
dhcpsnoop_ubus_check_devices(struct ubus_context *ctx, struct ubus_object *obj,
struct ubus_request_data *req, const char *method,
struct blob_attr *msg)
{
dhcpsnoop_dev_check();
return 0;
}
static int
dhcpsnoop_ubus_dump(struct ubus_context *ctx, struct ubus_object *obj,
struct ubus_request_data *req, const char *method,
struct blob_attr *msg)
{
blob_buf_init(&b, 0);
cache_dump(&b);
ubus_send_reply(ctx, req, b.head);
return 0;
}
static const struct ubus_method dhcpsnoop_methods[] = {
UBUS_METHOD("config", dhcpsnoop_ubus_config, dhcpsnoop_config_policy),
UBUS_METHOD_NOARG("check_devices", dhcpsnoop_ubus_check_devices),
UBUS_METHOD_NOARG("dump", dhcpsnoop_ubus_dump),
};
static struct ubus_object_type dhcpsnoop_object_type =
UBUS_OBJECT_TYPE("dhcpsnoop", dhcpsnoop_methods);
static struct ubus_object dhcpsnoop_object = {
.name = "dhcpsnoop",
.type = &dhcpsnoop_object_type,
.methods = dhcpsnoop_methods,
.n_methods = ARRAY_SIZE(dhcpsnoop_methods),
};
static void
ubus_connect_handler(struct ubus_context *ctx)
{
ubus_add_object(ctx, &dhcpsnoop_object);
}
static struct ubus_auto_conn conn;
void dhcpsnoop_ubus_init(void)
{
conn.cb = ubus_connect_handler;
ubus_auto_connect(&conn);
}
void dhcpsnoop_ubus_done(void)
{
ubus_auto_shutdown(&conn);
blob_buf_free(&b);
}
void dhcpsnoop_ubus_notify(const char *type, const uint8_t *msg, size_t len)
{
char *buf;
fprintf(stderr, "dhcp message type=%s\n", type);
if (!dhcpsnoop_object.has_subscribers)
return;
blob_buf_init(&b, 0);
buf = blobmsg_alloc_string_buffer(&b, "packet", 2 * len + 1);
while (len > 0) {
buf += sprintf(buf, "%02x", *msg);
msg++;
len--;
}
blobmsg_add_string_buffer(&b);
ubus_notify(&conn.ctx, &dhcpsnoop_object, type, b.head, -1);
}

View File

@@ -0,0 +1,51 @@
#
# Copyright (C) 2022 OpenWrt.org
#
# This is free software, licensed under the GNU General Public License v2.
# See /LICENSE for more information.
#
include $(TOPDIR)/rules.mk
PKG_NAME:=unetd
PKG_SOURCE_PROTO:=git
PKG_SOURCE_URL=https://github.com/nbd168/unetd
PKG_SOURCE_DATE:=2022-05-23
PKG_SOURCE_VERSION:=f75c2e70c0e494566dbbb20d408309412b4110e6
PKG_MIRROR_HASH:=633e6b0406b89850d0caf933fb419345be37d5deab812251d6183a7ab3f2cd42
PKG_LICENSE:=GPL-2.0
PKG_MAINTAINER:=Felix Fietkau <nbd@nbd.name>
PKG_BUILD_PARALLEL:=1
include $(INCLUDE_DIR)/package.mk
include $(INCLUDE_DIR)/cmake.mk
define Package/unetd
SECTION:=utils
CATEGORY:=Base system
TITLE:=Wireguard network configuration service
DEPENDS:=+libubox +libubus +libblobmsg-json +libnl-tiny +TARGET_ipq807x:kmod-wireguard-backport +!TARGET_ipq807x:kmod-wireguard +wireguard-tools
endef
TARGET_CFLAGS += \
-I$(STAGING_DIR)/usr/include/libnl-tiny \
-I$(STAGING_DIR)/usr/include
CMAKE_OPTIONS += \
-DLIBNL_LIBS=-lnl-tiny
define Package/unetd/install
$(INSTALL_DIR) \
$(1)/etc/init.d \
$(1)/lib/netifd/proto \
$(1)/usr/sbin
$(INSTALL_BIN) \
$(PKG_INSTALL_DIR)/usr/sbin/unetd \
$(1)/usr/sbin/
$(INSTALL_BIN) ./files/unetd.init $(1)/etc/init.d/unetd
$(INSTALL_BIN) ./files/unetd.sh $(1)/lib/netifd/proto
endef
$(eval $(call BuildPackage,unetd))

View File

@@ -0,0 +1,15 @@
#!/bin/sh /etc/rc.common
# Copyright (c) 2021 OpenWrt.org
START=19
USE_PROCD=1
PROG=/usr/sbin/unetd
start_service() {
mkdir -p /var/run/unetd
procd_open_instance
procd_set_param command "$PROG" -h /var/run/unetd/hosts
procd_set_param respawn
procd_close_instance
}

View File

@@ -0,0 +1,67 @@
#!/bin/sh
[ -x /usr/sbin/unetd ] || exit 0
. /lib/functions.sh
. /lib/functions/network.sh
. ../netifd-proto.sh
init_proto "$@"
proto_unet_init_config() {
proto_config_add_string device
proto_config_add_string type
proto_config_add_string key
proto_config_add_string file
proto_config_add_int keepalive
proto_config_add_string domain
no_device=1
available=1
no_proto_task=1
}
proto_unet_setup() {
local config="$1"
local device type key file keepalive domain
json_get_vars device type key file keepalive domain
device="${device:-$config}"
[ -n "$file" ] && type="${type:-file}"
json_init
json_add_string name "$device"
json_add_string type "$type"
json_add_string interface "$config"
json_add_string key "$key"
json_add_string file "$file"
[ -n "$keepalive" ] && json_add_int keepalive "$keepalive"
json_add_string domain "$domain"
ip link del dev "$device" >/dev/null 2>&1
ip link add dev "$device" type wireguard || {
echo "Could not create wireguard device $device"
proto_setup_failed "$config"
exit 1
}
ubus call unetd network_add "$(json_dump)"
}
proto_unet_teardown() {
local config="$1"
local iface="$2"
local device
json_get_vars device
device="${device:-$iface}"
json_init
json_add_string name "$device"
ip link del dev "$device"
ubus call unetd network_del "$(json_dump)"
}
add_protocol unet

View File

@@ -143,5 +143,5 @@ start_service()
procd_open_instance
procd_set_param command "/usr/libexec/uchannel.uc"
procd_set_param respawn 1 300 0
procd_close_instancea
procd_close_instance
}

View File

@@ -1,5 +1,4 @@
#!/usr/bin/ucode
{%
let fs = require("fs");
let ubus = require("ubus");
let conn = ubus.connect();
@@ -56,7 +55,7 @@ function state_get() {
function state_set(state) {
let file = fs.open("/tmp/uchannel.json", "w");
state.uptime = uptime;
state.executed = uptime;
file.write(state);
file.close();
@@ -64,7 +63,7 @@ function state_set(state) {
node: "*",
data: {
status: state.status,
uptime: state.uptime,
uptime: state.executed,
}
});
printf("entering %s state\n", state.status);
@@ -259,8 +258,8 @@ function channel_balance(band, mask) {
function youngest() {
for (let ip, host in hosts) {
if (host.host_info.status == "overlap" &&
host.host_info.uptime < uptime) {
if (host.host_info?.status == "overlap" &&
host.host_info?.uptime < uptime) {
print("Found a younger host\n");
return 1;
}
@@ -272,7 +271,7 @@ function youngest() {
let state = state_get();
if (state.status == "waiting" &&
(uptime - state.uptime < (12 * 60 * 60))) {
(uptime - state.changed < (12 * 60 * 60))) {
state_set(state);
return;
}
@@ -328,4 +327,3 @@ for (let freq, obj in overlap) {
state.status = "waiting";
state.changed = uptime;
state_set(state);
%}

View File

@@ -86,6 +86,11 @@ $(call Package/ath11k-wifi-default)
TITLE:=gl-ax1800 bdf
endef
define Package/ath11k-wifi-motorola-q14
$(call Package/ath11k-wifi-default)
TITLE:=motorola q14 bdf
endef
define ath11k-wifi-install-one-to
$(INSTALL_DIR) $(2)/lib/firmware/$(3)/
$(INSTALL_DATA) $(1) $(2)/lib/firmware/$(3)/board.bin
@@ -173,6 +178,13 @@ define Package/ath11k-wifi-gl-ax1800/install
$(INSTALL_DATA) ./board-gl-ax1800.bin.IPQ6018 $(1)/lib/firmware/ath11k/IPQ6018/hw1.0/board-2.bin
endef
define Package/ath11k-wifi-motorola-q14/install
$(INSTALL_DIR) $(1)/lib/firmware/ath11k/IPQ5018/hw1.0/
$(INSTALL_DIR) $(1)/lib/firmware/ath11k/qcn6122/hw1.0/
$(INSTALL_DATA) ./board-motorol-q14.bin.IPQ5018 $(1)/lib/firmware/ath11k/IPQ5018/hw1.0/board.bin
$(INSTALL_DATA) ./board-2-motorol-q14.bin.QCN6122 $(1)/lib/firmware/ath11k/qcn6122/hw1.0/board-2.bin
endef
$(eval $(call generate-ath11k-wifi-package,cig-wf188,Cigtech WF188))
$(eval $(call generate-ath11k-wifi-package,cig-wf188n,Cigtech WF188n))
$(eval $(call generate-ath11k-wifi-package,cig-wf194c,Cigtech WF194c))
@@ -196,3 +208,4 @@ $(eval $(call BuildPackage,ath11k-wifi-qcom-ipq8074))
$(eval $(call BuildPackage,ath11k-wifi-qcom-ipq6018))
$(eval $(call BuildPackage,ath11k-wifi-qcom-qcn9000))
$(eval $(call BuildPackage,ath11k-wifi-cig-wf196_6g))
$(eval $(call BuildPackage,ath11k-wifi-motorola-q14))

View File

@@ -15,7 +15,7 @@ define Package/$(PKG_NAME)
URL:=http://www.qca.qualcomm.com
MAINTAINER:=Qualcomm Atheros
TITLE:= QCA ftm utils
DEPENDS:= @TARGET_ipq_ipq807x||TARGET_ipq_ipq807x_64||TARGET_ipq_ipq60xx||TARGET_ipq_ipq60xx_64||TARGET_ipq_ipq50xx||TARGET_ipq_ipq50xx_64||TARGET_ipq807x||TARGET_ipq50xx +libnl +libtcmd +qca-diag +librt +FEATURE_QCA_IOT:qca-IOT +FEATURE_QCA_IOT_IPQ50XX_SUPPORT:btdaemon +kmod-diag-char
DEPENDS:= @TARGET_ipq_ipq807x||TARGET_ipq_ipq807x_64||TARGET_ipq_ipq60xx||TARGET_ipq_ipq60xx_64||TARGET_ipq_ipq50xx||TARGET_ipq_ipq50xx_64||TARGET_ipq807x||TARGET_ipq50xx +libnl +libtcmd +qca-diag +librt +kmod-diag-char
endef
define Package/$(PKG_NAME)/description/Default

View File

@@ -371,9 +371,9 @@ CONFIG_INTERWORKING=y
CONFIG_TAXONOMY=y
# Fast Initial Link Setup (FILS) (IEEE 802.11ai)
#CONFIG_FILS=y
CONFIG_FILS=y
# FILS shared key authentication with PFS
#CONFIG_FILS_SK_PFS=y
CONFIG_FILS_SK_PFS=y
# Include internal line edit mode in hostapd_cli. This can be used to provide
# limited command line editing and history support.

View File

@@ -154,6 +154,8 @@ hostapd_prepare_device_config() {
set_default ema 0
set_default acs_exclude_dfs 0
[ "$band" = "6g" ] && multiple_bssid=1
[ -n "$country" ] && {
append base_cfg "country_code=$country" "$N"
[ -n "$country3" ] && append base_cfg "country3=$country3" "$N"
@@ -353,6 +355,7 @@ hostapd_common_add_bss_config() {
config_add_int sae_pwe
config_add_string 'owe_transition_bssid:macaddr' 'owe_transition_ssid:string'
config_add_string owe_transition_ifname
config_add_boolean iw_enabled iw_internet iw_asra iw_esr iw_uesa
config_add_int iw_access_network_type iw_venue_group iw_venue_type
@@ -704,7 +707,7 @@ hostapd_set_bss_options() {
set_default ieee80211w 2
set_default sae_require_mfp 1
;;
psk-sae|eap-eap256)
psk-sae|psk2-radius|eap-eap256)
set_default ieee80211w 1
set_default sae_require_mfp 1
;;
@@ -716,10 +719,11 @@ hostapd_set_bss_options() {
case "$auth_type" in
none|owe)
json_get_vars owe_transition_bssid owe_transition_ssid
json_get_vars owe_transition_bssid owe_transition_ssid owe_transition_ifname
[ -n "$owe_transition_ssid" ] && append bss_conf "owe_transition_ssid=\"$owe_transition_ssid\"" "$N"
[ -n "$owe_transition_bssid" ] && append bss_conf "owe_transition_bssid=$owe_transition_bssid" "$N"
[ -n "$owe_transition_ifname" ] && append bss_conf "owe_transition_ifname=$owe_transition_ifname" "$N"
wps_possible=1
# Here we make the assumption that if we're in open mode
@@ -767,6 +771,11 @@ hostapd_set_bss_options() {
append bss_conf "wep_default_key=$wep_keyidx" "$N"
[ -n "$wep_rekey" ] && append bss_conf "wep_rekey_period=$wep_rekey" "$N"
;;
psk2-radius)
append bss_conf "wpa_psk_radius=3" "$N"
append_radius_server
vlan_possible=1
;;
esac
local auth_algs=$((($auth_mode_shared << 1) | $auth_mode_open))

View File

@@ -0,0 +1,13 @@
Index: hostapd-2021-02-20-59e9794c/src/ap/sta_info.c
===================================================================
--- hostapd-2021-02-20-59e9794c.orig/src/ap/sta_info.c
+++ hostapd-2021-02-20-59e9794c/src/ap/sta_info.c
@@ -717,7 +717,7 @@ struct sta_info * ap_sta_add(struct host
return sta;
wpa_printf(MSG_DEBUG, " New STA");
- if (hapd->num_sta >= hapd->conf->max_num_sta) {
+ if (hostapd_check_max_sta(hapd)) {
/* FIX: might try to remove some old STAs first? */
wpa_printf(MSG_DEBUG, "no more room for new STAs (%d/%d)",
hapd->num_sta, hapd->conf->max_num_sta);

View File

@@ -0,0 +1,24 @@
Index: hostapd-2021-02-20-59e9794c/src/radius/radius_das.c
===================================================================
--- hostapd-2021-02-20-59e9794c.orig/src/radius/radius_das.c
+++ hostapd-2021-02-20-59e9794c/src/radius/radius_das.c
@@ -48,6 +48,8 @@ static struct radius_msg * radius_das_di
RADIUS_ATTR_EVENT_TIMESTAMP,
RADIUS_ATTR_MESSAGE_AUTHENTICATOR,
RADIUS_ATTR_CHARGEABLE_USER_IDENTITY,
+ RADIUS_ATTR_VENDOR_SPECIFIC,
+ RADIUS_ATTR_CALLED_STATION_ID,
#ifdef CONFIG_IPV6
RADIUS_ATTR_NAS_IPV6_ADDRESS,
#endif /* CONFIG_IPV6 */
@@ -205,9 +207,8 @@ static struct radius_msg * radius_das_co
RADIUS_ATTR_EVENT_TIMESTAMP,
RADIUS_ATTR_MESSAGE_AUTHENTICATOR,
RADIUS_ATTR_CHARGEABLE_USER_IDENTITY,
-#ifdef CONFIG_HS20
RADIUS_ATTR_VENDOR_SPECIFIC,
-#endif /* CONFIG_HS20 */
+ RADIUS_ATTR_CALLED_STATION_ID,
#ifdef CONFIG_IPV6
RADIUS_ATTR_NAS_IPV6_ADDRESS,
#endif /* CONFIG_IPV6 */

View File

@@ -0,0 +1,459 @@
From 1c3438fec4bad13a676617915ff56af54e7b4542 Mon Sep 17 00:00:00 2001
From: Jouni Malinen <j@w1.fi>
Date: Sat, 2 Apr 2022 13:12:43 +0300
Subject: [PATCH] RADIUS ACL/PSK check during 4-way handshake
Add an alternative sequence for performing the RADIUS ACL check and PSK
fetch. The previously used (macaddr_acl=2, wpa_psk_radius=2) combination
does this during IEEE 802.11 Authentication frame exchange while the new
option (wpa_psk_radius=3) does this during the 4-way handshake. This
allows some more information to be provided to the RADIUS authentication
server.
Signed-off-by: Jouni Malinen <j@w1.fi>
---
hostapd/config_file.c | 3 +-
hostapd/hostapd.conf | 5 ++-
src/ap/ap_config.c | 4 ++-
src/ap/ap_config.h | 5 +--
src/ap/ieee802_11.c | 5 ++-
src/ap/ieee802_11.h | 2 ++
src/ap/ieee802_11_auth.c | 76 ++++++++++++++++++++++++++++++++++++----
src/ap/ieee802_11_auth.h | 5 ++-
src/ap/wpa_auth.c | 51 ++++++++++++++++++++++++++-
src/ap/wpa_auth.h | 9 ++++-
src/ap/wpa_auth_glue.c | 25 ++++++++++++-
src/ap/wpa_auth_i.h | 1 +
12 files changed, 172 insertions(+), 19 deletions(-)
--- a/hostapd/config_file.c
+++ b/hostapd/config_file.c
@@ -2858,7 +2858,8 @@ static int hostapd_config_fill(struct ho
bss->wpa_psk_radius = atoi(pos);
if (bss->wpa_psk_radius != PSK_RADIUS_IGNORED &&
bss->wpa_psk_radius != PSK_RADIUS_ACCEPTED &&
- bss->wpa_psk_radius != PSK_RADIUS_REQUIRED) {
+ bss->wpa_psk_radius != PSK_RADIUS_REQUIRED &&
+ bss->wpa_psk_radius != PSK_RADIUS_DURING_4WAY_HS) {
wpa_printf(MSG_ERROR,
"Line %d: unknown wpa_psk_radius %d",
line, bss->wpa_psk_radius);
--- a/hostapd/hostapd.conf
+++ b/hostapd/hostapd.conf
@@ -1635,12 +1635,15 @@ own_ip_addr=127.0.0.1
#wpa_psk_file=/etc/hostapd.wpa_psk
# Optionally, WPA passphrase can be received from RADIUS authentication server
-# This requires macaddr_acl to be set to 2 (RADIUS)
+# This requires macaddr_acl to be set to 2 (RADIUS) for wpa_psk_radius values
+# 1 and 2.
# 0 = disabled (default)
# 1 = optional; use default passphrase/psk if RADIUS server does not include
# Tunnel-Password
# 2 = required; reject authentication if RADIUS server does not include
# Tunnel-Password
+# 3 = ask RADIUS server during 4-way handshake if there is no locally
+# configured PSK/passphrase for the STA
#wpa_psk_radius=0
# Set of accepted key management algorithms (WPA-PSK, WPA-EAP, or both). The
--- a/src/ap/ap_config.c
+++ b/src/ap/ap_config.c
@@ -1,6 +1,6 @@
/*
* hostapd / Configuration helper functions
- * Copyright (c) 2003-2014, Jouni Malinen <j@w1.fi>
+ * Copyright (c) 2003-2022, Jouni Malinen <j@w1.fi>
*
* This software may be distributed under the terms of the BSD license.
* See README for more details.
@@ -1245,6 +1245,7 @@ static int hostapd_config_check_bss(stru
if (full_config && bss->wpa &&
bss->wpa_psk_radius != PSK_RADIUS_IGNORED &&
+ bss->wpa_psk_radius != PSK_RADIUS_DURING_4WAY_HS &&
bss->macaddr_acl != USE_EXTERNAL_RADIUS_AUTH) {
wpa_printf(MSG_ERROR, "WPA-PSK using RADIUS enabled, but no "
"RADIUS checking (macaddr_acl=2) enabled.");
@@ -1254,6 +1255,7 @@ static int hostapd_config_check_bss(stru
if (full_config && bss->wpa && (bss->wpa_key_mgmt & WPA_KEY_MGMT_PSK) &&
bss->ssid.wpa_psk == NULL && bss->ssid.wpa_passphrase == NULL &&
bss->ssid.wpa_psk_file == NULL &&
+ bss->wpa_psk_radius != PSK_RADIUS_DURING_4WAY_HS &&
(bss->wpa_psk_radius != PSK_RADIUS_REQUIRED ||
bss->macaddr_acl != USE_EXTERNAL_RADIUS_AUTH)) {
wpa_printf(MSG_ERROR, "WPA-PSK enabled, but PSK or passphrase "
--- a/src/ap/ap_config.h
+++ b/src/ap/ap_config.h
@@ -1,6 +1,6 @@
/*
* hostapd / Configuration definitions and helpers functions
- * Copyright (c) 2003-2015, Jouni Malinen <j@w1.fi>
+ * Copyright (c) 2003-2022, Jouni Malinen <j@w1.fi>
*
* This software may be distributed under the terms of the BSD license.
* See README for more details.
@@ -367,7 +367,8 @@ struct hostapd_bss_config {
enum {
PSK_RADIUS_IGNORED = 0,
PSK_RADIUS_ACCEPTED = 1,
- PSK_RADIUS_REQUIRED = 2
+ PSK_RADIUS_REQUIRED = 2,
+ PSK_RADIUS_DURING_4WAY_HS = 3,
} wpa_psk_radius;
int wpa_pairwise;
int group_cipher; /* wpa_group value override from configuation */
--- a/src/ap/ieee802_11.c
+++ b/src/ap/ieee802_11.c
@@ -2348,9 +2348,8 @@ static int ieee802_11_allowed_address(st
}
-static int
-ieee802_11_set_radius_info(struct hostapd_data *hapd, struct sta_info *sta,
- int res, struct radius_sta *info)
+int ieee802_11_set_radius_info(struct hostapd_data *hapd, struct sta_info *sta,
+ int res, struct radius_sta *info)
{
u32 session_timeout = info->session_timeout;
u32 acct_interim_interval = info->acct_interim_interval;
--- a/src/ap/ieee802_11.h
+++ b/src/ap/ieee802_11.h
@@ -220,4 +220,6 @@ void auth_sae_process_commit(void *eloop
u8 * hostapd_eid_rsnxe(struct hostapd_data *hapd, u8 *eid, size_t len);
u8 * hostapd_get_rsne(struct hostapd_data *hapd, u8 *pos, size_t len);
u8 * hostapd_get_rsnxe(struct hostapd_data *hapd, u8 *pos, size_t len);
+int ieee802_11_set_radius_info(struct hostapd_data *hapd, struct sta_info *sta,
+ int res, struct radius_sta *info);
#endif /* IEEE802_11_H */
--- a/src/ap/ieee802_11_auth.c
+++ b/src/ap/ieee802_11_auth.c
@@ -1,6 +1,6 @@
/*
* hostapd / IEEE 802.11 authentication (ACL)
- * Copyright (c) 2003-2012, Jouni Malinen <j@w1.fi>
+ * Copyright (c) 2003-2022, Jouni Malinen <j@w1.fi>
*
* This software may be distributed under the terms of the BSD license.
* See README for more details.
@@ -20,6 +20,8 @@
#include "hostapd.h"
#include "ap_config.h"
#include "ap_drv_ops.h"
+#include "sta_info.h"
+#include "wpa_auth.h"
#include "ieee802_11.h"
#include "ieee802_1x.h"
#include "ieee802_11_auth.h"
@@ -43,6 +45,8 @@ struct hostapd_acl_query_data {
u8 *auth_msg; /* IEEE 802.11 authentication frame from station */
size_t auth_msg_len;
struct hostapd_acl_query_data *next;
+ bool radius_psk;
+ int akm;
};
@@ -153,6 +157,13 @@ static int hostapd_radius_acl_query(stru
goto fail;
}
+ if (query->akm &&
+ !radius_msg_add_attr_int32(msg, RADIUS_ATTR_WLAN_AKM_SUITE,
+ wpa_akm_to_suite(query->akm))) {
+ wpa_printf(MSG_DEBUG, "Could not add WLAN-AKM-Suite");
+ goto fail;
+ }
+
if (radius_client_send(hapd->radius, msg, RADIUS_AUTH, addr) < 0)
goto fail;
return 0;
@@ -566,17 +577,40 @@ hostapd_acl_recv_radius(struct radius_ms
cache->next = hapd->acl_cache;
hapd->acl_cache = cache;
+ if (query->radius_psk) {
+ struct sta_info *sta;
+ bool success = cache->accepted == HOSTAPD_ACL_ACCEPT;
+
+ sta = ap_get_sta(hapd, query->addr);
+ if (!sta || !sta->wpa_sm) {
+ wpa_printf(MSG_DEBUG,
+ "No STA/SM entry found for the RADIUS PSK response");
+ goto done;
+ }
+#ifdef NEED_AP_MLME
+ if (success &&
+ (ieee802_11_set_radius_info(hapd, sta, cache->accepted,
+ info) < 0 ||
+ ap_sta_bind_vlan(hapd, sta) < 0))
+ success = false;
+#endif /* NEED_AP_MLME */
+ wpa_auth_sta_radius_psk_resp(sta->wpa_sm, success);
+ } else {
#ifdef CONFIG_DRIVER_RADIUS_ACL
- hostapd_drv_set_radius_acl_auth(hapd, query->addr, cache->accepted,
- info->session_timeout);
+ hostapd_drv_set_radius_acl_auth(hapd, query->addr,
+ cache->accepted,
+ info->session_timeout);
#else /* CONFIG_DRIVER_RADIUS_ACL */
#ifdef NEED_AP_MLME
- /* Re-send original authentication frame for 802.11 processing */
- wpa_printf(MSG_DEBUG, "Re-sending authentication frame after "
- "successful RADIUS ACL query");
- ieee802_11_mgmt(hapd, query->auth_msg, query->auth_msg_len, NULL);
+ /* Re-send original authentication frame for 802.11 processing
+ */
+ wpa_printf(MSG_DEBUG,
+ "Re-sending authentication frame after successful RADIUS ACL query");
+ ieee802_11_mgmt(hapd, query->auth_msg, query->auth_msg_len,
+ NULL);
#endif /* NEED_AP_MLME */
#endif /* CONFIG_DRIVER_RADIUS_ACL */
+ }
done:
if (prev == NULL)
@@ -658,3 +692,31 @@ void hostapd_free_psk_list(struct hostap
os_free(prev);
}
}
+
+
+#ifndef CONFIG_NO_RADIUS
+void hostapd_acl_req_radius_psk(struct hostapd_data *hapd, const u8 *addr,
+ int key_mgmt, const u8 *anonce,
+ const u8 *eapol, size_t eapol_len)
+{
+ struct hostapd_acl_query_data *query;
+
+ query = os_zalloc(sizeof(*query));
+ if (!query)
+ return;
+
+ query->radius_psk = true;
+ query->akm = key_mgmt;
+ os_get_reltime(&query->timestamp);
+ os_memcpy(query->addr, addr, ETH_ALEN);
+ if (hostapd_radius_acl_query(hapd, addr, query)) {
+ wpa_printf(MSG_DEBUG,
+ "Failed to send Access-Request for RADIUS PSK/ACL query");
+ hostapd_acl_query_free(query);
+ return;
+ }
+
+ query->next = hapd->acl_queries;
+ hapd->acl_queries = query;
+}
+#endif /* CONFIG_NO_RADIUS */
--- a/src/ap/ieee802_11_auth.h
+++ b/src/ap/ieee802_11_auth.h
@@ -1,6 +1,6 @@
/*
* hostapd / IEEE 802.11 authentication (ACL)
- * Copyright (c) 2003-2005, Jouni Malinen <j@w1.fi>
+ * Copyright (c) 2003-2022, Jouni Malinen <j@w1.fi>
*
* This software may be distributed under the terms of the BSD license.
* See README for more details.
@@ -36,5 +36,8 @@ void hostapd_free_psk_list(struct hostap
void hostapd_acl_expire(struct hostapd_data *hapd);
void hostapd_copy_psk_list(struct hostapd_sta_wpa_psk_short **psk,
struct hostapd_sta_wpa_psk_short *src);
+void hostapd_acl_req_radius_psk(struct hostapd_data *hapd, const u8 *addr,
+ int key_mgmt, const u8 *anonce,
+ const u8 *eapol, size_t eapol_len);
#endif /* IEEE802_11_AUTH_H */
--- a/src/ap/wpa_auth.c
+++ b/src/ap/wpa_auth.c
@@ -1,6 +1,6 @@
/*
* IEEE 802.11 RSN / WPA Authenticator
- * Copyright (c) 2004-2019, Jouni Malinen <j@w1.fi>
+ * Copyright (c) 2004-2022, Jouni Malinen <j@w1.fi>
*
* This software may be distributed under the terms of the BSD license.
* See README for more details.
@@ -1465,6 +1465,12 @@ static void wpa_send_eapol_timeout(void
struct wpa_authenticator *wpa_auth = eloop_ctx;
struct wpa_state_machine *sm = timeout_ctx;
+ if (sm->waiting_radius_psk) {
+ wpa_auth_logger(wpa_auth, sm->addr, LOGGER_DEBUG,
+ "Ignore EAPOL-Key timeout while waiting for RADIUS PSK");
+ return;
+ }
+
sm->pending_1_of_4_timeout = 0;
wpa_auth_logger(wpa_auth, sm->addr, LOGGER_DEBUG, "EAPOL-Key timeout");
sm->TimeoutEvt = true;
@@ -3003,6 +3009,19 @@ SM_STATE(WPA_PTK, PTKCALCNEGOTIATING)
break;
}
+ if (!ok && wpa_key_mgmt_wpa_psk_no_sae(sm->wpa_key_mgmt) &&
+ wpa_auth->conf.radius_psk && wpa_auth->cb->request_radius_psk &&
+ !sm->waiting_radius_psk) {
+ wpa_printf(MSG_DEBUG, "No PSK available - ask RADIUS server");
+ wpa_auth->cb->request_radius_psk(wpa_auth->cb_ctx, sm->addr,
+ sm->wpa_key_mgmt,
+ sm->ANonce,
+ sm->last_rx_eapol_key,
+ sm->last_rx_eapol_key_len);
+ sm->waiting_radius_psk = 1;
+ return;
+ }
+
if (!ok) {
wpa_auth_logger(sm->wpa_auth, sm->addr, LOGGER_DEBUG,
"invalid MIC in msg 2/4 of 4-Way Handshake");
@@ -3758,6 +3777,11 @@ SM_STEP(WPA_PTK)
} else if (wpa_auth_uses_sae(sm) && sm->pmksa) {
SM_ENTER(WPA_PTK, PTKSTART);
#endif /* CONFIG_SAE */
+ } else if (wpa_key_mgmt_wpa_psk_no_sae(sm->wpa_key_mgmt) &&
+ wpa_auth->conf.radius_psk) {
+ wpa_printf(MSG_DEBUG,
+ "INITPSK: No PSK yet available for STA - use RADIUS later");
+ SM_ENTER(WPA_PTK, PTKSTART);
} else {
wpa_auth_logger(wpa_auth, sm->addr, LOGGER_INFO,
"no PSK configured for the STA");
@@ -5661,3 +5685,28 @@ void wpa_auth_set_ocv_override_freq(stru
}
#endif /* CONFIG_TESTING_OPTIONS */
+
+
+void wpa_auth_sta_radius_psk_resp(struct wpa_state_machine *sm, bool success)
+{
+ if (!sm->waiting_radius_psk) {
+ wpa_printf(MSG_DEBUG,
+ "Ignore RADIUS PSK response for " MACSTR
+ " that did not wait one",
+ MAC2STR(sm->addr));
+ return;
+ }
+
+ wpa_printf(MSG_DEBUG, "RADIUS PSK response for " MACSTR " (%s)",
+ MAC2STR(sm->addr), success ? "success" : "fail");
+ sm->waiting_radius_psk = 0;
+
+ if (success) {
+ /* Try to process the EAPOL-Key msg 2/4 again */
+ sm->EAPOLKeyReceived = true;
+ } else {
+ sm->Disconnect = true;
+ }
+
+ eloop_register_timeout(0, 0, wpa_sm_call_step, sm, NULL);
+}
--- a/src/ap/wpa_auth.h
+++ b/src/ap/wpa_auth.h
@@ -1,6 +1,6 @@
/*
* hostapd - IEEE 802.11i-2004 / WPA Authenticator
- * Copyright (c) 2004-2017, Jouni Malinen <j@w1.fi>
+ * Copyright (c) 2004-2022, Jouni Malinen <j@w1.fi>
*
* This software may be distributed under the terms of the BSD license.
* See README for more details.
@@ -273,6 +273,8 @@ struct wpa_auth_config {
* PTK derivation regardless of advertised capabilities.
*/
bool force_kdk_derivation;
+
+ bool radius_psk;
};
typedef enum {
@@ -320,6 +322,9 @@ struct wpa_auth_callbacks {
void (*store_ptksa)(void *ctx, const u8 *addr, int cipher,
u32 life_time, const struct wpa_ptk *ptk);
void (*clear_ptksa)(void *ctx, const u8 *addr, int cipher);
+ void (*request_radius_psk)(void *ctx, const u8 *addr, int key_mgmt,
+ const u8 *anonce,
+ const u8 *eapol, size_t eapol_len);
#ifdef CONFIG_IEEE80211R_AP
struct wpa_state_machine * (*add_sta)(void *ctx, const u8 *sta_addr);
int (*add_sta_ft)(void *ctx, const u8 *sta_addr);
@@ -567,4 +572,6 @@ void wpa_auth_set_ocv_override_freq(stru
enum wpa_auth_ocv_override_frame frame,
unsigned int freq);
+void wpa_auth_sta_radius_psk_resp(struct wpa_state_machine *sm, bool success);
+
#endif /* WPA_AUTH_H */
--- a/src/ap/wpa_auth_glue.c
+++ b/src/ap/wpa_auth_glue.c
@@ -1,6 +1,6 @@
/*
* hostapd / WPA authenticator glue code
- * Copyright (c) 2002-2012, Jouni Malinen <j@w1.fi>
+ * Copyright (c) 2002-2022, Jouni Malinen <j@w1.fi>
*
* This software may be distributed under the terms of the BSD license.
* See README for more details.
@@ -29,6 +29,7 @@
#include "ap_drv_ops.h"
#include "ap_config.h"
#include "ieee802_11.h"
+#include "ieee802_11_auth.h"
#include "pmksa_cache_auth.h"
#include "wpa_auth.h"
#include "wpa_auth_glue.h"
@@ -214,6 +215,8 @@ static void hostapd_wpa_auth_conf(struct
wconf->force_kdk_derivation = conf->force_kdk_derivation;
#endif /* CONFIG_TESTING_OPTIONS */
#endif /* CONFIG_PASN */
+
+ wconf->radius_psk = conf->wpa_psk_radius == PSK_RADIUS_DURING_4WAY_HS;
}
@@ -1435,6 +1438,23 @@ static void hostapd_wpa_unregister_ft_ou
#endif /* CONFIG_IEEE80211R_AP */
+#ifndef CONFIG_NO_RADIUS
+static void hostapd_request_radius_psk(void *ctx, const u8 *addr, int key_mgmt,
+ const u8 *anonce,
+ const u8 *eapol, size_t eapol_len)
+{
+ struct hostapd_data *hapd = ctx;
+
+ wpa_printf(MSG_DEBUG, "RADIUS PSK request for " MACSTR " key_mgmt=0x%x",
+ MAC2STR(addr), key_mgmt);
+ wpa_hexdump(MSG_DEBUG, "ANonce", anonce, WPA_NONCE_LEN);
+ wpa_hexdump(MSG_DEBUG, "EAPOL", eapol, eapol_len);
+ hostapd_acl_req_radius_psk(hapd, addr, key_mgmt, anonce, eapol,
+ eapol_len);
+}
+#endif /* CONFIG_NO_RADIUS */
+
+
int hostapd_setup_wpa(struct hostapd_data *hapd)
{
struct wpa_auth_config _conf;
@@ -1478,6 +1498,9 @@ int hostapd_setup_wpa(struct hostapd_dat
.set_session_timeout = hostapd_wpa_auth_set_session_timeout,
.get_session_timeout = hostapd_wpa_auth_get_session_timeout,
#endif /* CONFIG_IEEE80211R_AP */
+#ifndef CONFIG_NO_RADIUS
+ .request_radius_psk = hostapd_request_radius_psk,
+#endif /* CONFIG_NO_RADIUS */
};
const u8 *wpa_ie;
size_t wpa_ie_len;
--- a/src/ap/wpa_auth_i.h
+++ b/src/ap/wpa_auth_i.h
@@ -89,6 +89,7 @@ struct wpa_state_machine {
unsigned int rx_eapol_key_secure:1;
unsigned int update_snonce:1;
unsigned int alt_snonce_valid:1;
+ unsigned int waiting_radius_psk:1;
#ifdef CONFIG_IEEE80211R_AP
unsigned int ft_completed:1;
unsigned int pmk_r1_name_valid:1;

View File

@@ -0,0 +1,350 @@
From 24763e3cd0a564eb71f3c501bbb4fbb0d7070762 Mon Sep 17 00:00:00 2001
From: Jouni Malinen <j@w1.fi>
Date: Fri, 15 Apr 2022 17:31:48 +0300
Subject: [PATCH] RADIUS: Attributes with Extended Types (RFC 6929)
Supported extended types for RADIUS attributes for the cases defined in
RFC 6929.
Signed-off-by: Jouni Malinen <j@w1.fi>
---
src/radius/radius.c | 195 ++++++++++++++++++++++++++++++++++++++------
src/radius/radius.h | 26 +++++-
2 files changed, 193 insertions(+), 28 deletions(-)
diff --git a/src/radius/radius.c b/src/radius/radius.c
index be16e27b9..a64228067 100644
--- a/src/radius/radius.c
+++ b/src/radius/radius.c
@@ -1,6 +1,6 @@
/*
* RADIUS message processing
- * Copyright (c) 2002-2009, 2011-2015, Jouni Malinen <j@w1.fi>
+ * Copyright (c) 2002-2009, 2011-2022, Jouni Malinen <j@w1.fi>
*
* This software may be distributed under the terms of the BSD license.
* See README for more details.
@@ -159,7 +159,8 @@ static const char *radius_code_string(u8 code)
struct radius_attr_type {
- u8 type;
+ u16 type; /* 0..255 for basic types;
+ * (241 << 8) | <ext-type> for extended types */
char *name;
enum {
RADIUS_ATTR_UNDIST, RADIUS_ATTR_TEXT, RADIUS_ATTR_IP,
@@ -260,11 +261,31 @@ static const struct radius_attr_type radius_attrs[] =
RADIUS_ATTR_HEXDUMP },
{ RADIUS_ATTR_WLAN_GROUP_MGMT_CIPHER, "WLAN-Group-Mgmt-Pairwise-Cipher",
RADIUS_ATTR_HEXDUMP },
+ { RADIUS_ATTR_EXT_TYPE_1, "Extended-Type-1", RADIUS_ATTR_UNDIST },
+ { RADIUS_ATTR_EXT_TYPE_2, "Extended-Type-2", RADIUS_ATTR_UNDIST },
+ { RADIUS_ATTR_EXT_TYPE_3, "Extended-Type-3", RADIUS_ATTR_UNDIST },
+ { RADIUS_ATTR_EXT_TYPE_4, "Extended-Type-4", RADIUS_ATTR_UNDIST },
+ { RADIUS_ATTR_LONG_EXT_TYPE_1, "Long-Extended-Type-1",
+ RADIUS_ATTR_UNDIST },
+ { RADIUS_ATTR_LONG_EXT_TYPE_2, "Long-Extended-Type-2",
+ RADIUS_ATTR_UNDIST },
+ { RADIUS_ATTR_EXT_VENDOR_SPECIFIC_1, "Extended-Vendor-Specific-1",
+ RADIUS_ATTR_UNDIST },
+ { RADIUS_ATTR_EXT_VENDOR_SPECIFIC_2, "Extended-Vendor-Specific-2",
+ RADIUS_ATTR_UNDIST },
+ { RADIUS_ATTR_EXT_VENDOR_SPECIFIC_3, "Extended-Vendor-Specific-3",
+ RADIUS_ATTR_UNDIST },
+ { RADIUS_ATTR_EXT_VENDOR_SPECIFIC_4, "Extended-Vendor-Specific-4",
+ RADIUS_ATTR_UNDIST },
+ { RADIUS_ATTR_EXT_VENDOR_SPECIFIC_5, "Extended-Vendor-Specific-5",
+ RADIUS_ATTR_UNDIST },
+ { RADIUS_ATTR_EXT_VENDOR_SPECIFIC_6, "Extended-Vendor-Specific-6",
+ RADIUS_ATTR_UNDIST },
};
#define RADIUS_ATTRS ARRAY_SIZE(radius_attrs)
-static const struct radius_attr_type *radius_get_attr_type(u8 type)
+static const struct radius_attr_type * radius_get_attr_type(u16 type)
{
size_t i;
@@ -277,23 +298,60 @@ static const struct radius_attr_type *radius_get_attr_type(u8 type)
}
+static bool radius_is_long_ext_type(u8 type)
+{
+ return type == RADIUS_ATTR_LONG_EXT_TYPE_1 ||
+ type == RADIUS_ATTR_LONG_EXT_TYPE_2;
+}
+
+
+static bool radius_is_ext_type(u8 type)
+{
+ return type >= RADIUS_ATTR_EXT_TYPE_1 &&
+ type <= RADIUS_ATTR_LONG_EXT_TYPE_2;
+}
+
+
static void radius_msg_dump_attr(struct radius_attr_hdr *hdr)
{
+ struct radius_attr_hdr_ext *ext = NULL;
const struct radius_attr_type *attr;
int len;
unsigned char *pos;
char buf[1000];
- attr = radius_get_attr_type(hdr->type);
+ if (hdr->length < sizeof(struct radius_attr_hdr))
+ return;
- wpa_printf(MSG_INFO, " Attribute %d (%s) length=%d",
- hdr->type, attr ? attr->name : "?Unknown?", hdr->length);
+ if (radius_is_ext_type(hdr->type)) {
+ if (hdr->length < 4) {
+ wpa_printf(MSG_INFO,
+ " Invalid attribute %d (too short for extended type)",
+ hdr->type);
+ return;
+ }
- if (attr == NULL || hdr->length < sizeof(struct radius_attr_hdr))
- return;
+ ext = (struct radius_attr_hdr_ext *) hdr;
+ }
+
+ if (ext) {
+ attr = radius_get_attr_type((ext->type << 8) | ext->ext_type);
+ wpa_printf(MSG_INFO, " Attribute %d.%d (%s) length=%d",
+ ext->type, ext->ext_type,
+ attr ? attr->name : "?Unknown?", ext->length);
+ pos = (unsigned char *) (ext + 1);
+ len = ext->length - sizeof(struct radius_attr_hdr_ext);
+ } else {
+ attr = radius_get_attr_type(hdr->type);
+ wpa_printf(MSG_INFO, " Attribute %d (%s) length=%d",
+ hdr->type, attr ? attr->name : "?Unknown?",
+ hdr->length);
+ pos = (unsigned char *) (hdr + 1);
+ len = hdr->length - sizeof(struct radius_attr_hdr);
+ }
- len = hdr->length - sizeof(struct radius_attr_hdr);
- pos = (unsigned char *) (hdr + 1);
+ if (!attr)
+ return;
switch (attr->data_type) {
case RADIUS_ATTR_TEXT:
@@ -627,22 +685,54 @@ static int radius_msg_add_attr_to_array(struct radius_msg *msg,
}
-struct radius_attr_hdr *radius_msg_add_attr(struct radius_msg *msg, u8 type,
- const u8 *data, size_t data_len)
+struct radius_attr_hdr * radius_msg_add_attr(struct radius_msg *msg, u16 type,
+ const u8 *data, size_t data_len)
{
- size_t buf_needed;
- struct radius_attr_hdr *attr;
+ size_t buf_needed, max_len;
+ struct radius_attr_hdr *attr = NULL;
+ struct radius_attr_hdr_ext *ext;
+ u8 ext_type = 0;
if (TEST_FAIL())
return NULL;
- if (data_len > RADIUS_MAX_ATTR_LEN) {
- wpa_printf(MSG_ERROR, "radius_msg_add_attr: too long attribute (%lu bytes)",
- (unsigned long) data_len);
- return NULL;
+ if (type > 255) {
+ if (!radius_is_ext_type(type >> 8)) {
+ wpa_printf(MSG_ERROR,
+ "%s: Undefined extended type %d.%d",
+ __func__, type >> 8, type & 0xff);
+ return NULL;
+ }
+ ext_type = type & 0xff;
+ type >>= 8;
+ } else if (radius_is_ext_type(type)) {
+ wpa_printf(MSG_ERROR, "%s: Unexpected extended type use for %d",
+ __func__, type);
}
- buf_needed = sizeof(*attr) + data_len;
+ if (radius_is_long_ext_type(type)) {
+ size_t hdr_len = sizeof(struct radius_attr_hdr_ext) + 1;
+ size_t plen = 255 - hdr_len;
+ size_t num;
+
+ max_len = 4096;
+ num = (data_len + plen - 1) / plen;
+ if (num == 0)
+ num = 1;
+ buf_needed = num * hdr_len + data_len;
+ } else if (radius_is_ext_type(type)) {
+ max_len = RADIUS_MAX_EXT_ATTR_LEN;
+ buf_needed = sizeof(struct radius_attr_hdr_ext) + data_len;
+ } else {
+ max_len = RADIUS_MAX_ATTR_LEN;
+ buf_needed = sizeof(*attr) + data_len;
+ }
+ if (data_len > max_len) {
+ wpa_printf(MSG_ERROR,
+ "%s: too long attribute (%zu > %zu bytes)",
+ __func__, data_len, max_len);
+ return NULL;
+ }
if (wpabuf_tailroom(msg->buf) < buf_needed) {
/* allocate more space for message buffer */
@@ -651,13 +741,44 @@ struct radius_attr_hdr *radius_msg_add_attr(struct radius_msg *msg, u8 type,
msg->hdr = wpabuf_mhead(msg->buf);
}
- attr = wpabuf_put(msg->buf, sizeof(struct radius_attr_hdr));
- attr->type = type;
- attr->length = sizeof(*attr) + data_len;
- wpabuf_put_data(msg->buf, data, data_len);
-
- if (radius_msg_add_attr_to_array(msg, attr))
- return NULL;
+ if (radius_is_long_ext_type(type)) {
+ size_t plen = 255 - sizeof(struct radius_attr_hdr_ext) - 1;
+ size_t alen;
+
+ do {
+ alen = data_len > plen ? plen : data_len;
+ ext = wpabuf_put(msg->buf,
+ sizeof(struct radius_attr_hdr_ext));
+ if (!attr)
+ attr = (struct radius_attr_hdr *) ext;
+ ext->type = type;
+ ext->length = sizeof(*ext) + 1 + alen;
+ ext->ext_type = ext_type;
+ wpabuf_put_u8(msg->buf, data_len > alen ? 0x80 : 0);
+ wpabuf_put_data(msg->buf, data, data_len);
+ data += alen;
+ data_len -= alen;
+ if (radius_msg_add_attr_to_array(
+ msg, (struct radius_attr_hdr *) ext))
+ return NULL;
+ } while (data_len > 0);
+ } else if (radius_is_ext_type(type)) {
+ ext = wpabuf_put(msg->buf, sizeof(struct radius_attr_hdr_ext));
+ attr = (struct radius_attr_hdr *) ext;
+ ext->type = type;
+ ext->length = sizeof(*ext) + data_len;
+ ext->ext_type = ext_type;
+ wpabuf_put_data(msg->buf, data, data_len);
+ if (radius_msg_add_attr_to_array(msg, attr))
+ return NULL;
+ } else {
+ attr = wpabuf_put(msg->buf, sizeof(struct radius_attr_hdr));
+ attr->type = type;
+ attr->length = sizeof(*attr) + data_len;
+ wpabuf_put_data(msg->buf, data, data_len);
+ if (radius_msg_add_attr_to_array(msg, attr))
+ return NULL;
+ }
return attr;
}
@@ -1285,6 +1406,28 @@ int radius_msg_add_wfa(struct radius_msg *msg, u8 subtype, const u8 *data,
}
+int radius_msg_add_ext_vs(struct radius_msg *msg, u16 type, u32 vendor_id,
+ u8 vendor_type, const u8 *data, size_t len)
+{
+ struct radius_attr_hdr *attr;
+ u8 *buf, *pos;
+ size_t alen;
+
+ alen = 4 + 1 + len;
+ buf = os_malloc(alen);
+ if (!buf)
+ return 0;
+ pos = buf;
+ WPA_PUT_BE32(pos, vendor_id);
+ pos += 4;
+ *pos++ = vendor_type;
+ os_memcpy(pos, data, len);
+ attr = radius_msg_add_attr(msg, type, buf, alen);
+ os_free(buf);
+ return attr != NULL;
+}
+
+
int radius_user_password_hide(struct radius_msg *msg,
const u8 *data, size_t data_len,
const u8 *secret, size_t secret_len,
diff --git a/src/radius/radius.h b/src/radius/radius.h
index fb8148180..490c8d1f6 100644
--- a/src/radius/radius.h
+++ b/src/radius/radius.h
@@ -1,6 +1,6 @@
/*
* RADIUS message processing
- * Copyright (c) 2002-2009, 2012, 2014-2015, Jouni Malinen <j@w1.fi>
+ * Copyright (c) 2002-2009, 2012, 2014-2022, Jouni Malinen <j@w1.fi>
*
* This software may be distributed under the terms of the BSD license.
* See README for more details.
@@ -46,7 +46,15 @@ struct radius_attr_hdr {
/* followed by length-2 octets of attribute value */
} STRUCT_PACKED;
+struct radius_attr_hdr_ext {
+ u8 type;
+ u8 length; /* including this header */
+ u8 ext_type;
+ /* followed by length-3 octets of attribute value */
+} STRUCT_PACKED;
+
#define RADIUS_MAX_ATTR_LEN (255 - sizeof(struct radius_attr_hdr))
+#define RADIUS_MAX_EXT_ATTR_LEN (255 - sizeof(struct radius_attr_hdr_ext))
enum { RADIUS_ATTR_USER_NAME = 1,
RADIUS_ATTR_USER_PASSWORD = 2,
@@ -113,6 +121,18 @@ enum { RADIUS_ATTR_USER_NAME = 1,
RADIUS_ATTR_WLAN_GROUP_CIPHER = 187,
RADIUS_ATTR_WLAN_AKM_SUITE = 188,
RADIUS_ATTR_WLAN_GROUP_MGMT_CIPHER = 189,
+ RADIUS_ATTR_EXT_TYPE_1 = 241,
+ RADIUS_ATTR_EXT_TYPE_2 = 242,
+ RADIUS_ATTR_EXT_TYPE_3 = 243,
+ RADIUS_ATTR_EXT_TYPE_4 = 244,
+ RADIUS_ATTR_LONG_EXT_TYPE_1 = 245,
+ RADIUS_ATTR_LONG_EXT_TYPE_2 = 246,
+ RADIUS_ATTR_EXT_VENDOR_SPECIFIC_1 = (241 << 8) | 26,
+ RADIUS_ATTR_EXT_VENDOR_SPECIFIC_2 = (242 << 8) | 26,
+ RADIUS_ATTR_EXT_VENDOR_SPECIFIC_3 = (243 << 8) | 26,
+ RADIUS_ATTR_EXT_VENDOR_SPECIFIC_4 = (244 << 8) | 26,
+ RADIUS_ATTR_EXT_VENDOR_SPECIFIC_5 = (245 << 8) | 26,
+ RADIUS_ATTR_EXT_VENDOR_SPECIFIC_6 = (246 << 8) | 26,
};
@@ -257,7 +277,7 @@ int radius_msg_verify_acct_req(struct radius_msg *msg, const u8 *secret,
int radius_msg_verify_das_req(struct radius_msg *msg, const u8 *secret,
size_t secret_len,
int require_message_authenticator);
-struct radius_attr_hdr * radius_msg_add_attr(struct radius_msg *msg, u8 type,
+struct radius_attr_hdr * radius_msg_add_attr(struct radius_msg *msg, u16 type,
const u8 *data, size_t data_len);
struct radius_msg * radius_msg_parse(const u8 *data, size_t len);
int radius_msg_add_eap(struct radius_msg *msg, const u8 *data,
@@ -284,6 +304,8 @@ int radius_msg_add_mppe_keys(struct radius_msg *msg,
const u8 *recv_key, size_t recv_key_len);
int radius_msg_add_wfa(struct radius_msg *msg, u8 subtype, const u8 *data,
size_t len);
+int radius_msg_add_ext_vs(struct radius_msg *msg, u16 type, u32 vendor_id,
+ u8 vendor_type, const u8 *data, size_t len);
int radius_user_password_hide(struct radius_msg *msg,
const u8 *data, size_t data_len,
const u8 *secret, size_t secret_len,
--
2.25.1

View File

@@ -0,0 +1,102 @@
From b94371af8402f60218716552e571ca72cff4e3c0 Mon Sep 17 00:00:00 2001
From: Jouni Malinen <j@w1.fi>
Date: Fri, 15 Apr 2022 17:36:25 +0300
Subject: [PATCH] RADIUS attributes for EAPOL-Key message details
Use vendor specific RADIUS attributes for sending ANonce and EAPOL-Key
msg 2/4 for the wpa_psk_radius=3 case. The vendor specific attributes
for this are defined in FreeRADIUS as follows:
BEGIN-VENDOR FreeRADIUS format=Extended-Vendor-Specific-5
ATTRIBUTE FreeRADIUS-802.1X-Anonce 1 octets[32]
ATTRIBUTE FreeRADIUS-802.1X-EAPoL-Key-Msg 2 octets
END-VENDOR FreeRADIUS
Signed-off-by: Jouni Malinen <j@w1.fi>
---
src/ap/ieee802_11_auth.c | 29 +++++++++++++++++++++++++++++
src/radius/radius.h | 7 +++++++
2 files changed, 36 insertions(+)
diff --git a/src/ap/ieee802_11_auth.c b/src/ap/ieee802_11_auth.c
index a54d7616e..4277d82cb 100644
--- a/src/ap/ieee802_11_auth.c
+++ b/src/ap/ieee802_11_auth.c
@@ -47,6 +47,9 @@ struct hostapd_acl_query_data {
struct hostapd_acl_query_data *next;
bool radius_psk;
int akm;
+ u8 *anonce;
+ u8 *eapol;
+ size_t eapol_len;
};
@@ -102,6 +105,8 @@ static void hostapd_acl_query_free(struct hostapd_acl_query_data *query)
if (!query)
return;
os_free(query->auth_msg);
+ os_free(query->anonce);
+ os_free(query->eapol);
os_free(query);
}
@@ -164,6 +169,24 @@ static int hostapd_radius_acl_query(struct hostapd_data *hapd, const u8 *addr,
goto fail;
}
+ if (query->anonce &&
+ !radius_msg_add_ext_vs(msg, RADIUS_ATTR_EXT_VENDOR_SPECIFIC_5,
+ RADIUS_VENDOR_ID_FREERADIUS,
+ RADIUS_VENDOR_ATTR_FREERADIUS_802_1X_ANONCE,
+ query->anonce, WPA_NONCE_LEN)) {
+ wpa_printf(MSG_DEBUG, "Could not add FreeRADIUS-802.1X-Anonce");
+ goto fail;
+ }
+
+ if (query->eapol &&
+ !radius_msg_add_ext_vs(msg, RADIUS_ATTR_EXT_VENDOR_SPECIFIC_5,
+ RADIUS_VENDOR_ID_FREERADIUS,
+ RADIUS_VENDOR_ATTR_FREERADIUS_802_1X_EAPOL_KEY_MSG,
+ query->eapol, query->eapol_len)) {
+ wpa_printf(MSG_DEBUG, "Could not add FreeRADIUS-802.1X-EAPoL-Key-Msg");
+ goto fail;
+ }
+
if (radius_client_send(hapd->radius, msg, RADIUS_AUTH, addr) < 0)
goto fail;
return 0;
@@ -703,6 +726,12 @@ void hostapd_acl_req_radius_psk(struct hostapd_data *hapd, const u8 *addr,
query->akm = key_mgmt;
os_get_reltime(&query->timestamp);
os_memcpy(query->addr, addr, ETH_ALEN);
+ if (anonce)
+ query->anonce = os_memdup(anonce, WPA_NONCE_LEN);
+ if (eapol) {
+ query->eapol = os_memdup(eapol, eapol_len);
+ query->eapol_len = eapol_len;
+ }
if (hostapd_radius_acl_query(hapd, addr, query)) {
wpa_printf(MSG_DEBUG,
"Failed to send Access-Request for RADIUS PSK/ACL query");
diff --git a/src/radius/radius.h b/src/radius/radius.h
index 490c8d1f6..177c64a66 100644
--- a/src/radius/radius.h
+++ b/src/radius/radius.h
@@ -208,6 +208,13 @@ enum { RADIUS_VENDOR_ATTR_MS_MPPE_SEND_KEY = 16,
RADIUS_VENDOR_ATTR_MS_MPPE_RECV_KEY = 17
};
+/* FreeRADIUS vendor-specific attributes */
+#define RADIUS_VENDOR_ID_FREERADIUS 11344
+/* Extended-Vendor-Specific-5 (245.26; long extended header) */
+enum {
+ RADIUS_VENDOR_ATTR_FREERADIUS_802_1X_ANONCE = 1,
+ RADIUS_VENDOR_ATTR_FREERADIUS_802_1X_EAPOL_KEY_MSG = 2,
+};
/* Hotspot 2.0 - WFA Vendor-specific RADIUS Attributes */
#define RADIUS_VENDOR_ID_WFA 40808
--
2.25.1

View File

@@ -179,11 +179,12 @@ config-$(call config_package,mac80211-hwsim) += MAC80211_HWSIM
MAKE_OPTS:= -C "$(PKG_BUILD_DIR)" \
CROSS_COMPILE="$(KERNEL_CROSS)" \
ARCH="$(LINUX_KARCH)" \
EXTRA_CFLAGS="-I$(PKG_BUILD_DIR)/include $(IREMAP_CFLAGS) -I$(STAGING_DIR)/usr/include/qca-nss-drv -I$(STAGING_DIR)/usr/include/qca-nss-clients" \
EXTRA_CFLAGS="-I$(PKG_BUILD_DIR)/include $(IREMAP_CFLAGS) -I$(STAGING_DIR)/usr/include/qca-nss-drv -I$(STAGING_DIR)/usr/include/qca-nss-clients -Wno-incompatible-pointer-types -Wno-discarded-qualifiers -Wno-int-conversion -Wno-unused-function -Wno-implicit-fallthrough" \
KLIB_BUILD="$(LINUX_DIR)" \
MODPROBE=true \
KLIB=$(TARGET_MODULES_DIR) \
KERNEL_SUBLEVEL=$(lastword $(subst ., ,$(KERNEL_PATCHVER))) \
KBUILD_MODPOST_WARN=1 \
KBUILD_LDFLAGS_MODULE_PREREQ=
define ConfigVars

View File

@@ -84,6 +84,8 @@ drv_mac80211_init_iface_config() {
config_add_int dtim_period
config_add_int start_disabled
config_add_int fils_discovery_max_interval
# mesh
config_add_string mesh_id
config_add_int $MP_CONFIG_INT
@@ -488,9 +490,11 @@ mac80211_hostapd_setup_bss() {
hostapd_set_bss_options hostapd_cfg "$phy" "$vif" || return 1
json_get_vars wds wds_bridge dtim_period max_listen_int start_disabled
json_get_vars fils_discovery_max_interval
set_default wds 0
set_default start_disabled 0
set_default fils_discovery_max_interval 0
[ "$wds" -gt 0 ] && {
append hostapd_cfg "wds_sta=1" "$N"
@@ -498,6 +502,14 @@ mac80211_hostapd_setup_bss() {
}
[ "$staidx" -gt 0 -o "$start_disabled" -eq 1 ] && append hostapd_cfg "start_disabled=1" "$N"
[ "$band" = "6g" ] && {
if [ "$fils_discovery_max_interval" -gt 0 ] && [ "$fils_discovery_max_interval" -le 20 ]; then
append hostapd_cfg "fils_discovery_max_interval=$fils_discovery_max_interval" "$N"
else
append hostapd_cfg "fils_discovery_max_interval=20" "$N"
fi
}
cat >> /var/run/hostapd-$phy.conf <<EOF
$hostapd_cfg
bssid=$macaddr
@@ -718,6 +730,7 @@ mac80211_prepare_vif() {
[ "$wds" -gt 0 ] && wdsflag="4addr on"
mac80211_iw_interface_add "$phy" "$ifname" managed "$wdsflag" || return
if [ "$wds" -gt 0 ]; then
echo 1 > /sys/kernel/debug/ieee80211/$phy/netdev\:$ifname/disable_offload
iw "$ifname" set 4addr on
else
iw "$ifname" set 4addr off
@@ -1049,6 +1062,8 @@ drv_mac80211_setup() {
wireless_set_retry 0
return 1
}
[ "$band" = "6g" ] && multiple_bssid=1
wireless_set_data phy="$phy"
[ -z "$(uci -q -P /var/state show wireless._${phy})" ] && uci -q -P /var/state set wireless._${phy}=phy

View File

@@ -1,7 +1,7 @@
From bb797fc82f8ade2a1c0b7a68dd7c920eae2f531f Mon Sep 17 00:00:00 2001
From 4b7a8429c654dc7a3fc96c0042592793a09f667a Mon Sep 17 00:00:00 2001
From: John Crispin <john@phrozen.org>
Date: Tue, 18 May 2021 10:46:43 +0200
Subject: [PATCH 01/74] libubox: update to latest HEAD
Subject: [PATCH 2/4] libubox: update to latest HEAD
Signed-off-by: John Crispin <john@phrozen.org>
---
@@ -9,7 +9,7 @@ Signed-off-by: John Crispin <john@phrozen.org>
1 file changed, 4 insertions(+), 4 deletions(-)
diff --git a/package/libs/libubox/Makefile b/package/libs/libubox/Makefile
index d2c07783e1..3b01930d6c 100644
index d2c07783e1..c112b49d0f 100644
--- a/package/libs/libubox/Makefile
+++ b/package/libs/libubox/Makefile
@@ -5,9 +5,9 @@ PKG_RELEASE=2
@@ -19,9 +19,9 @@ index d2c07783e1..3b01930d6c 100644
-PKG_MIRROR_HASH:=7dd1db1e0074a9c7c722db654cce3111b3bd3cff0bfd791c4497cb0f6c22d3ca
-PKG_SOURCE_DATE:=2021-05-16
-PKG_SOURCE_VERSION:=b14c4688612c05c78ce984d7bde633bce8703b1e
+PKG_MIRROR_HASH:=82d84fb97e725b0a18ceac639cae0c17d922754bb648ff58c62069d92798a6cd
+PKG_SOURCE_DATE:=2021-08-19
+PKG_SOURCE_VERSION:=c86a894ec63d83ecf2c373bbf9dc8fba9713d942
+PKG_MIRROR_HASH:=cf48d00ed0ea74d53f2043eb9f9dc52834c0b214f258201cf22dfff7dd6c6e40
+PKG_SOURCE_DATE:=2022-05-15
+PKG_SOURCE_VERSION:=d2223ef9da7172a84d1508733dc58840e1381e3c
PKG_ABI_VERSION:=$(call abi_version_str,$(PKG_SOURCE_DATE))
CMAKE_INSTALL:=1

View File

@@ -1,22 +1,31 @@
From 23f5618453b232b9ebc5b61b7a560cd4abc09957 Mon Sep 17 00:00:00 2001
From f7aad67ef1f61a15fb09d927e331b46f6cafb44e Mon Sep 17 00:00:00 2001
From: John Crispin <john@phrozen.org>
Date: Thu, 27 May 2021 13:24:47 +0200
Subject: [PATCH] netifd: update to latest HEAD
Subject: [PATCH 3/4] netifd: update to latest HEAD
Signed-off-by: John Crispin <john@phrozen.org>
---
package/network/config/netifd/Makefile | 2 -
.../config/netifd/patches/100-script.patch | 21 +++++++++++
.../config/netifd/patches/hairpin.patch | 37 +++++++++++++++++++
3 files changed, 58 insertions(+), 2 deletions(-)
package/network/config/netifd/Makefile | 8 +++----
.../config/netifd/patches/100-script.patch | 21 +++++++++++++++++++
2 files changed, 24 insertions(+), 5 deletions(-)
create mode 100644 package/network/config/netifd/patches/100-script.patch
create mode 100644 package/network/config/netifd/patches/hairpin.patch
diff --git a/package/network/config/netifd/Makefile b/package/network/config/netifd/Makefile
index cd4f8f423d..e4399b2473 100644
index cd4f8f423d..c0a053cd4f 100644
--- a/package/network/config/netifd/Makefile
+++ b/package/network/config/netifd/Makefile
@@ -13,8 +13,6 @@ PKG_MAINTAINER:=Felix Fietkau <nbd@nbd.name>
@@ -5,16 +5,14 @@ PKG_RELEASE:=1
PKG_SOURCE_PROTO:=git
PKG_SOURCE_URL=$(PROJECT_GIT)/project/netifd.git
-PKG_SOURCE_DATE:=2021-10-30
-PKG_SOURCE_VERSION:=8f82742ca4f47f459284f3a07323d04da72ea5f6
-PKG_MIRROR_HASH:=5e519bb1aec9bb30782213f32f19f12e874c909e42826618dd4332ded816d2fe
+PKG_SOURCE_DATE:=2022-05-19
+PKG_SOURCE_VERSION:=507c0513d1766757d969530c51fe7d368354538d
+PKG_MIRROR_HASH:=706ede2ffd787a1f5388f2e80300e8f559a704dda21ebc05356074765593539c
PKG_MAINTAINER:=Felix Fietkau <nbd@nbd.name>
PKG_LICENSE:=GPL-2.0
PKG_LICENSE_FILES:=

View File

@@ -0,0 +1,44 @@
From bd346c1fa7f205b10f1aa8f1f4e4e89c3a80c13d Mon Sep 17 00:00:00 2001
From: John Crispin <john@phrozen.org>
Date: Thu, 26 May 2022 09:01:48 +0200
Subject: [PATCH 1/4] libnl-tiny: update to latest HEAD
Signed-off-by: John Crispin <john@phrozen.org>
---
package/libs/libnl-tiny/Makefile | 10 +++++-----
1 file changed, 5 insertions(+), 5 deletions(-)
diff --git a/package/libs/libnl-tiny/Makefile b/package/libs/libnl-tiny/Makefile
index bdb496c48e..48df6a4c8c 100644
--- a/package/libs/libnl-tiny/Makefile
+++ b/package/libs/libnl-tiny/Makefile
@@ -8,13 +8,13 @@
include $(TOPDIR)/rules.mk
PKG_NAME:=libnl-tiny
-PKG_RELEASE:=2
+PKG_RELEASE:=1
PKG_SOURCE_PROTO:=git
PKG_SOURCE_URL=$(PROJECT_GIT)/project/libnl-tiny.git
-PKG_SOURCE_DATE:=2020-08-05
-PKG_SOURCE_VERSION:=c291088f631d1694f7ba0444b59677b194348da8
-PKG_MIRROR_HASH:=99bcce12701bb34dadb39689d95c2c5cf1e27719d0ecfd645d3957a8947025ac
+PKG_SOURCE_DATE:=2022-05-17
+PKG_SOURCE_VERSION:=b5b2ba09c4f1c8b3c21580aea7223edc2f5e92be
+PKG_MIRROR_HASH:=b957d56aa8c2e7b55184111be69eb8dea734f1feba19e670a91f302459a48a78
CMAKE_INSTALL:=1
PKG_LICENSE:=LGPL-2.1
@@ -27,7 +27,7 @@ define Package/libnl-tiny
SECTION:=libs
CATEGORY:=Libraries
TITLE:=netlink socket library
- ABI_VERSION:=1
+ ABI_VERSION:=$(PKG_SOURCE_DATE)
endef
define Package/libnl-tiny/description
--
2.25.1

View File

@@ -0,0 +1,66 @@
From 9bede53698b963280df8b7c3c85c052e66e9d548 Mon Sep 17 00:00:00 2001
From: John Crispin <john@phrozen.org>
Date: Thu, 17 Feb 2022 08:27:09 +0100
Subject: [PATCH] net: bridge: clear bridge's private skb space on xmit
We need to clear all of the bridge private skb variables as they can be
stale due to the packet being recirculated through the stack and then
transmitted through the bridge device. Similar memset is already done on
bridge's input. We've seen cases where proxyarp_replied was 1 on routed
multicast packets transmitted through the bridge to ports with neigh
suppress which were getting dropped. Same thing can in theory happen with
the port isolation bit as well.
Fixes: 821f1b21cabb ("bridge: add new BR_NEIGH_SUPPRESS port flag to suppress arp and nd flood")
Signed-off-by: Nikolay Aleksandrov <nikolay@cumulusnetworks.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
---
...r-bridge-s-private-skb-space-on-xmit.patch | 36 +++++++++++++++++++
1 file changed, 36 insertions(+)
create mode 100644 target/linux/generic/backport-5.4/999-net-bridge-clear-bridge-s-private-skb-space-on-xmit.patch
diff --git a/target/linux/generic/backport-5.4/999-net-bridge-clear-bridge-s-private-skb-space-on-xmit.patch b/target/linux/generic/backport-5.4/999-net-bridge-clear-bridge-s-private-skb-space-on-xmit.patch
new file mode 100644
index 0000000000..20f71569da
--- /dev/null
+++ b/target/linux/generic/backport-5.4/999-net-bridge-clear-bridge-s-private-skb-space-on-xmit.patch
@@ -0,0 +1,36 @@
+From fd65e5a95d08389444e8591a20538b3edece0e15 Mon Sep 17 00:00:00 2001
+From: Nikolay Aleksandrov <nikolay@cumulusnetworks.com>
+Date: Fri, 31 Jul 2020 19:26:16 +0300
+Subject: [PATCH] net: bridge: clear bridge's private skb space on xmit
+
+We need to clear all of the bridge private skb variables as they can be
+stale due to the packet being recirculated through the stack and then
+transmitted through the bridge device. Similar memset is already done on
+bridge's input. We've seen cases where proxyarp_replied was 1 on routed
+multicast packets transmitted through the bridge to ports with neigh
+suppress which were getting dropped. Same thing can in theory happen with
+the port isolation bit as well.
+
+Fixes: 821f1b21cabb ("bridge: add new BR_NEIGH_SUPPRESS port flag to suppress arp and nd flood")
+Signed-off-by: Nikolay Aleksandrov <nikolay@cumulusnetworks.com>
+Signed-off-by: David S. Miller <davem@davemloft.net>
+---
+ net/bridge/br_device.c | 2 ++
+ 1 file changed, 2 insertions(+)
+
+diff --git a/net/bridge/br_device.c b/net/bridge/br_device.c
+index 8c7b78f8bc23..9a2fb4aa1a10 100644
+--- a/net/bridge/br_device.c
++++ b/net/bridge/br_device.c
+@@ -36,6 +36,8 @@ netdev_tx_t br_dev_xmit(struct sk_buff *skb, struct net_device *dev)
+ const unsigned char *dest;
+ u16 vid = 0;
+
++ memset(skb->cb, 0, sizeof(struct br_input_skb_cb));
++
+ rcu_read_lock();
+ nf_ops = rcu_dereference(nf_br_ops);
+ if (nf_ops && nf_ops->br_dev_xmit_hook(skb)) {
+--
+2.25.1
+
--
2.25.1

View File

@@ -0,0 +1,66 @@
From 574539ee2cdbb3dd54086423c6dfdd19bb1c06a6 Mon Sep 17 00:00:00 2001
From: David Bauer <mail@david-bauer.net>
Date: Thu, 16 Jun 2022 01:55:26 +0200
Subject: [PATCH] hostapd: add owe_transition_ifname
Add the owe_transition_ifname config option to wifi-ifaces.
This allows to configure OWE transition VAPs without adding SSID / BSSID
to the uci conifg but instead autodiscovering these parameters from
other networks on the same PHY.
The following configuration creates a OWE transition mode network
constellation.
config wifi-iface 'open0'
option device 'radio0'
option ifname 'open0'
option network 'lan'
option mode 'ap'
option ssid 'FreeNet'
option encryption 'none'
option owe_transition_ifname 'owe0'
config wifi-iface 'owe0'
option device 'radio0'
option ifname 'owe0'
option network 'lan'
option mode 'ap'
option ssid 'owe_tm.FreeNet'
option encryption 'owe'
option hidden '1'
option owe_transition_ifname 'open0'
Signed-off-by: David Bauer <mail@david-bauer.net>
---
package/network/services/hostapd/files/hostapd.sh | 4 +++-
1 file changed, 3 insertions(+), 1 deletion(-)
diff --git a/package/network/services/hostapd/files/hostapd.sh b/package/network/services/hostapd/files/hostapd.sh
index e5f816a55b..fa344bd2dd 100644
--- a/package/network/services/hostapd/files/hostapd.sh
+++ b/package/network/services/hostapd/files/hostapd.sh
@@ -335,6 +335,7 @@ hostapd_common_add_bss_config() {
config_add_int sae_pwe
config_add_string 'owe_transition_bssid:macaddr' 'owe_transition_ssid:string'
+ config_add_string owe_transition_ifname
config_add_boolean iw_enabled iw_internet iw_asra iw_esr iw_uesa
config_add_int iw_access_network_type iw_venue_group iw_venue_type
@@ -635,10 +636,11 @@ hostapd_set_bss_options() {
case "$auth_type" in
none|owe)
- json_get_vars owe_transition_bssid owe_transition_ssid
+ json_get_vars owe_transition_bssid owe_transition_ssid owe_transition_ifname
[ -n "$owe_transition_ssid" ] && append bss_conf "owe_transition_ssid=\"$owe_transition_ssid\"" "$N"
[ -n "$owe_transition_bssid" ] && append bss_conf "owe_transition_bssid=$owe_transition_bssid" "$N"
+ [ -n "$owe_transition_ifname" ] && append bss_conf "owe_transition_ifname=$owe_transition_ifname" "$N"
wps_possible=1
# Here we make the assumption that if we're in open mode
--
2.25.1

View File

@@ -0,0 +1,26 @@
From aed33811a7780131e72bf14a616579bee46ce5ae Mon Sep 17 00:00:00 2001
From: John Crispin <john@phrozen.org>
Date: Tue, 3 May 2022 07:42:32 +0200
Subject: [PATCH] bpf.mk: backport a fix that unbreaks bpf compile on armv7
Signed-off-by: John Crispin <john@phrozen.org>
---
include/bpf.mk | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/include/bpf.mk b/include/bpf.mk
index 2f797625b6..d8164436a4 100644
--- a/include/bpf.mk
+++ b/include/bpf.mk
@@ -66,7 +66,7 @@ define CompileBPF
LD_LIBRARY_PATH=$(LD_LIBRARY_PATH):$(STAGING_DIR_HOST)/lib \
$(LLVM_DIS) < $(patsubst %.c,%.opt,$(1)) > $(patsubst %.c,%.S,$(1))
LD_LIBRARY_PATH=$(LD_LIBRARY_PATH):$(STAGING_DIR_HOST)/lib \
- $(LLVM_LLC) -march=$(BPF_TARGET) -filetype=obj -o $(patsubst %.c,%.o,$(1)) < $(patsubst %.c,%.S,$(1))
+ $(LLVM_LLC) -march=$(BPF_TARGET) -mcpu=v3 -filetype=obj -o $(patsubst %.c,%.o,$(1)) < $(patsubst %.c,%.S,$(1))
LD_LIBRARY_PATH=$(LD_LIBRARY_PATH):$(STAGING_DIR_HOST)/lib \
$(LLVM_STRIP) --strip-debug $(patsubst %.c,%.o,$(1))
endef
--
2.25.1

View File

@@ -0,0 +1,33 @@
From f057826fed0208c369ca9483092c706bf5c9ae9e Mon Sep 17 00:00:00 2001
From: John Crispin <john@phrozen.org>
Date: Thu, 12 May 2022 09:31:11 +0200
Subject: [PATCH] iwinfo: add 6E support
Signed-off-by: John Crispin <john@phrozen.org>
---
package/network/utils/iwinfo/patches/100-6g.patch | 13 +++++++++++++
1 file changed, 13 insertions(+)
create mode 100644 package/network/utils/iwinfo/patches/100-6g.patch
diff --git a/package/network/utils/iwinfo/patches/100-6g.patch b/package/network/utils/iwinfo/patches/100-6g.patch
new file mode 100644
index 0000000000..45472e8ccf
--- /dev/null
+++ b/package/network/utils/iwinfo/patches/100-6g.patch
@@ -0,0 +1,13 @@
+Index: libiwinfo-2021-06-09-c0414642/iwinfo_nl80211.c
+===================================================================
+--- libiwinfo-2021-06-09-c0414642.orig/iwinfo_nl80211.c
++++ libiwinfo-2021-06-09-c0414642/iwinfo_nl80211.c
+@@ -642,6 +642,8 @@ static int nl80211_freq2channel(int freq
+ return (freq - 4000) / 5;
+ else if(freq >= 56160 + 2160 * 1 && freq <= 56160 + 2160 * 6)
+ return (freq - 56160) / 2160;
++ else if (freq >= 5955 && freq <= 7115)
++ return (freq - 5950) / 5;
+ else
+ return (freq - 5000) / 5;
+ }
--
2.25.1

View File

@@ -0,0 +1,25 @@
From c5b68d334fa19e5fa0632d9d361cb613b1384b75 Mon Sep 17 00:00:00 2001
From: John Crispin <john@phrozen.org>
Date: Mon, 13 Jun 2022 13:33:31 +0200
Subject: [PATCH] dnsmasq: ignore dhcp on the ifb-dhcp interface
Signed-off-by: John Crispin <john@phrozen.org>
---
package/network/services/dnsmasq/files/dnsmasq.init | 1 +
1 file changed, 1 insertion(+)
diff --git a/package/network/services/dnsmasq/files/dnsmasq.init b/package/network/services/dnsmasq/files/dnsmasq.init
index dacd476cd4..d00485da90 100644
--- a/package/network/services/dnsmasq/files/dnsmasq.init
+++ b/package/network/services/dnsmasq/files/dnsmasq.init
@@ -1108,6 +1108,7 @@ dnsmasq_start()
[ -n "$BOOT" ] || config_foreach filter_dnsmasq dhcp dhcp_add "$cfg"
fi
+ xappend "except-interface=ifb-dhcp"
echo >> $CONFIGFILE_TMP
config_foreach filter_dnsmasq cname dhcp_cname_add "$cfg"
--
2.25.1

View File

@@ -0,0 +1,29 @@
From fcea0e786c9311e3fc6ff256ba320aaa07b6ae05 Mon Sep 17 00:00:00 2001
From: John Crispin <john@phrozen.org>
Date: Mon, 13 Jun 2022 13:37:17 +0200
Subject: [PATCH] wireguard-tools: do not select the kernel module
unetd will select the correct kernel module.
Signed-off-by: John Crispin <john@phrozen.org>
---
package/network/utils/wireguard-tools/Makefile | 3 +--
1 file changed, 1 insertion(+), 2 deletions(-)
diff --git a/package/network/utils/wireguard-tools/Makefile b/package/network/utils/wireguard-tools/Makefile
index 5f8da147c1..e0df0a6c67 100644
--- a/package/network/utils/wireguard-tools/Makefile
+++ b/package/network/utils/wireguard-tools/Makefile
@@ -38,8 +38,7 @@ define Package/wireguard-tools
TITLE:=WireGuard userspace control program (wg)
DEPENDS:= \
+@BUSYBOX_CONFIG_IP \
- +@BUSYBOX_CONFIG_FEATURE_IP_LINK \
- +kmod-wireguard
+ +@BUSYBOX_CONFIG_FEATURE_IP_LINK
endef
define Package/wireguard-tools/description
--
2.25.1

View File

@@ -1,7 +1,7 @@
From 7244d33107173856db10bb2084146137704e7e18 Mon Sep 17 00:00:00 2001
From abd52a80294b6752cc66432041e91ca11944366e Mon Sep 17 00:00:00 2001
From: John Crispin <john@phrozen.org>
Date: Sat, 4 Sep 2021 05:56:53 +0200
Subject: [PATCH 28/43] ipq4019: add CIG wf610d
Subject: [PATCH 01/33] ipq4019: add CIG wf610d
Signed-off-by: John Crispin <john@phrozen.org>
---
@@ -11,10 +11,10 @@ Signed-off-by: John Crispin <john@phrozen.org>
.../ipq40xx/base-files/etc/board.d/02_network | 1 +
.../etc/hotplug.d/firmware/11-ath10k-caldata | 8 +
.../lib/preinit/05_set_iface_mac_ipq40xx.sh | 4 +
.../boot/dts/qcom-ipq4029-ap-cig-wf610d.dts | 409 ++++++++++++++++++
.../boot/dts/qcom-ipq4029-ap-cig-wf610d.dts | 414 ++++++++++++++++++
target/linux/ipq40xx/image/generic.mk | 14 +
.../901-arm-boot-add-dts-files.patch | 3 +-
9 files changed, 444 insertions(+), 2 deletions(-)
9 files changed, 449 insertions(+), 2 deletions(-)
create mode 100644 package/firmware/ipq-wifi/board-cig_wf610d.qca4019
create mode 100755 target/linux/ipq40xx/files/arch/arm/boot/dts/qcom-ipq4029-ap-cig-wf610d.dts
@@ -133,7 +133,7 @@ index 1d4c78833a..d62a2e5061 100755
edgecore,oap100|\
openmesh,a42|\
diff --git a/target/linux/ipq40xx/base-files/etc/hotplug.d/firmware/11-ath10k-caldata b/target/linux/ipq40xx/base-files/etc/hotplug.d/firmware/11-ath10k-caldata
index b7ee73b12e..3948c08984 100644
index b12c9af9a7..4a3f18579c 100644
--- a/target/linux/ipq40xx/base-files/etc/hotplug.d/firmware/11-ath10k-caldata
+++ b/target/linux/ipq40xx/base-files/etc/hotplug.d/firmware/11-ath10k-caldata
@@ -93,6 +93,10 @@ case "$FIRMWARE" in
@@ -175,10 +175,10 @@ index 0d606c75b5..4d3b1df219 100644
ip link set dev eth1 address $(mtd_get_mac_binary "ART" 0x0)
diff --git a/target/linux/ipq40xx/files/arch/arm/boot/dts/qcom-ipq4029-ap-cig-wf610d.dts b/target/linux/ipq40xx/files/arch/arm/boot/dts/qcom-ipq4029-ap-cig-wf610d.dts
new file mode 100755
index 0000000000..e75e35e8ef
index 0000000000..3f24369f19
--- /dev/null
+++ b/target/linux/ipq40xx/files/arch/arm/boot/dts/qcom-ipq4029-ap-cig-wf610d.dts
@@ -0,0 +1,409 @@
@@ -0,0 +1,414 @@
+/* Copyright (c) 2015, The Linux Foundation. All rights reserved.
+ *
+ * Permission to use, copy, modify, and/or distribute this software for any
@@ -395,7 +395,13 @@ index 0000000000..e75e35e8ef
+ firmware@180000 {
+ compatible = "denx,fit";
+ label = "firmware";
+ reg = <0x180000 0x1e80000>;
+ reg = <0x180000 0x1e70000>;
+ };
+
+ certificates@1ff0000 {
+ compatible = "denx,fit";
+ label = "certificates";
+ reg = <0x1ff0000 0x10000>;
+ };
+ };
+ };
@@ -522,9 +528,8 @@ index 0000000000..e75e35e8ef
+ };
+
+ ess-switch@c000000 {
+ switch_cpu_bmp = <0x1>; /* cpu port bitmap */
+ switch_lan_bmp = <0x3e>; /* lan port bitmap */
+ switch_wan_bmp = <0>; /* wan port bitmap */
+ switch_wan_bmp = <1>; /* wan port bitmap */
+ status = "okay";
+ };
+
@@ -589,7 +594,7 @@ index 0000000000..e75e35e8ef
+
+};
diff --git a/target/linux/ipq40xx/image/generic.mk b/target/linux/ipq40xx/image/generic.mk
index a435a127fa..31f4971c90 100644
index 49aa202e62..bca03f58ec 100644
--- a/target/linux/ipq40xx/image/generic.mk
+++ b/target/linux/ipq40xx/image/generic.mk
@@ -271,6 +271,20 @@ define Device/cilab_meshpoint-one

View File

@@ -0,0 +1,375 @@
From bac86b0d264589822e6020702e5eca04f6df40d8 Mon Sep 17 00:00:00 2001
From: Sohail Ahmad <sohail@indionetworks.com>
Date: Fri, 6 May 2022 07:47:25 +0200
Subject: [PATCH] ipq40xx: Support for Indio's Outdoor IP67 WiFi5 AP UM-550AC
Changes made in OpenWrt supported targets to support Indio's UM-550AC AP which is based on IPQ4019 chipset
Signed-off-by: Sohail Ahmad <sohail@indionetworks.com>
---
.../ipq40xx/base-files/etc/board.d/02_network | 3 +-
.../etc/hotplug.d/firmware/11-ath10k-caldata | 6 +-
.../arm/boot/dts/qcom-ipq4019-um-550ac.dts | 94 ++++++++++
.../arm/boot/dts/qcom-ipq4019-um-550ac.dtsi | 168 ++++++++++++++++++
target/linux/ipq40xx/image/generic.mk | 14 ++
.../ipq40xx/patches-5.4/999-hfcl_ion.patch | 6 +-
6 files changed, 285 insertions(+), 6 deletions(-)
create mode 100644 target/linux/ipq40xx/files/arch/arm/boot/dts/qcom-ipq4019-um-550ac.dts
create mode 100644 target/linux/ipq40xx/files/arch/arm/boot/dts/qcom-ipq4019-um-550ac.dtsi
diff --git a/target/linux/ipq40xx/base-files/etc/board.d/02_network b/target/linux/ipq40xx/base-files/etc/board.d/02_network
index 76e21801d9..a02f47f102 100755
--- a/target/linux/ipq40xx/base-files/etc/board.d/02_network
+++ b/target/linux/ipq40xx/base-files/etc/board.d/02_network
@@ -124,7 +124,8 @@ ipq40xx_setup_interfaces()
ucidef_add_switch "switch0" \
"0u@eth0" "1:lan" "2:lan" "3:lan" "4:lan" "0u@eth1" "5:wan"
;;
- um-325ac)
+ um-325ac |\
+ um-550ac)
ucidef_set_interface_wan "eth0"
ucidef_set_interface_lan "eth1"
;;
diff --git a/target/linux/ipq40xx/base-files/etc/hotplug.d/firmware/11-ath10k-caldata b/target/linux/ipq40xx/base-files/etc/hotplug.d/firmware/11-ath10k-caldata
index 3f32308f3e..785d51ed98 100644
--- a/target/linux/ipq40xx/base-files/etc/hotplug.d/firmware/11-ath10k-caldata
+++ b/target/linux/ipq40xx/base-files/etc/hotplug.d/firmware/11-ath10k-caldata
@@ -173,7 +173,8 @@ case "$FIRMWARE" in
caldata_extract "0:ART" 4096 12064
ath10k_patch_mac $(mtd_get_mac_ascii 0:ART WLAN0_BASEMAC)
;;
- um-325ac)
+ um-325ac |\
+ um-550ac)
caldata_extract "ART" 0x1000 0x2f20
;;
esac
@@ -298,7 +299,8 @@ case "$FIRMWARE" in
caldata_extract "0:ART" 20480 12064
ath10k_patch_mac $(mtd_get_mac_ascii 0:ART WLAN1_BASEMAC)
;;
- um-325ac)
+ um-325ac |\
+ um-550ac)
caldata_extract "ART" 0x5000 0x2f20
;;
esac
diff --git a/target/linux/ipq40xx/files/arch/arm/boot/dts/qcom-ipq4019-um-550ac.dts b/target/linux/ipq40xx/files/arch/arm/boot/dts/qcom-ipq4019-um-550ac.dts
new file mode 100644
index 0000000000..a15df3f916
--- /dev/null
+++ b/target/linux/ipq40xx/files/arch/arm/boot/dts/qcom-ipq4019-um-550ac.dts
@@ -0,0 +1,94 @@
+/* Copyright (c) 2015, 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-ipq4019-um-550ac.dtsi"
+
+/ {
+ model = "Indio Networks UM-550AC";
+ compatible = "um-550ac";
+
+ memory {
+ device_type = "memory";
+ reg = <0x80000000 0x10000000>;
+ };
+};
+
+&blsp1_spi1 {
+ mx25l25635f@0 {
+ compatible = "mx25l25635f", "jedec,spi-nor";
+ #address-cells = <1>;
+ #size-cells = <1>;
+ reg = <0>;
+ spi-max-frequency = <24000000>;
+
+ SBL1@0 {
+ label = "SBL1";
+ reg = <0x0 0x40000>;
+ read-only;
+ };
+ MIBIB@40000 {
+ label = "MIBIB";
+ reg = <0x40000 0x20000>;
+ read-only;
+ };
+ QSEE@60000 {
+ label = "QSEE";
+ reg = <0x60000 0x60000>;
+ read-only;
+ };
+ CDT@c0000 {
+ label = "CDT";
+ reg = <0xc0000 0x10000>;
+ read-only;
+ };
+ DDRPARAMS@d0000 {
+ label = "DDRPARAMS";
+ reg = <0xd0000 0x10000>;
+ read-only;
+ };
+ APPSBLENV@e0000 {
+ label = "APPSBLENV";
+ reg = <0xe0000 0x10000>;
+ read-only;
+ };
+ APPSBL@f0000 {
+ label = "APPSBL";
+ reg = <0xf0000 0x80000>;
+ read-only;
+ };
+ ART@170000 {
+ label = "ART";
+ reg = <0x170000 0x10000>;
+ read-only;
+ };
+ kernel@180000 {
+ label = "kernel";
+ reg = <0x180000 0x400000>;
+ };
+ rootfs@580000 {
+ label = "rootfs";
+ reg = <0x580000 0x15F0000>;
+ };
+ certificates@1b80000 {
+ label = "certificates";
+ reg = <0x1b80000 0x10000>;
+ };
+ firmware@180000 {
+ label = "firmware";
+ reg = <0x180000 0x1a00000>;
+ };
+ };
+};
diff --git a/target/linux/ipq40xx/files/arch/arm/boot/dts/qcom-ipq4019-um-550ac.dtsi b/target/linux/ipq40xx/files/arch/arm/boot/dts/qcom-ipq4019-um-550ac.dtsi
new file mode 100644
index 0000000000..5f4c8a103b
--- /dev/null
+++ b/target/linux/ipq40xx/files/arch/arm/boot/dts/qcom-ipq4019-um-550ac.dtsi
@@ -0,0 +1,168 @@
+/* Copyright (c) 2015, 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-ipq4019.dtsi"
+#include <dt-bindings/soc/qcom,tcsr.h>
+
+/ {
+ model = "Indio Networks UM-550AC";
+ compatible = "um-550ac";
+
+ aliases {
+ serial0 = &blsp1_uart1;
+ };
+
+ chosen {
+ stdout-path = "serial0:115200n8";
+ };
+
+ soc {
+ tcsr@194b000 {
+ /* select hostmode */
+ compatible = "qcom,tcsr";
+ reg = <0x194b000 0x100>;
+ qcom,usb-hsphy-mode-select = <TCSR_USB_HSPHY_HOST_MODE>;
+ status = "okay";
+ };
+
+ ess_tcsr@1953000 {
+ compatible = "qcom,tcsr";
+ reg = <0x1953000 0x1000>;
+ qcom,ess-interface-select = <TCSR_ESS_PSGMII>;
+ };
+
+ tcsr@1949000 {
+ compatible = "qcom,tcsr";
+ reg = <0x1949000 0x100>;
+ qcom,wifi_glb_cfg = <TCSR_WIFI_GLB_CFG>;
+ };
+
+ tcsr@1957000 {
+ compatible = "qcom,tcsr";
+ reg = <0x1957000 0x100>;
+ qcom,wifi_noc_memtype_m0_m2 = <TCSR_WIFI_NOC_MEMTYPE_M0_M2>;
+ };
+
+ rng@22000 {
+ status = "ok";
+ };
+
+ pinctrl@1000000 {
+ serial_pins: serial_pinmux {
+ mux {
+ pins = "gpio60", "gpio61";
+ function = "blsp_uart0";
+ bias-disable;
+ };
+ };
+
+ spi_0_pins: spi_0_pinmux {
+ pinmux {
+ function = "blsp_spi0";
+ pins = "gpio55", "gpio56", "gpio57";
+ };
+ pinmux_cs {
+ function = "gpio";
+ pins = "gpio54";
+ };
+ pinconf {
+ pins = "gpio55", "gpio56", "gpio57";
+ drive-strength = <12>;
+ bias-disable;
+ };
+ pinconf_cs {
+ pins = "gpio54";
+ drive-strength = <2>;
+ bias-disable;
+ output-high;
+ };
+ };
+ };
+
+ blsp_dma: dma@7884000 {
+ status = "ok";
+ };
+
+ spi@78b5000 {
+ pinctrl-0 = <&spi_0_pins>;
+ pinctrl-names = "default";
+ status = "ok";
+ cs-gpios = <&tlmm 54 0>;
+ };
+
+ serial@78af000 {
+ pinctrl-0 = <&serial_pins>;
+ pinctrl-names = "default";
+ status = "ok";
+ };
+
+ cryptobam: dma@8e04000 {
+ status = "ok";
+ };
+
+ crypto@8e3a000 {
+ status = "ok";
+ };
+
+ watchdog@b017000 {
+ status = "ok";
+ };
+
+ wifi@a000000 {
+ status = "ok";
+ };
+
+ wifi@a800000 {
+ status = "ok";
+ };
+
+ mdio@90000 {
+ status = "okay";
+ };
+
+ ess-switch@c000000 {
+ status = "okay";
+ };
+
+ ess-psgmii@98000 {
+ status = "okay";
+ };
+
+ edma@c080000 {
+ status = "okay";
+ };
+
+ usb3_ss_phy: ssphy@9a000 {
+ status = "okay";
+ };
+
+ usb3_hs_phy: hsphy@a6000 {
+ status = "okay";
+ };
+
+ usb3: usb3@8af8800 {
+ status = "okay";
+ };
+
+ usb2_hs_phy: hsphy@a8000 {
+ status = "okay";
+ };
+
+ usb2: usb2@60f8800 {
+ status = "okay";
+ };
+ };
+};
diff --git a/target/linux/ipq40xx/image/generic.mk b/target/linux/ipq40xx/image/generic.mk
index 526f20528f..7cfd20e9b6 100644
--- a/target/linux/ipq40xx/image/generic.mk
+++ b/target/linux/ipq40xx/image/generic.mk
@@ -918,3 +918,17 @@ define Device/udaya_a5-id2
IMAGE/sysupgrade.bin := append-kernel | pad-to $$$$(KERNEL_SIZE) | append-rootfs | pad-rootfs | append-metadata
endef
TARGET_DEVICES += udaya_a5-id2
+
+define Device/um-550ac
+ DEVICE_VENDOR := Indio Networks
+ DEVICE_MODEL := UM-550AC
+ BOARD_NAME := um-550ac
+ SOC := qcom-ipq4019
+ DEVICE_DTS := qcom-ipq4019-um-550ac
+ KERNEL_INSTALL := 1
+ KERNEL_SIZE := 4096k
+ IMAGE_SIZE := 26624k
+ $(call Device/FitImage)
+ IMAGE/sysupgrade.bin := append-kernel | pad-to $$$$(KERNEL_SIZE) | append-rootfs | pad-rootfs | append-metadata
+endef
+TARGET_DEVICES += um-550ac
diff --git a/target/linux/ipq40xx/patches-5.4/999-hfcl_ion.patch b/target/linux/ipq40xx/patches-5.4/999-hfcl_ion.patch
index 274071a5cc..d7b3de9508 100644
--- a/target/linux/ipq40xx/patches-5.4/999-hfcl_ion.patch
+++ b/target/linux/ipq40xx/patches-5.4/999-hfcl_ion.patch
@@ -10,11 +10,11 @@ Index: linux-5.4.158/arch/arm/boot/dts/Makefile
qcom-ipq4028-wpj428.dtb \
qcom-ipq4029-ap-303.dtb \
qcom-ipq4029-ap-303h.dtb \
-@@ -906,6 +907,7 @@ dtb-$(CONFIG_ARCH_QCOM) += \
- qcom-msm8974-sony-xperia-castor.dtb \
+@@ -907,6 +908,7 @@ dtb-$(CONFIG_ARCH_QCOM) += \
qcom-msm8974-sony-xperia-honami.dtb \
qcom-mdm9615-wp8548-mangoh-green.dtb \
+ qcom-ipq4019-um-325ac.dtb \
+ qcom-ipq4018-udaya-a5-id2.dtb \
- qcom-ipq4019-um-325ac.dtb
+ qcom-ipq4019-um-550ac.dtb
dtb-$(CONFIG_ARCH_RDA) += \
rda8810pl-orangepi-2g-iot.dtb \
--
2.25.1

View File

@@ -0,0 +1,409 @@
From 38880b602348676c4643e0a435239a793bbfefab Mon Sep 17 00:00:00 2001
From: Sohail Ahmad <sohail@indionetworks.com>
Date: Fri, 6 May 2022 09:05:41 +0200
Subject: [PATCH] ipq40xx: Support for Indio UM-510AC-V3 AP Model, Outdoor
WiFi5 AP based on IPQ40XX
Changes made in OpenWrt supported targets to support Indio's UM-510AC-V3 AP which is based on IPQ4019 chipset
Signed-off-by: Sohail Ahmad <sohail@indionetworks.com>
---
.../ipq40xx/base-files/etc/board.d/02_network | 1 +
.../etc/hotplug.d/firmware/11-ath10k-caldata | 2 +
.../arm/boot/dts/qcom-ipq4019-um-510ac-v3.dts | 94 ++++++++++
.../boot/dts/qcom-ipq4019-um-510ac-v3.dtsi | 168 ++++++++++++++++++
target/linux/ipq40xx/image/generic.mk | 15 ++
.../912-dts-ipq4019-indio-um-550ac.patch | 13 ++
.../913-dts-ipq4019-indio-um-510ac-v3.patch | 11 ++
.../ipq40xx/patches-5.4/999-hfcl_ion.patch | 4 +-
8 files changed, 306 insertions(+), 2 deletions(-)
create mode 100644 target/linux/ipq40xx/files/arch/arm/boot/dts/qcom-ipq4019-um-510ac-v3.dts
create mode 100644 target/linux/ipq40xx/files/arch/arm/boot/dts/qcom-ipq4019-um-510ac-v3.dtsi
create mode 100644 target/linux/ipq40xx/patches-5.4/912-dts-ipq4019-indio-um-550ac.patch
create mode 100644 target/linux/ipq40xx/patches-5.4/913-dts-ipq4019-indio-um-510ac-v3.patch
diff --git a/target/linux/ipq40xx/base-files/etc/board.d/02_network b/target/linux/ipq40xx/base-files/etc/board.d/02_network
index a02f47f102..abaa6f3e16 100755
--- a/target/linux/ipq40xx/base-files/etc/board.d/02_network
+++ b/target/linux/ipq40xx/base-files/etc/board.d/02_network
@@ -125,6 +125,7 @@ ipq40xx_setup_interfaces()
"0u@eth0" "1:lan" "2:lan" "3:lan" "4:lan" "0u@eth1" "5:wan"
;;
um-325ac |\
+ um-510ac-v3 |\
um-550ac)
ucidef_set_interface_wan "eth0"
ucidef_set_interface_lan "eth1"
diff --git a/target/linux/ipq40xx/base-files/etc/hotplug.d/firmware/11-ath10k-caldata b/target/linux/ipq40xx/base-files/etc/hotplug.d/firmware/11-ath10k-caldata
index 785d51ed98..4af1d5ea2f 100644
--- a/target/linux/ipq40xx/base-files/etc/hotplug.d/firmware/11-ath10k-caldata
+++ b/target/linux/ipq40xx/base-files/etc/hotplug.d/firmware/11-ath10k-caldata
@@ -174,6 +174,7 @@ case "$FIRMWARE" in
ath10k_patch_mac $(mtd_get_mac_ascii 0:ART WLAN0_BASEMAC)
;;
um-325ac |\
+ um-510ac-v3 |\
um-550ac)
caldata_extract "ART" 0x1000 0x2f20
;;
@@ -300,6 +301,7 @@ case "$FIRMWARE" in
ath10k_patch_mac $(mtd_get_mac_ascii 0:ART WLAN1_BASEMAC)
;;
um-325ac |\
+ um-510ac-v3 |\
um-550ac)
caldata_extract "ART" 0x5000 0x2f20
;;
diff --git a/target/linux/ipq40xx/files/arch/arm/boot/dts/qcom-ipq4019-um-510ac-v3.dts b/target/linux/ipq40xx/files/arch/arm/boot/dts/qcom-ipq4019-um-510ac-v3.dts
new file mode 100644
index 0000000000..e0854189c1
--- /dev/null
+++ b/target/linux/ipq40xx/files/arch/arm/boot/dts/qcom-ipq4019-um-510ac-v3.dts
@@ -0,0 +1,94 @@
+/* Copyright (c) 2015, 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-ipq4019-um-510ac-v3.dtsi"
+
+/ {
+ model = "Indio Networks UM-510AC-V3";
+ compatible = "um-510ac-v3";
+
+ memory {
+ device_type = "memory";
+ reg = <0x80000000 0x10000000>;
+ };
+};
+
+&blsp1_spi1 {
+ mx25l25635f@0 {
+ compatible = "mx25l25635f", "jedec,spi-nor";
+ #address-cells = <1>;
+ #size-cells = <1>;
+ reg = <0>;
+ spi-max-frequency = <24000000>;
+
+ SBL1@0 {
+ label = "SBL1";
+ reg = <0x0 0x40000>;
+ read-only;
+ };
+ MIBIB@40000 {
+ label = "MIBIB";
+ reg = <0x40000 0x20000>;
+ read-only;
+ };
+ QSEE@60000 {
+ label = "QSEE";
+ reg = <0x60000 0x60000>;
+ read-only;
+ };
+ CDT@c0000 {
+ label = "CDT";
+ reg = <0xc0000 0x10000>;
+ read-only;
+ };
+ DDRPARAMS@d0000 {
+ label = "DDRPARAMS";
+ reg = <0xd0000 0x10000>;
+ read-only;
+ };
+ APPSBLENV@e0000 {
+ label = "APPSBLENV";
+ reg = <0xe0000 0x10000>;
+ read-only;
+ };
+ APPSBL@f0000 {
+ label = "APPSBL";
+ reg = <0xf0000 0x80000>;
+ read-only;
+ };
+ ART@170000 {
+ label = "ART";
+ reg = <0x170000 0x10000>;
+ read-only;
+ };
+ kernel@180000 {
+ label = "kernel";
+ reg = <0x180000 0x400000>;
+ };
+ rootfs@580000 {
+ label = "rootfs";
+ reg = <0x580000 0x15F0000>;
+ };
+ certificates@1b80000 {
+ label = "certificates";
+ reg = <0x1b80000 0x10000>;
+ };
+ firmware@180000 {
+ label = "firmware";
+ reg = <0x180000 0x1a00000>;
+ };
+ };
+};
diff --git a/target/linux/ipq40xx/files/arch/arm/boot/dts/qcom-ipq4019-um-510ac-v3.dtsi b/target/linux/ipq40xx/files/arch/arm/boot/dts/qcom-ipq4019-um-510ac-v3.dtsi
new file mode 100644
index 0000000000..a8ad081f03
--- /dev/null
+++ b/target/linux/ipq40xx/files/arch/arm/boot/dts/qcom-ipq4019-um-510ac-v3.dtsi
@@ -0,0 +1,168 @@
+/* Copyright (c) 2015, 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-ipq4019.dtsi"
+#include <dt-bindings/soc/qcom,tcsr.h>
+
+/ {
+ model = "Indio Networks UM-510AC-V3";
+ compatible = "um-510ac-v3";
+
+ aliases {
+ serial0 = &blsp1_uart1;
+ };
+
+ chosen {
+ stdout-path = "serial0:115200n8";
+ };
+
+ soc {
+ tcsr@194b000 {
+ /* select hostmode */
+ compatible = "qcom,tcsr";
+ reg = <0x194b000 0x100>;
+ qcom,usb-hsphy-mode-select = <TCSR_USB_HSPHY_HOST_MODE>;
+ status = "okay";
+ };
+
+ ess_tcsr@1953000 {
+ compatible = "qcom,tcsr";
+ reg = <0x1953000 0x1000>;
+ qcom,ess-interface-select = <TCSR_ESS_PSGMII>;
+ };
+
+ tcsr@1949000 {
+ compatible = "qcom,tcsr";
+ reg = <0x1949000 0x100>;
+ qcom,wifi_glb_cfg = <TCSR_WIFI_GLB_CFG>;
+ };
+
+ tcsr@1957000 {
+ compatible = "qcom,tcsr";
+ reg = <0x1957000 0x100>;
+ qcom,wifi_noc_memtype_m0_m2 = <TCSR_WIFI_NOC_MEMTYPE_M0_M2>;
+ };
+
+ rng@22000 {
+ status = "ok";
+ };
+
+ pinctrl@1000000 {
+ serial_pins: serial_pinmux {
+ mux {
+ pins = "gpio60", "gpio61";
+ function = "blsp_uart0";
+ bias-disable;
+ };
+ };
+
+ spi_0_pins: spi_0_pinmux {
+ pinmux {
+ function = "blsp_spi0";
+ pins = "gpio55", "gpio56", "gpio57";
+ };
+ pinmux_cs {
+ function = "gpio";
+ pins = "gpio54";
+ };
+ pinconf {
+ pins = "gpio55", "gpio56", "gpio57";
+ drive-strength = <12>;
+ bias-disable;
+ };
+ pinconf_cs {
+ pins = "gpio54";
+ drive-strength = <2>;
+ bias-disable;
+ output-high;
+ };
+ };
+ };
+
+ blsp_dma: dma@7884000 {
+ status = "ok";
+ };
+
+ spi@78b5000 {
+ pinctrl-0 = <&spi_0_pins>;
+ pinctrl-names = "default";
+ status = "ok";
+ cs-gpios = <&tlmm 54 0>;
+ };
+
+ serial@78af000 {
+ pinctrl-0 = <&serial_pins>;
+ pinctrl-names = "default";
+ status = "ok";
+ };
+
+ cryptobam: dma@8e04000 {
+ status = "ok";
+ };
+
+ crypto@8e3a000 {
+ status = "ok";
+ };
+
+ watchdog@b017000 {
+ status = "ok";
+ };
+
+ wifi@a000000 {
+ status = "ok";
+ };
+
+ wifi@a800000 {
+ status = "ok";
+ };
+
+ mdio@90000 {
+ status = "okay";
+ };
+
+ ess-switch@c000000 {
+ status = "okay";
+ };
+
+ ess-psgmii@98000 {
+ status = "okay";
+ };
+
+ edma@c080000 {
+ status = "okay";
+ };
+
+ usb3_ss_phy: ssphy@9a000 {
+ status = "okay";
+ };
+
+ usb3_hs_phy: hsphy@a6000 {
+ status = "okay";
+ };
+
+ usb3: usb3@8af8800 {
+ status = "okay";
+ };
+
+ usb2_hs_phy: hsphy@a8000 {
+ status = "okay";
+ };
+
+ usb2: usb2@60f8800 {
+ status = "okay";
+ };
+ };
+};
diff --git a/target/linux/ipq40xx/image/generic.mk b/target/linux/ipq40xx/image/generic.mk
index 7cfd20e9b6..c156cb3415 100644
--- a/target/linux/ipq40xx/image/generic.mk
+++ b/target/linux/ipq40xx/image/generic.mk
@@ -932,3 +932,18 @@ define Device/um-550ac
IMAGE/sysupgrade.bin := append-kernel | pad-to $$$$(KERNEL_SIZE) | append-rootfs | pad-rootfs | append-metadata
endef
TARGET_DEVICES += um-550ac
+
+
+define Device/um-510ac-v3
+ DEVICE_VENDOR := Indio Networks
+ DEVICE_MODEL := UM-510AC-V3
+ BOARD_NAME := um-510ac-v3
+ SOC := qcom-ipq4019
+ DEVICE_DTS := qcom-ipq4019-um-510ac-v3
+ KERNEL_INSTALL := 1
+ KERNEL_SIZE := 4096k
+ IMAGE_SIZE := 26624k
+ $(call Device/FitImage)
+ IMAGE/sysupgrade.bin := append-kernel | pad-to $$$$(KERNEL_SIZE) | append-rootfs | pad-rootfs | append-metadata
+endef
+TARGET_DEVICES += um-510ac-v3
diff --git a/target/linux/ipq40xx/patches-5.4/912-dts-ipq4019-indio-um-550ac.patch b/target/linux/ipq40xx/patches-5.4/912-dts-ipq4019-indio-um-550ac.patch
new file mode 100644
index 0000000000..876eb48d0a
--- /dev/null
+++ b/target/linux/ipq40xx/patches-5.4/912-dts-ipq4019-indio-um-550ac.patch
@@ -0,0 +1,13 @@
+diff -Nurb a/arch/arm/boot/dts/Makefile b/arch/arm/boot/dts/Makefile
+--- a/arch/arm/boot/dts/Makefile 2022-03-27 09:16:13.544943010 +0000
++++ b/arch/arm/boot/dts/Makefile 2022-03-27 09:17:15.574098533 +0000
+@@ -907,7 +907,8 @@
+ qcom-msm8974-sony-xperia-castor.dtb \
+ qcom-msm8974-sony-xperia-honami.dtb \
+ qcom-mdm9615-wp8548-mangoh-green.dtb \
+- qcom-ipq4019-um-325ac.dtb
++ qcom-ipq4019-um-325ac.dtb \
++ qcom-ipq4019-um-550ac.dtb
+ dtb-$(CONFIG_ARCH_RDA) += \
+ rda8810pl-orangepi-2g-iot.dtb \
+ rda8810pl-orangepi-i96.dtb
diff --git a/target/linux/ipq40xx/patches-5.4/913-dts-ipq4019-indio-um-510ac-v3.patch b/target/linux/ipq40xx/patches-5.4/913-dts-ipq4019-indio-um-510ac-v3.patch
new file mode 100644
index 0000000000..dd22a709a7
--- /dev/null
+++ b/target/linux/ipq40xx/patches-5.4/913-dts-ipq4019-indio-um-510ac-v3.patch
@@ -0,0 +1,11 @@
+diff -Nurb a/arch/arm/boot/dts/Makefile b/arch/arm/boot/dts/Makefile
+--- a/arch/arm/boot/dts/Makefile 2022-03-31 03:03:23.379141391 +0000
++++ b/arch/arm/boot/dts/Makefile 2022-03-31 03:07:24.671320669 +0000
+@@ -908,6 +908,7 @@
+ qcom-msm8974-sony-xperia-honami.dtb \
+ qcom-mdm9615-wp8548-mangoh-green.dtb \
+ qcom-ipq4019-um-325ac.dtb \
++ qcom-ipq4019-um-510ac-v3.dtb \
+ qcom-ipq4019-um-550ac.dtb
+ dtb-$(CONFIG_ARCH_RDA) += \
+ rda8810pl-orangepi-2g-iot.dtb \
diff --git a/target/linux/ipq40xx/patches-5.4/999-hfcl_ion.patch b/target/linux/ipq40xx/patches-5.4/999-hfcl_ion.patch
index d7b3de9508..5100c408b9 100644
--- a/target/linux/ipq40xx/patches-5.4/999-hfcl_ion.patch
+++ b/target/linux/ipq40xx/patches-5.4/999-hfcl_ion.patch
@@ -10,10 +10,10 @@ Index: linux-5.4.158/arch/arm/boot/dts/Makefile
qcom-ipq4028-wpj428.dtb \
qcom-ipq4029-ap-303.dtb \
qcom-ipq4029-ap-303h.dtb \
-@@ -907,6 +908,7 @@ dtb-$(CONFIG_ARCH_QCOM) += \
- qcom-msm8974-sony-xperia-honami.dtb \
+@@ -908,6 +909,7 @@ dtb-$(CONFIG_ARCH_QCOM) += \
qcom-mdm9615-wp8548-mangoh-green.dtb \
qcom-ipq4019-um-325ac.dtb \
+ qcom-ipq4019-um-510ac-v3.dtb \
+ qcom-ipq4018-udaya-a5-id2.dtb \
qcom-ipq4019-um-550ac.dtb
dtb-$(CONFIG_ARCH_RDA) += \
--
2.25.1

View File

@@ -0,0 +1,105 @@
From 86dc0a3f51da3440bc216d988c04b225ba169247 Mon Sep 17 00:00:00 2001
From: John Crispin <john@phrozen.org>
Date: Thu, 16 Jun 2022 12:46:08 +0200
Subject: [PATCH] ipq40xx: add dual boot support for ecw5211
Signed-off-by: John Crispin <john@phrozen.org>
---
.../ipq40xx/base-files/etc/init.d/bootcount | 17 ++++++++++++++---
.../base-files/lib/upgrade/platform.sh | 19 ++++++++++++++++++-
.../arm/boot/dts/qcom-ipq4018-ecw5211.dts | 10 ++++++++++
3 files changed, 42 insertions(+), 4 deletions(-)
diff --git a/target/linux/ipq40xx/base-files/etc/init.d/bootcount b/target/linux/ipq40xx/base-files/etc/init.d/bootcount
index 36b5d56d0c..5cda1fc245 100755
--- a/target/linux/ipq40xx/base-files/etc/init.d/bootcount
+++ b/target/linux/ipq40xx/base-files/etc/init.d/bootcount
@@ -13,13 +13,24 @@ boot() {
linksys,mr8300)
mtd resetbc s_env || true
;;
- edgecore,spw2ac1200|\
- edgecore,spw2ac1200-lan-poe|\
edgecore,ecw5211)
+ part="$(awk -F 'ubi.mtd=' '{printf $2}' /proc/cmdline | cut -d " " -f1)"
+ case "$part" in
+ rootfs1|\
+ rootfs2)
+ avail=$(fw_printenv -n upgrade_available)
+ [ ${avail} -ne 1 ] && fw_setenv upgrade_available 1
+ fw_setenv bootcount 0
+ ;;
+ esac
+ ;;
+ edgecore,spw2ac1200|\
+ edgecore,spw2ac1200-lan-poe)
avail=$(fw_printenv -n upgrade_available)
[ ${avail} -eq 0 ] || {
- fw_setenv bootcount 0
fw_setenv upgrade_available 0
+ fw_setenv bootcount 0
}
+ ;;
esac
}
diff --git a/target/linux/ipq40xx/base-files/lib/upgrade/platform.sh b/target/linux/ipq40xx/base-files/lib/upgrade/platform.sh
index d44a57c62a..6f2bff527c 100644
--- a/target/linux/ipq40xx/base-files/lib/upgrade/platform.sh
+++ b/target/linux/ipq40xx/base-files/lib/upgrade/platform.sh
@@ -66,7 +66,6 @@ platform_do_upgrade() {
avm,fritzrepeater-3000 |\
buffalo,wtr-m2133hp |\
cilab,meshpoint-one |\
- edgecore,ecw5211 |\
edgecore,oap100 |\
engenius,eap2200 |\
glinet,gl-ap1300 |\
@@ -78,6 +77,24 @@ platform_do_upgrade() {
tp-link,ec420-g1)
nand_do_upgrade "$1"
;;
+ edgecore,ecw5211)
+ mkdir -p /var/lock/
+ part="$(awk -F 'ubi.mtd=' '{printf $2}' /proc/cmdline | cut -d " " -f 1)"
+ case "$part" in
+ rootfs1)
+ fw_setenv active 2 || exit 1
+ CI_UBIPART="rootfs2"
+ ;;
+ rootfs2)
+ fw_setenv active 1 || exit 1
+ CI_UBIPART="rootfs1"
+ ;;
+ *)
+ # legacy bootloader
+ ;;
+ esac
+ nand_do_upgrade "$1"
+ ;;
alfa-network,ap120c-ac)
mkdir -p /var/lock/
part="$(awk -F 'ubi.mtd=' '{printf $2}' /proc/cmdline | sed -e 's/ .*$//')"
diff --git a/target/linux/ipq40xx/files/arch/arm/boot/dts/qcom-ipq4018-ecw5211.dts b/target/linux/ipq40xx/files/arch/arm/boot/dts/qcom-ipq4018-ecw5211.dts
index 0ee8d1a52e..d8c0853c58 100644
--- a/target/linux/ipq40xx/files/arch/arm/boot/dts/qcom-ipq4018-ecw5211.dts
+++ b/target/linux/ipq40xx/files/arch/arm/boot/dts/qcom-ipq4018-ecw5211.dts
@@ -258,6 +258,16 @@
label = "rootfs";
reg = <0x00000000 0x04000000>;
};
+
+ partition@1 {
+ label = "rootfs1";
+ reg = <0x00000000 0x04000000>;
+ };
+
+ partition@4000000 {
+ label = "rootfs2";
+ reg = <0x04000000 0x04000000>;
+ };
};
};
};
--
2.25.1

View File

@@ -113,25 +113,6 @@ index 0000000000..6c429f1852
+config_foreach ubootenv_add_app_config ubootenv
+
+exit 0
diff --git a/toolchain/kernel-headers/Makefile b/toolchain/kernel-headers/Makefile
index c33f26d46d..06236b5a47 100644
--- a/toolchain/kernel-headers/Makefile
+++ b/toolchain/kernel-headers/Makefile
@@ -12,6 +12,14 @@ BUILD_DIR := $(KERNEL_BUILD_DIR)
override QUILT:=
override HOST_QUILT:=
+include $(INCLUDE_DIR)/target.mk
+
+ifeq ($(KERNEL_PATCHVER),4.4)
+ KERNEL_PATCHVER := 5.10
+ KERNEL_NAME_SUFFIX:=
+endif
+
+include $(INCLUDE_DIR)/kernel-version.mk
include $(INCLUDE_DIR)/kernel.mk
PKG_NAME:=linux
--
2.25.1

View File

@@ -0,0 +1,31 @@
From 398ceb5dee1a6e1e7e30e02d4f77316a83fdc5b1 Mon Sep 17 00:00:00 2001
From: John Crispin <john@phrozen.org>
Date: Sun, 22 May 2022 16:56:10 +0200
Subject: [PATCH] include/image-commands.mk: build mmc qdsk images
Signed-off-by: John Crispin <john@phrozen.org>
---
include/image-commands.mk | 7 +++++++
1 file changed, 7 insertions(+)
diff --git a/include/image-commands.mk b/include/image-commands.mk
index d4bce80e68..541ec4f575 100644
--- a/include/image-commands.mk
+++ b/include/image-commands.mk
@@ -354,6 +354,13 @@ define Build/qsdk-ipq-factory-nor
@mv $@.new $@
endef
+define Build/qsdk-ipq-factory-mmc
+ $(TOPDIR)/scripts/mkits-qsdk-ipq-image.sh \
+ $@.its hlos $(IMAGE_KERNEL) rootfs $(IMAGE_ROOTFS)
+ PATH=$(LINUX_DIR)/scripts/dtc:$(PATH) mkimage -f $@.its $@.new
+ @mv $@.new $@
+endef
+
define Build/seama
$(STAGING_DIR_HOST)/bin/seama -i $@ \
-m "dev=/dev/mtdblock/$(SEAMA_MTDBLOCK)" -m "type=firmware"
--
2.25.1

View File

@@ -1,7 +1,7 @@
From dccf411274a126c0f12d16ec220fbbb518858d84 Mon Sep 17 00:00:00 2001
From c8878d6eda88d844593bb6a6e205eafc27f32b34 Mon Sep 17 00:00:00 2001
From: Felix Fietkau <nbd@nbd.name>
Date: Thu, 10 Mar 2022 18:09:15 +0100
Subject: [PATCH 14/14] update actiontec web7200 support
Subject: [PATCH 02/37] update actiontec web7200 support
Signed-off-by: Felix Fietkau <nbd@nbd.name>
---
@@ -16,10 +16,11 @@ Signed-off-by: Felix Fietkau <nbd@nbd.name>
.../linux/ramips/files/include/nmbm/nmbm-os.h | 69 -
target/linux/ramips/files/include/nmbm/nmbm.h | 102 -
target/linux/ramips/image/mt7621.mk | 20 +-
.../etc/hotplug.d/ieee80211/10_fix_wifi_mac | 5 +
.../mt7621/base-files/lib/upgrade/platform.sh | 7 +-
target/linux/ramips/mt7621/config-5.4 | 8 -
.../499-mtd-add-nmbm-support.patch | 21 -
14 files changed, 79 insertions(+), 4185 deletions(-)
15 files changed, 84 insertions(+), 4185 deletions(-)
delete mode 100644 target/linux/ramips/files/drivers/mtd/nmbm/Kconfig
delete mode 100644 target/linux/ramips/files/drivers/mtd/nmbm/Makefile
delete mode 100644 target/linux/ramips/files/drivers/mtd/nmbm/nmbm-core.c
@@ -4352,6 +4353,22 @@ index 57c3efcf2b..81ef6bbd14 100644
define Device/unielec_u7621-01-16m
$(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 bd0f0254c6..7109a4647e 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
@@ -10,6 +10,11 @@ PHYNBR=${DEVPATH##*/phy}
board=$(board_name)
case "$board" in
+ actiontec,web7200)
+ wan_mac=$(mtd_get_mac_ascii u-boot-env "AeiBaseMACAddr")
+ [ "$PHYNBR" = "0" ] && macaddr_add $wan_mac 2 > /sys${DEVPATH}/macaddress
+ [ "$PHYNBR" = "1" ] && macaddr_add $wan_mac 3 > /sys${DEVPATH}/macaddress
+ ;;
glinet,gl-mt1300)
[ "$PHYNBR" = "1" ] && \
macaddr_add "$(mtd_get_mac_binary factory 0x4)" 1 > /sys${DEVPATH}/macaddress
diff --git a/target/linux/ramips/mt7621/base-files/lib/upgrade/platform.sh b/target/linux/ramips/mt7621/base-files/lib/upgrade/platform.sh
index 924f259e25..93f6e836dc 100755
--- a/target/linux/ramips/mt7621/base-files/lib/upgrade/platform.sh

View File

@@ -0,0 +1,281 @@
From abd6918dc1af8d411aacc333bbddbfdcce25d439 Mon Sep 17 00:00:00 2001
From: John Crispin <john@phrozen.org>
Date: Wed, 20 Apr 2022 09:13:33 +0200
Subject: [PATCH 01/35] ramips: add mt7621_indio_um-305ax
Signed-off-by: John Crispin <john@phrozen.org>
---
.../ramips/dts/mt7621_indio_um-305ax.dts | 146 ++++++++++++++++++
target/linux/ramips/image/mt7621.mk | 12 ++
.../mt7621/base-files/etc/board.d/02_network | 6 +
.../etc/hotplug.d/ieee80211/10_fix_wifi_mac | 6 +
target/linux/ramips/mt7621/config-5.4 | 11 +-
5 files changed, 176 insertions(+), 5 deletions(-)
create mode 100644 target/linux/ramips/dts/mt7621_indio_um-305ax.dts
diff --git a/target/linux/ramips/dts/mt7621_indio_um-305ax.dts b/target/linux/ramips/dts/mt7621_indio_um-305ax.dts
new file mode 100644
index 0000000000..79cffbdec2
--- /dev/null
+++ b/target/linux/ramips/dts/mt7621_indio_um-305ax.dts
@@ -0,0 +1,146 @@
+// 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 = "indio,um-305ax", "mediatek,mt7621-soc";
+ model = "INDIO UM-305AX";
+
+ aliases {
+ led-boot = &led_green;
+ led-failsafe = &led_red;
+ led-running = &led_blue;
+ led-upgrade = &led_red;
+ label-mac-device = &wan_port;
+ };
+
+ chosen {
+ bootargs = "console=ttyS0,115200";
+ bootargs-override = "console=ttyS0,115200";
+ };
+
+ leds {
+ compatible = "gpio-leds";
+
+ led_blue: blue {
+ label = "blue";
+ gpios = <&gpio 24 GPIO_ACTIVE_LOW>;
+ default-state = "off";
+ };
+
+ led_red: red {
+ label = "red";
+ gpios = <&gpio 23 GPIO_ACTIVE_LOW>;
+ default-state = "off";
+ };
+
+ led_green: green {
+ label = "green";
+ gpios = <&gpio 15 GPIO_ACTIVE_LOW>;
+ };
+ };
+
+ keys {
+ compatible = "gpio-keys-polled";
+ poll-interval = <50>;
+ pinctrl-names = "default";
+
+ reset {
+ label = "reset";
+ gpios = <&gpio 18 GPIO_ACTIVE_LOW>;
+ linux,code = <KEY_RESTART>;
+ };
+ };
+};
+
+&state_default {
+ gpio {
+ groups = "rgmii2";
+ function = "gpio";
+ };
+};
+
+&pcie {
+ status = "okay";
+};
+
+&pcie1 {
+ wifi@0,0 {
+ reg = <0x0 0 0 0 0>;
+ mediatek,mtd-eeprom = <&factory 0x0>;
+ };
+};
+
+&gmac0 {
+ mtd-mac-address = <&factory 0x4>;
+};
+
+&switch0 {
+ ports {
+ wan_port: port@0 {
+ status = "okay";
+ label = "wan";
+ mtd-mac-address = <&factory 0x28>;
+ };
+
+ port@1 {
+ status = "okay";
+ label = "lan";
+ };
+ };
+};
+
+&spi0 {
+ status = "okay";
+
+ flash@0 {
+ compatible = "jedec,spi-nor";
+ reg = <0>;
+ spi-max-frequency = <50000000>;
+
+ partitions {
+ compatible = "fixed-partitions";
+ #address-cells = <1>;
+ #size-cells = <1>;
+
+ partition@0 {
+ label = "u-boot";
+ reg = <0x0 0x30000>;
+ read-only;
+ };
+
+ partition@30000 {
+ label = "u-boot-env";
+ reg = <0x30000 0x10000>;
+ read-only;
+ };
+
+ partition@40000 {
+ label = "product";
+ reg = <0x40000 0x10000>;
+ read-only;
+ };
+
+ factory: partition@50000 {
+ label = "factory";
+ reg = <0x50000 0x40000>;
+ read-only;
+ };
+ partition@90000 {
+ compatible = "denx,fit";
+ label = "firmware";
+ reg = <0x90000 0xf60000>;
+ };
+
+ partition@ff0000 {
+ label = "certificates";
+ reg = <0xff0000 0x10000>;
+ };
+
+ };
+ };
+};
+
diff --git a/target/linux/ramips/image/mt7621.mk b/target/linux/ramips/image/mt7621.mk
index 81ef6bbd14..9e1eed024b 100644
--- a/target/linux/ramips/image/mt7621.mk
+++ b/target/linux/ramips/image/mt7621.mk
@@ -1736,3 +1736,15 @@ define Device/zyxel_wap6805
IMAGE/sysupgrade.bin := sysupgrade-tar | append-metadata
endef
TARGET_DEVICES += zyxel_wap6805
+
+define Device/indio_um-305ax
+ $(Device/dsa-migration)
+ DEVICE_VENDOR := INDIO
+ DEVICE_MODEL := UM-305AX
+ DEVICE_DTS_CONFIG := config@1
+ DEVICE_PACKAGES += kmod-mt7915e
+ KERNEL := kernel-bin | lzma | fit lzma $$(KDIR)/image-$$(firstword $$(DEVICE_DTS)).dtb
+ IMAGE_SIZE := 15774k
+endef
+TARGET_DEVICES += indio_um-305ax
+
diff --git a/target/linux/ramips/mt7621/base-files/etc/board.d/02_network b/target/linux/ramips/mt7621/base-files/etc/board.d/02_network
index b88fac6f59..c0a6bc884a 100755
--- a/target/linux/ramips/mt7621/base-files/etc/board.d/02_network
+++ b/target/linux/ramips/mt7621/base-files/etc/board.d/02_network
@@ -33,6 +33,7 @@ ramips_setup_interfaces()
;;
actiontec,web7200|\
asiarf,ap7621-001|\
+ indio,um-305ax|\
winstars,ws-wn583a6)
ucidef_set_interfaces_lan_wan "lan" "wan"
;;
@@ -173,6 +174,11 @@ ramips_setup_macs()
wan_mac=$label_mac
lan_mac=$(macaddr_add $label_mac 1)
;;
+ indio,um-305ax)
+ label_mac=$(mtd_get_mac_binary factory 0x4)
+ wan_mac=$(macaddr_add $label_mac 1)
+ lan_mac=$label_mac
+ ;;
esac
[ -n "$lan_mac" ] && ucidef_set_interface_macaddr "lan" $lan_mac
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 7109a4647e..157e706534 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
@@ -15,6 +15,12 @@ case "$board" in
[ "$PHYNBR" = "0" ] && macaddr_add $wan_mac 2 > /sys${DEVPATH}/macaddress
[ "$PHYNBR" = "1" ] && macaddr_add $wan_mac 3 > /sys${DEVPATH}/macaddress
;;
+ indio,um-305ax)
+ [ "$PHYNBR" = "0" ] && \
+ macaddr_add "$(mtd_get_mac_binary factory 0x4)" 2 > /sys${DEVPATH}/macaddress
+ [ "$PHYNBR" = "1" ] && \
+ macaddr_add "$(mtd_get_mac_binary factory 0x4)" 3 > /sys${DEVPATH}/macaddress
+ ;;
glinet,gl-mt1300)
[ "$PHYNBR" = "1" ] && \
macaddr_add "$(mtd_get_mac_binary factory 0x4)" 1 > /sys${DEVPATH}/macaddress
diff --git a/target/linux/ramips/mt7621/config-5.4 b/target/linux/ramips/mt7621/config-5.4
index eada0ff602..809baf5441 100644
--- a/target/linux/ramips/mt7621/config-5.4
+++ b/target/linux/ramips/mt7621/config-5.4
@@ -43,6 +43,7 @@ CONFIG_CRYPTO_AEAD2=y
CONFIG_CRYPTO_DEFLATE=y
CONFIG_CRYPTO_HASH2=y
CONFIG_CRYPTO_HASH_INFO=y
+CONFIG_CRYPTO_LIB_POLY1305_RSIZE=2
CONFIG_CRYPTO_LZO=y
CONFIG_CRYPTO_MANAGER=y
CONFIG_CRYPTO_MANAGER2=y
@@ -53,17 +54,12 @@ CONFIG_DEBUG_PINCTRL=y
CONFIG_DIMLIB=y
CONFIG_DMA_NONCOHERENT=y
CONFIG_DMA_NONCOHERENT_CACHE_SYNC=y
-# CONFIG_DMA_RALINK is not set
# CONFIG_DTB_GNUBEE1 is not set
# CONFIG_DTB_GNUBEE2 is not set
CONFIG_DTB_RT_NONE=y
CONFIG_DTC=y
CONFIG_EARLY_PRINTK=y
-CONFIG_EFI_EARLYCON=y
CONFIG_FIXED_PHY=y
-CONFIG_FONT_8x16=y
-CONFIG_FONT_AUTOSELECT=y
-CONFIG_FONT_SUPPORT=y
CONFIG_FW_LOADER_PAGED_BUF=y
CONFIG_GENERIC_ATOMIC64=y
CONFIG_GENERIC_CLOCKEVENTS=y
@@ -209,6 +205,7 @@ CONFIG_PHYLIB=y
CONFIG_PHYLINK=y
# CONFIG_PHY_RALINK_USB is not set
CONFIG_PINCTRL=y
+CONFIG_PINCTRL_AW9523=y
CONFIG_PINCTRL_RT2880=y
# CONFIG_PINCTRL_SINGLE is not set
CONFIG_PINCTRL_SX150X=y
@@ -222,7 +219,11 @@ CONFIG_RALINK=y
CONFIG_RATIONAL=y
CONFIG_RCU_NEED_SEGCBLIST=y
CONFIG_RCU_STALL_COMMON=y
+CONFIG_REED_SOLOMON=y
+CONFIG_REED_SOLOMON_DEC8=y
+CONFIG_REED_SOLOMON_ENC8=y
CONFIG_REGMAP=y
+CONFIG_REGMAP_I2C=y
CONFIG_REGMAP_MMIO=y
CONFIG_REGULATOR=y
CONFIG_REGULATOR_FIXED_VOLTAGE=y
--
2.25.1

View File

@@ -0,0 +1,52 @@
From 7d9a7204d421589a9514cf7f56de170e51889f2a Mon Sep 17 00:00:00 2001
From: John Crispin <john@phrozen.org>
Date: Wed, 4 May 2022 17:08:45 +0200
Subject: [PATCH] ramips: disable switch/bridge offload
This is breaking win10 laptops when vlan_filtering is enabled
Signed-off-by: John Crispin <john@phrozen.org>
---
target/linux/ramips/patches-5.4/992-dsa.patch | 30 +++++++++++++++++++
1 file changed, 30 insertions(+)
create mode 100644 target/linux/ramips/patches-5.4/992-dsa.patch
diff --git a/target/linux/ramips/patches-5.4/992-dsa.patch b/target/linux/ramips/patches-5.4/992-dsa.patch
new file mode 100644
index 0000000000..3c130a5be8
--- /dev/null
+++ b/target/linux/ramips/patches-5.4/992-dsa.patch
@@ -0,0 +1,30 @@
+Index: linux-5.4.158/drivers/net/dsa/mt7530.c
+===================================================================
+--- linux-5.4.158.orig/drivers/net/dsa/mt7530.c
++++ linux-5.4.158/drivers/net/dsa/mt7530.c
+@@ -1608,17 +1608,17 @@ static const struct dsa_switch_ops mt753
+ .port_enable = mt7530_port_enable,
+ .port_disable = mt7530_port_disable,
+ .port_stp_state_set = mt7530_stp_state_set,
+- .port_bridge_join = mt7530_port_bridge_join,
+- .port_bridge_leave = mt7530_port_bridge_leave,
++// .port_bridge_join = mt7530_port_bridge_join,
++// .port_bridge_leave = mt7530_port_bridge_leave,
+ .port_fdb_add = mt7530_port_fdb_add,
+ .port_fdb_del = mt7530_port_fdb_del,
+ .port_fdb_dump = mt7530_port_fdb_dump,
+- .port_vlan_filtering = mt7530_port_vlan_filtering,
+- .port_vlan_prepare = mt7530_port_vlan_prepare,
+- .port_vlan_add = mt7530_port_vlan_add,
+- .port_vlan_del = mt7530_port_vlan_del,
+- .port_mirror_add = mt7530_port_mirror_add,
+- .port_mirror_del = mt7530_port_mirror_del,
++// .port_vlan_filtering = mt7530_port_vlan_filtering,
++// .port_vlan_prepare = mt7530_port_vlan_prepare,
++// .port_vlan_add = mt7530_port_vlan_add,
++// .port_vlan_del = mt7530_port_vlan_del,
++// .port_mirror_add = mt7530_port_mirror_add,
++// .port_mirror_del = mt7530_port_mirror_del,
+ .phylink_validate = mt7530_phylink_validate,
+ .phylink_mac_link_state = mt7530_phylink_mac_link_state,
+ .phylink_mac_config = mt7530_phylink_mac_config,
--
2.25.1

View File

@@ -1,13 +1,12 @@
From d692bfd33a8169b47dcf200fcfd238cdbc4a4084 Mon Sep 17 00:00:00 2001
From 9572a5a438a8fc6e53283cdab8f56479509e476f Mon Sep 17 00:00:00 2001
From: John Crispin <john@phrozen.org>
Date: Sun, 2 Jan 2022 09:56:17 +0100
Subject: [PATCH 70/83] rtkmipsel: add kernel-version
Date: Sat, 7 May 2022 19:48:29 +0200
Subject: [PATCH] rtkmipsel: add kernel-version
Signed-off-by: John Crispin <john@phrozen.org>
---
include/kernel-version.mk | 2 ++
include/target.mk | 2 +-
2 files changed, 3 insertions(+), 1 deletion(-)
1 file changed, 2 insertions(+)
diff --git a/include/kernel-version.mk b/include/kernel-version.mk
index efecf2f919..787abfca14 100644
@@ -27,19 +26,6 @@ index efecf2f919..787abfca14 100644
LINUX_KERNEL_HASH-4.4.60 = e7f2f47acf17497d6ffd713eda65c025b3df0bce09faa8c04712bf1b3cfc9fdb
LINUX_KERNEL_HASH-4.14.193 = 0b0fb41d4430e1a42738b341cbfd2f41951aa5cd02acabbd53f076119c8b9f03
LINUX_KERNEL_HASH-5.4.158 = 6e018fecdc8fc24553756e582d83b82d65b10a6b03ef36262a24911f839b8d59
diff --git a/include/target.mk b/include/target.mk
index 691f8fb186..d198d59262 100644
--- a/include/target.mk
+++ b/include/target.mk
@@ -138,7 +138,7 @@ ifneq ($(TARGET_BUILD)$(if $(DUMP),,1),)
endif
GENERIC_PLATFORM_DIR := $(TOPDIR)/target/linux/generic
-ifeq ($(CONFIG_TARGET_ipq807x),y)
+ifeq ($(CONFIG_TARGET_ipq807x)$(CONFIG_TARGET_rtkmipsel),y)
GENERIC_BACKPORT_DIR :=
GENERIC_PATCH_DIR :=
GENERIC_HACK_DIR :=
--
2.25.1

View File

@@ -1,34 +1,36 @@
From 985c5b1cf2101c9824076b5fe1062b589f81f168 Mon Sep 17 00:00:00 2001
From 414f0c79a0fac86020f220b6feba518926420491 Mon Sep 17 00:00:00 2001
From: John Crispin <john@phrozen.org>
Date: Wed, 3 Nov 2021 14:33:31 +0100
Subject: [PATCH 49/51] kernel-headers: add v3.18->v5.10 support
Date: Sat, 7 May 2022 19:50:33 +0200
Subject: [PATCH 4/4] kernel-headers: add v3.18->v5.10 support
Signed-off-by: John Crispin <john@phrozen.org>
---
toolchain/kernel-headers/Makefile | 8 +++++++-
1 file changed, 7 insertions(+), 1 deletion(-)
toolchain/kernel-headers/Makefile | 12 ++++++++++++
1 file changed, 12 insertions(+)
diff --git a/toolchain/kernel-headers/Makefile b/toolchain/kernel-headers/Makefile
index 06236b5a47..df6e734bc2 100644
index c33f26d46d..a97f230d57 100644
--- a/toolchain/kernel-headers/Makefile
+++ b/toolchain/kernel-headers/Makefile
@@ -14,9 +14,15 @@ override HOST_QUILT:=
@@ -14,6 +14,18 @@ override HOST_QUILT:=
include $(INCLUDE_DIR)/target.mk
include $(INCLUDE_DIR)/kernel.mk
-ifeq ($(KERNEL_PATCHVER),4.4)
+
+ifneq ($(filter 3.18 4.4,$(KERNEL_PATCHVER)),)
KERNEL_PATCHVER := 5.10
KERNEL_NAME_SUFFIX:=
+ifneq ($(KERNEL_NAME_SUFFIX),)
+ KERNEL_PATCHVER := 5.10
+ KERNEL_NAME_SUFFIX:=
+ GENERIC_BACKPORT_DIR := $(GENERIC_PLATFORM_DIR)/backport$(if $(wildcard $(GENERIC_PLATFORM_DIR)/backport-$(KERNEL_PATCHVER)),-$(KERNEL_PATCHVER))
+ GENERIC_PATCH_DIR := $(GENERIC_PLATFORM_DIR)/pending$(if $(wildcard $(GENERIC_PLATFORM_DIR)/pending-$(KERNEL_PATCHVER)),-$(KERNEL_PATCHVER))
+ GENERIC_HACK_DIR := $(GENERIC_PLATFORM_DIR)/hack$(if $(wildcard $(GENERIC_PLATFORM_DIR)/hack-$(KERNEL_PATCHVER)),-$(KERNEL_PATCHVER))
+ GENERIC_FILES_DIR := $(foreach dir,$(wildcard $(GENERIC_PLATFORM_DIR)/files $(GENERIC_PLATFORM_DIR)/files-$(KERNEL_PATCHVER)),"$(dir)")
+ $(warning GENERIC_BACKPORT_DIR = $(GENERIC_BACKPORT_DIR))
endif
include $(INCLUDE_DIR)/kernel-version.mk
+ include $(INCLUDE_DIR)/kernel-version.mk
+ include $(INCLUDE_DIR)/kernel.mk
+endif
+
PKG_NAME:=linux
PKG_VERSION:=$(LINUX_VERSION)
PKG_SOURCE:=$(LINUX_SOURCE)
--
2.25.1

View File

@@ -1,7 +1,7 @@
From b982cd26327d9bfe9460b39916a7a8b519f59315 Mon Sep 17 00:00:00 2001
From aa6938c36045da952053965eefdb7a29049641e9 Mon Sep 17 00:00:00 2001
From: John Crispin <john@phrozen.org>
Date: Sun, 2 Jan 2022 10:09:59 +0100
Subject: [PATCH 1/2] rtkmipsel: select gcc-5 as the compiler
Date: Sun, 8 May 2022 07:03:08 +0200
Subject: [PATCH] rtkmipsel: select gcc-5 as the compiler
Signed-off-by: John Crispin <john@phrozen.org>
---

View File

@@ -0,0 +1,33 @@
From c56a1d430f797495d23829547b3cf595d8282c19 Mon Sep 17 00:00:00 2001
From: John Crispin <john@phrozen.org>
Date: Mon, 2 May 2022 08:46:19 +0200
Subject: [PATCH] hostapd: fix phy level max-assoc settings
Signed-off-by: John Crispin <john@phrozen.org>
---
.../services/hostapd/patches/780-maxassoc.patch | 13 +++++++++++++
1 file changed, 13 insertions(+)
create mode 100644 package/network/services/hostapd/patches/780-maxassoc.patch
diff --git a/package/network/services/hostapd/patches/780-maxassoc.patch b/package/network/services/hostapd/patches/780-maxassoc.patch
new file mode 100644
index 0000000000..98840f382a
--- /dev/null
+++ b/package/network/services/hostapd/patches/780-maxassoc.patch
@@ -0,0 +1,13 @@
+Index: hostapd-2021-02-20-59e9794c/src/ap/sta_info.c
+===================================================================
+--- hostapd-2021-02-20-59e9794c.orig/src/ap/sta_info.c
++++ hostapd-2021-02-20-59e9794c/src/ap/sta_info.c
+@@ -717,7 +717,7 @@ struct sta_info * ap_sta_add(struct host
+ return sta;
+
+ wpa_printf(MSG_DEBUG, " New STA");
+- if (hapd->num_sta >= hapd->conf->max_num_sta) {
++ if (hostapd_check_max_sta(hapd)) {
+ /* FIX: might try to remove some old STAs first? */
+ wpa_printf(MSG_DEBUG, "no more room for new STAs (%d/%d)",
+ hapd->num_sta, hapd->conf->max_num_sta);
--
2.25.1

View File

@@ -0,0 +1,32 @@
From 43a6bc51c3e71201a32ab0f03606eb078eff19ee Mon Sep 17 00:00:00 2001
From: Arif Alam <arif.alam@netexperience.com>
Date: Tue, 26 Apr 2022 17:37:58 -0400
Subject: [PATCH] netifd: add psk radius
Signed-off-by: Arif Alam <arif.alam@netexperience.com>
---
.../config/netifd/patches/200-psk-radius.patch | 12 ++++++++++++
1 file changed, 12 insertions(+)
create mode 100644 package/network/config/netifd/patches/200-psk-radius.patch
diff --git a/package/network/config/netifd/patches/200-psk-radius.patch b/package/network/config/netifd/patches/200-psk-radius.patch
new file mode 100644
index 0000000000..b6f6cdfda0
--- /dev/null
+++ b/package/network/config/netifd/patches/200-psk-radius.patch
@@ -0,0 +1,12 @@
+--- a/scripts/netifd-wireless.sh
++++ b/scripts/netifd-wireless.sh
+@@ -260,6 +260,9 @@ wireless_vif_parse_encryption() {
+ wpa3*)
+ auth_type=eap256
+ ;;
++ psk2-radius*)
++ auth_type=psk2-radius
++ ;;
+ psk3-mixed*|sae-mixed*)
+ auth_type=psk-sae
+ ;;
--
2.25.1

View File

@@ -0,0 +1,972 @@
From 658484bf494873895a1e78835a65ed8297e67348 Mon Sep 17 00:00:00 2001
From: John Crispin <john@phrozen.org>
Date: Mon, 30 May 2022 14:57:44 +0200
Subject: [PATCH 14/15] hostapd: add psk2-radius support
Signed-off-by: John Crispin <john@phrozen.org>
---
...ACL-PSK-check-during-4-way-handshake.patch | 484 ++++++++++++++++++
...ributes-with-Extended-Types-RFC-6929.patch | 350 +++++++++++++
...ibutes-for-EAPOL-Key-message-details.patch | 102 ++++
3 files changed, 936 insertions(+)
create mode 100644 package/network/services/hostapd/patches/n00-001-RADIUS-ACL-PSK-check-during-4-way-handshake.patch
create mode 100644 package/network/services/hostapd/patches/n00-002-RADIUS-Attributes-with-Extended-Types-RFC-6929.patch
create mode 100644 package/network/services/hostapd/patches/n00-003-RADIUS-attributes-for-EAPOL-Key-message-details.patch
diff --git a/package/network/services/hostapd/patches/n00-001-RADIUS-ACL-PSK-check-during-4-way-handshake.patch b/package/network/services/hostapd/patches/n00-001-RADIUS-ACL-PSK-check-during-4-way-handshake.patch
new file mode 100644
index 0000000000..7a265ecc6b
--- /dev/null
+++ b/package/network/services/hostapd/patches/n00-001-RADIUS-ACL-PSK-check-during-4-way-handshake.patch
@@ -0,0 +1,484 @@
+From 1c3438fec4bad13a676617915ff56af54e7b4542 Mon Sep 17 00:00:00 2001
+From: Jouni Malinen <j@w1.fi>
+Date: Sat, 2 Apr 2022 13:12:43 +0300
+Subject: [PATCH] RADIUS ACL/PSK check during 4-way handshake
+
+Add an alternative sequence for performing the RADIUS ACL check and PSK
+fetch. The previously used (macaddr_acl=2, wpa_psk_radius=2) combination
+does this during IEEE 802.11 Authentication frame exchange while the new
+option (wpa_psk_radius=3) does this during the 4-way handshake. This
+allows some more information to be provided to the RADIUS authentication
+server.
+
+Signed-off-by: Jouni Malinen <j@w1.fi>
+---
+ hostapd/config_file.c | 3 +-
+ hostapd/hostapd.conf | 5 ++-
+ src/ap/ap_config.c | 4 ++-
+ src/ap/ap_config.h | 5 +--
+ src/ap/ieee802_11.c | 5 ++-
+ src/ap/ieee802_11.h | 2 ++
+ src/ap/ieee802_11_auth.c | 76 ++++++++++++++++++++++++++++++++++++----
+ src/ap/ieee802_11_auth.h | 5 ++-
+ src/ap/wpa_auth.c | 51 ++++++++++++++++++++++++++-
+ src/ap/wpa_auth.h | 9 ++++-
+ src/ap/wpa_auth_glue.c | 25 ++++++++++++-
+ src/ap/wpa_auth_i.h | 1 +
+ 12 files changed, 172 insertions(+), 19 deletions(-)
+
+Index: hostapd-2022-01-16-cff80b4f/hostapd/config_file.c
+===================================================================
+--- hostapd-2022-01-16-cff80b4f.orig/hostapd/config_file.c
++++ hostapd-2022-01-16-cff80b4f/hostapd/config_file.c
+@@ -2989,7 +2989,8 @@ static int hostapd_config_fill(struct ho
+ bss->wpa_psk_radius = atoi(pos);
+ if (bss->wpa_psk_radius != PSK_RADIUS_IGNORED &&
+ bss->wpa_psk_radius != PSK_RADIUS_ACCEPTED &&
+- bss->wpa_psk_radius != PSK_RADIUS_REQUIRED) {
++ bss->wpa_psk_radius != PSK_RADIUS_REQUIRED &&
++ bss->wpa_psk_radius != PSK_RADIUS_DURING_4WAY_HS) {
+ wpa_printf(MSG_ERROR,
+ "Line %d: unknown wpa_psk_radius %d",
+ line, bss->wpa_psk_radius);
+Index: hostapd-2022-01-16-cff80b4f/hostapd/hostapd.conf
+===================================================================
+--- hostapd-2022-01-16-cff80b4f.orig/hostapd/hostapd.conf
++++ hostapd-2022-01-16-cff80b4f/hostapd/hostapd.conf
+@@ -1651,12 +1651,15 @@ own_ip_addr=127.0.0.1
+ #wpa_psk_file=/etc/hostapd.wpa_psk
+
+ # Optionally, WPA passphrase can be received from RADIUS authentication server
+-# This requires macaddr_acl to be set to 2 (RADIUS)
++# This requires macaddr_acl to be set to 2 (RADIUS) for wpa_psk_radius values
++# 1 and 2.
+ # 0 = disabled (default)
+ # 1 = optional; use default passphrase/psk if RADIUS server does not include
+ # Tunnel-Password
+ # 2 = required; reject authentication if RADIUS server does not include
+ # Tunnel-Password
++# 3 = ask RADIUS server during 4-way handshake if there is no locally
++# configured PSK/passphrase for the STA
+ #wpa_psk_radius=0
+
+ # Set of accepted key management algorithms (WPA-PSK, WPA-EAP, or both). The
+Index: hostapd-2022-01-16-cff80b4f/src/ap/ap_config.c
+===================================================================
+--- hostapd-2022-01-16-cff80b4f.orig/src/ap/ap_config.c
++++ hostapd-2022-01-16-cff80b4f/src/ap/ap_config.c
+@@ -1,6 +1,6 @@
+ /*
+ * hostapd / Configuration helper functions
+- * Copyright (c) 2003-2014, Jouni Malinen <j@w1.fi>
++ * Copyright (c) 2003-2022, Jouni Malinen <j@w1.fi>
+ *
+ * This software may be distributed under the terms of the BSD license.
+ * See README for more details.
+@@ -1245,6 +1245,7 @@ static int hostapd_config_check_bss(stru
+
+ if (full_config && bss->wpa &&
+ bss->wpa_psk_radius != PSK_RADIUS_IGNORED &&
++ bss->wpa_psk_radius != PSK_RADIUS_DURING_4WAY_HS &&
+ bss->macaddr_acl != USE_EXTERNAL_RADIUS_AUTH) {
+ wpa_printf(MSG_ERROR, "WPA-PSK using RADIUS enabled, but no "
+ "RADIUS checking (macaddr_acl=2) enabled.");
+@@ -1254,6 +1255,7 @@ static int hostapd_config_check_bss(stru
+ if (full_config && bss->wpa && (bss->wpa_key_mgmt & WPA_KEY_MGMT_PSK) &&
+ bss->ssid.wpa_psk == NULL && bss->ssid.wpa_passphrase == NULL &&
+ bss->ssid.wpa_psk_file == NULL &&
++ bss->wpa_psk_radius != PSK_RADIUS_DURING_4WAY_HS &&
+ (bss->wpa_psk_radius != PSK_RADIUS_REQUIRED ||
+ bss->macaddr_acl != USE_EXTERNAL_RADIUS_AUTH)) {
+ wpa_printf(MSG_ERROR, "WPA-PSK enabled, but PSK or passphrase "
+Index: hostapd-2022-01-16-cff80b4f/src/ap/ap_config.h
+===================================================================
+--- hostapd-2022-01-16-cff80b4f.orig/src/ap/ap_config.h
++++ hostapd-2022-01-16-cff80b4f/src/ap/ap_config.h
+@@ -1,6 +1,6 @@
+ /*
+ * hostapd / Configuration definitions and helpers functions
+- * Copyright (c) 2003-2015, Jouni Malinen <j@w1.fi>
++ * Copyright (c) 2003-2022, Jouni Malinen <j@w1.fi>
+ *
+ * This software may be distributed under the terms of the BSD license.
+ * See README for more details.
+@@ -369,7 +369,8 @@ struct hostapd_bss_config {
+ enum {
+ PSK_RADIUS_IGNORED = 0,
+ PSK_RADIUS_ACCEPTED = 1,
+- PSK_RADIUS_REQUIRED = 2
++ PSK_RADIUS_REQUIRED = 2,
++ PSK_RADIUS_DURING_4WAY_HS = 3,
+ } wpa_psk_radius;
+ int wpa_pairwise;
+ int group_cipher; /* wpa_group value override from configuation */
+Index: hostapd-2022-01-16-cff80b4f/src/ap/ieee802_11.c
+===================================================================
+--- hostapd-2022-01-16-cff80b4f.orig/src/ap/ieee802_11.c
++++ hostapd-2022-01-16-cff80b4f/src/ap/ieee802_11.c
+@@ -2315,9 +2315,8 @@ static int ieee802_11_allowed_address(st
+ }
+
+
+-static int
+-ieee802_11_set_radius_info(struct hostapd_data *hapd, struct sta_info *sta,
+- int res, struct radius_sta *info)
++int ieee802_11_set_radius_info(struct hostapd_data *hapd, struct sta_info *sta,
++ int res, struct radius_sta *info)
+ {
+ u32 session_timeout = info->session_timeout;
+ u32 acct_interim_interval = info->acct_interim_interval;
+Index: hostapd-2022-01-16-cff80b4f/src/ap/ieee802_11.h
+===================================================================
+--- hostapd-2022-01-16-cff80b4f.orig/src/ap/ieee802_11.h
++++ hostapd-2022-01-16-cff80b4f/src/ap/ieee802_11.h
+@@ -196,5 +196,7 @@ void auth_sae_process_commit(void *eloop
+ u8 * hostapd_eid_rsnxe(struct hostapd_data *hapd, u8 *eid, size_t len);
+ size_t hostapd_eid_rnr_len(struct hostapd_data *hapd, u32 type);
+ u8 * hostapd_eid_rnr(struct hostapd_data *hapd, u8 *eid, u32 type);
++int ieee802_11_set_radius_info(struct hostapd_data *hapd, struct sta_info *sta,
++ int res, struct radius_sta *info);
+
+ #endif /* IEEE802_11_H */
+Index: hostapd-2022-01-16-cff80b4f/src/ap/ieee802_11_auth.c
+===================================================================
+--- hostapd-2022-01-16-cff80b4f.orig/src/ap/ieee802_11_auth.c
++++ hostapd-2022-01-16-cff80b4f/src/ap/ieee802_11_auth.c
+@@ -1,6 +1,6 @@
+ /*
+ * hostapd / IEEE 802.11 authentication (ACL)
+- * Copyright (c) 2003-2012, Jouni Malinen <j@w1.fi>
++ * Copyright (c) 2003-2022, Jouni Malinen <j@w1.fi>
+ *
+ * This software may be distributed under the terms of the BSD license.
+ * See README for more details.
+@@ -20,6 +20,8 @@
+ #include "hostapd.h"
+ #include "ap_config.h"
+ #include "ap_drv_ops.h"
++#include "sta_info.h"
++#include "wpa_auth.h"
+ #include "ieee802_11.h"
+ #include "ieee802_1x.h"
+ #include "ieee802_11_auth.h"
+@@ -43,6 +45,8 @@ struct hostapd_acl_query_data {
+ u8 *auth_msg; /* IEEE 802.11 authentication frame from station */
+ size_t auth_msg_len;
+ struct hostapd_acl_query_data *next;
++ bool radius_psk;
++ int akm;
+ };
+
+
+@@ -153,6 +157,13 @@ static int hostapd_radius_acl_query(stru
+ goto fail;
+ }
+
++ if (query->akm &&
++ !radius_msg_add_attr_int32(msg, RADIUS_ATTR_WLAN_AKM_SUITE,
++ wpa_akm_to_suite(query->akm))) {
++ wpa_printf(MSG_DEBUG, "Could not add WLAN-AKM-Suite");
++ goto fail;
++ }
++
+ if (radius_client_send(hapd->radius, msg, RADIUS_AUTH, addr) < 0)
+ goto fail;
+ return 0;
+@@ -557,17 +568,40 @@ hostapd_acl_recv_radius(struct radius_ms
+ cache->next = hapd->acl_cache;
+ hapd->acl_cache = cache;
+
++ if (query->radius_psk) {
++ struct sta_info *sta;
++ bool success = cache->accepted == HOSTAPD_ACL_ACCEPT;
++
++ sta = ap_get_sta(hapd, query->addr);
++ if (!sta || !sta->wpa_sm) {
++ wpa_printf(MSG_DEBUG,
++ "No STA/SM entry found for the RADIUS PSK response");
++ goto done;
++ }
++#ifdef NEED_AP_MLME
++ if (success &&
++ (ieee802_11_set_radius_info(hapd, sta, cache->accepted,
++ info) < 0 ||
++ ap_sta_bind_vlan(hapd, sta) < 0))
++ success = false;
++#endif /* NEED_AP_MLME */
++ wpa_auth_sta_radius_psk_resp(sta->wpa_sm, success);
++ } else {
+ #ifdef CONFIG_DRIVER_RADIUS_ACL
+- hostapd_drv_set_radius_acl_auth(hapd, query->addr, cache->accepted,
+- info->session_timeout);
++ hostapd_drv_set_radius_acl_auth(hapd, query->addr,
++ cache->accepted,
++ info->session_timeout);
+ #else /* CONFIG_DRIVER_RADIUS_ACL */
+ #ifdef NEED_AP_MLME
+- /* Re-send original authentication frame for 802.11 processing */
+- wpa_printf(MSG_DEBUG, "Re-sending authentication frame after "
+- "successful RADIUS ACL query");
+- ieee802_11_mgmt(hapd, query->auth_msg, query->auth_msg_len, NULL);
++ /* Re-send original authentication frame for 802.11 processing
++ */
++ wpa_printf(MSG_DEBUG,
++ "Re-sending authentication frame after successful RADIUS ACL query");
++ ieee802_11_mgmt(hapd, query->auth_msg, query->auth_msg_len,
++ NULL);
+ #endif /* NEED_AP_MLME */
+ #endif /* CONFIG_DRIVER_RADIUS_ACL */
++ }
+
+ done:
+ if (prev == NULL)
+@@ -649,3 +683,31 @@ void hostapd_free_psk_list(struct hostap
+ os_free(prev);
+ }
+ }
++
++
++#ifndef CONFIG_NO_RADIUS
++void hostapd_acl_req_radius_psk(struct hostapd_data *hapd, const u8 *addr,
++ int key_mgmt, const u8 *anonce,
++ const u8 *eapol, size_t eapol_len)
++{
++ struct hostapd_acl_query_data *query;
++
++ query = os_zalloc(sizeof(*query));
++ if (!query)
++ return;
++
++ query->radius_psk = true;
++ query->akm = key_mgmt;
++ os_get_reltime(&query->timestamp);
++ os_memcpy(query->addr, addr, ETH_ALEN);
++ if (hostapd_radius_acl_query(hapd, addr, query)) {
++ wpa_printf(MSG_DEBUG,
++ "Failed to send Access-Request for RADIUS PSK/ACL query");
++ hostapd_acl_query_free(query);
++ return;
++ }
++
++ query->next = hapd->acl_queries;
++ hapd->acl_queries = query;
++}
++#endif /* CONFIG_NO_RADIUS */
+Index: hostapd-2022-01-16-cff80b4f/src/ap/ieee802_11_auth.h
+===================================================================
+--- hostapd-2022-01-16-cff80b4f.orig/src/ap/ieee802_11_auth.h
++++ hostapd-2022-01-16-cff80b4f/src/ap/ieee802_11_auth.h
+@@ -1,6 +1,6 @@
+ /*
+ * hostapd / IEEE 802.11 authentication (ACL)
+- * Copyright (c) 2003-2005, Jouni Malinen <j@w1.fi>
++ * Copyright (c) 2003-2022, Jouni Malinen <j@w1.fi>
+ *
+ * This software may be distributed under the terms of the BSD license.
+ * See README for more details.
+@@ -36,5 +36,8 @@ void hostapd_free_psk_list(struct hostap
+ void hostapd_acl_expire(struct hostapd_data *hapd);
+ void hostapd_copy_psk_list(struct hostapd_sta_wpa_psk_short **psk,
+ struct hostapd_sta_wpa_psk_short *src);
++void hostapd_acl_req_radius_psk(struct hostapd_data *hapd, const u8 *addr,
++ int key_mgmt, const u8 *anonce,
++ const u8 *eapol, size_t eapol_len);
+
+ #endif /* IEEE802_11_AUTH_H */
+Index: hostapd-2022-01-16-cff80b4f/src/ap/wpa_auth.c
+===================================================================
+--- hostapd-2022-01-16-cff80b4f.orig/src/ap/wpa_auth.c
++++ hostapd-2022-01-16-cff80b4f/src/ap/wpa_auth.c
+@@ -1,6 +1,6 @@
+ /*
+ * IEEE 802.11 RSN / WPA Authenticator
+- * Copyright (c) 2004-2019, Jouni Malinen <j@w1.fi>
++ * Copyright (c) 2004-2022, Jouni Malinen <j@w1.fi>
+ *
+ * This software may be distributed under the terms of the BSD license.
+ * See README for more details.
+@@ -1481,6 +1481,12 @@ static void wpa_send_eapol_timeout(void
+ struct wpa_authenticator *wpa_auth = eloop_ctx;
+ struct wpa_state_machine *sm = timeout_ctx;
+
++ if (sm->waiting_radius_psk) {
++ wpa_auth_logger(wpa_auth, sm->addr, LOGGER_DEBUG,
++ "Ignore EAPOL-Key timeout while waiting for RADIUS PSK");
++ return;
++ }
++
+ sm->pending_1_of_4_timeout = 0;
+ wpa_auth_logger(wpa_auth, sm->addr, LOGGER_DEBUG, "EAPOL-Key timeout");
+ sm->TimeoutEvt = true;
+@@ -3017,6 +3023,19 @@ SM_STATE(WPA_PTK, PTKCALCNEGOTIATING)
+ break;
+ }
+
++ if (!ok && wpa_key_mgmt_wpa_psk_no_sae(sm->wpa_key_mgmt) &&
++ wpa_auth->conf.radius_psk && wpa_auth->cb->request_radius_psk &&
++ !sm->waiting_radius_psk) {
++ wpa_printf(MSG_DEBUG, "No PSK available - ask RADIUS server");
++ wpa_auth->cb->request_radius_psk(wpa_auth->cb_ctx, sm->addr,
++ sm->wpa_key_mgmt,
++ sm->ANonce,
++ sm->last_rx_eapol_key,
++ sm->last_rx_eapol_key_len);
++ sm->waiting_radius_psk = 1;
++ return;
++ }
++
+ if (!ok) {
+ wpa_auth_logger(sm->wpa_auth, sm->addr, LOGGER_DEBUG,
+ "invalid MIC in msg 2/4 of 4-Way Handshake");
+@@ -3774,6 +3793,11 @@ SM_STEP(WPA_PTK)
+ } else if (wpa_auth_uses_sae(sm) && sm->pmksa) {
+ SM_ENTER(WPA_PTK, PTKSTART);
+ #endif /* CONFIG_SAE */
++ } else if (wpa_key_mgmt_wpa_psk_no_sae(sm->wpa_key_mgmt) &&
++ wpa_auth->conf.radius_psk) {
++ wpa_printf(MSG_DEBUG,
++ "INITPSK: No PSK yet available for STA - use RADIUS later");
++ SM_ENTER(WPA_PTK, PTKSTART);
+ } else {
+ wpa_auth_logger(wpa_auth, sm->addr, LOGGER_INFO,
+ "no PSK configured for the STA");
+@@ -5688,3 +5712,28 @@ void wpa_auth_set_ocv_override_freq(stru
+ }
+
+ #endif /* CONFIG_TESTING_OPTIONS */
++
++
++void wpa_auth_sta_radius_psk_resp(struct wpa_state_machine *sm, bool success)
++{
++ if (!sm->waiting_radius_psk) {
++ wpa_printf(MSG_DEBUG,
++ "Ignore RADIUS PSK response for " MACSTR
++ " that did not wait one",
++ MAC2STR(sm->addr));
++ return;
++ }
++
++ wpa_printf(MSG_DEBUG, "RADIUS PSK response for " MACSTR " (%s)",
++ MAC2STR(sm->addr), success ? "success" : "fail");
++ sm->waiting_radius_psk = 0;
++
++ if (success) {
++ /* Try to process the EAPOL-Key msg 2/4 again */
++ sm->EAPOLKeyReceived = true;
++ } else {
++ sm->Disconnect = true;
++ }
++
++ eloop_register_timeout(0, 0, wpa_sm_call_step, sm, NULL);
++}
+Index: hostapd-2022-01-16-cff80b4f/src/ap/wpa_auth.h
+===================================================================
+--- hostapd-2022-01-16-cff80b4f.orig/src/ap/wpa_auth.h
++++ hostapd-2022-01-16-cff80b4f/src/ap/wpa_auth.h
+@@ -1,6 +1,6 @@
+ /*
+ * hostapd - IEEE 802.11i-2004 / WPA Authenticator
+- * Copyright (c) 2004-2017, Jouni Malinen <j@w1.fi>
++ * Copyright (c) 2004-2022, Jouni Malinen <j@w1.fi>
+ *
+ * This software may be distributed under the terms of the BSD license.
+ * See README for more details.
+@@ -273,6 +273,8 @@ struct wpa_auth_config {
+ * PTK derivation regardless of advertised capabilities.
+ */
+ bool force_kdk_derivation;
++
++ bool radius_psk;
+ };
+
+ typedef enum {
+@@ -320,6 +322,9 @@ struct wpa_auth_callbacks {
+ void (*store_ptksa)(void *ctx, const u8 *addr, int cipher,
+ u32 life_time, const struct wpa_ptk *ptk);
+ void (*clear_ptksa)(void *ctx, const u8 *addr, int cipher);
++ void (*request_radius_psk)(void *ctx, const u8 *addr, int key_mgmt,
++ const u8 *anonce,
++ const u8 *eapol, size_t eapol_len);
+ #ifdef CONFIG_IEEE80211R_AP
+ struct wpa_state_machine * (*add_sta)(void *ctx, const u8 *sta_addr);
+ int (*add_sta_ft)(void *ctx, const u8 *sta_addr);
+@@ -572,4 +577,6 @@ void wpa_auth_set_ocv_override_freq(stru
+ enum wpa_auth_ocv_override_frame frame,
+ unsigned int freq);
+
++void wpa_auth_sta_radius_psk_resp(struct wpa_state_machine *sm, bool success);
++
+ #endif /* WPA_AUTH_H */
+Index: hostapd-2022-01-16-cff80b4f/src/ap/wpa_auth_glue.c
+===================================================================
+--- hostapd-2022-01-16-cff80b4f.orig/src/ap/wpa_auth_glue.c
++++ hostapd-2022-01-16-cff80b4f/src/ap/wpa_auth_glue.c
+@@ -1,6 +1,6 @@
+ /*
+ * hostapd / WPA authenticator glue code
+- * Copyright (c) 2002-2012, Jouni Malinen <j@w1.fi>
++ * Copyright (c) 2002-2022, Jouni Malinen <j@w1.fi>
+ *
+ * This software may be distributed under the terms of the BSD license.
+ * See README for more details.
+@@ -29,6 +29,7 @@
+ #include "ap_drv_ops.h"
+ #include "ap_config.h"
+ #include "ieee802_11.h"
++#include "ieee802_11_auth.h"
+ #include "pmksa_cache_auth.h"
+ #include "wpa_auth.h"
+ #include "wpa_auth_glue.h"
+@@ -214,6 +215,8 @@ static void hostapd_wpa_auth_conf(struct
+ wconf->force_kdk_derivation = conf->force_kdk_derivation;
+ #endif /* CONFIG_TESTING_OPTIONS */
+ #endif /* CONFIG_PASN */
++
++ wconf->radius_psk = conf->wpa_psk_radius == PSK_RADIUS_DURING_4WAY_HS;
+ }
+
+
+@@ -1444,6 +1447,23 @@ static void hostapd_wpa_unregister_ft_ou
+ #endif /* CONFIG_IEEE80211R_AP */
+
+
++#ifndef CONFIG_NO_RADIUS
++static void hostapd_request_radius_psk(void *ctx, const u8 *addr, int key_mgmt,
++ const u8 *anonce,
++ const u8 *eapol, size_t eapol_len)
++{
++ struct hostapd_data *hapd = ctx;
++
++ wpa_printf(MSG_DEBUG, "RADIUS PSK request for " MACSTR " key_mgmt=0x%x",
++ MAC2STR(addr), key_mgmt);
++ wpa_hexdump(MSG_DEBUG, "ANonce", anonce, WPA_NONCE_LEN);
++ wpa_hexdump(MSG_DEBUG, "EAPOL", eapol, eapol_len);
++ hostapd_acl_req_radius_psk(hapd, addr, key_mgmt, anonce, eapol,
++ eapol_len);
++}
++#endif /* CONFIG_NO_RADIUS */
++
++
+ int hostapd_setup_wpa(struct hostapd_data *hapd)
+ {
+ struct wpa_auth_config _conf;
+@@ -1487,6 +1507,9 @@ int hostapd_setup_wpa(struct hostapd_dat
+ .set_session_timeout = hostapd_wpa_auth_set_session_timeout,
+ .get_session_timeout = hostapd_wpa_auth_get_session_timeout,
+ #endif /* CONFIG_IEEE80211R_AP */
++#ifndef CONFIG_NO_RADIUS
++ .request_radius_psk = hostapd_request_radius_psk,
++#endif /* CONFIG_NO_RADIUS */
+ };
+ const u8 *wpa_ie;
+ size_t wpa_ie_len;
+Index: hostapd-2022-01-16-cff80b4f/src/ap/wpa_auth_i.h
+===================================================================
+--- hostapd-2022-01-16-cff80b4f.orig/src/ap/wpa_auth_i.h
++++ hostapd-2022-01-16-cff80b4f/src/ap/wpa_auth_i.h
+@@ -89,6 +89,7 @@ struct wpa_state_machine {
+ unsigned int rx_eapol_key_secure:1;
+ unsigned int update_snonce:1;
+ unsigned int alt_snonce_valid:1;
++ unsigned int waiting_radius_psk:1;
+ #ifdef CONFIG_IEEE80211R_AP
+ unsigned int ft_completed:1;
+ unsigned int pmk_r1_name_valid:1;
diff --git a/package/network/services/hostapd/patches/n00-002-RADIUS-Attributes-with-Extended-Types-RFC-6929.patch b/package/network/services/hostapd/patches/n00-002-RADIUS-Attributes-with-Extended-Types-RFC-6929.patch
new file mode 100644
index 0000000000..eef9117176
--- /dev/null
+++ b/package/network/services/hostapd/patches/n00-002-RADIUS-Attributes-with-Extended-Types-RFC-6929.patch
@@ -0,0 +1,350 @@
+From 24763e3cd0a564eb71f3c501bbb4fbb0d7070762 Mon Sep 17 00:00:00 2001
+From: Jouni Malinen <j@w1.fi>
+Date: Fri, 15 Apr 2022 17:31:48 +0300
+Subject: [PATCH] RADIUS: Attributes with Extended Types (RFC 6929)
+
+Supported extended types for RADIUS attributes for the cases defined in
+RFC 6929.
+
+Signed-off-by: Jouni Malinen <j@w1.fi>
+---
+ src/radius/radius.c | 195 ++++++++++++++++++++++++++++++++++++++------
+ src/radius/radius.h | 26 +++++-
+ 2 files changed, 193 insertions(+), 28 deletions(-)
+
+diff --git a/src/radius/radius.c b/src/radius/radius.c
+index be16e27b9..a64228067 100644
+--- a/src/radius/radius.c
++++ b/src/radius/radius.c
+@@ -1,6 +1,6 @@
+ /*
+ * RADIUS message processing
+- * Copyright (c) 2002-2009, 2011-2015, Jouni Malinen <j@w1.fi>
++ * Copyright (c) 2002-2009, 2011-2022, Jouni Malinen <j@w1.fi>
+ *
+ * This software may be distributed under the terms of the BSD license.
+ * See README for more details.
+@@ -159,7 +159,8 @@ static const char *radius_code_string(u8 code)
+
+
+ struct radius_attr_type {
+- u8 type;
++ u16 type; /* 0..255 for basic types;
++ * (241 << 8) | <ext-type> for extended types */
+ char *name;
+ enum {
+ RADIUS_ATTR_UNDIST, RADIUS_ATTR_TEXT, RADIUS_ATTR_IP,
+@@ -260,11 +261,31 @@ static const struct radius_attr_type radius_attrs[] =
+ RADIUS_ATTR_HEXDUMP },
+ { RADIUS_ATTR_WLAN_GROUP_MGMT_CIPHER, "WLAN-Group-Mgmt-Pairwise-Cipher",
+ RADIUS_ATTR_HEXDUMP },
++ { RADIUS_ATTR_EXT_TYPE_1, "Extended-Type-1", RADIUS_ATTR_UNDIST },
++ { RADIUS_ATTR_EXT_TYPE_2, "Extended-Type-2", RADIUS_ATTR_UNDIST },
++ { RADIUS_ATTR_EXT_TYPE_3, "Extended-Type-3", RADIUS_ATTR_UNDIST },
++ { RADIUS_ATTR_EXT_TYPE_4, "Extended-Type-4", RADIUS_ATTR_UNDIST },
++ { RADIUS_ATTR_LONG_EXT_TYPE_1, "Long-Extended-Type-1",
++ RADIUS_ATTR_UNDIST },
++ { RADIUS_ATTR_LONG_EXT_TYPE_2, "Long-Extended-Type-2",
++ RADIUS_ATTR_UNDIST },
++ { RADIUS_ATTR_EXT_VENDOR_SPECIFIC_1, "Extended-Vendor-Specific-1",
++ RADIUS_ATTR_UNDIST },
++ { RADIUS_ATTR_EXT_VENDOR_SPECIFIC_2, "Extended-Vendor-Specific-2",
++ RADIUS_ATTR_UNDIST },
++ { RADIUS_ATTR_EXT_VENDOR_SPECIFIC_3, "Extended-Vendor-Specific-3",
++ RADIUS_ATTR_UNDIST },
++ { RADIUS_ATTR_EXT_VENDOR_SPECIFIC_4, "Extended-Vendor-Specific-4",
++ RADIUS_ATTR_UNDIST },
++ { RADIUS_ATTR_EXT_VENDOR_SPECIFIC_5, "Extended-Vendor-Specific-5",
++ RADIUS_ATTR_UNDIST },
++ { RADIUS_ATTR_EXT_VENDOR_SPECIFIC_6, "Extended-Vendor-Specific-6",
++ RADIUS_ATTR_UNDIST },
+ };
+ #define RADIUS_ATTRS ARRAY_SIZE(radius_attrs)
+
+
+-static const struct radius_attr_type *radius_get_attr_type(u8 type)
++static const struct radius_attr_type * radius_get_attr_type(u16 type)
+ {
+ size_t i;
+
+@@ -277,23 +298,60 @@ static const struct radius_attr_type *radius_get_attr_type(u8 type)
+ }
+
+
++static bool radius_is_long_ext_type(u8 type)
++{
++ return type == RADIUS_ATTR_LONG_EXT_TYPE_1 ||
++ type == RADIUS_ATTR_LONG_EXT_TYPE_2;
++}
++
++
++static bool radius_is_ext_type(u8 type)
++{
++ return type >= RADIUS_ATTR_EXT_TYPE_1 &&
++ type <= RADIUS_ATTR_LONG_EXT_TYPE_2;
++}
++
++
+ static void radius_msg_dump_attr(struct radius_attr_hdr *hdr)
+ {
++ struct radius_attr_hdr_ext *ext = NULL;
+ const struct radius_attr_type *attr;
+ int len;
+ unsigned char *pos;
+ char buf[1000];
+
+- attr = radius_get_attr_type(hdr->type);
++ if (hdr->length < sizeof(struct radius_attr_hdr))
++ return;
+
+- wpa_printf(MSG_INFO, " Attribute %d (%s) length=%d",
+- hdr->type, attr ? attr->name : "?Unknown?", hdr->length);
++ if (radius_is_ext_type(hdr->type)) {
++ if (hdr->length < 4) {
++ wpa_printf(MSG_INFO,
++ " Invalid attribute %d (too short for extended type)",
++ hdr->type);
++ return;
++ }
+
+- if (attr == NULL || hdr->length < sizeof(struct radius_attr_hdr))
+- return;
++ ext = (struct radius_attr_hdr_ext *) hdr;
++ }
++
++ if (ext) {
++ attr = radius_get_attr_type((ext->type << 8) | ext->ext_type);
++ wpa_printf(MSG_INFO, " Attribute %d.%d (%s) length=%d",
++ ext->type, ext->ext_type,
++ attr ? attr->name : "?Unknown?", ext->length);
++ pos = (unsigned char *) (ext + 1);
++ len = ext->length - sizeof(struct radius_attr_hdr_ext);
++ } else {
++ attr = radius_get_attr_type(hdr->type);
++ wpa_printf(MSG_INFO, " Attribute %d (%s) length=%d",
++ hdr->type, attr ? attr->name : "?Unknown?",
++ hdr->length);
++ pos = (unsigned char *) (hdr + 1);
++ len = hdr->length - sizeof(struct radius_attr_hdr);
++ }
+
+- len = hdr->length - sizeof(struct radius_attr_hdr);
+- pos = (unsigned char *) (hdr + 1);
++ if (!attr)
++ return;
+
+ switch (attr->data_type) {
+ case RADIUS_ATTR_TEXT:
+@@ -627,22 +685,54 @@ static int radius_msg_add_attr_to_array(struct radius_msg *msg,
+ }
+
+
+-struct radius_attr_hdr *radius_msg_add_attr(struct radius_msg *msg, u8 type,
+- const u8 *data, size_t data_len)
++struct radius_attr_hdr * radius_msg_add_attr(struct radius_msg *msg, u16 type,
++ const u8 *data, size_t data_len)
+ {
+- size_t buf_needed;
+- struct radius_attr_hdr *attr;
++ size_t buf_needed, max_len;
++ struct radius_attr_hdr *attr = NULL;
++ struct radius_attr_hdr_ext *ext;
++ u8 ext_type = 0;
+
+ if (TEST_FAIL())
+ return NULL;
+
+- if (data_len > RADIUS_MAX_ATTR_LEN) {
+- wpa_printf(MSG_ERROR, "radius_msg_add_attr: too long attribute (%lu bytes)",
+- (unsigned long) data_len);
+- return NULL;
++ if (type > 255) {
++ if (!radius_is_ext_type(type >> 8)) {
++ wpa_printf(MSG_ERROR,
++ "%s: Undefined extended type %d.%d",
++ __func__, type >> 8, type & 0xff);
++ return NULL;
++ }
++ ext_type = type & 0xff;
++ type >>= 8;
++ } else if (radius_is_ext_type(type)) {
++ wpa_printf(MSG_ERROR, "%s: Unexpected extended type use for %d",
++ __func__, type);
+ }
+
+- buf_needed = sizeof(*attr) + data_len;
++ if (radius_is_long_ext_type(type)) {
++ size_t hdr_len = sizeof(struct radius_attr_hdr_ext) + 1;
++ size_t plen = 255 - hdr_len;
++ size_t num;
++
++ max_len = 4096;
++ num = (data_len + plen - 1) / plen;
++ if (num == 0)
++ num = 1;
++ buf_needed = num * hdr_len + data_len;
++ } else if (radius_is_ext_type(type)) {
++ max_len = RADIUS_MAX_EXT_ATTR_LEN;
++ buf_needed = sizeof(struct radius_attr_hdr_ext) + data_len;
++ } else {
++ max_len = RADIUS_MAX_ATTR_LEN;
++ buf_needed = sizeof(*attr) + data_len;
++ }
++ if (data_len > max_len) {
++ wpa_printf(MSG_ERROR,
++ "%s: too long attribute (%zu > %zu bytes)",
++ __func__, data_len, max_len);
++ return NULL;
++ }
+
+ if (wpabuf_tailroom(msg->buf) < buf_needed) {
+ /* allocate more space for message buffer */
+@@ -651,13 +741,44 @@ struct radius_attr_hdr *radius_msg_add_attr(struct radius_msg *msg, u8 type,
+ msg->hdr = wpabuf_mhead(msg->buf);
+ }
+
+- attr = wpabuf_put(msg->buf, sizeof(struct radius_attr_hdr));
+- attr->type = type;
+- attr->length = sizeof(*attr) + data_len;
+- wpabuf_put_data(msg->buf, data, data_len);
+-
+- if (radius_msg_add_attr_to_array(msg, attr))
+- return NULL;
++ if (radius_is_long_ext_type(type)) {
++ size_t plen = 255 - sizeof(struct radius_attr_hdr_ext) - 1;
++ size_t alen;
++
++ do {
++ alen = data_len > plen ? plen : data_len;
++ ext = wpabuf_put(msg->buf,
++ sizeof(struct radius_attr_hdr_ext));
++ if (!attr)
++ attr = (struct radius_attr_hdr *) ext;
++ ext->type = type;
++ ext->length = sizeof(*ext) + 1 + alen;
++ ext->ext_type = ext_type;
++ wpabuf_put_u8(msg->buf, data_len > alen ? 0x80 : 0);
++ wpabuf_put_data(msg->buf, data, data_len);
++ data += alen;
++ data_len -= alen;
++ if (radius_msg_add_attr_to_array(
++ msg, (struct radius_attr_hdr *) ext))
++ return NULL;
++ } while (data_len > 0);
++ } else if (radius_is_ext_type(type)) {
++ ext = wpabuf_put(msg->buf, sizeof(struct radius_attr_hdr_ext));
++ attr = (struct radius_attr_hdr *) ext;
++ ext->type = type;
++ ext->length = sizeof(*ext) + data_len;
++ ext->ext_type = ext_type;
++ wpabuf_put_data(msg->buf, data, data_len);
++ if (radius_msg_add_attr_to_array(msg, attr))
++ return NULL;
++ } else {
++ attr = wpabuf_put(msg->buf, sizeof(struct radius_attr_hdr));
++ attr->type = type;
++ attr->length = sizeof(*attr) + data_len;
++ wpabuf_put_data(msg->buf, data, data_len);
++ if (radius_msg_add_attr_to_array(msg, attr))
++ return NULL;
++ }
+
+ return attr;
+ }
+@@ -1285,6 +1406,28 @@ int radius_msg_add_wfa(struct radius_msg *msg, u8 subtype, const u8 *data,
+ }
+
+
++int radius_msg_add_ext_vs(struct radius_msg *msg, u16 type, u32 vendor_id,
++ u8 vendor_type, const u8 *data, size_t len)
++{
++ struct radius_attr_hdr *attr;
++ u8 *buf, *pos;
++ size_t alen;
++
++ alen = 4 + 1 + len;
++ buf = os_malloc(alen);
++ if (!buf)
++ return 0;
++ pos = buf;
++ WPA_PUT_BE32(pos, vendor_id);
++ pos += 4;
++ *pos++ = vendor_type;
++ os_memcpy(pos, data, len);
++ attr = radius_msg_add_attr(msg, type, buf, alen);
++ os_free(buf);
++ return attr != NULL;
++}
++
++
+ int radius_user_password_hide(struct radius_msg *msg,
+ const u8 *data, size_t data_len,
+ const u8 *secret, size_t secret_len,
+diff --git a/src/radius/radius.h b/src/radius/radius.h
+index fb8148180..490c8d1f6 100644
+--- a/src/radius/radius.h
++++ b/src/radius/radius.h
+@@ -1,6 +1,6 @@
+ /*
+ * RADIUS message processing
+- * Copyright (c) 2002-2009, 2012, 2014-2015, Jouni Malinen <j@w1.fi>
++ * Copyright (c) 2002-2009, 2012, 2014-2022, Jouni Malinen <j@w1.fi>
+ *
+ * This software may be distributed under the terms of the BSD license.
+ * See README for more details.
+@@ -46,7 +46,15 @@ struct radius_attr_hdr {
+ /* followed by length-2 octets of attribute value */
+ } STRUCT_PACKED;
+
++struct radius_attr_hdr_ext {
++ u8 type;
++ u8 length; /* including this header */
++ u8 ext_type;
++ /* followed by length-3 octets of attribute value */
++} STRUCT_PACKED;
++
+ #define RADIUS_MAX_ATTR_LEN (255 - sizeof(struct radius_attr_hdr))
++#define RADIUS_MAX_EXT_ATTR_LEN (255 - sizeof(struct radius_attr_hdr_ext))
+
+ enum { RADIUS_ATTR_USER_NAME = 1,
+ RADIUS_ATTR_USER_PASSWORD = 2,
+@@ -113,6 +121,18 @@ enum { RADIUS_ATTR_USER_NAME = 1,
+ RADIUS_ATTR_WLAN_GROUP_CIPHER = 187,
+ RADIUS_ATTR_WLAN_AKM_SUITE = 188,
+ RADIUS_ATTR_WLAN_GROUP_MGMT_CIPHER = 189,
++ RADIUS_ATTR_EXT_TYPE_1 = 241,
++ RADIUS_ATTR_EXT_TYPE_2 = 242,
++ RADIUS_ATTR_EXT_TYPE_3 = 243,
++ RADIUS_ATTR_EXT_TYPE_4 = 244,
++ RADIUS_ATTR_LONG_EXT_TYPE_1 = 245,
++ RADIUS_ATTR_LONG_EXT_TYPE_2 = 246,
++ RADIUS_ATTR_EXT_VENDOR_SPECIFIC_1 = (241 << 8) | 26,
++ RADIUS_ATTR_EXT_VENDOR_SPECIFIC_2 = (242 << 8) | 26,
++ RADIUS_ATTR_EXT_VENDOR_SPECIFIC_3 = (243 << 8) | 26,
++ RADIUS_ATTR_EXT_VENDOR_SPECIFIC_4 = (244 << 8) | 26,
++ RADIUS_ATTR_EXT_VENDOR_SPECIFIC_5 = (245 << 8) | 26,
++ RADIUS_ATTR_EXT_VENDOR_SPECIFIC_6 = (246 << 8) | 26,
+ };
+
+
+@@ -257,7 +277,7 @@ int radius_msg_verify_acct_req(struct radius_msg *msg, const u8 *secret,
+ int radius_msg_verify_das_req(struct radius_msg *msg, const u8 *secret,
+ size_t secret_len,
+ int require_message_authenticator);
+-struct radius_attr_hdr * radius_msg_add_attr(struct radius_msg *msg, u8 type,
++struct radius_attr_hdr * radius_msg_add_attr(struct radius_msg *msg, u16 type,
+ const u8 *data, size_t data_len);
+ struct radius_msg * radius_msg_parse(const u8 *data, size_t len);
+ int radius_msg_add_eap(struct radius_msg *msg, const u8 *data,
+@@ -284,6 +304,8 @@ int radius_msg_add_mppe_keys(struct radius_msg *msg,
+ const u8 *recv_key, size_t recv_key_len);
+ int radius_msg_add_wfa(struct radius_msg *msg, u8 subtype, const u8 *data,
+ size_t len);
++int radius_msg_add_ext_vs(struct radius_msg *msg, u16 type, u32 vendor_id,
++ u8 vendor_type, const u8 *data, size_t len);
+ int radius_user_password_hide(struct radius_msg *msg,
+ const u8 *data, size_t data_len,
+ const u8 *secret, size_t secret_len,
+--
+2.25.1
+
diff --git a/package/network/services/hostapd/patches/n00-003-RADIUS-attributes-for-EAPOL-Key-message-details.patch b/package/network/services/hostapd/patches/n00-003-RADIUS-attributes-for-EAPOL-Key-message-details.patch
new file mode 100644
index 0000000000..df8baa7856
--- /dev/null
+++ b/package/network/services/hostapd/patches/n00-003-RADIUS-attributes-for-EAPOL-Key-message-details.patch
@@ -0,0 +1,102 @@
+From b94371af8402f60218716552e571ca72cff4e3c0 Mon Sep 17 00:00:00 2001
+From: Jouni Malinen <j@w1.fi>
+Date: Fri, 15 Apr 2022 17:36:25 +0300
+Subject: [PATCH] RADIUS attributes for EAPOL-Key message details
+
+Use vendor specific RADIUS attributes for sending ANonce and EAPOL-Key
+msg 2/4 for the wpa_psk_radius=3 case. The vendor specific attributes
+for this are defined in FreeRADIUS as follows:
+
+BEGIN-VENDOR FreeRADIUS format=Extended-Vendor-Specific-5
+ATTRIBUTE FreeRADIUS-802.1X-Anonce 1 octets[32]
+ATTRIBUTE FreeRADIUS-802.1X-EAPoL-Key-Msg 2 octets
+END-VENDOR FreeRADIUS
+
+Signed-off-by: Jouni Malinen <j@w1.fi>
+---
+ src/ap/ieee802_11_auth.c | 29 +++++++++++++++++++++++++++++
+ src/radius/radius.h | 7 +++++++
+ 2 files changed, 36 insertions(+)
+
+diff --git a/src/ap/ieee802_11_auth.c b/src/ap/ieee802_11_auth.c
+index a54d7616e..4277d82cb 100644
+--- a/src/ap/ieee802_11_auth.c
++++ b/src/ap/ieee802_11_auth.c
+@@ -47,6 +47,9 @@ struct hostapd_acl_query_data {
+ struct hostapd_acl_query_data *next;
+ bool radius_psk;
+ int akm;
++ u8 *anonce;
++ u8 *eapol;
++ size_t eapol_len;
+ };
+
+
+@@ -102,6 +105,8 @@ static void hostapd_acl_query_free(struct hostapd_acl_query_data *query)
+ if (!query)
+ return;
+ os_free(query->auth_msg);
++ os_free(query->anonce);
++ os_free(query->eapol);
+ os_free(query);
+ }
+
+@@ -164,6 +169,24 @@ static int hostapd_radius_acl_query(struct hostapd_data *hapd, const u8 *addr,
+ goto fail;
+ }
+
++ if (query->anonce &&
++ !radius_msg_add_ext_vs(msg, RADIUS_ATTR_EXT_VENDOR_SPECIFIC_5,
++ RADIUS_VENDOR_ID_FREERADIUS,
++ RADIUS_VENDOR_ATTR_FREERADIUS_802_1X_ANONCE,
++ query->anonce, WPA_NONCE_LEN)) {
++ wpa_printf(MSG_DEBUG, "Could not add FreeRADIUS-802.1X-Anonce");
++ goto fail;
++ }
++
++ if (query->eapol &&
++ !radius_msg_add_ext_vs(msg, RADIUS_ATTR_EXT_VENDOR_SPECIFIC_5,
++ RADIUS_VENDOR_ID_FREERADIUS,
++ RADIUS_VENDOR_ATTR_FREERADIUS_802_1X_EAPOL_KEY_MSG,
++ query->eapol, query->eapol_len)) {
++ wpa_printf(MSG_DEBUG, "Could not add FreeRADIUS-802.1X-EAPoL-Key-Msg");
++ goto fail;
++ }
++
+ if (radius_client_send(hapd->radius, msg, RADIUS_AUTH, addr) < 0)
+ goto fail;
+ return 0;
+@@ -703,6 +726,12 @@ void hostapd_acl_req_radius_psk(struct hostapd_data *hapd, const u8 *addr,
+ query->akm = key_mgmt;
+ os_get_reltime(&query->timestamp);
+ os_memcpy(query->addr, addr, ETH_ALEN);
++ if (anonce)
++ query->anonce = os_memdup(anonce, WPA_NONCE_LEN);
++ if (eapol) {
++ query->eapol = os_memdup(eapol, eapol_len);
++ query->eapol_len = eapol_len;
++ }
+ if (hostapd_radius_acl_query(hapd, addr, query)) {
+ wpa_printf(MSG_DEBUG,
+ "Failed to send Access-Request for RADIUS PSK/ACL query");
+diff --git a/src/radius/radius.h b/src/radius/radius.h
+index 490c8d1f6..177c64a66 100644
+--- a/src/radius/radius.h
++++ b/src/radius/radius.h
+@@ -208,6 +208,13 @@ enum { RADIUS_VENDOR_ATTR_MS_MPPE_SEND_KEY = 16,
+ RADIUS_VENDOR_ATTR_MS_MPPE_RECV_KEY = 17
+ };
+
++/* FreeRADIUS vendor-specific attributes */
++#define RADIUS_VENDOR_ID_FREERADIUS 11344
++/* Extended-Vendor-Specific-5 (245.26; long extended header) */
++enum {
++ RADIUS_VENDOR_ATTR_FREERADIUS_802_1X_ANONCE = 1,
++ RADIUS_VENDOR_ATTR_FREERADIUS_802_1X_EAPOL_KEY_MSG = 2,
++};
+
+ /* Hotspot 2.0 - WFA Vendor-specific RADIUS Attributes */
+ #define RADIUS_VENDOR_ID_WFA 40808
+--
+2.25.1
+
--
2.25.1

View File

@@ -0,0 +1,38 @@
From 8f55fad4bbc1e9f04b263a1dc2d3897de52c8b38 Mon Sep 17 00:00:00 2001
From: John Crispin <john@phrozen.org>
Date: Tue, 31 May 2022 08:09:20 +0200
Subject: [PATCH 15/15] hostapd: add psk2-radius support
Signed-off-by: John Crispin <john@phrozen.org>
---
package/network/services/hostapd/files/hostapd.sh | 7 ++++++-
1 file changed, 6 insertions(+), 1 deletion(-)
diff --git a/package/network/services/hostapd/files/hostapd.sh b/package/network/services/hostapd/files/hostapd.sh
index df1aec0b42..d117a24975 100644
--- a/package/network/services/hostapd/files/hostapd.sh
+++ b/package/network/services/hostapd/files/hostapd.sh
@@ -704,7 +704,7 @@ hostapd_set_bss_options() {
set_default ieee80211w 2
set_default sae_require_mfp 1
;;
- psk-sae|eap-eap256)
+ psk-sae|psk2-radius|eap-eap256)
set_default ieee80211w 1
set_default sae_require_mfp 1
;;
@@ -767,6 +767,11 @@ hostapd_set_bss_options() {
append bss_conf "wep_default_key=$wep_keyidx" "$N"
[ -n "$wep_rekey" ] && append bss_conf "wep_rekey_period=$wep_rekey" "$N"
;;
+ psk2-radius)
+ append bss_conf "wpa_psk_radius=3" "$N"
+ append_radius_server
+ vlan_possible=1
+ ;;
esac
local auth_algs=$((($auth_mode_shared << 1) | $auth_mode_open))
--
2.25.1

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