rc.docker: only flush global addresses (keep link addresses)

This commit is contained in:
bergware
2025-02-15 20:42:49 +01:00
parent bda43f7920
commit 28d620e7c7

View File

@@ -438,7 +438,7 @@ docker_network_start(){
if [[ $DOCKER_ALLOW_ACCESS == yes && -n $IPV4 ]]; then
# create shim interface and copy parent IPv4 address to shim interface
[[ -e $SYSTEM/$LINK ]] || run ip link add link $NETWORK name $LINK type $ATTACH mode $MODE
run ip addr flush dev $LINK
run ip addr flush dev $LINK scope global
run ip -4 addr add $IPV4 dev $LINK metric 0
# disable IPv6 on shim interface
echo 1 >$CONF6/$LINK/disable_ipv6
@@ -464,7 +464,7 @@ docker_network_start(){
fi
elif [[ $TYPE != wlan ]]; then
if [[ $DOCKER_ALLOW_ACCESS == yes && -n $IPV4 ]]; then
run ip addr flush dev $VHOST
run ip addr flush dev $VHOST scope global
# copy IPv4 address to vhost interface
run ip -4 addr add $IPV4 dev $VHOST metric 0
log "prepared network $VHOST for host access"
@@ -472,7 +472,7 @@ docker_network_start(){
VHOST=vhost${NETWORK//[^0-9.]/}
if [[ -e $SYSTEM/$VHOST ]]; then
# remove IP addresses of vhost
run ip addr flush dev $VHOST
run ip addr flush dev $VHOST scope global
# remove routing of vhost
run ip -4 route flush dev $VHOST
run ip -6 route flush dev $VHOST