Skip to content

Avoid de-configuring non-existing interface #563

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Mar 17, 2025
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
18 changes: 13 additions & 5 deletions network/vif-route-qubes
Original file line number Diff line number Diff line change
Expand Up @@ -144,7 +144,9 @@ table inet qubes-nat-accel {
fi
;;
offline)
do_without_error ifdown "${vif}"
if [ -e /sys/class/net/"$vif" ]; then
do_without_error ifdown "${vif}"
fi
ipcmd='del'
nftables_cmd=delete
cmdprefix='do_without_error'
Expand Down Expand Up @@ -240,14 +242,20 @@ if [ "${ip}" ]; then
log error "Cannot set IPv6 route to ${addr}, IPv6 disabled in the kernel"
continue
fi
${cmdprefix} ip route "${ipcmd}" "${addr}" dev "${vif}" metric "$metric"
if [ "$ipcmd" = "add" ] || [ -e /sys/class/net/"$vif" ]; then
${cmdprefix} ip route "${ipcmd}" "${addr}" dev "${vif}" metric "$metric"
fi

network_hooks "${command}" "${vif}" "${addr}"
done
${cmdprefix} ip addr "${ipcmd}" "${back_ip}/32" dev "${vif}"
if [ "$ipcmd" = "add" ] || [ -e /sys/class/net/"$vif" ]; then
${cmdprefix} ip addr "${ipcmd}" "${back_ip}/32" dev "${vif}"
fi
if [[ -n "${back_ip6}" ]] && [[ "${back_ip6}" != "fe80:"* ]] && [[ "$ipv6_disabled" = '0' ]]; then
${cmdprefix} ip addr "${ipcmd}" "${back_ip6}/128" dev "${vif}"
echo 1 >"/proc/sys/net/ipv6/conf/${vif}/proxy_ndp"
if [ "$ipcmd" = "add" ] || [ -e /sys/class/net/"$vif" ]; then
${cmdprefix} ip addr "${ipcmd}" "${back_ip6}/128" dev "${vif}"
echo 1 >"/proc/sys/net/ipv6/conf/${vif}/proxy_ndp"
fi
fi
else
network_hooks "${command}" "${vif}"
Expand Down