From: Thomas Lamprecht Date: Tue, 24 Aug 2021 12:23:53 +0000 (+0200) Subject: Revert "evpn : remove "ip route add vrf vrf_myzone unreachable default metric 4278198... X-Git-Url: https://git.puffer.fish/?a=commitdiff_plain;h=8591dacbff05c144c7e2b28a8fd13234cd681fdd;p=matthieu%2Fpve-network.git Revert "evpn : remove "ip route add vrf vrf_myzone unreachable default metric 4278198272" on exit node" replaced by another series https://lists.proxmox.com/pipermail/pve-devel/2021-August/049771.html This reverts commit 95e2f20f5c70f0cd0aa4fe80dad35dace9dc165d. --- diff --git a/PVE/Network/SDN/Zones/EvpnPlugin.pm b/PVE/Network/SDN/Zones/EvpnPlugin.pm index 6dd970b..4fa46f7 100644 --- a/PVE/Network/SDN/Zones/EvpnPlugin.pm +++ b/PVE/Network/SDN/Zones/EvpnPlugin.pm @@ -73,7 +73,6 @@ sub generate_sdn_config { my $bgprouter = PVE::Network::SDN::Controllers::EvpnPlugin::find_bgp_controller($local_node, $controller_cfg); my $loopback = $bgprouter->{loopback} if $bgprouter->{loopback}; my ($ifaceip, $iface) = PVE::Network::SDN::Zones::Plugin::find_local_ip_interface_peers(\@peers, $loopback); - my $is_evpn_gateway = $plugin_config->{'exitnodes'}->{$local_node}; my $mtu = 1450; $mtu = $interfaces_config->{$iface}->{mtu} - 50 if $interfaces_config->{$iface}->{mtu}; @@ -128,6 +127,8 @@ sub generate_sdn_config { if ($subnet->{snat}) { + my $is_evpn_gateway = $plugin_config->{'exitnodes'}->{$local_node}; + #find outgoing interface my ($outip, $outiface) = PVE::Network::SDN::Zones::Plugin::get_local_route_ip($checkrouteip); if ($outip && $outiface && $is_evpn_gateway) { @@ -157,7 +158,7 @@ sub generate_sdn_config { #vrf interface @iface_config = (); push @iface_config, "vrf-table auto"; - push @iface_config, "post-up ip route add vrf $vrf_iface unreachable default metric 4278198272" if !$is_evpn_gateway; + push @iface_config, "post-up ip route add vrf $vrf_iface unreachable default metric 4278198272"; push(@{$config->{$vrf_iface}}, @iface_config) if !$config->{$vrf_iface}; if ($vrfvxlan) { diff --git a/test/zones/evpn/exitnode/expected_sdn_interfaces b/test/zones/evpn/exitnode/expected_sdn_interfaces index ca691cd..4cf13e0 100644 --- a/test/zones/evpn/exitnode/expected_sdn_interfaces +++ b/test/zones/evpn/exitnode/expected_sdn_interfaces @@ -14,6 +14,7 @@ iface myvnet auto vrf_myzone iface vrf_myzone vrf-table auto + post-up ip route add vrf vrf_myzone unreachable default metric 4278198272 auto vrfbr_myzone iface vrfbr_myzone diff --git a/test/zones/evpn/exitnode_snat/expected_sdn_interfaces b/test/zones/evpn/exitnode_snat/expected_sdn_interfaces index 77168ad..a2a183e 100644 --- a/test/zones/evpn/exitnode_snat/expected_sdn_interfaces +++ b/test/zones/evpn/exitnode_snat/expected_sdn_interfaces @@ -33,6 +33,7 @@ iface myvnet2 auto vrf_myzone iface vrf_myzone vrf-table auto + post-up ip route add vrf vrf_myzone unreachable default metric 4278198272 auto vrfbr_myzone iface vrfbr_myzone