diff --git a/src/etc/inc/plugins.inc.d/vxlan.inc b/src/etc/inc/plugins.inc.d/vxlan.inc
index 6d2c5c6fd..06c715a8a 100644
--- a/src/etc/inc/plugins.inc.d/vxlan.inc
+++ b/src/etc/inc/plugins.inc.d/vxlan.inc
@@ -94,12 +94,7 @@ function vxlan_configure_do($verbose = false, $device = null)
}
$configured_devices[] = $device_name;
- $current_settings = [
- 'vxlanid' => null,
- 'vxlanlocal' => null,
- 'vxlanremote' => null,
- 'vxlangroup' => null,
- ];
+ $current_settings = [];
if (empty($interfaces_details[$device_name])) {
// new device
@@ -108,22 +103,28 @@ function vxlan_configure_do($verbose = false, $device = null)
} else {
$isChanged = false;
$current_settings['vxlanid'] = $interfaces_details[$device_name]['vxlan']['vni'];
- $current_settings['vxlanlocal'] = explode(":", $interfaces_details[$device_name]['vxlan']['local'])[0];
- $current_settings['vxlanremote'] = explode(":", $interfaces_details[$device_name]['vxlan']['remote'])[0];
- if (!empty($interfaces_details[$device_name]['vxlan']['group'])) {
- $current_settings['vxlangroup'] = explode(":", $interfaces_details[$device_name]['vxlan']['group'])[0];
+ foreach (['local', 'remote', 'group'] as $target) {
+ if (!empty($interfaces_details[$device_name]['vxlan'][$target])) {
+ $tmp = explode(':', $interfaces_details[$device_name]['vxlan'][$target]);
+ $current_settings['vxlan'.$target] = $tmp[0];
+ $current_settings['vxlan'.$target.'port'] = $tmp[1];
+ }
}
}
// gather settings, detect changes
$ifcnfcmd = '/sbin/ifconfig %s';
$ifcnfcmdp = array($device_name);
- foreach (array('vxlanid', 'vxlanlocal', 'vxlanremote', 'vxlangroup', 'vxlandev') as $param) {
+ foreach ([
+ 'vxlanid', 'vxlanlocal', 'vxlanremote', 'vxlanlocalport', 'vxlanremoteport', 'vxlangroup', 'vxlandev'
+ ] as $param) {
$value = '';
if ($param == 'vxlandev') {
$intfnm = (string)$vxlan->$param;
if (!empty($cnf->interfaces->$intfnm)) {
$value = (string)$cnf->interfaces->$intfnm->if;
}
+ } elseif (str_ends_with($param, 'port')) {
+ $value = !empty((string)$vxlan->$param) ? (string)$vxlan->$param : '4789';
} else {
$value = (string)$vxlan->$param;
}
diff --git a/src/opnsense/mvc/app/controllers/OPNsense/Interfaces/forms/dialogVxlan.xml b/src/opnsense/mvc/app/controllers/OPNsense/Interfaces/forms/dialogVxlan.xml
index ba4cc35b6..8b2a68a7c 100644
--- a/src/opnsense/mvc/app/controllers/OPNsense/Interfaces/forms/dialogVxlan.xml
+++ b/src/opnsense/mvc/app/controllers/OPNsense/Interfaces/forms/dialogVxlan.xml
@@ -20,6 +20,13 @@
When the interface is configured in unicast mode, the listening socket is bound to this address.
+
+ vxlan.vxlanlocalport
+
+ text
+ Define the source port. Default is 4789.
+ true
+
vxlan.vxlanremote
@@ -29,6 +36,13 @@
This is the IP address of the remote end of the tunnel.
+
+ vxlan.vxlanremoteport
+
+ text
+ Define the remote port. Default is 4789.
+ true
+
vxlan.vxlangroup
diff --git a/src/opnsense/mvc/app/models/OPNsense/Interfaces/VxLan.xml b/src/opnsense/mvc/app/models/OPNsense/Interfaces/VxLan.xml
index d95ce2520..d19da936f 100644
--- a/src/opnsense/mvc/app/models/OPNsense/Interfaces/VxLan.xml
+++ b/src/opnsense/mvc/app/models/OPNsense/Interfaces/VxLan.xml
@@ -1,6 +1,6 @@
//OPNsense/Interfaces/vxlans
- 1.0.1
+ 1.0.2
VXLAN configuration
@@ -16,9 +16,11 @@
Y
N
+
N
+
N