Support older kernels

Support older kernels
This commit is contained in:
Kroese 2023-04-22 01:44:12 +02:00 committed by GitHub
commit fc1347e654
2 changed files with 13 additions and 5 deletions

View File

@ -112,8 +112,10 @@ configureNAT () {
iptables -t nat -A PREROUTING -i "${VM_NET_DEV}" -p tcp -j DNAT --to $VM_NET_IP iptables -t nat -A PREROUTING -i "${VM_NET_DEV}" -p tcp -j DNAT --to $VM_NET_IP
iptables -t nat -A PREROUTING -i "${VM_NET_DEV}" -p udp -j DNAT --to $VM_NET_IP iptables -t nat -A PREROUTING -i "${VM_NET_DEV}" -p udp -j DNAT --to $VM_NET_IP
if (( KERNEL > 4 )); then
# Hack for guest VMs complaining about "bad udp checksums in 5 packets" # Hack for guest VMs complaining about "bad udp checksums in 5 packets"
iptables -A POSTROUTING -t mangle -p udp --dport bootpc -j CHECKSUM --checksum-fill || true iptables -A POSTROUTING -t mangle -p udp --dport bootpc -j CHECKSUM --checksum-fill || true
fi
#Enable port forwarding flag #Enable port forwarding flag
[[ $(< /proc/sys/net/ipv4/ip_forward) -eq 0 ]] && sysctl -w net.ipv4.ip_forward=1 [[ $(< /proc/sys/net/ipv4/ip_forward) -eq 0 ]] && sysctl -w net.ipv4.ip_forward=1

View File

@ -3,8 +3,8 @@ set -eu
# Docker environment variabeles # Docker environment variabeles
: ${URL:=''}. # URL of the PAT file : ${URL:=''} # URL of the PAT file
: ${DEBUG:=''}. # Enable debug mode : ${DEBUG:=''} # Enable debug mode
: ${ALLOCATE:='Y'} # Preallocate diskspace : ${ALLOCATE:='Y'} # Preallocate diskspace
: ${CPU_CORES:='1'} # Amount of CPU cores : ${CPU_CORES:='1'} # Amount of CPU cores
: ${DISK_SIZE:='16G'} # Initial data disk size : ${DISK_SIZE:='16G'} # Initial data disk size
@ -13,6 +13,8 @@ set -eu
echo "Starting Virtual DSM for Docker v${VERSION}..." echo "Starting Virtual DSM for Docker v${VERSION}..."
STORAGE="/storage" STORAGE="/storage"
KERNEL=$(uname -r | cut -b 1)
[ ! -d "$STORAGE" ] && echo "Storage folder (${STORAGE}) not found!" && exit 69 [ ! -d "$STORAGE" ] && echo "Storage folder (${STORAGE}) not found!" && exit 69
[ ! -f "/run/run.sh" ] && echo "Script must run inside Docker container!" && exit 60 [ ! -f "/run/run.sh" ] && echo "Script must run inside Docker container!" && exit 60
@ -67,4 +69,8 @@ set -m
) )
set +m set +m
if (( KERNEL > 4 )); then
pidwait -F "${_QEMU_PID}" & wait $! pidwait -F "${_QEMU_PID}" & wait $!
else
tail --pid "$(cat ${_QEMU_PID})" --follow /dev/null & wait $!
fi