* [pve-devel] [PATCH v2 common 1/6] interfaces: allow arbitrary bridge names in network config
2024-02-23 14:36 [pve-devel] [PATCH v2 common/docs/widget-toolkit/manager/firewall 0/6] drop vmbr prefix for bridges Stefan Hanreich
@ 2024-02-23 14:36 ` Stefan Hanreich
2024-02-23 14:36 ` [pve-devel] [PATCH v2 docs 2/6] network: update specification for bridge names Stefan Hanreich
` (4 subsequent siblings)
5 siblings, 0 replies; 10+ messages in thread
From: Stefan Hanreich @ 2024-02-23 14:36 UTC (permalink / raw)
To: pve-devel
Similar to other interface types, we can detect a bridge by the
presense of it's bridge_ports attribute rather than solely relying on
the "vmbr" ifname prefix heuristic.
For OVS bridges we need to examine the OVS type instead.
The check needs to be moved up since other prefixes could
theoretically be included in a bridge name and then would otherwise
get picked up wrongly.
Originally-by: Jillian Morgan <jillian.morgan@primordial.ca>
Signed-off-by: Stefan Hanreich <s.hanreich@proxmox.com>
---
src/PVE/INotify.pm | 24 +++++++++++-------------
1 file changed, 11 insertions(+), 13 deletions(-)
diff --git a/src/PVE/INotify.pm b/src/PVE/INotify.pm
index bc33a8f..8a34128 100644
--- a/src/PVE/INotify.pm
+++ b/src/PVE/INotify.pm
@@ -1033,7 +1033,17 @@ sub __read_etc_network_interfaces {
foreach my $iface (keys %$ifaces) {
my $d = $ifaces->{$iface};
$d->{type} = 'unknown';
- if ($iface =~ m/^bond\d+$/) {
+ if (defined $d->{'bridge_ports'}) {
+ $d->{type} = 'bridge';
+ if (!defined ($d->{bridge_stp})) {
+ $d->{bridge_stp} = 'off';
+ }
+ if (!defined($d->{bridge_fd}) && $d->{bridge_stp} eq 'off') {
+ $d->{bridge_fd} = 0;
+ }
+ } elsif ($d->{ovs_type} && $d->{ovs_type} eq 'OVSBridge') {
+ $d->{type} = $d->{ovs_type};
+ } elsif ($iface =~ m/^bond\d+$/) {
if (!$d->{ovs_type}) {
$d->{type} = 'bond';
} elsif ($d->{ovs_type} eq 'OVSBond') {
@@ -1053,18 +1063,6 @@ sub __read_etc_network_interfaces {
my $tag = &$extract_ovs_option($d, 'tag');
$d->{ovs_tag} = $tag if defined($tag);
}
- } elsif ($iface =~ m/^vmbr\d+$/) {
- if (!$d->{ovs_type}) {
- $d->{type} = 'bridge';
- if (!defined ($d->{bridge_stp})) {
- $d->{bridge_stp} = 'off';
- }
- if (!defined($d->{bridge_fd}) && $d->{bridge_stp} eq 'off') {
- $d->{bridge_fd} = 0;
- }
- } elsif ($d->{ovs_type} eq 'OVSBridge') {
- $d->{type} = $d->{ovs_type};
- }
} elsif ($iface =~ m/^(\S+):\d+$/) {
$d->{type} = 'alias';
if (defined ($ifaces->{$1})) {
--
2.39.2
^ permalink raw reply [flat|nested] 10+ messages in thread
* [pve-devel] [PATCH v2 docs 2/6] network: update specification for bridge names
2024-02-23 14:36 [pve-devel] [PATCH v2 common/docs/widget-toolkit/manager/firewall 0/6] drop vmbr prefix for bridges Stefan Hanreich
2024-02-23 14:36 ` [pve-devel] [PATCH v2 common 1/6] interfaces: allow arbitrary bridge names in network config Stefan Hanreich
@ 2024-02-23 14:36 ` Stefan Hanreich
2024-02-23 14:36 ` [pve-devel] [PATCH v2 widget-toolkit 3/6] network: allow bridges to have any valid interface name Stefan Hanreich
` (3 subsequent siblings)
5 siblings, 0 replies; 10+ messages in thread
From: Stefan Hanreich @ 2024-02-23 14:36 UTC (permalink / raw)
To: pve-devel
Signed-off-by: Stefan Hanreich <s.hanreich@proxmox.com>
---
pve-network.adoc | 15 +++++++++------
1 file changed, 9 insertions(+), 6 deletions(-)
diff --git a/pve-network.adoc b/pve-network.adoc
index d1ec64b..62edeb6 100644
--- a/pve-network.adoc
+++ b/pve-network.adoc
@@ -13,11 +13,12 @@ page contains the complete format description. All {pve} tools try hard to keep
direct user modifications, but using the GUI is still preferable, because it
protects you from errors.
-A 'vmbr' interface is needed to connect guests to the underlying physical
-network. They are a Linux bridge which can be thought of as a virtual switch
-to which the guests and physical interfaces are connected to. This section
-provides some examples on how the network can be set up to accomodate different
-use cases like redundancy with a xref:sysadmin_network_bond['bond'],
+A bridge interface (commonly called 'vmbrX') is needed to connect guests to the
+underlying physical network. They are a Linux bridge which can be thought of as
+a virtual switch to which the guests and physical interfaces are connected to.
+This section provides some examples on how the network can be set up to
+accomodate different use cases like redundancy with a
+xref:sysadmin_network_bond['bond'],
xref:sysadmin_network_vlan['vlans'] or
xref:sysadmin_network_routed['routed'] and
xref:sysadmin_network_masquerading['NAT'] setups.
@@ -75,7 +76,9 @@ We currently use the following naming conventions for device names:
scheme is used for {pve} hosts which were installed before the 5.0
release. When upgrading to 5.0, the names are kept as-is.
-* Bridge names: `vmbr[N]`, where 0 ≤ N ≤ 4094 (`vmbr0` - `vmbr4094`)
+* Bridge names: Commonly `vmbr[N]`, where 0 ≤ N ≤ 4094 (`vmbr0` - `vmbr4094`),
+but you can use any alphanumeric string that starts with a character and is at
+most 15 characters long.
* Bonds: `bond[N]`, where 0 ≤ N (`bond0`, `bond1`, ...)
--
2.39.2
^ permalink raw reply [flat|nested] 10+ messages in thread
* [pve-devel] [PATCH v2 widget-toolkit 3/6] network: allow bridges to have any valid interface name
2024-02-23 14:36 [pve-devel] [PATCH v2 common/docs/widget-toolkit/manager/firewall 0/6] drop vmbr prefix for bridges Stefan Hanreich
2024-02-23 14:36 ` [pve-devel] [PATCH v2 common 1/6] interfaces: allow arbitrary bridge names in network config Stefan Hanreich
2024-02-23 14:36 ` [pve-devel] [PATCH v2 docs 2/6] network: update specification for bridge names Stefan Hanreich
@ 2024-02-23 14:36 ` Stefan Hanreich
2024-02-23 14:36 ` [pve-devel] [PATCH v2 manager 4/6] sdn: qinq: vlan: properly validate bridge name Stefan Hanreich
` (2 subsequent siblings)
5 siblings, 0 replies; 10+ messages in thread
From: Stefan Hanreich @ 2024-02-23 14:36 UTC (permalink / raw)
To: pve-devel
Allow the web UI to accept bridge interfaces with any valid interface
name, rather than being limited to the arbitrary "vmbr" prefix.
Originally-by: Jillian Morgan <jillian.morgan@primordial.ca>
Signed-off-by: Stefan Hanreich <s.hanreich@proxmox.com>
---
src/Toolkit.js | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/src/Toolkit.js b/src/Toolkit.js
index 6fd73f5..b8fbd91 100644
--- a/src/Toolkit.js
+++ b/src/Toolkit.js
@@ -76,7 +76,7 @@ Ext.apply(Ext.form.field.VTypes, {
MacPrefixText: gettext('Example') + ': 02:8f - ' + gettext('only unicast addresses are allowed'),
BridgeName: function(v) {
- return (/^vmbr\d{1,4}$/).test(v);
+ return (/^[a-zA-Z][a-zA-Z0-9_]{0,14}$/).test(v);
},
VlanName: function(v) {
if (Proxmox.Utils.VlanInterface_match.test(v)) {
@@ -86,7 +86,7 @@ Ext.apply(Ext.form.field.VTypes, {
}
return true;
},
- BridgeNameText: gettext('Format') + ': vmbr<b>N</b>, where 0 <= <b>N</b> <= 9999',
+ BridgeNameText: gettext('Format') + ': alphanumeric string starting with a character',
BondName: function(v) {
return (/^bond\d{1,4}$/).test(v);
--
2.39.2
^ permalink raw reply [flat|nested] 10+ messages in thread
* [pve-devel] [PATCH v2 manager 4/6] sdn: qinq: vlan: properly validate bridge name
2024-02-23 14:36 [pve-devel] [PATCH v2 common/docs/widget-toolkit/manager/firewall 0/6] drop vmbr prefix for bridges Stefan Hanreich
` (2 preceding siblings ...)
2024-02-23 14:36 ` [pve-devel] [PATCH v2 widget-toolkit 3/6] network: allow bridges to have any valid interface name Stefan Hanreich
@ 2024-02-23 14:36 ` Stefan Hanreich
2024-02-23 14:36 ` [pve-devel] [PATCH v2 manager 5/6] sdn: vlan: fix indentation in vlan edit dialogue Stefan Hanreich
2024-02-23 14:36 ` [pve-devel] [PATCH v2 firewall 6/6] simulator: use new bridge naming scheme Stefan Hanreich
5 siblings, 0 replies; 10+ messages in thread
From: Stefan Hanreich @ 2024-02-23 14:36 UTC (permalink / raw)
To: pve-devel
Signed-off-by: Stefan Hanreich <s.hanreich@proxmox.com>
---
www/manager6/sdn/zones/QinQEdit.js | 3 +++
www/manager6/sdn/zones/VlanEdit.js | 3 +++
2 files changed, 6 insertions(+)
diff --git a/www/manager6/sdn/zones/QinQEdit.js b/www/manager6/sdn/zones/QinQEdit.js
index 795ff9dfd..de177d7cb 100644
--- a/www/manager6/sdn/zones/QinQEdit.js
+++ b/www/manager6/sdn/zones/QinQEdit.js
@@ -24,6 +24,9 @@ Ext.define('PVE.sdn.zones.QinQInputPanel', {
name: 'bridge',
fieldLabel: 'Bridge',
allowBlank: false,
+ vtype: 'BridgeName',
+ minLength: 1,
+ maxLength: 10,
},
{
xtype: 'proxmoxintegerfield',
diff --git a/www/manager6/sdn/zones/VlanEdit.js b/www/manager6/sdn/zones/VlanEdit.js
index 23530bfcf..7f7ccca41 100644
--- a/www/manager6/sdn/zones/VlanEdit.js
+++ b/www/manager6/sdn/zones/VlanEdit.js
@@ -24,6 +24,9 @@ Ext.define('PVE.sdn.zones.VlanInputPanel', {
name: 'bridge',
fieldLabel: 'Bridge',
allowBlank: false,
+ vtype: 'BridgeName',
+ minLength: 1,
+ maxLength: 10,
},
];
--
2.39.2
^ permalink raw reply [flat|nested] 10+ messages in thread
* [pve-devel] [PATCH v2 manager 5/6] sdn: vlan: fix indentation in vlan edit dialogue
2024-02-23 14:36 [pve-devel] [PATCH v2 common/docs/widget-toolkit/manager/firewall 0/6] drop vmbr prefix for bridges Stefan Hanreich
` (3 preceding siblings ...)
2024-02-23 14:36 ` [pve-devel] [PATCH v2 manager 4/6] sdn: qinq: vlan: properly validate bridge name Stefan Hanreich
@ 2024-02-23 14:36 ` Stefan Hanreich
2024-02-23 14:36 ` [pve-devel] [PATCH v2 firewall 6/6] simulator: use new bridge naming scheme Stefan Hanreich
5 siblings, 0 replies; 10+ messages in thread
From: Stefan Hanreich @ 2024-02-23 14:36 UTC (permalink / raw)
To: pve-devel
Signed-off-by: Stefan Hanreich <s.hanreich@proxmox.com>
---
www/manager6/sdn/zones/VlanEdit.js | 8 ++++----
1 file changed, 4 insertions(+), 4 deletions(-)
diff --git a/www/manager6/sdn/zones/VlanEdit.js b/www/manager6/sdn/zones/VlanEdit.js
index 7f7ccca41..0bef5c8ec 100644
--- a/www/manager6/sdn/zones/VlanEdit.js
+++ b/www/manager6/sdn/zones/VlanEdit.js
@@ -20,10 +20,10 @@ Ext.define('PVE.sdn.zones.VlanInputPanel', {
me.items = [
{
- xtype: 'textfield',
- name: 'bridge',
- fieldLabel: 'Bridge',
- allowBlank: false,
+ xtype: 'textfield',
+ name: 'bridge',
+ fieldLabel: 'Bridge',
+ allowBlank: false,
vtype: 'BridgeName',
minLength: 1,
maxLength: 10,
--
2.39.2
^ permalink raw reply [flat|nested] 10+ messages in thread
* [pve-devel] [PATCH v2 firewall 6/6] simulator: use new bridge naming scheme
2024-02-23 14:36 [pve-devel] [PATCH v2 common/docs/widget-toolkit/manager/firewall 0/6] drop vmbr prefix for bridges Stefan Hanreich
` (4 preceding siblings ...)
2024-02-23 14:36 ` [pve-devel] [PATCH v2 manager 5/6] sdn: vlan: fix indentation in vlan edit dialogue Stefan Hanreich
@ 2024-02-23 14:36 ` Stefan Hanreich
[not found] ` <mailman.235.1708944723.434.pve-devel@lists.proxmox.com>
5 siblings, 1 reply; 10+ messages in thread
From: Stefan Hanreich @ 2024-02-23 14:36 UTC (permalink / raw)
To: pve-devel
We now allow bridges without the vmbr prefix, so we need to allow them
here in the simulator as well.
Signed-off-by: Stefan Hanreich <s.hanreich@proxmox.com>
---
src/PVE/FirewallSimulator.pm | 20 ++++++++++----------
src/PVE/Service/pve_firewall.pm | 4 ++--
2 files changed, 12 insertions(+), 12 deletions(-)
diff --git a/src/PVE/FirewallSimulator.pm b/src/PVE/FirewallSimulator.pm
index 140c46e..bd297d5 100644
--- a/src/PVE/FirewallSimulator.pm
+++ b/src/PVE/FirewallSimulator.pm
@@ -397,7 +397,7 @@ sub route_packet {
$pkg->{physdev_in} = $target->{fwln} || die 'internal error';
$pkg->{physdev_out} = $target->{tapdev} || die 'internal error';
- } elsif ($route_state =~ m/^vmbr\d+$/) {
+ } elsif ($route_state =~ m/^[a-zA-Z][a-zA-Z0-9]{0,14}$/) {
die "missing physdev_in - internal error?" if !$physdev_in;
$pkg->{physdev_in} = $physdev_in;
@@ -531,11 +531,6 @@ sub simulate_firewall {
$from_info->{type} = 'host';
$start_state = 'host';
$pkg->{source} = $host_ip if !defined($pkg->{source});
- } elsif ($from =~ m|^(vmbr\d+)/(\S+)$|) {
- $from_info->{type} = 'bport';
- $from_info->{bridge} = $1;
- $from_info->{iface} = $2;
- $start_state = 'from-bport';
} elsif ($from eq 'outside') {
$from_info->{type} = 'bport';
$from_info->{bridge} = 'vmbr0';
@@ -559,6 +554,11 @@ sub simulate_firewall {
$from_info = extract_vm_info($vmdata, $vmid, $netnum);
$start_state = 'fwbr-out';
$pkg->{mac_source} = $from_info->{macaddr};
+ } elsif ($from =~ m|^([a-zA-Z][a-zA-Z0-9]{0,14})/(\S+)$|) {
+ $from_info->{type} = 'bport';
+ $from_info->{bridge} = $1;
+ $from_info->{iface} = $2;
+ $start_state = 'from-bport';
} else {
die "unable to parse \"from => '$from'\"\n";
}
@@ -569,10 +569,6 @@ sub simulate_firewall {
$target->{type} = 'host';
$target->{iface} = 'host';
$pkg->{dest} = $host_ip if !defined($pkg->{dest});
- } elsif ($to =~ m|^(vmbr\d+)/(\S+)$|) {
- $target->{type} = 'bport';
- $target->{bridge} = $1;
- $target->{iface} = $2;
} elsif ($to eq 'outside') {
$target->{type} = 'bport';
$target->{bridge} = 'vmbr0';
@@ -591,6 +587,10 @@ sub simulate_firewall {
my $vmid = $1;
$target = extract_vm_info($vmdata, $vmid, 0);
$target->{iface} = $target->{tapdev};
+ } elsif ($to =~ m|^([a-zA-Z][a-zA-Z0-9]{0,14})/(\S+)$|) {
+ $target->{type} = 'bport';
+ $target->{bridge} = $1;
+ $target->{iface} = $2;
} else {
die "unable to parse \"to => '$to'\"\n";
}
diff --git a/src/PVE/Service/pve_firewall.pm b/src/PVE/Service/pve_firewall.pm
index 30d14d9..20fbc31 100755
--- a/src/PVE/Service/pve_firewall.pm
+++ b/src/PVE/Service/pve_firewall.pm
@@ -312,14 +312,14 @@ __PACKAGE__->register_method ({
from => {
description => "Source zone.",
type => 'string',
- pattern => '(host|outside|vm\d+|ct\d+|vmbr\d+/\S+)',
+ pattern => '(host|outside|vm\d+|ct\d+|([a-zA-Z][a-zA-Z0-9]{0,14})/(\S+))',
optional => 1,
default => 'outside',
},
to => {
description => "Destination zone.",
type => 'string',
- pattern => '(host|outside|vm\d+|ct\d+|vmbr\d+/\S+)',
+ pattern => '(host|outside|vm\d+|ct\d+|([a-zA-Z][a-zA-Z0-9]{0,14})/(\S+))',
optional => 1,
default => 'host',
},
--
2.39.2
^ permalink raw reply [flat|nested] 10+ messages in thread