mirror of
https://github.com/community-scripts/ProxmoxVE.git
synced 2026-11-06 13:34:57 +01:00
fix(openwrt-vm): leave the NIC untagged on a bridge without a port (#18473)
Advanced mode prefills the LAN VLAN with 999. On a bridge with no physical port that is not VLAN-aware (an internal vmbr1, the usual LAN choice) pve-bridge cannot tag the tap, and qm start failed with "no physical interface on bridge 'vmbr1'". The tag is dropped there with a warning, for LAN and WAN alike. The scripts base still pointed at DevScripts, where this script was removed on 10-09, so every run was reported as a DevScripts run.
This commit is contained in:
committed by
GitHub
parent
4adef93eb9
commit
5e5e840458
+13
-1
@@ -4,7 +4,7 @@
|
||||
# License: MIT
|
||||
# https://github.com/community-scripts/ProxmoxVE/raw/main/LICENSE
|
||||
|
||||
COMMUNITY_SCRIPTS_URL="${COMMUNITY_SCRIPTS_URL:-https://raw.githubusercontent.com/community-scripts/DevScripts/main}"
|
||||
COMMUNITY_SCRIPTS_URL="${COMMUNITY_SCRIPTS_URL:-https://raw.githubusercontent.com/community-scripts/ProxmoxVE/main}"
|
||||
source <(curl -fsSL "${COMMUNITY_SCRIPTS_CORE_URL:-https://raw.githubusercontent.com/community-scripts/core/main}/pve/vm-core.func")
|
||||
load_functions
|
||||
|
||||
@@ -341,6 +341,18 @@ if [[ "$VM_STATE" != *stopped* ]]; then
|
||||
fi
|
||||
msg_ok "OpenWrt has shut down"
|
||||
|
||||
# pve-bridge tags a NIC on a port of the bridge; a bridge without one only takes tags when VLAN-aware
|
||||
if [[ -n "$LAN_VLAN" && -d "/sys/class/net/${LAN_BRG}/bridge" && "$(cat "/sys/class/net/${LAN_BRG}/bridge/vlan_filtering" 2>/dev/null)" != "1" ]] &&
|
||||
! ls "/sys/class/net/${LAN_BRG}/brif" 2>/dev/null | grep -qE '^((eth|bond)[0-9]+|en[^.]+)(\.[0-9]+)?$'; then
|
||||
msg_warn "LAN bridge ${LAN_BRG} has no physical port and is not VLAN-aware; the LAN NIC stays untagged"
|
||||
LAN_VLAN=""
|
||||
fi
|
||||
if [[ -n "$VLAN" && -d "/sys/class/net/${BRG}/bridge" && "$(cat "/sys/class/net/${BRG}/bridge/vlan_filtering" 2>/dev/null)" != "1" ]] &&
|
||||
! ls "/sys/class/net/${BRG}/brif" 2>/dev/null | grep -qE '^((eth|bond)[0-9]+|en[^.]+)(\.[0-9]+)?$'; then
|
||||
msg_warn "WAN bridge ${BRG} has no physical port and is not VLAN-aware; the WAN NIC stays untagged"
|
||||
VLAN=""
|
||||
fi
|
||||
|
||||
msg_info "Adding bridge interfaces on Proxmox side"
|
||||
qm set $VMID \
|
||||
-net0 virtio,bridge=${LAN_BRG},macaddr=${LAN_MAC}${LAN_VLAN}${MTU} \
|
||||
|
||||
Reference in New Issue
Block a user