Skip to content

kernel: enable IPv4 policy routing (ip rule) for modem.py - #140

Open
shunnag wants to merge 1 commit into
commaai:masterfrom
shunnag:kernel-policy-routing
Open

shunnag wants to merge 1 commit into
commaai:masterfrom
shunnag:kernel-policy-routing

Conversation

@shunnag

@shunnag shunnag commented Oct 21, 2026

Copy link
Copy Markdown

Enable CONFIG_IP_ADVANCED_ROUTER and CONFIG_IP_MULTIPLE_TABLES, so ip rule works. This is the kernel part of #139.

After PPP comes up, modem.py adds a default route via ppp0 in table 1000 and runs ip rule add from <ip> table 1000. Neither arm64 defconfig nor vamos.config sets these options, so on the released kernel the rule fails with Operation not supported and modem.py tears down the routes and retries. On master LTE still goes through ModemManager, so today this only matters on liberation-day-7.2.

Key test (details and the other runs are in #139): comma four on liberation-day-7.2, the same userland in both runs (unmodified modem.py, test stand-ins for killall and resolvectl on PATH), about 10 min with Wi-Fi, then about 5 min without.

kernel result
released (7.2.0-vamos-7626c37) ip rule fails 4.6/min, pppd killed each time (90 pppd PIDs). modem.log: route install failed (ip rule add from <ip> table 1000): RTNETLINK answers: Operation not supported 70 times, route set up 0 times. Without Wi-Fi: no LTE default route, name lookups fail.
with these 2 lines (c2a60cf) held: one pppd, no route changes, name lookups OK with and without Wi-Fi

So fixing the userland alone is not enough. c2a60cf is a local test build that also has the 4 NAT lines from #134 and ath10k Wi-Fi patches (#135 and a series on linux-wireless; not LTE), swapped in as boot.img only; one run each.

Config check: a build with only these 2 lines at this position differs from the released kernel's embedded config only in IP_ADVANCED_ROUTER, IP_MULTIPLE_TABLES and FIB_RULES (ikconfig_R0_vs_R3_2lines.txt). I did not boot it. ikconfig_R0_vs_R1.txt shows the config of the tested build (taken from e9735b3, the same config without the ath10k patches).

Based on master like #134; it also applies to liberation-day-7.2, and I can retarget it. The 2 lines go after CONFIG_IPV6=y, so this PR, #134 and #110 merge without conflicts (local git merge).

Not tested: master, IPv6, a full image build.

I worked through this with Claude (AI). English is hard for me, so AI helped write the English. I ran all the device tests myself on my comma four.
ikconfig_R0_vs_R1.txt
ikconfig_R0_vs_R3_2lines.txt

openpilot's modem.py runs "ip rule add from <ip> table 1000" after PPP
comes up. Without CONFIG_IP_MULTIPLE_TABLES this fails with "Operation
not supported", and modem.py tears down the routes and retries.

Enable CONFIG_IP_ADVANCED_ROUTER and CONFIG_IP_MULTIPLE_TABLES. This
also turns on CONFIG_FIB_RULES. IPv6 policy routing stays off.
@github-actions

Copy link
Copy Markdown

vamOS System Profile

Changes vs master

Metric Change
Used space 3558.0MB → 3559.2MB (+1.1MB)
Sparse image 3507.3MB → 3509.3MB (+2.0MB)
Package count 529 → 529

Added packages: MesaLib-devel-26.2.5_2, NetworkManager-1.58.1_1, SPIRV-LLVM-Translator22-22.1.7_1, Vulkan-Headers-1.4.363.0_1, ca-certificates-20250419+3.131.1_2, freetype-2.15.0_1, freetype-devel-2.15.0_1, gawk-5.4.1_1, gdb-18.1_1, gdb-common-18.1_1, libgbm-26.2.5_2, libgbm-devel-26.2.5_2, libnm-1.58.1_1, mesa-26.2.5_2, mesa-dri-26.2.5_2, mesa-libgallium-26.2.5_2, mesa-opencl-26.2.5_2, vulkan-loader-1.4.363.0_1, vulkan-loader-devel-1.4.363.0_1

Removed packages: MesaLib-devel-26.2.5_1, NetworkManager-1.56.0_1, SPIRV-LLVM-Translator22-22.1.6_1, Vulkan-Headers-1.4.357.0_1, ca-certificates-20250419+3.127_1, freetype-2.14.3_1, freetype-devel-2.14.3_1, gawk-5.3.2_1, gdb-17.2_1, gdb-common-17.2_1, libgbm-26.2.5_1, libgbm-devel-26.2.5_1, libnm-1.56.0_1, mesa-26.2.5_1, mesa-dri-26.2.5_1, mesa-libgallium-26.2.5_1, mesa-opencl-26.2.5_1, vulkan-loader-1.4.357.0_1, vulkan-loader-devel-1.4.357.0_1

Directory size changes (>1MB)
Directory Change

Metric Value
Used space 3559.2MB / 5959.5MB
Files 54787
Directories 4696
Symlinks 3389
Packages 529

Top 10 Directories

Directory Size

Category Breakdown

Category Size %
xbps packages 2654.8MB 74.5%
Python venv 591.8MB 16.6%
Firmware 11.2MB .3%
Other 301.2MB 8.4%

Top 10 Packages by Size

Package Size
mit-krb5-libs-1.21.3_1 270.4MB
gawk-5.4.1_1 210.3MB
llvm-21_3 141.5MB
libllvm21-21.1.8_1 134.6MB
libldns-1.9.2_1 124.3MB
pd-mapper-1.0_1 74MB
glib-2.88.3_1 67.4MB
gcc-14.2.1+20250405_4 67.1MB
libclang-cpp21-21.1.8_1 58.4MB
libcap-progs-2.78_1 56MB

Top 30 Files by Size

File Size
/usr/lib/llvm/22/lib/libLLVM.so.22.1 134.5MB
/usr/lib/llvm/21/lib/libLLVM.so.21.1 124.3MB
/usr/lib/llvm/21/lib/libMLIR.so.21.1 89.7MB
/usr/lib/llvm/21/bin/mlir-transform-opt 82.9MB
/usr/lib/llvm/22/lib/libclang-cpp.so.22.1 58.4MB
/usr/lib/llvm/21/lib/libclang-cpp.so.21.1 56MB
/usr/lib/llvm/21/bin/mlir-translate 53.2MB
/usr/lib/llvm/21/bin/llvm-exegesis 52MB
/usr/lib/llvm/21/bin/llvm-bolt-binary-analysis 50.6MB
/usr/lib/gcc/aarch64-linux-gnu/14.2/gnat1 40.1MB
/usr/bin/gdb 39.5MB
/usr/lib/libgallium-26.2.5.so 38.5MB
/usr/lib/gcc/aarch64-linux-gnu/14.2/cc1plus 37.3MB
/usr/lib/libRusticlOpenCL.so.1.0.0 35.5MB
/usr/lib/libllvm-qcom.so 35.2MB
/usr/lib/gcc/aarch64-linux-gnu/14.2/cc1 35.2MB
/usr/lib/gcc/aarch64-linux-gnu/14.2/lto1 33.9MB
/usr/bin/lto-dump 33.9MB
/usr/local/venv/bin/ruff 31.8MB
/usr/share/icu/78.3/icudt78l.dat 31.5MB
/usr/lib/llvm/21/lib/libclang.so.21.1.8 30.2MB
/usr/bin/uv 30.2MB
/usr/lib/libz3.so 28.8MB
/usr/lib/llvm/21/bin/c-index-test 28.6MB
/usr/local/venv/lib/python3.12/site-packages/gcc_arm_none_eabi/toolchain/libexec/gcc/arm-none-eabi/13.2.1/cc1 28.2MB
/usr/bin/run 26.8MB
/usr/local/venv/lib/python3.12/site-packages/numpy.libs/libscipy_openblas64_-71e1b124.so 23.6MB
/usr/comma/updater 23.5MB
/usr/comma/setup 23.5MB
/usr/comma/reset 23.5MB

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant