On Tue, Jun 26, 2018 at 08:23:37PM +0000, Thiruvazhiyan Lakshmanan wrote:
> Hi Ondrej,
> Thanks for your advice, with the updated iproute2 package, I can see the mpls 
> routes in the table now.
> I need another help now, I am trying to advertise the loopback interface 
> addresses to the labeled unicast BGP peer with label value of 3 (Implicit 
> null), but unable to do it. I am trying to create a static label route and 
> advertise to the label unicast bgp peer, but I still see the routes received 
> in the unicast table in the peer.
> ...
> protocol static static4 {
>         ipv4;
>         route 10.10.100.10/32 via 10.10.101.38 mpls 3;
> }

Hi

This does not work, because "via IP mpls X" means that labes X is label
assigned by IP. That label is announced when IP is announced as
bgp_next_hop, but when 'next hop self' is used (or when local address is
used as bgp_next_hop for other reasons) then local label (instead of
label of IP) must be used, but BIRD currently does not support local
label assignment, and such route is ignored.

Attached patch fixes it so BIRD will use implicit-NULL automatically
when route is announced with local next hop via MPLS-BGP.

Compile BIRD with it.

-- 
Elen sila lumenn' omentielvo

Ondrej 'Santiago' Zajicek (email: santi...@crfreenet.org)
OpenPGP encrypted e-mails preferred (KeyID 0x11DEADC3, wwwkeys.pgp.net)
"To err is human -- to blame it on a computer is even more so."
commit 8e86ffce8251f4e48f61b6d8e89966d037ef8e59
Author: Ondrej Zajicek (work) <santi...@crfreenet.org>
Date:   Sun Jul 1 01:03:16 2018 +0200

    BGP: Use implicit-NULL label when announcing MPLS routes with local next-hop
    
    We currently cannot assing local labels, but we can still be LSP egress
    router. Therefore when we announce labeled route with local next-hop, we
    should announce implicit-NULL label instead of rejecting it completely.

diff --git a/proto/bgp/packets.c b/proto/bgp/packets.c
index d67ef0b2..c40b8ec2 100644
--- a/proto/bgp/packets.c
+++ b/proto/bgp/packets.c
@@ -875,7 +875,10 @@ bgp_update_next_hop_ip(struct bgp_export_state *s, eattr *a, ea_list **to)
 
       /* TODO: Use local MPLS assigned label */
       if (s->mpls)
-	bgp_unset_attr(to, s->pool, BA_MPLS_LABEL_STACK);
+      {
+	u32 implicit_null = BGP_MPLS_NULL;
+	bgp_set_attr_data(to, s->pool, BA_MPLS_LABEL_STACK, 0, &implicit_null, 4);
+      }
     }
   }
 

Reply via email to