]> git.puffer.fish Git - mirror/frr.git/commitdiff
lib: Add encap behavior to SRv6 nexthop
authorCarmine Scarpitta <cscarpit@cisco.com>
Fri, 21 Feb 2025 12:38:15 +0000 (13:38 +0100)
committerCarmine Scarpitta <cscarpit@cisco.com>
Wed, 30 Apr 2025 15:51:25 +0000 (15:51 +0000)
This commit introduces the `encap_behavior` field to the SRv6 nexthop
data structure and update the compare, hash, and copy functions to
handle this new field. The `encap_behavior` field allows daemons to
specify one of the encapsulation behaviors defined in RFC 8986 when
installing an SRv6 nexthop in the RIB.

Signed-off-by: Carmine Scarpitta <cscarpit@cisco.com>
lib/nexthop.c
lib/srv6.h

index c377b9cb0067d303b9ce89ec6cc7fc1322934894..7850827f4a33e75c113bcfdcd31856984181e8ce 100644 (file)
@@ -100,6 +100,12 @@ static int _nexthop_srv6_cmp(const struct nexthop *nh1,
                        break;
        }
 
+       if (nh1->nh_srv6->seg6_segs->encap_behavior > nh2->nh_srv6->seg6_segs->encap_behavior)
+               return 1;
+
+       if (nh1->nh_srv6->seg6_segs->encap_behavior < nh2->nh_srv6->seg6_segs->encap_behavior)
+               return -1;
+
        return ret;
 }
 
@@ -823,6 +829,7 @@ uint32_t nexthop_hash(const struct nexthop *nexthop)
                                        segs_num -= 1;
                                        i += 1;
                                }
+                               key = jhash_1word(nexthop->nh_srv6->seg6_segs->encap_behavior, key);
                        }
                }
        }
index b25241adfac4c232d620730e640e43d35e73b37f..acc828e4567b37099136328fba31ede8b0af3e99 100644 (file)
@@ -108,6 +108,7 @@ struct seg6local_flavors_info {
 };
 
 struct seg6_seg_stack {
+       enum srv6_headend_behavior encap_behavior;
        uint8_t num_segs;
        struct in6_addr seg[0]; /* 1 or more segs */
 };