fix(tf): retain IPv6 client routes and carry WLAN RX repair

This commit is contained in:
kanoqwq committed 2026-10-02 23:38:44 +08:00
1 parent 5e301d4f67
commit 89b376d0a4
5 files changed
+109 -21

No files matched your search

+19
View File
@@ -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.
+5 -2
View File
@@ -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 <<UCI
set network.lan.ip6assign='60'
set network.globals.ula_prefix='fd66:1126:7956::/48'
+66 -4
View File
@@ -1,9 +1,71 @@
#!/bin/sh
# Watch the LAN for public SLAAC addresses (odhcpd relay hands the carrier's /64 to
# clients) and pin a host route for each one. Without it, a reply coming back through
# NAT66 follows sipa_eth0's connected /64 route and dies on the wrong interface -
# measured: ICMP 100% loss, TCP connect timeouts, until the /128 exists.
# Watch the bearer's public SLAAC prefix and keep it routed to the LAN.
#
# The carrier hands out one /64 by RA on sipa_eth0, and odhcpd relays it to LAN
# clients, which SLAAC their own public addresses out of it. Replies to those
# addresses (NAT66 DNAT on the way back, or any traffic inside the prefix) must
# be delivered on br-lan - but no on-link route for the prefix exists there:
# mu300cell.sh flushes the bearer's v6 routes on every setup, so a lookup for
# a client address falls through to the default route and the reply leaves via
# the modem towards the carrier gateway, where it disappears. Measured: every
# connection from a client address without a pinned /128 timed out (stable
# SLAAC addresses never made it into the neighbour table, so only the privacy
# addresses ever got pinned), and Android clients reacted by suppressing AAAA
# queries for the whole network - "DNS resolves nothing over IPv6, IPv6 looks
# dead end to end" - until the next reconnect forgot the verdict.
#
# The /64 on br-lan is the primary mechanism: NDP there resolves each client
# on demand, with no race for addresses that never showed up in the neighbour
# table. The per-neighbour /128 pins below are kept as a small latency
# optimisation for known neighbours. The prefix is tracked so a carrier
# renumber replaces the route instead of stacking a stale one.
drop_old_prefix() {
[ -n "$1" ] || return
ip -6 route del "$1" dev br-lan 2>/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' ||
+8
View File
@@ -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
+11 -15
View File
@@ -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,