Skip to content

Fix: Replace 'pref' with 'priority' in ip rule for Android compatibility#21

Open
frendhisaido wants to merge 1 commit intoeventlOwOp:masterfrom
iethes:fix-android-policy-routing
Open

Fix: Replace 'pref' with 'priority' in ip rule for Android compatibility#21
frendhisaido wants to merge 1 commit intoeventlOwOp:masterfrom
iethes:fix-android-policy-routing

Conversation

@frendhisaido
Copy link
Copy Markdown

Summary

Fix ZeroTier connectivity on Android 14+ devices by replacing unsupported 'pref' keyword with 'priority' in ip rule commands.

Problem

After installing zerotier-magisk on Android 14 (API 34), ZeroTier service was running and connected, but pinging other devices resulted in 100% packet loss. The routing table showed correct routes, but they weren't being used.

Root Cause

The Magisk module's service.sh script attempted to add a high-priority routing rule:

ip rule add from all lookup main pref 1
ip -6 rule add from all lookup main pref 1

The pref keyword is not supported by Android's ip command (correct keyword is priority), causing these commands to fail silently on every boot. Without this rule, Android's default policy routing rules (priority 10000+) took precedence.

Solution

Changed pref 1 to priority 1 in magisk/lib.sh __start() function.

Testing

  • Device: Infinix X6833B (Android 14, API 34)
  • Architecture: arm64-v8a
  • IP command: iproute2-ss171113
  • ZeroTier: 1.14.2
  • Module: zerotier-magisk-aarch64-gcc-SSO-e2c0c3a

Verified:

  • ip rule add from all lookup main priority 1 works correctly
  • Routing rule persists after reboot
  • ZeroTier peers accessible without manual interface specification

…ompatibility

The 'pref' keyword is not supported by Android's ip command, causing routing
rules to fail silently on boot. This prevented ZeroTier traffic from being
routed through the ztyg2zjccj interface on Android 14+ devices.

Changed 'pref 1' to 'priority 1' in lib.sh __start() function to ensure
main routing table is consulted before Android's default policy rules
(priority 10000+).

Fixes issue where ZeroTier shows connected but cannot ping other peers
(100% packet loss) despite correct routing table configuration.

Tested on:
- Device: Infinix X6833B (Android 14, API 34)
- Architecture: arm64-v8a
- ZeroTier: 1.14.2
- Module: zerotier-magisk-aarch64-gcc-SSO-e2c0c3a
- IP command: iproute2-ss171113
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