mirror of
https://github.com/vdsm/virtual-dsm.git
synced 2025-06-06 00:19:06 +08:00
feat: Automaticly match MTU size (#908)
This commit is contained in:
parent
52fe712b6f
commit
a1993e590a
@ -37,6 +37,7 @@ RUN set -eu && extra="" && \
|
|||||||
net-tools \
|
net-tools \
|
||||||
e2fsprogs \
|
e2fsprogs \
|
||||||
qemu-utils \
|
qemu-utils \
|
||||||
|
iputils-ping \
|
||||||
ca-certificates \
|
ca-certificates \
|
||||||
netcat-openbsd \
|
netcat-openbsd \
|
||||||
qemu-system-x86 \
|
qemu-system-x86 \
|
||||||
|
@ -4,6 +4,7 @@ set -Eeuo pipefail
|
|||||||
# Docker environment variables
|
# Docker environment variables
|
||||||
|
|
||||||
: "${MAC:=""}"
|
: "${MAC:=""}"
|
||||||
|
: "${MTU:=""}"
|
||||||
: "${DHCP:="N"}"
|
: "${DHCP:="N"}"
|
||||||
: "${NETWORK:="Y"}"
|
: "${NETWORK:="Y"}"
|
||||||
: "${USER_PORTS:=""}"
|
: "${USER_PORTS:=""}"
|
||||||
@ -345,6 +346,10 @@ getInfo() {
|
|||||||
error "$ADD_ERR -e \"VM_NET_DEV=NAME\" to specify another interface name." && exit 27
|
error "$ADD_ERR -e \"VM_NET_DEV=NAME\" to specify another interface name." && exit 27
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
if [ -z "$MTU" ]; then
|
||||||
|
MTU=$(cat "/sys/class/net/$VM_NET_DEV/mtu")
|
||||||
|
fi
|
||||||
|
|
||||||
if [ -z "$VM_NET_MAC" ]; then
|
if [ -z "$VM_NET_MAC" ]; then
|
||||||
local file="$STORAGE/dsm.mac"
|
local file="$STORAGE/dsm.mac"
|
||||||
[ -s "$file" ] && VM_NET_MAC=$(<"$file")
|
[ -s "$file" ] && VM_NET_MAC=$(<"$file")
|
||||||
@ -387,7 +392,7 @@ getInfo
|
|||||||
html "Initializing network..."
|
html "Initializing network..."
|
||||||
|
|
||||||
if [[ "$DEBUG" == [Yy1]* ]]; then
|
if [[ "$DEBUG" == [Yy1]* ]]; then
|
||||||
info "Host: $HOST IP: $IP Gateway: $GATEWAY Interface: $VM_NET_DEV MAC: $VM_NET_MAC"
|
info "Host: $HOST IP: $IP Gateway: $GATEWAY Interface: $VM_NET_DEV MAC: $VM_NET_MAC MTU: $MTU"
|
||||||
[ -f /etc/resolv.conf ] && grep '^nameserver*' /etc/resolv.conf
|
[ -f /etc/resolv.conf ] && grep '^nameserver*' /etc/resolv.conf
|
||||||
echo
|
echo
|
||||||
fi
|
fi
|
||||||
@ -452,6 +457,6 @@ else
|
|||||||
|
|
||||||
fi
|
fi
|
||||||
|
|
||||||
NET_OPTS+=" -device $ADAPTER,romfile=,netdev=hostnet0,mac=$VM_NET_MAC,id=net0"
|
NET_OPTS+=" -device $ADAPTER,romfile=,netdev=hostnet0,mac=$VM_NET_MAC,host_mtu=$MTU,id=net0"
|
||||||
|
|
||||||
return 0
|
return 0
|
||||||
|
Loading…
x
Reference in New Issue
Block a user