File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -92,15 +92,13 @@ if [ -z "$GW" ]; then
9292 log -t cocoon-network " WARN: no gateway found; skip ndc setup"
9393else
9494 # Register network with netd so it owns the routes and policy tables.
95+ # Destroy first in case a previous run left a stale network registration.
96+ ndc network destroy " $NETID " 2> /dev/null
9597 ndc network create " $NETID " 2> /dev/null
9698 ndc network interface add " $NETID " " $IFACE " 2> /dev/null
99+ SUBNET=" $( ip -4 route show table main 2> /dev/null | sed -n " s#^\([0-9.][0-9./]*\) dev ${IFACE} .*#\1#p" | head -1) "
100+ [ -n " $SUBNET " ] && ndc network route add " $NETID " " $IFACE " " $SUBNET " 2> /dev/null
97101 ndc network route add " $NETID " " $IFACE " 0.0.0.0/0 " $GW " 2> /dev/null
98- SRC=" $( iface_src) "
99- if [ -n " $SRC " ]; then
100- # Add subnet route so netd can resolve L2 for local destinations.
101- SUBNET=" $( ip -4 route show table main 2> /dev/null | sed -n " s#^\([0-9.][0-9./]*\) dev ${IFACE} .*#\1#p" | head -1) "
102- [ -n " $SUBNET " ] && ndc network route add " $NETID " " $IFACE " " $SUBNET " 2> /dev/null
103- fi
104102 ndc network default set " $NETID " 2> /dev/null
105103 ndc network permission user set NETWORK " $NETID " 2> /dev/null
106104fi
You can’t perform that action at this time.
0 commit comments