public inbox for pve-devel@lists.proxmox.com
 help / color / mirror / Atom feed
From: Alexandre Derumier <aderumier@odiso.com>
To: pve-devel@lists.proxmox.com
Subject: [pve-devel] [PATCH pve-network 02/10] controllers: bgp: use loopback ip src for loopback network
Date: Fri, 11 Feb 2022 10:33:23 +0100	[thread overview]
Message-ID: <20220211093331.609127-3-aderumier@odiso.com> (raw)
In-Reply-To: <20220211093331.609127-1-aderumier@odiso.com>

can be usefull if we want to join other loopback ips,
like a ceph cluster in the underlay network

Signed-off-by: Alexandre Derumier <aderumier@odiso.com>
---
 PVE/Network/SDN/Controllers/BgpPlugin.pm                 | 7 +++++++
 PVE/Network/SDN/Controllers/EvpnPlugin.pm                | 2 ++
 test/zones/evpn/ebgp_loopback/expected_controller_config | 6 ++++++
 3 files changed, 15 insertions(+)

diff --git a/PVE/Network/SDN/Controllers/BgpPlugin.pm b/PVE/Network/SDN/Controllers/BgpPlugin.pm
index 69c688b..075ca90 100644
--- a/PVE/Network/SDN/Controllers/BgpPlugin.pm
+++ b/PVE/Network/SDN/Controllers/BgpPlugin.pm
@@ -110,6 +110,13 @@ sub generate_controller_config {
 	push(@{$bgp->{"address-family"}->{"$ipversion unicast"}}, "neighbor BGP soft-reconfiguration inbound");
     }
 
+    if ($loopback) {
+	push(@{$config->{frr}->{''}}, "ip prefix-list loopbacks_ips seq 10 permit 0.0.0.0/0 le 32");
+	push(@{$config->{frr}->{''}}, "ip protocol bgp route-map correct_src");
+	push(@{$config->{frr}->{'route-map'}->{'correct_src permit 1'}}, "match ip address prefix-list loopbacks_ips");
+	push(@{$config->{frr}->{'route-map'}->{'correct_src permit 1'}}, "set src $ifaceip");
+    }
+
     return $config;
 }
 
diff --git a/PVE/Network/SDN/Controllers/EvpnPlugin.pm b/PVE/Network/SDN/Controllers/EvpnPlugin.pm
index 3e450cf..61a6314 100644
--- a/PVE/Network/SDN/Controllers/EvpnPlugin.pm
+++ b/PVE/Network/SDN/Controllers/EvpnPlugin.pm
@@ -258,6 +258,7 @@ sub sort_frr_config {
     $order->{'ipv4 unicast'} = 1;
     $order->{'ipv6 unicast'} = 2;
     $order->{'l2vpn evpn'} = 3;
+    $order->{'route-map'} = 200;
 
     my $a_val = 100;
     my $b_val = 100;
@@ -283,6 +284,7 @@ sub generate_frr_recurse{
    $keylist->{vrf} = 1;
    $keylist->{'address-family'} = 1;
    $keylist->{router} = 1;
+   $keylist->{'route-map'} = 1;
 
    my $exitkeylist = {};
    $exitkeylist->{vrf} = 1;
diff --git a/test/zones/evpn/ebgp_loopback/expected_controller_config b/test/zones/evpn/ebgp_loopback/expected_controller_config
index 23be7f9..01cb2c2 100644
--- a/test/zones/evpn/ebgp_loopback/expected_controller_config
+++ b/test/zones/evpn/ebgp_loopback/expected_controller_config
@@ -5,6 +5,8 @@ frr defaults datacenter
 service integrated-vtysh-config
 hostname localhost
 !
+ip prefix-list loopbacks_ips seq 10 permit 0.0.0.0/0 le 32
+ip protocol bgp route-map correct_src
 !
 vrf vrf_myzone
  vni 1000
@@ -49,5 +51,9 @@ router bgp 65001 vrf vrf_myzone
   route-target export 65000:1000
  exit-address-family
 !
+route-map correct_src permit 1
+ match ip address prefix-list loopbacks_ips
+ set src 192.168.0.1
+!
 line vty
 !
\ No newline at end of file
-- 
2.30.2




  parent reply	other threads:[~2022-02-11  9:34 UTC|newest]

Thread overview: 12+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-02-11  9:33 [pve-devel] [PATCH pve-network 00/10] bgp/evpn improvements Alexandre Derumier
2022-02-11  9:33 ` [pve-devel] [PATCH pve-network 01/10] zones: status : skip node if node don't have the zone Alexandre Derumier
2022-02-11  9:33 ` Alexandre Derumier [this message]
2022-02-11  9:33 ` [pve-devel] [PATCH pve-network 03/10] controllers: bgp: add bgp-multipath-as-path-relax option Alexandre Derumier
2022-02-11  9:33 ` [pve-devel] [PATCH pve-network 04/10] controllers: evpn : add min/max value to asn Alexandre Derumier
2022-02-11  9:33 ` [pve-devel] [PATCH pve-network 05/10] controllers: evpn/bgp : add exitnodes-primary && rework route-map Alexandre Derumier
2022-02-11  9:33 ` [pve-devel] [PATCH pve-network 06/10] controllers: evpn: add missing bgp router-id in vrf Alexandre Derumier
2022-02-11  9:33 ` [pve-devel] [PATCH pve-network 07/10] zones: evpn : add rt-import Alexandre Derumier
2022-02-11  9:33 ` [pve-devel] [PATCH pve-network 08/10] controllers: evpn : remove "no bgp ebgp-requires-policy" Alexandre Derumier
2022-02-11  9:33 ` [pve-devel] [PATCH pve-network 09/10] controllers: bgp : remove bgp network import-check Alexandre Derumier
2022-02-11  9:33 ` [pve-devel] [PATCH pve-network 10/10] controllers: evpn : remove ip forwarding, ipv6 forwarding and add frr version Alexandre Derumier
2022-02-14  7:12 ` [pve-devel] applied-series: [PATCH pve-network 00/10] bgp/evpn improvements Thomas Lamprecht

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20220211093331.609127-3-aderumier@odiso.com \
    --to=aderumier@odiso.com \
    --cc=pve-devel@lists.proxmox.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
Service provided by Proxmox Server Solutions GmbH | Privacy | Legal