Skip to content

Commit

Permalink
Fallback: If there is no default IPv6 gateway, use the default IPv4 g…
Browse files Browse the repository at this point in the history
…ateway interface instead

Signed-off-by: DL6ER <[email protected]>
  • Loading branch information
DL6ER committed Jul 22, 2024
1 parent c7f7608 commit ef97d5b
Showing 1 changed file with 5 additions and 0 deletions.
5 changes: 5 additions & 0 deletions padd.sh
Original file line number Diff line number Diff line change
Expand Up @@ -394,6 +394,11 @@ GetNetworkInformation() {
gateway_v4_iface=$(echo "${gateway_raw}" | jq -r '.gateway[] | select(.family == "inet") | .interface' | head -n 1)
v4_iface_data=$(echo "${interfaces_raw}" | jq --arg iface "${gateway_v4_iface}" '.interfaces[] | select(.name==$iface)' 2>/dev/null)
gateway_v6_iface=$(echo "${gateway_raw}" | jq -r '.gateway[] | select(.family == "inet6") | .interface' | head -n 1)
# Fallback: If there is no default IPv6 gateway, use the default IPv4
# gateway interface instead
if [ -z "${gateway_v6_iface}" ]; then
gateway_v6_iface="${gateway_v4_iface}"
fi
v6_iface_data=$(echo "${interfaces_raw}" | jq --arg iface "${gateway_v6_iface}" '.interfaces[] | select(.name==$iface)' 2>/dev/null)
config=$(GetFTLData "config")

Expand Down

0 comments on commit ef97d5b

Please sign in to comment.