[pve-devel] [PATCH pve-network 1/1] Update vxlan plugin to emit local tunnel IP

Thomas Lamprecht t.lamprecht at proxmox.com
Thu Oct 10 08:21:14 CEST 2024


An actual commit message would be good, including at least a reason for
why this is done.

Am 08/10/2024 um 06:01 schrieb apalrd:
> ---
>  src/PVE/Network/SDN/Zones/VxlanPlugin.pm                   | 4 ++--
>  src/test/zones/vxlan/basic/expected_sdn_interfaces         | 1 +
>  src/test/zones/vxlan/vlanawarevnet/expected_sdn_interfaces | 1 +
>  src/test/zones/vxlan/vxlanport/expected_sdn_interfaces     | 1 +
>  4 files changed, 5 insertions(+), 2 deletions(-)
> 
> diff --git a/src/PVE/Network/SDN/Zones/VxlanPlugin.pm b/src/PVE/Network/SDN/Zones/VxlanPlugin.pm
> index 9a77bb9..c3cf0ce 100644
> --- a/src/PVE/Network/SDN/Zones/VxlanPlugin.pm
> +++ b/src/PVE/Network/SDN/Zones/VxlanPlugin.pm
> @@ -76,8 +76,8 @@ sub generate_sdn_config {
>      push @iface_config, "vxlan-id $tag";
>  
>      for my $address (@peers) {
> -	next if $address eq $ifaceip;
> -	push @iface_config, "vxlan_remoteip $address";

As Alexandre said, use an if/else, or alternatively a ternary:

my $vxlan_key = $address eq $ifaceip ? 'vxlan_local_tunnelip' : 'vxlan_remoteip';
push @iface_config, "$vxlan_key $address";

> +	    push @iface_config, "vxlan_local_tunnelip $address" if $address eq $ifaceip;
> +        push @iface_config, "vxlan_remoteip $address" if $address ne $ifaceip;
>      }
>      push @iface_config, "vxlan-port $vxlanport" if $vxlanport;
>  




More information about the pve-devel mailing list