mirror of
https://github.com/vdsm/virtual-dsm.git
synced 2025-11-06 01:54:52 +08:00
Compare commits
No commits in common. "5e8bbc28680a3581aff8df3ee9fcaa0bb2429d98" and "8b145924b98f4fd629ffb51b7f03e346985f6934" have entirely different histories.
5e8bbc2868
...
8b145924b9
@ -31,6 +31,7 @@ if [ -n "$URL" ] && [ ! -s "$FILE" ] && [ ! -d "$DIR" ]; then
|
||||
BASE=$(basename "$URL" .pat)
|
||||
if [ ! -s "$STORAGE/$BASE.system.img" ]; then
|
||||
BASE=$(basename "${URL%%\?*}" .pat)
|
||||
BASE="${BASE//+/ }"
|
||||
printf -v BASE '%b' "${BASE//%/\\x}"
|
||||
BASE="${BASE//[!A-Za-z0-9._-]/_}"
|
||||
fi
|
||||
@ -65,6 +66,7 @@ fi
|
||||
|
||||
if [ ! -s "$FILE" ]; then
|
||||
BASE=$(basename "${URL%%\?*}" .pat)
|
||||
BASE="${BASE//+/ }"
|
||||
printf -v BASE '%b' "${BASE//%/\\x}"
|
||||
BASE="${BASE//[!A-Za-z0-9._-]/_}"
|
||||
fi
|
||||
|
||||
@ -403,6 +403,7 @@ configureNAT() {
|
||||
|
||||
# Create the necessary file structure for /dev/net/tun
|
||||
if [ ! -c /dev/net/tun ]; then
|
||||
[[ "$PODMAN" == [Yy1]* ]] && return 1
|
||||
[ ! -d /dev/net ] && mkdir -m 755 /dev/net
|
||||
if mknod /dev/net/tun c 10 200; then
|
||||
chmod 666 /dev/net/tun
|
||||
@ -410,7 +411,6 @@ configureNAT() {
|
||||
fi
|
||||
|
||||
if [ ! -c /dev/net/tun ]; then
|
||||
[[ "$PODMAN" == [Yy1]* ]] && return 1
|
||||
warn "$tuntap" && return 1
|
||||
fi
|
||||
|
||||
@ -418,7 +418,6 @@ configureNAT() {
|
||||
if [[ $(< /proc/sys/net/ipv4/ip_forward) -eq 0 ]]; then
|
||||
{ sysctl -w net.ipv4.ip_forward=1 > /dev/null 2>&1; rc=$?; } || :
|
||||
if (( rc != 0 )) || [[ $(< /proc/sys/net/ipv4/ip_forward) -eq 0 ]]; then
|
||||
[[ "$PODMAN" == [Yy1]* ]] && return 1
|
||||
warn "IP forwarding is disabled. $ADD_ERR --sysctl net.ipv4.ip_forward=1"
|
||||
return 1
|
||||
fi
|
||||
@ -445,7 +444,6 @@ configureNAT() {
|
||||
{ ip link add dev "$VM_NET_BRIDGE" type bridge ; rc=$?; } || :
|
||||
|
||||
if (( rc != 0 )); then
|
||||
[[ "$PODMAN" == [Yy1]* ]] && return 1
|
||||
warn "failed to create bridge. $ADD_ERR --cap-add NET_ADMIN" && return 1
|
||||
fi
|
||||
|
||||
@ -460,7 +458,6 @@ configureNAT() {
|
||||
|
||||
# QEMU Works with taps, set tap to the bridge created
|
||||
if ! ip tuntap add dev "$VM_NET_TAP" mode tap; then
|
||||
[[ "$PODMAN" == [Yy1]* ]] && return 1
|
||||
warn "$tuntap" && return 1
|
||||
fi
|
||||
|
||||
@ -740,6 +737,13 @@ getInfo() {
|
||||
|
||||
GATEWAY_MAC=$(echo "$VM_NET_MAC" | md5sum | sed 's/^\(..\)\(..\)\(..\)\(..\)\(..\).*$/02:\1:\2:\3:\4:\5/')
|
||||
|
||||
if [[ "$PODMAN" == [Yy1]* && "$DHCP" != [Yy1]* ]]; then
|
||||
if [ -z "$NETWORK" ] || [[ "${NETWORK^^}" == "Y" ]]; then
|
||||
# By default Podman has no permissions for NAT networking
|
||||
NETWORK="user"
|
||||
fi
|
||||
fi
|
||||
|
||||
if [[ "$DEBUG" == [Yy1]* ]]; then
|
||||
line="Host: $HOST IP: $IP Gateway: $GATEWAY Interface: $VM_NET_DEV MAC: $VM_NET_MAC MTU: $mtu"
|
||||
[[ "$MTU" != "0" && "$MTU" != "$mtu" ]] && line+=" ($MTU)"
|
||||
@ -801,12 +805,8 @@ else
|
||||
|
||||
closeBridge
|
||||
NETWORK="user"
|
||||
|
||||
if [[ "$PODMAN" != [Yy1]* ]]; then
|
||||
msg="falling back to user-mode networking!"
|
||||
msg="failed to setup NAT networking, $msg"
|
||||
warn "$msg"
|
||||
fi
|
||||
msg="falling back to user-mode networking!"
|
||||
msg="failed to setup NAT networking, $msg"
|
||||
|
||||
fi ;;
|
||||
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user