]> git.puffer.fish Git - mirror/frr.git/commitdiff
bgpd: fix label in adj-rib-out 15434/head
authorPhilippe Guibert <philippe.guibert@6wind.com>
Thu, 23 Feb 2023 14:38:11 +0000 (15:38 +0100)
committerLouis Scalbert <louis.scalbert@6wind.com>
Wed, 5 Jun 2024 11:11:29 +0000 (13:11 +0200)
After modifying the "label vpn export value", the vpn label information
of the VRF is not updated to the peers.

For example, the 192.168.0.0/24 prefix is announced to the peer with a
label value of 222.

> router bgp 65500
> [..]
>  neighbor 192.0.2.2 remote-as 65501
>  address-family ipv4-vpn
>   neighbor 192.0.2.2 activate
>  exit-address-family
> exit
> router bgp 65500 vrf vrf2
>  address-family ipv4 unicast
>   network 192.168.0.0/24
>   label vpn export 222
>   rd vpn export 444:444
>   rt vpn both 53:100
>   export vpn
>   import vpn
>  exit-address-family

Changing the label with "label vpn export" does not update the label
value to the peer unless the BGP sessions is re-established.

No labels are stored are stored struct bgp_adj_out so that it is
impossible to compare the current value with the previous value
in adj-RIB-out.

Reference the bgp_labels pointer in struct bgp_adj_out and compare the
values when updating adj-RIB-out.

Signed-off-by: Philippe Guibert <philippe.guibert@6wind.com>
Signed-off-by: Louis Scalbert <louis.scalbert@6wind.com>
bgpd/bgp_advertise.h
bgpd/bgp_updgrp_adv.c

index e3cd743d43d2ecde9ee743dbc68dce5bb611d5e7..8c831892b33d8ca62102b360efd1358ccd4af0c7 100644 (file)
@@ -75,6 +75,9 @@ struct bgp_adj_out {
        /* Advertised attribute.  */
        struct attr *attr;
 
+       /* VPN label information */
+       struct bgp_labels *labels;
+
        /* Advertisement information.  */
        struct bgp_advertise *adv;
 };
index 0a852c75de77271d9515a35fc508c5bbb788dca0..250378af68456f2e279f33a4f10bce83a68ba6fa 100644 (file)
@@ -78,6 +78,8 @@ static inline struct bgp_adj_out *adj_lookup(struct bgp_dest *dest,
 
 static void adj_free(struct bgp_adj_out *adj)
 {
+       bgp_labels_unintern(&adj->labels);
+
        TAILQ_REMOVE(&(adj->subgroup->adjq), adj, subgrp_adj_train);
        SUBGRP_DECR_STAT(adj->subgroup, adj_count);
 
@@ -572,7 +574,9 @@ bool bgp_adj_out_set_subgroup(struct bgp_dest *dest,
                attr_hash = attrhash_key_make(attr);
 
        if (!CHECK_FLAG(subgrp->sflags, SUBGRP_STATUS_FORCE_UPDATES) &&
-           attr_hash && adj->attr_hash == attr_hash) {
+           attr_hash && adj->attr_hash == attr_hash &&
+           bgp_labels_cmp(path->extra ? path->extra->labels : NULL,
+                          adj->labels)) {
                if (BGP_DEBUG(update, UPDATE_OUT)) {
                        char attr_str[BUFSIZ] = {0};
 
@@ -614,6 +618,10 @@ bool bgp_adj_out_set_subgroup(struct bgp_dest *dest,
        adv->baa = bgp_advertise_attr_intern(subgrp->hash, attr);
        adv->adj = adj;
        adj->attr_hash = attr_hash;
+       if (path->extra)
+               adj->labels = bgp_labels_intern(path->extra->labels);
+       else
+               adj->labels = NULL;
 
        /* Add new advertisement to advertisement attribute list. */
        bgp_advertise_add(adv->baa, adv);