Skip to content

Commit

Permalink
Use link scope for routes
Browse files Browse the repository at this point in the history
Host scope means "only valid within this host", which is certainly not
correct for Xen virtual devices.  Link scope means "only valid in the
context of this link", which is correct.

Fixes: QubesOS/qubes-issues#7123.
Suggested-by: Ente <[email protected]>
(cherry picked from commit 0220911)
  • Loading branch information
DemiMarie authored and marmarek committed Nov 29, 2022
1 parent 09e7b96 commit 4be011c
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions network/setup-ip
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,8 @@
. /usr/lib/qubes/init/functions
set -uo pipefail

add_host_route () {
/sbin/ip -- route replace to unicast "$1" dev "$2" onlink scope host
add_link_route () {
/sbin/ip -- route replace to unicast "$1" dev "$2" scope link
}

add_default_route () {
Expand All @@ -32,9 +32,9 @@ configure_network() {
/sbin/ip link set dev "$INTERFACE" up

if [ -n "$gateway" ]; then
add_host_route "$gateway" "$INTERFACE"
add_link_route "$gateway" "$INTERFACE"
if [ -n "$gateway6" ] && ! echo "$gateway6" | grep -q "^fe80:"; then
add_host_route "$gateway6/$netmask6" "$INTERFACE"
add_link_route "$gateway6/$netmask6" "$INTERFACE"
fi
if ! qsvc disable-default-route ; then
add_default_route "$gateway" "$INTERFACE"
Expand Down

0 comments on commit 4be011c

Please sign in to comment.