]> git.puffer.fish Git - matthieu/frr.git/commitdiff
bgpd: Move attr->pmsi_tnl_type to attr->extra->pmsi_tnl_type
authorDonatas Abraitis <donatas.abraitis@gmail.com>
Sat, 5 Feb 2022 08:01:45 +0000 (10:01 +0200)
committerDonatas Abraitis <donatas.abraitis@gmail.com>
Sat, 5 Feb 2022 08:01:45 +0000 (10:01 +0200)
Signed-off-by: Donatas Abraitis <donatas.abraitis@gmail.com>
bgpd/bgp_attr.h

index 6e9a4e7c3b96c6e5ba3c92915cd79e379d014a2d..8324bca65a54a9f91dc293e9df42e63c8a140a4f 100644 (file)
@@ -160,6 +160,9 @@ struct bgp_attr_srv6_l3vpn {
 };
 
 struct attr_extra {
+       /* PMSI tunnel type (RFC 6514). */
+       enum pta_type pmsi_tnl_type;
+
        /* Extended Communities attribute. */
        struct ecommunity *ipv6_ecommunity;
 };
@@ -187,9 +190,6 @@ struct attr {
        /* Path origin attribute */
        uint8_t origin;
 
-       /* PMSI tunnel type (RFC 6514). */
-       enum pta_type pmsi_tnl_type;
-
        /* has the route-map changed any attribute?
           Used on the peer outbound side. */
        uint32_t rmap_change_flags;
@@ -503,15 +503,21 @@ static inline uint32_t mac_mobility_seqnum(struct attr *attr)
        return (attr) ? attr->mm_seqnum : 0;
 }
 
-static inline enum pta_type bgp_attr_get_pmsi_tnl_type(struct attr *attr)
+static inline enum pta_type bgp_attr_get_pmsi_tnl_type(const struct attr *attr)
 {
-       return attr->pmsi_tnl_type;
+       if (attr->extra)
+               return attr->extra->pmsi_tnl_type;
+
+       return PMSI_TNLTYPE_NO_INFO;
 }
 
 static inline void bgp_attr_set_pmsi_tnl_type(struct attr *attr,
                                              enum pta_type pmsi_tnl_type)
 {
-       attr->pmsi_tnl_type = pmsi_tnl_type;
+       if (!attr->extra)
+               attr->extra = bgp_attr_extra_alloc();
+
+       attr->extra->pmsi_tnl_type = pmsi_tnl_type;
 }
 
 static inline struct ecommunity *