Skip to content

Commit

Permalink
setup-ip: Invoke 'ip' via $PATH
Browse files Browse the repository at this point in the history
Debian recently [1] removed the symlink in /sbin which breaks our
setup-ip script. Fedora on the other hand has 'ip' only in {/usr,}/sbin.
So invoke ip without specifying a path and rely on the shell's $PATH.

[1]: https://salsa.debian.org/kernel-team/iproute2/-/commit/c4bb148dd4ed0601ca32ee8a458007d0c348d6c3
  • Loading branch information
HW42 committed Jul 25, 2024
1 parent 0f346ad commit 08fe31f
Showing 1 changed file with 10 additions and 10 deletions.
20 changes: 10 additions & 10 deletions network/setup-ip
Original file line number Diff line number Diff line change
Expand Up @@ -6,11 +6,11 @@
set -ueo pipefail

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

add_default_route () {
/sbin/ip -- route replace to unicast default via "$1" dev "$2" onlink
ip -- route replace to unicast default via "$1" dev "$2" onlink
}

readonly netvm_mac=fe:ff:ff:ff:ff:ff
Expand All @@ -27,19 +27,19 @@ configure_network () {
local secondary_dns="${10}"
local custom="${11}"

/sbin/ip -- address replace "$ip/$netmask" dev "$INTERFACE"
ip -- address replace "$ip/$netmask" dev "$INTERFACE"
if [[ "$custom" = false ]]; then
/sbin/ip -- neighbour replace to "$gateway" dev "$INTERFACE" \
ip -- neighbour replace to "$gateway" dev "$INTERFACE" \
lladdr "$netvm_mac" nud permanent
fi
if [ -n "$ip6" ]; then
/sbin/ip -- address replace "$ip6/$netmask6" dev "$INTERFACE"
ip -- address replace "$ip6/$netmask6" dev "$INTERFACE"
if [ -n "$gateway6" ] && [[ "$custom" = false ]]; then
/sbin/ip -- neighbour replace to "$gateway6" dev "$INTERFACE" \
ip -- neighbour replace to "$gateway6" dev "$INTERFACE" \
lladdr "$netvm_mac" nud permanent
fi
fi
/sbin/ip link set dev "$INTERFACE" group 1 up
ip link set dev "$INTERFACE" group 1 up

if [ -n "$gateway" ]; then
add_link_route "$gateway" "$INTERFACE"
Expand Down Expand Up @@ -96,7 +96,7 @@ configure_network_nm () {
local ip4_nm_config
local ip6_nm_config
local uuid
/sbin/ip link set dev "$INTERFACE" group 1
ip link set dev "$INTERFACE" group 1

prefix="$(get_prefix_from_subnet "$netmask")"
prefix6="$netmask6"
Expand Down Expand Up @@ -167,12 +167,12 @@ __EOF__
# reload connection
nmcli connection load "$nm_config" || :
if [[ "$custom" = false ]]; then
/sbin/ip -- neighbour replace to "$gateway" dev "$INTERFACE" \
ip -- neighbour replace to "$gateway" dev "$INTERFACE" \
lladdr "$netvm_mac" nud permanent
fi
if [ -n "$gateway6" ]; then
if [[ "$custom" = false ]]; then
/sbin/ip -- neighbour replace to "$gateway6" dev "$INTERFACE" \
ip -- neighbour replace to "$gateway6" dev "$INTERFACE" \
lladdr "$netvm_mac" nud permanent
fi
fi
Expand Down

0 comments on commit 08fe31f

Please sign in to comment.