[pve-devel] [PATCH v2 pve-network 08/13] vxlan: add support for ipv4/ipv6/mac for anycast routing

Alexandre Derumier aderumier at odiso.com
Thu Aug 29 12:32:49 CEST 2019


Signed-off-by: Alexandre Derumier <aderumier at odiso.com>
---
 PVE/Network/SDN/VnetPlugin.pm  |  7 ++++---
 PVE/Network/SDN/VxlanPlugin.pm | 11 +++++++++--
 2 files changed, 13 insertions(+), 5 deletions(-)

diff --git a/PVE/Network/SDN/VnetPlugin.pm b/PVE/Network/SDN/VnetPlugin.pm
index 6da17b7..09e9372 100644
--- a/PVE/Network/SDN/VnetPlugin.pm
+++ b/PVE/Network/SDN/VnetPlugin.pm
@@ -34,16 +34,16 @@ sub properties {
         },
         ipv4 => {
             description => "Anycast router ipv4 address.",
-            type => 'string', format => 'ipv4',
+            type => 'string', format => 'CIDRv4',
             optional => 1,
         },
 	ipv6 => {
 	    description => "Anycast router ipv6 address.",
-	    type => 'string', format => 'ipv6',
+	    type => 'string', format => 'CIDRv6',
 	    optional => 1,
 	},
         mac => {
-            type => 'boolean',
+            type => 'string',
             description => "Anycast router mac address",
 	    optional => 1,
         }
@@ -58,6 +58,7 @@ sub options {
         ipv4 => { optional => 1 },
         ipv6 => { optional => 1 },
         mtu => { optional => 1 },
+        mac => { optional => 1 },
     };
 }
 
diff --git a/PVE/Network/SDN/VxlanPlugin.pm b/PVE/Network/SDN/VxlanPlugin.pm
index c93dbc4..f090ce8 100644
--- a/PVE/Network/SDN/VxlanPlugin.pm
+++ b/PVE/Network/SDN/VxlanPlugin.pm
@@ -63,6 +63,9 @@ sub generate_sdn_config {
 
     my $tag = $vnet->{tag};
     my $alias = $vnet->{alias};
+    my $ipv4 = $vnet->{ipv4};
+    my $ipv6 = $vnet->{ipv6};
+    my $mac = $vnet->{mac};
     my $multicastaddress = $plugin_config->{'multicast-address'};
     my @unicastaddress = split(',', $plugin_config->{'unicast-address'}) if $plugin_config->{'unicast-address'};
 
@@ -86,7 +89,7 @@ sub generate_sdn_config {
 
     my $config = "\n";
     $config .= "auto vxlan$vnetid\n";
-    $config .= "iface vxlan$vnetid inet manual\n";
+    $config .= "iface vxlan$vnetid\n";
     $config .= "       vxlan-id $tag\n";
 
     if($multicastaddress) {
@@ -107,7 +110,10 @@ sub generate_sdn_config {
     $config .= "       mtu $mtu\n" if $mtu;
     $config .= "\n";
     $config .= "auto $vnetid\n";
-    $config .= "iface $vnetid inet manual\n";
+    $config .= "iface $vnetid\n";
+    $config .= "       address $ipv4\n" if $ipv4;
+    $config .= "       address $ipv6\n" if $ipv6;
+    $config .= "       hwaddress $mac\n" if $mac;
     $config .= "       bridge_ports vxlan$vnetid\n";
     $config .= "       bridge_stp off\n";
     $config .= "       bridge_fd 0\n";
@@ -137,6 +143,7 @@ sub generate_sdn_config {
 
 	    $config .= "\n";
 	    $config .= "auto $brvrf\n";
+	    $config .= "iface $brvrf\n";
 	    $config .= "	bridge-ports $vxlanvrf\n";
 	    $config .= "	bridge_stp off\n";
 	    $config .= "	bridge_fd 0\n";
-- 
2.20.1




More information about the pve-devel mailing list