diff options
Diffstat (limited to 'lib')
| -rw-r--r-- | lib/command.h | 2 | ||||
| -rw-r--r-- | lib/frrstr.c | 9 | ||||
| -rw-r--r-- | lib/frrstr.h | 9 | ||||
| -rw-r--r-- | lib/ipaddr.h | 2 | ||||
| -rw-r--r-- | lib/srv6.c | 8 | ||||
| -rw-r--r-- | lib/srv6.h | 20 | ||||
| -rw-r--r-- | lib/vty.c | 9 | ||||
| -rw-r--r-- | lib/vty.h | 9 | ||||
| -rw-r--r-- | lib/zclient.c | 2 |
9 files changed, 62 insertions, 8 deletions
diff --git a/lib/command.h b/lib/command.h index 31e5cad23f..0f9715e81c 100644 --- a/lib/command.h +++ b/lib/command.h @@ -383,6 +383,8 @@ struct cmd_node { #define SHOW_STR "Show running system information\n" #define IP_STR "IP information\n" #define IPV6_STR "IPv6 information\n" +#define IP_ADDR_STR "IPv4 Address\n" +#define IP6_ADDR_STR "IPv6 Address\n" #define SRTE_STR "SR-TE information\n" #define SRTE_COLOR_STR "SR-TE Color information\n" #define NO_STR "Negate a command or set its defaults\n" diff --git a/lib/frrstr.c b/lib/frrstr.c index 1b98b224cc..d66c6f8c16 100644 --- a/lib/frrstr.c +++ b/lib/frrstr.c @@ -23,11 +23,16 @@ #include <string.h> #include <ctype.h> #include <sys/types.h> -#ifdef HAVE_LIBPCREPOSIX +#ifdef HAVE_LIBPCRE2_POSIX +#ifndef _FRR_PCRE2_POSIX +#define _FRR_PCRE2_POSIX +#include <pcre2posix.h> +#endif /* _FRR_PCRE2_POSIX */ +#elif defined(HAVE_LIBPCREPOSIX) #include <pcreposix.h> #else #include <regex.h> -#endif /* HAVE_LIBPCREPOSIX */ +#endif /* HAVE_LIBPCRE2_POSIX */ #include "frrstr.h" #include "memory.h" diff --git a/lib/frrstr.h b/lib/frrstr.h index d52d6a4482..f0066d0fc5 100644 --- a/lib/frrstr.h +++ b/lib/frrstr.h @@ -23,11 +23,16 @@ #include <sys/types.h> #include <sys/types.h> -#ifdef HAVE_LIBPCREPOSIX +#ifdef HAVE_LIBPCRE2_POSIX +#ifndef _FRR_PCRE2_POSIX +#define _FRR_PCRE2_POSIX +#include <pcre2posix.h> +#endif /* _FRR_PCRE2_POSIX */ +#elif defined(HAVE_LIBPCREPOSIX) #include <pcreposix.h> #else #include <regex.h> -#endif /* HAVE_LIBPCREPOSIX */ +#endif /* HAVE_LIBPCRE2_POSIX */ #include <stdbool.h> #include "vector.h" diff --git a/lib/ipaddr.h b/lib/ipaddr.h index d7ab358afe..43b3028200 100644 --- a/lib/ipaddr.h +++ b/lib/ipaddr.h @@ -61,6 +61,8 @@ struct ipaddr { #define IPADDRSZ(p) \ (IS_IPADDR_V4((p)) ? sizeof(struct in_addr) : sizeof(struct in6_addr)) +#define IPADDR_STRING_SIZE 46 + static inline int ipaddr_family(const struct ipaddr *ip) { switch (ip->ipa_type) { diff --git a/lib/srv6.c b/lib/srv6.c index 1c2c8913d5..5cd82080f5 100644 --- a/lib/srv6.c +++ b/lib/srv6.c @@ -241,6 +241,10 @@ json_object *srv6_locator_json(const struct srv6_locator *loc) json_object_int_add(jo_root, "argumentBitsLength", loc->argument_bits_length); + /* set true if the locator is a Micro-segment (uSID) locator */ + if (CHECK_FLAG(loc->flags, SRV6_LOCATOR_USID)) + json_object_string_add(jo_root, "behavior", "usid"); + /* set status_up */ json_object_boolean_add(jo_root, "statusUp", loc->status_up); @@ -286,6 +290,10 @@ json_object *srv6_locator_detailed_json(const struct srv6_locator *loc) json_object_int_add(jo_root, "argumentBitsLength", loc->argument_bits_length); + /* set true if the locator is a Micro-segment (uSID) locator */ + if (CHECK_FLAG(loc->flags, SRV6_LOCATOR_USID)) + json_object_string_add(jo_root, "behavior", "usid"); + /* set algonum */ json_object_int_add(jo_root, "algoNum", loc->algonum); diff --git a/lib/srv6.h b/lib/srv6.h index 18d5bdebc2..acfb0631cc 100644 --- a/lib/srv6.h +++ b/lib/srv6.h @@ -92,6 +92,9 @@ struct srv6_locator { bool status_up; struct list *chunks; + uint8_t flags; +#define SRV6_LOCATOR_USID (1 << 0) /* The SRv6 Locator is a uSID Locator */ + QOBJ_FIELDS; }; DECLARE_QOBJ_TYPE(srv6_locator); @@ -116,6 +119,23 @@ struct srv6_locator_chunk { uint8_t proto; uint16_t instance; uint32_t session_id; + + uint8_t flags; +}; + +/* + * SRv6 Endpoint Behavior codepoints, as defined by IANA in + * https://www.iana.org/assignments/segment-routing/segment-routing.xhtml + */ +enum srv6_endpoint_behavior_codepoint { + SRV6_ENDPOINT_BEHAVIOR_RESERVED = 0x0000, + SRV6_ENDPOINT_BEHAVIOR_END_DT6 = 0x0012, + SRV6_ENDPOINT_BEHAVIOR_END_DT4 = 0x0013, + SRV6_ENDPOINT_BEHAVIOR_END_DT46 = 0x0014, + SRV6_ENDPOINT_BEHAVIOR_END_DT6_USID = 0x003E, + SRV6_ENDPOINT_BEHAVIOR_END_DT4_USID = 0x003F, + SRV6_ENDPOINT_BEHAVIOR_END_DT46_USID = 0x0040, + SRV6_ENDPOINT_BEHAVIOR_OPAQUE = 0xFFFF, }; struct nexthop_srv6 { @@ -24,11 +24,16 @@ #include <lib/version.h> #include <sys/types.h> #include <sys/types.h> -#ifdef HAVE_LIBPCREPOSIX +#ifdef HAVE_LIBPCRE2_POSIX +#ifndef _FRR_PCRE2_POSIX +#define _FRR_PCRE2_POSIX +#include <pcre2posix.h> +#endif /* _FRR_PCRE2_POSIX */ +#elif defined(HAVE_LIBPCREPOSIX) #include <pcreposix.h> #else #include <regex.h> -#endif /* HAVE_LIBPCREPOSIX */ +#endif /* HAVE_LIBPCRE2_POSIX */ #include <stdio.h> #include "linklist.h" @@ -22,11 +22,16 @@ #define _ZEBRA_VTY_H #include <sys/types.h> -#ifdef HAVE_LIBPCREPOSIX +#ifdef HAVE_LIBPCRE2_POSIX +#ifndef _FRR_PCRE2_POSIX +#define _FRR_PCRE2_POSIX +#include <pcre2posix.h> +#endif /* _FRR_PCRE2_POSIX */ +#elif defined(HAVE_LIBPCREPOSIX) #include <pcreposix.h> #else #include <regex.h> -#endif /* HAVE_LIBPCREPOSIX */ +#endif /* HAVE_LIBPCRE2_POSIX */ #include "thread.h" #include "log.h" diff --git a/lib/zclient.c b/lib/zclient.c index 2517773dc4..fd6eb7db0d 100644 --- a/lib/zclient.c +++ b/lib/zclient.c @@ -1088,6 +1088,7 @@ int zapi_srv6_locator_chunk_encode(struct stream *s, stream_putc(s, c->node_bits_length); stream_putc(s, c->function_bits_length); stream_putc(s, c->argument_bits_length); + stream_putc(s, c->flags); return 0; } @@ -1109,6 +1110,7 @@ int zapi_srv6_locator_chunk_decode(struct stream *s, STREAM_GETC(s, c->node_bits_length); STREAM_GETC(s, c->function_bits_length); STREAM_GETC(s, c->argument_bits_length); + STREAM_GETC(s, c->flags); return 0; stream_failure: |
