Skip to content

Commit 24eba68

Browse files
committed
fix: guard Android network.sh against repeated netd trigger
1 parent 1442be6 commit 24eba68

1 file changed

Lines changed: 8 additions & 0 deletions

File tree

os-image/android/network.sh

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,13 @@
1414
IFACE=eth0
1515
NETID=100
1616

17+
# Guard against repeated invocations — cocoon-network.rc triggers on every
18+
# netd start/restart. Only run once; subsequent calls are no-ops.
19+
GUARD="/tmp/.cocoon-network-done"
20+
if [ -f "$GUARD" ]; then
21+
exit 0
22+
fi
23+
1724
cmdline_ip() {
1825
for x in $(cat /proc/cmdline); do
1926
case "$x" in
@@ -101,6 +108,7 @@ else
101108
ndc network route add "$NETID" "$IFACE" 0.0.0.0/0 "$GW" 2>/dev/null
102109
ndc network default set "$NETID" 2>/dev/null
103110
ndc network permission user set NETWORK "$NETID" 2>/dev/null
111+
touch "$GUARD"
104112
fi
105113

106114
# Set DNS (no ConnectivityService to configure resolvers).

0 commit comments

Comments
 (0)