From: Gabriel Goller <g.goller@proxmox.com>
To: pve-devel@lists.proxmox.com
Subject: [PATCH pve-manager v3 26/28] ui: sdn: allow static routes for Simple zone VRFs
Date: Thu, 19 Nov 2026 20:41:12 +0100 [thread overview]
Message-ID: <20261119194116.575520-27-g.goller@proxmox.com> (raw)
In-Reply-To: <20261119194116.575520-1-g.goller@proxmox.com>
Allow Simple zones to reach networks outside their directly connected
subnets through static routes.
Routes can use a gateway, an outgoing interface, or both. IPv6 link-local
gateways require an interface. Keep the routes in a separate tab so the
general zone settings remain easy to use.
Signed-off-by: Gabriel Goller <g.goller@proxmox.com>
---
www/manager6/Makefile | 1 +
www/manager6/Toolkit.js | 2 +-
www/manager6/sdn/StaticRoutes.js | 222 +++++++++++++++++++++++++++
www/manager6/sdn/zones/Base.js | 22 ++-
www/manager6/sdn/zones/SimpleEdit.js | 12 ++
5 files changed, 256 insertions(+), 3 deletions(-)
create mode 100644 www/manager6/sdn/StaticRoutes.js
diff --git a/www/manager6/Makefile b/www/manager6/Makefile
index e8e2bd0b49e8..349b912b61da 100644
--- a/www/manager6/Makefile
+++ b/www/manager6/Makefile
@@ -305,6 +305,7 @@ JSSRC= \
sdn/VnetPanel.js \
sdn/SubnetEdit.js \
sdn/SubnetView.js \
+ sdn/StaticRoutes.js \
sdn/ZoneContentView.js \
sdn/ZoneContentPanel.js \
sdn/ZoneBridgesPanel.js \
diff --git a/www/manager6/Toolkit.js b/www/manager6/Toolkit.js
index 9cc89184188e..2fea13e4aed3 100644
--- a/www/manager6/Toolkit.js
+++ b/www/manager6/Toolkit.js
@@ -17,7 +17,7 @@ Ext.apply(Ext.form.field.VTypes, {
IP64FullRangeCIDRAddress: function (v) {
let result = Proxmox.Utils.IP64_cidr_match.exec(v);
- if (result === null) {
+ if (result === null || result[0] !== v) {
return false;
}
if (result[1] !== undefined) {
diff --git a/www/manager6/sdn/StaticRoutes.js b/www/manager6/sdn/StaticRoutes.js
new file mode 100644
index 000000000000..62e0be8c9182
--- /dev/null
+++ b/www/manager6/sdn/StaticRoutes.js
@@ -0,0 +1,222 @@
+Ext.define('PVE.sdn.StaticRouteEdit', {
+ extend: 'Proxmox.window.Edit',
+
+ subject: gettext('Static Route'),
+ width: 450,
+ isAdd: true,
+ url: '#',
+
+ fieldDefaults: {
+ labelWidth: 150,
+ },
+
+ items: [
+ {
+ xtype: 'textfield',
+ name: 'prefix',
+ fieldLabel: gettext('Destination Prefix'),
+ vtype: 'IP64FullRangeCIDRAddress',
+ allowBlank: false,
+ },
+ {
+ xtype: 'proxmoxtextfield',
+ name: 'via',
+ fieldLabel: gettext('Gateway'),
+ vtype: 'IP64Address',
+ skipEmptyText: true,
+ validator: function (value) {
+ let iface = this.up('window').down('[name=iface]')?.getValue();
+ return value || iface
+ ? true
+ : gettext('Either a gateway or an interface is required.');
+ },
+ listeners: {
+ change: function (field) {
+ field.up('window').down('[name=iface]')?.validate();
+ },
+ },
+ },
+ {
+ xtype: 'proxmoxtextfield',
+ name: 'iface',
+ fieldLabel: gettext('Outgoing Interface'),
+ maxLength: 15,
+ regex: /^[^\s,=/]+$/,
+ skipEmptyText: true,
+ validator: function (value) {
+ let via = this.up('window').down('[name=via]')?.getValue();
+ if (!value && !via) {
+ return gettext('Either a gateway or an interface is required.');
+ }
+ if (!value && /^fe[89ab][0-9a-f]:/i.test(via)) {
+ return gettext('An interface is required for an IPv6 link-local gateway.');
+ }
+ return true;
+ },
+ listeners: {
+ change: function (field) {
+ field.up('window').down('[name=via]')?.validate();
+ },
+ },
+ },
+ {
+ xtype: 'proxmoxintegerfield',
+ name: 'distance',
+ fieldLabel: gettext('Distance'),
+ minValue: 1,
+ maxValue: 255,
+ allowBlank: true,
+ },
+ ],
+
+ submit: function () {
+ let me = this;
+ if (me.isValid()) {
+ me.onSave(me.getValues());
+ me.close();
+ }
+ },
+});
+
+Ext.define('PVE.sdn.StaticRoutes', {
+ extend: 'Ext.grid.Panel',
+ alias: 'widget.pveSDNStaticRoutes',
+ mixins: ['Ext.form.field.Field'],
+
+ isCreate: false,
+ value: [],
+ height: 250,
+
+ store: {
+ fields: [
+ 'route',
+ ...['prefix', 'via', 'iface', 'distance'].map((name) => ({
+ name,
+ calculate: (data) => data.route[name],
+ })),
+ ],
+ data: [],
+ },
+
+ viewConfig: {
+ emptyText: gettext('No static routes configured'),
+ deferEmptyText: false,
+ },
+
+ columns: [
+ {
+ text: gettext('Destination Prefix'),
+ dataIndex: 'prefix',
+ flex: 2,
+ renderer: Ext.htmlEncode,
+ },
+ {
+ text: gettext('Gateway'),
+ dataIndex: 'via',
+ flex: 2,
+ renderer: Ext.htmlEncode,
+ },
+ {
+ text: gettext('Interface'),
+ dataIndex: 'iface',
+ flex: 1,
+ renderer: Ext.htmlEncode,
+ },
+ {
+ text: gettext('Distance'),
+ dataIndex: 'distance',
+ width: 80,
+ renderer: Ext.htmlEncode,
+ },
+ ],
+
+ editRoute: function (record) {
+ let me = this;
+ let win = Ext.create('PVE.sdn.StaticRouteEdit', {
+ isCreate: !record,
+ onSave: function (values) {
+ if (record) {
+ record.set('route', values);
+ } else {
+ me.getStore().add({ route: values });
+ }
+ },
+ });
+ if (record) {
+ win.setValues(record.get('route'));
+ }
+ win.show();
+ },
+
+ isEqual: function (value1, value2) {
+ return JSON.stringify(value1) === JSON.stringify(value2);
+ },
+
+ getValue: function () {
+ return this.getStore()
+ .getRange()
+ .map((record) => PVE.Parser.printPropertyString(record.get('route')));
+ },
+
+ setValue: function (value) {
+ let me = this;
+ me.getStore().setData(
+ (value ?? []).map((route) => ({ route: PVE.Parser.parsePropertyString(route) })),
+ );
+ me.checkChange();
+ return me;
+ },
+
+ getSubmitData: function () {
+ let me = this;
+ if (me.disabled || !me.submitValue) {
+ return null;
+ }
+ let value = me.getValue();
+ if (value.length) {
+ return { [me.getName()]: value };
+ }
+ return me.isCreate ? null : { delete: me.getName() };
+ },
+
+ // The grid cannot show field errors itself. Proxmox.window.Edit marks the API errors on the
+ // form before it shows them in the error dialog, so these must exist but need not do anything.
+ markInvalid: Ext.emptyFn,
+ clearInvalid: Ext.emptyFn,
+
+ initComponent: function () {
+ let me = this;
+ let sm = Ext.create('Ext.selection.RowModel');
+
+ me.selModel = sm;
+ me.tbar = [
+ {
+ text: gettext('Add'),
+ handler: () => me.editRoute(),
+ },
+ {
+ xtype: 'proxmoxButton',
+ text: gettext('Edit'),
+ disabled: true,
+ selModel: sm,
+ handler: () => me.editRoute(sm.getSelection()[0]),
+ },
+ {
+ xtype: 'proxmoxButton',
+ text: gettext('Remove'),
+ disabled: true,
+ selModel: sm,
+ handler: () => me.getStore().remove(sm.getSelection()),
+ },
+ ];
+
+ me.callParent();
+ me.initField();
+ me.mon(me.getStore(), {
+ datachanged: me.checkChange,
+ update: me.checkChange,
+ scope: me,
+ });
+ me.on('itemdblclick', (grid, record) => me.editRoute(record));
+ },
+});
diff --git a/www/manager6/sdn/zones/Base.js b/www/manager6/sdn/zones/Base.js
index 66f93de0dff2..ebfbc953317d 100644
--- a/www/manager6/sdn/zones/Base.js
+++ b/www/manager6/sdn/zones/Base.js
@@ -45,6 +45,8 @@ Ext.define('PVE.panel.SDNZoneBase', {
emptyText: gettext('All') + ' (' + gettext('No restrictions') + ')',
multiSelect: true,
autoSelect: false,
+ skipEmptyText: true,
+ deleteEmpty: !me.isCreate,
},
{
xtype: 'pveSDNIpamSelector',
@@ -110,10 +112,26 @@ Ext.define('PVE.sdn.zones.BaseEdit', {
zone: me.zone,
});
+ let additionalTabs = ipanel.getAdditionalTabs?.() ?? [];
+ let items = [ipanel];
+ if (additionalTabs.length) {
+ ipanel.setTitle(gettext('General'));
+ me.width = 760;
+ me.bodyPadding = 0;
+ items = [
+ {
+ xtype: 'tabpanel',
+ bodyPadding: 10,
+ deferredRender: false,
+ items: [ipanel, ...additionalTabs],
+ },
+ ];
+ }
+
Ext.apply(me, {
subject: PVE.Utils.format_sdnzone_type(me.type),
isAdd: true,
- items: [ipanel],
+ items,
});
me.callParent();
@@ -136,7 +154,7 @@ Ext.define('PVE.sdn.zones.BaseEdit', {
values.enable = values.disable ? 0 : 1;
- ipanel.setValues(values);
+ me.setValues(values);
},
});
}
diff --git a/www/manager6/sdn/zones/SimpleEdit.js b/www/manager6/sdn/zones/SimpleEdit.js
index 9c88668bb5d6..5b80bfcdbeec 100644
--- a/www/manager6/sdn/zones/SimpleEdit.js
+++ b/www/manager6/sdn/zones/SimpleEdit.js
@@ -3,6 +3,18 @@ Ext.define('PVE.sdn.zones.SimpleInputPanel', {
onlineHelp: 'pvesdn_zone_plugin_simple',
+ getAdditionalTabs: function () {
+ return [
+ {
+ xtype: 'pveSDNStaticRoutes',
+ title: gettext('Static Routes'),
+ onlineHelp: this.onlineHelp,
+ name: 'route',
+ isCreate: this.isCreate,
+ },
+ ];
+ },
+
onGetValues: function (values) {
var me = this;
--
2.47.3
next prev parent reply other threads:[~2026-11-19 19:44 UTC|newest]
Thread overview: 29+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-11-19 19:40 [PATCH common/manager/network/proxmox{-ve-rs,-perl-rs,-widget-toolkit} v3 00/28] SDN VRF support Gabriel Goller
2026-11-19 19:40 ` [PATCH pve-common v3 01/28] interfaces: preserve VRF membership across address family changes Gabriel Goller
2026-11-19 19:40 ` [PATCH proxmox-ve-rs v3 02/28] frr: add VRF-aware OSPF rendering Gabriel Goller
2026-11-19 19:40 ` [PATCH proxmox-ve-rs v3 03/28] sdn: add zone references to OSPF and BGP fabrics Gabriel Goller
2026-11-19 19:40 ` [PATCH proxmox-ve-rs v3 04/28] sdn: generate fabric routing configuration in zone VRFs Gabriel Goller
2026-11-19 19:40 ` [PATCH proxmox-ve-rs v3 05/28] sdn: fix VRF route-map scoping and zone ID validation Gabriel Goller
2026-11-19 19:40 ` [PATCH proxmox-ve-rs v3 06/28] tests: fabrics: add tests for fabrics in VRFs Gabriel Goller
2026-11-19 19:40 ` [PATCH proxmox-ve-rs v3 07/28] sdn: allow static routes in simple zone VRFs Gabriel Goller
2026-11-19 19:40 ` [PATCH proxmox-perl-rs v3 08/28] pve-rs: fabrics: assign network interfaces to configured VRFs Gabriel Goller
2026-11-19 19:40 ` [PATCH proxmox-perl-rs v3 09/28] pve-rs: fabrics: make per-fabric status queries VRF-aware Gabriel Goller
2026-11-19 19:40 ` [PATCH proxmox-perl-rs v3 10/28] pve-rs: fabrics: include VRF routes in aggregate status Gabriel Goller
2026-11-19 19:40 ` [PATCH proxmox-perl-rs v3 11/28] pve-rs: fabrics: expose host interface membership Gabriel Goller
2026-11-19 19:40 ` [PATCH proxmox-perl-rs v3 12/28] sdn: expose static routes for simple zone uplinks Gabriel Goller
2026-11-19 19:40 ` [PATCH pve-network v3 13/28] sdn: evpn: add unreachable IPv6 default route to zone VRFs Gabriel Goller
2026-11-19 19:41 ` [PATCH pve-network v3 14/28] sdn: add optional VRFs for simple zones Gabriel Goller
2026-11-19 19:41 ` [PATCH pve-network v3 15/28] sdn: allow fabrics to use simple zone VRFs Gabriel Goller
2026-11-19 19:41 ` [PATCH pve-network v3 16/28] sdn: require underlay fabrics to use the default VRF Gabriel Goller
2026-11-19 19:41 ` [PATCH pve-network v3 17/28] sdn: move full range CIDR formats into a separate module Gabriel Goller
2026-11-19 19:41 ` [PATCH pve-network v3 18/28] sdn: simple: support static routes in zone routing tables Gabriel Goller
2026-11-19 19:41 ` [PATCH pve-network v3 19/28] sdn: dhcp: only configure DHCP for zones on the local node Gabriel Goller
2026-11-19 19:41 ` [PATCH pve-network v3 20/28] sdn: dhcp: run dnsmasq in the zone VRF Gabriel Goller
2026-11-19 19:41 ` [PATCH pve-network v3 21/28] sdn: dhcp: fix DNS server option for IPv4 subnets without gateway Gabriel Goller
2026-11-19 19:41 ` [PATCH pve-network v3 22/28] sdn: evpn: no exit node null routes for simple zone VRFs Gabriel Goller
2026-11-19 19:41 ` [PATCH proxmox-widget-toolkit v3 23/28] ui: network: allow selecting a VRF for host interfaces Gabriel Goller
2026-11-19 19:41 ` [PATCH pve-manager v3 24/28] ui: sdn: add VRF zone selection for fabrics Gabriel Goller
2026-11-19 19:41 ` [PATCH pve-manager v3 25/28] network: allow setting the VRF of host interfaces Gabriel Goller
2026-11-19 19:41 ` Gabriel Goller [this message]
2026-11-19 19:41 ` [PATCH pve-manager v3 27/28] network: generate SDN DHCP config after ifreload Gabriel Goller
2026-11-19 19:41 ` [PATCH pve-manager v3 28/28] ui: sdn: subnet: allow setting the DHCP DNS server Gabriel Goller
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20261119194116.575520-27-g.goller@proxmox.com \
--to=g.goller@proxmox.com \
--cc=pve-devel@lists.proxmox.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox