Skip to content
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

setup-ip: Invoke 'ip' via $PATH #516

Merged
merged 1 commit into from
Aug 8, 2024
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
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