]> git.puffer.fish Git - mirror/frr.git/commitdiff
lib: Add a function to convert SR Policy Headend Behaviors into string
authorCarmine Scarpitta <cscarpit@cisco.com>
Thu, 20 Feb 2025 09:08:03 +0000 (10:08 +0100)
committerCarmine Scarpitta <cscarpit@cisco.com>
Wed, 30 Apr 2025 15:51:25 +0000 (15:51 +0000)
This commit adds a function to convert SR Policy Headend Behaviors into
string format for printing.

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

index 24b387ec4ea4111fba6e9ac8ef81c7f647534efe..b25241adfac4c232d620730e640e43d35e73b37f 100644 (file)
@@ -345,6 +345,24 @@ struct srv6_sid_ctx {
        ifindex_t ifindex;
 };
 
+static inline const char *srv6_headend_behavior2str(enum srv6_headend_behavior behavior)
+{
+       switch (behavior) {
+       case SRV6_HEADEND_BEHAVIOR_H_INSERT:
+               return "H.Insert";
+       case SRV6_HEADEND_BEHAVIOR_H_ENCAPS:
+               return "H.Encaps";
+       case SRV6_HEADEND_BEHAVIOR_H_ENCAPS_RED:
+               return "H.Encaps.Red";
+       case SRV6_HEADEND_BEHAVIOR_H_ENCAPS_L2:
+               return "H.Encaps.L2";
+       case SRV6_HEADEND_BEHAVIOR_H_ENCAPS_L2_RED:
+               return "H.Encaps.L2.Red";
+       }
+
+       return "unknown";
+}
+
 static inline const char *seg6_mode2str(enum seg6_mode_t mode)
 {
        switch (mode) {