From 89b376d0a47c78ee8a63fcabdea7d20639bd2c67 Mon Sep 17 00:00:00 2001 From: kanoqwq Date: Fri, 2 Oct 2026 23:38:44 +0800 Subject: [PATCH] fix(tf): retain IPv6 client routes and carry WLAN RX repair --- docs/KERNEL-PATCH-AUDIT.md | 19 ++++++ openwrt/overlay/etc/uci-defaults/90-mu300 | 7 +- openwrt/overlay/opt/mu300/bin/ndp-learn | 70 ++++++++++++++++++-- upstream/make-bundle.sh | 8 +++ upstream/modules/sprd_wlan_combo/sc2355/rx.c | 26 +++----- 5 files changed, 109 insertions(+), 21 deletions(-) create mode 100644 docs/KERNEL-PATCH-AUDIT.md diff --git a/docs/KERNEL-PATCH-AUDIT.md b/docs/KERNEL-PATCH-AUDIT.md new file mode 100644 index 00000000..a55e7009 --- /dev/null +++ b/docs/KERNEL-PATCH-AUDIT.md @@ -0,0 +1,19 @@ +# 5.4 vendor patch audit for the 6.18 / 7.2 builds + +The mainline builds use the same `upstream/modules/` vendor module source. `upstream/build-modules.sh` copies that source at build time; it does not apply `kernel/patches/`. A source fix is therefore shared by both kernels, but **already-built modules and TF packages do not update automatically**. + +| 5.4 patch | 6.18 / 7.2 status | +| --- | --- | +| `bluetooth-marlin3-link-policy` | Kernel equivalent: `upstream/patches/0002-*`. | +| `of-reserved-mem-skip` | Kernel equivalent: `upstream/patches/0003-*`. | +| `of-reserved-mem-add` | Not applicable to the current minimal DT and module set; it only reserves RAM for the optional audio DSP port. Do not add reservations without audio. | +| `regdb-wens-certificate` | Not carried over. The mainline config does not request signed-regdb verification; the running 7.2.8 system uses country TR and operates a channel-36/80-MHz AP. Its early `regulatory.db` load fails because the file is absent, not because a signature is rejected. Revisit if signed regdb is enabled. | +| `sipa-delegate-einprogress` | Present in `upstream/modules/sprd_modem/sipa_delegate/`. | +| `sipc-base-addr-attr` | Present in `upstream/modules/sprd_modem/sipc/` and `mailbox/`; the unusable attributes are absent. | +| `sprdbt-tty-one-port` | Present in `upstream/modules/sprdbt_tty/tty-pcie/tty.c`. | +| `wcn-pcie-scan-timeout` | Present in `upstream/modules/wcn_bsp/pcie/pcie.c`. | +| `wlan_combo-5ghz-ap-ds-params`, `allow-bridging-ap`, `ap-stations-channel`, `default-board-config`, `pcie-post-init-retry`, `tx-complock-irqsave` | Present in `upstream/modules/sprd_wlan_combo/`. | +| `wlan_combo-rx-software-checksum` | Present in the shared source after the 7.2.8 Wi-Fi repair. The running 7.2.8 module was verified to return `CHECKSUM_NONE` without calling `rx_ipv6_csum`. **The existing `upstream/out` (6.18) and `upstream/out-7.2` module binaries still have the old checksum path and must be rebuilt before packaging.** | +| `audio-mem-fixed-region`, `audio-mem-shm-shift`, `mcdt-enable-clock`, `sprd-card-dummy-on-defer` | Only used by the separate optional 5.4 audio build. No corresponding audio modules are in the current 6.18 / 7.2 module set. | + +Verification performed on the running 7.2.8 device: Wi-Fi AP is up at 5 GHz/80 MHz, the module hash matches the newly built `upstream/out-7.2.8` module, and disassembly of its `sc2355_fill_skb_csum` returns zero after setting `CHECKSUM_NONE`. Disassembly of the existing 6.18 and earlier 7.2 artifacts still contains the old IPv6 checksum branch. This audit is about patch parity, not a claim that every subsystem has been exhaustively runtime-tested. diff --git a/openwrt/overlay/etc/uci-defaults/90-mu300 b/openwrt/overlay/etc/uci-defaults/90-mu300 index 3e88662a..8dafba52 100755 --- a/openwrt/overlay/etc/uci-defaults/90-mu300 +++ b/openwrt/overlay/etc/uci-defaults/90-mu300 @@ -34,8 +34,11 @@ UCI # - firewall masq6: egress NAT66 through the device's own public address (the carrier routes # one address per bearer; Android's tethering does the same) # - lan ip6assign + a ULA: a local range for the LAN itself -# - ndp-learn (init.d/mu300-ndp) pins host routes for each client public address: without -# them NAT66 replies follow sipa_eth0's connected /64 and never reach the client +# - ndp-learn (init.d/mu300-ndp) routes the carrier's /64 to br-lan: NAT66 replies +# (and any traffic inside the prefix) then reach clients through on-link NDP on the +# LAN. Without that route the lookup falls through to the default route and the +# reply leaves through the modem; per-address /128 pins are kept only as a +# latency optimisation for already-known neighbours uci -q batch </dev/null + old_stem=${1%::/64} + # `ip route show` prints host routes without the implicit /128 suffix. + for r in $(ip -6 route show dev br-lan 2>/dev/null | + awk -v stem="$old_stem:" '$1 !~ /\// && index($1,stem)==1 {print $1}'); do + ip -6 route del "$r/128" dev br-lan 2>/dev/null + done +} + +last_prefix= while :; do + # /proc/net/if_inet6 uses fixed-width hex, so this also handles prefixes + # whose first four hextets are compressed by `ip -6 addr`. + prefix=$(awk '$6=="sipa_eth0" && $4=="00" { + for (i=1; i<=4; i++) { + h=substr($1,(i-1)*4+1,4); sub(/^0+/,"",h); + if (h=="") h="0"; + printf "%s%s", (i>1?":":""), h; + } + print "::/64"; exit + }' /proc/net/if_inet6 2>/dev/null) + if [ -z "$prefix" ] && [ -n "$last_prefix" ]; then + drop_old_prefix "$last_prefix" + last_prefix= + fi + if [ -n "$prefix" ] && [ "$prefix" != "$last_prefix" ]; then + drop_old_prefix "$last_prefix" + ip -6 route replace "$prefix" dev br-lan metric 1024 2>/dev/null + last_prefix=$prefix + logger -t ndp-learn "LAN prefix route: $prefix dev br-lan" + fi + # odhcpd can learn a downstream client's /128 on the WAN side. That + # more-specific route overrides the LAN /64 and blackholes NAT66 replies. + # Remove only host routes inside the shared prefix; the LAN /64 resolves + # the client by NDP even before it appears in the neighbour table. + if [ -n "$prefix" ]; then + stem=${prefix%::/64} + for r in $(ip -6 route show dev sipa_eth0 2>/dev/null | + awk -v stem="$stem:" '$1 !~ /\// && index($1,stem)==1 {print $1}'); do + ip -6 route del "$r/128" dev sipa_eth0 2>/dev/null + done + ip -6 route show "$prefix" dev br-lan 2>/dev/null | grep -q 'dev br-lan' || + ip -6 route replace "$prefix" dev br-lan metric 1024 2>/dev/null + fi for a in $(ip -6 neigh show dev br-lan 2>/dev/null | cut -d' ' -f1 | grep -E '^[23][0-9a-f]*:'); do ip -6 route show "$a/128" 2>/dev/null | grep -q 'dev br-lan' || diff --git a/upstream/make-bundle.sh b/upstream/make-bundle.sh index eed388ca..6f75de6e 100755 --- a/upstream/make-bundle.sh +++ b/upstream/make-bundle.sh @@ -26,6 +26,14 @@ for m in "$UO"/modules/*.ko; do v=$(strings "$m" | sed -n 's/^vermagic=\([^ ]*\) .*/\1/p' | head -1) [ "$v" = "$krel" ] || { echo "$m is built for '$v', the kernel is '$krel'" >&2; exit 1; } done +# A matching vermagic is not enough: the shared WLAN source may have changed +# after this output was built (the IPv6 RX checksum fix exposed exactly that). +# Refuse a bundle containing the old binary rather than silently shipping it. +wlan_module=$UO/modules/sprd_wlan_combo.ko +if [ -f "$wlan_module" ] && [ -n "$(find "$U/modules/sprd_wlan_combo" -type f -newer "$wlan_module" -print -quit)" ]; then + echo "WLAN source is newer than $wlan_module; rebuild sprd_wlan_combo for $krel" >&2 + exit 1 +fi for m in $(cat "$U/module-order.txt"); do [ -f "$UO/modules/$m" ] || { echo "module-order.txt names $m, which was not built" >&2; exit 1; } done diff --git a/upstream/modules/sprd_wlan_combo/sc2355/rx.c b/upstream/modules/sprd_wlan_combo/sc2355/rx.c index 020bb656..965bda64 100644 --- a/upstream/modules/sprd_wlan_combo/sc2355/rx.c +++ b/upstream/modules/sprd_wlan_combo/sc2355/rx.c @@ -428,21 +428,17 @@ static void rx_net_work_queue(struct work_struct *work) inline int sc2355_fill_skb_csum(struct sk_buff *skb, unsigned short csum) { - int ret = 0; - - if (csum) { - ret = rx_ipv6_csum(skb->data, (__force __wsum)csum); - if (!ret) { - skb->ip_summed = CHECKSUM_COMPLETE; - skb->csum = (__force __wsum)csum; - } else if (ret > 0) { - skb->ip_summed = CHECKSUM_UNNECESSARY; - } - } else { - skb->ip_summed = CHECKSUM_NONE; - } - - return ret; + /* + * The firmware checksum does not match what the stack expects for CHECKSUM_COMPLETE: forwarded frames trigger + * "hw csum failure" with a full packet dump each time. Let the stack verify checksums in software. + * (Same as kernel/patches/wlan_combo-rx-software-checksum.patch does for the 5.4 build: without this, + * rx_ipv6_csum() returns -1 for IPv6 TCP/UDP frames whose msdu_len counts WiFi padding, and mm.c then + * drops the skb before netif_rx - every client IPv6 TCP/UDP frame over Wi-Fi vanished there.) + */ + (void)rx_ipv6_csum; + (void)csum; + skb->ip_summed = CHECKSUM_NONE; + return 0; } void sc2355_rx_send_cmd(struct sprd_hif *hif, void *data, int len,