Unverified Commit aaa68132 authored by Kroese's avatar Kroese Committed by GitHub
Browse files

fix: Ignore existing IP alias (#898)

parent f57da617
Loading
Loading
Loading
Loading
+6 −3
Original line number Diff line number Diff line
@@ -187,7 +187,6 @@ compat() {
  local interface="$2"
  local samba="20.20.20.1"

  [[ "$PODMAN" == [Yy1]* ]] && return 0
  [[ "$samba" == "$gateway" ]] && return 0
  [[ "${BOOT_MODE:-}" != "windows"* ]] && return 0

@@ -196,11 +195,15 @@ compat() {
  fi

  # Backwards compatibility with old installations
  if ip address add dev "$interface" "$samba/24" label "$interface:compat"; then
  if ip address add dev "$interface" "$samba/24" label "$interface:compat" 2>/dev/null; then
    SAMBA_INTERFACE="$samba"
  else
    msg=$(ip address add dev "$interface" "$samba/24" label "$interface:compat" 2>&1)
    if [[ "${msg,,}" != *"address already assigned"* && "$PODMAN" != [Yy1]* ]]; then
      echo "$msg" >&2
      warn "failed to configure IP alias. $ADD_ERR --cap-add NET_ADMIN"
    fi
  fi

  return 0
}