mirror of
https://github.com/lucaspalomodevelop/core.git
synced 2026-03-20 03:16:12 +00:00
Interfaces: Other Types: VXLAN - add optional local/remote port. closes https://github.com/opnsense/core/issues/7047
This commit is contained in:
parent
86686eff4b
commit
dea5f295ac
@ -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;
|
||||
}
|
||||
|
||||
@ -20,6 +20,13 @@
|
||||
When the interface is configured in unicast mode, the listening socket is bound to this address.
|
||||
</help>
|
||||
</field>
|
||||
<field>
|
||||
<id>vxlan.vxlanlocalport</id>
|
||||
<label>Source port</label>
|
||||
<type>text</type>
|
||||
<help>Define the source port. Default is 4789.</help>
|
||||
<advanced>true</advanced>
|
||||
</field>
|
||||
<field>
|
||||
<id>vxlan.vxlanremote</id>
|
||||
<label>Remote address</label>
|
||||
@ -29,6 +36,13 @@
|
||||
This is the IP address of the remote end of the tunnel.
|
||||
</help>
|
||||
</field>
|
||||
<field>
|
||||
<id>vxlan.vxlanremoteport</id>
|
||||
<label>Remote port</label>
|
||||
<type>text</type>
|
||||
<help>Define the remote port. Default is 4789.</help>
|
||||
<advanced>true</advanced>
|
||||
</field>
|
||||
<field>
|
||||
<id>vxlan.vxlangroup</id>
|
||||
<label>Multicast group</label>
|
||||
|
||||
@ -1,6 +1,6 @@
|
||||
<model>
|
||||
<mount>//OPNsense/Interfaces/vxlans</mount>
|
||||
<version>1.0.1</version>
|
||||
<version>1.0.2</version>
|
||||
<description>VXLAN configuration</description>
|
||||
<items>
|
||||
<vxlan type="ArrayField">
|
||||
@ -16,9 +16,11 @@
|
||||
<Required>Y</Required>
|
||||
<NetMaskAllowed>N</NetMaskAllowed>
|
||||
</vxlanlocal>
|
||||
<vxlanlocalport type="PortField"/>
|
||||
<vxlanremote type="NetworkField">
|
||||
<NetMaskAllowed>N</NetMaskAllowed>
|
||||
</vxlanremote>
|
||||
<vxlanremoteport type="PortField"/>
|
||||
<vxlangroup type="NetworkField">
|
||||
<NetMaskAllowed>N</NetMaskAllowed>
|
||||
</vxlangroup>
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user