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

fix: Wrong IP was passed to getSlirp (#1048)

parent 0878f80b
Loading
Loading
Loading
Loading
+9 −7
Original line number Diff line number Diff line
@@ -302,6 +302,7 @@ getUserPorts() {

getSlirp() {

  local ip="$1"
  local args=""
  local list=""

@@ -317,12 +318,12 @@ getSlirp() {
      proto="udp"
      num="${port%/udp}"
    elif [[ "$port" != *"/tcp" ]]; then
      args+="hostfwd=$proto::$num-$VM_NET_IP:$num,"
      args+="hostfwd=$proto::$num-$ip:$num,"
      proto="udp"
      num="${port%/udp}"
    fi

    args+="hostfwd=$proto::$num-$VM_NET_IP:$num,"
    args+="hostfwd=$proto::$num-$ip:$num,"
  done

  echo "$args" | sed 's/,*$//g'
@@ -349,7 +350,7 @@ configureSlirp() {
  NET_OPTS="-netdev user,id=hostnet0,ipv4=on,host=$gateway,net=${gateway%.*}.0/24,dhcpstart=$ip,${ipv6}hostname=$VM_NET_HOST"

  local forward=""
  forward=$(getSlirp)
  forward=$(getSlirp "$ip")
  [ -n "$forward" ] && NET_OPTS+=",$forward"

  if [[ "${DNSMASQ_DISABLE:-}" != [Yy1]* ]]; then
@@ -673,21 +674,22 @@ cleanUp() {

checkOS() {

  local kernel
  local os=""
  local if="macvlan"
  local kernel=""
  local iface="macvlan"

  kernel=$(uname -a)

  [[ "${kernel,,}" == *"darwin"* ]] && os="$ENGINE Desktop for macOS"
  [[ "${kernel,,}" == *"microsoft"* ]] && os="$ENGINE Desktop for Windows"

  if [[ "$DHCP" == [Yy1]* ]]; then
    if="macvtap"
    iface="macvtap"
    [[ "${kernel,,}" == *"synology"* ]] && os="Synology Container Manager"
  fi

  if [ -n "$os" ]; then
    warn "you are using $os which does not support $if, please revert to bridge networking!"
    warn "you are using $os which does not support $iface, please revert to bridge networking!"
  fi

  return 0