Skip to content

Commit 7d88a14

Browse files
ogournetrjarry
authored andcommitted
srv6: add srv6 module
Add Segment Routing (SR) over IPv6 (SRv6). SR over MPLS is not addressed. Endpoints, SR policies and steering rules can be configured as static rules through api/cli. Integration with BGP/IGP is future work. This patch addresses part of the following RFC: RFC8402: Segment Routing Architecture https://www.rfc-editor.org/rfc/rfc8402 RFC8754: IPv6 Segment Routing Header (SRH) https://www.rfc-editor.org/rfc/rfc8754 RFC8986: Segment Routing over IPv6 (SRv6) Network Programming https://www.rfc-editor.org/rfc/rfc8986 Headend node implements H.Encaps and H.Encaps.Red. Local node implements End, End.T (with PSP, USD flavors), End.DT6, End.DT4 and End.DT46. Signed-off-by: Olivier Gournet <[email protected]>
1 parent 16b3065 commit 7d88a14

13 files changed

+2509
-256
lines changed

docs/graph.svg

+340-256
Loading

modules/infra/api/gr_nexthop.h

+4
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,8 @@ typedef enum : uint16_t {
2626
typedef enum : uint8_t {
2727
GR_NH_IPV4 = 1,
2828
GR_NH_IPV6,
29+
GR_NH_SR6_IPV4,
30+
GR_NH_SR6_IPV6,
2931
GR_NH_TYPE_COUNT
3032
} gr_nh_type_t;
3133

@@ -82,8 +84,10 @@ static inline const char *gr_nh_flag_name(const gr_nh_flags_t flag) {
8284
static inline uint8_t nh_af(const struct gr_nexthop *nh) {
8385
switch (nh->type) {
8486
case GR_NH_IPV4:
87+
case GR_NH_SR6_IPV4:
8588
return AF_INET;
8689
case GR_NH_IPV6:
90+
case GR_NH_SR6_IPV6:
8791
return AF_INET6;
8892
case GR_NH_TYPE_COUNT:
8993
break;

modules/infra/control/nexthop.c

+4
Original file line numberDiff line numberDiff line change
@@ -48,9 +48,11 @@ nexthop_new(gr_nh_type_t type, uint16_t vrf_id, uint16_t iface_id, const void *a
4848
nh->type = type;
4949
switch (type) {
5050
case GR_NH_IPV4:
51+
case GR_NH_SR6_IPV4:
5152
nh->ipv4 = *(ip4_addr_t *)addr;
5253
break;
5354
case GR_NH_IPV6:
55+
case GR_NH_SR6_IPV6:
5456
nh->ipv6 = *(struct rte_ipv6_addr *)addr;
5557
break;
5658
default:
@@ -101,10 +103,12 @@ static void nh_lookup_cb(struct nexthop *nh, void *priv) {
101103

102104
switch (filter->type) {
103105
case GR_NH_IPV4:
106+
case GR_NH_SR6_IPV4:
104107
if (nh->ipv4 == *(ip4_addr_t *)filter->addr)
105108
filter->nh = nh;
106109
break;
107110
case GR_NH_IPV6:
111+
case GR_NH_SR6_IPV6:
108112
if (rte_ipv6_addr_eq(&nh->ipv6, filter->addr)) {
109113
bool is_linklocal = rte_ipv6_addr_is_linklocal(&nh->ipv6);
110114
if (!is_linklocal || nh->iface_id == filter->iface_id)

modules/meson.build

+1
Original file line numberDiff line numberDiff line change
@@ -6,3 +6,4 @@ subdir('ip')
66
subdir('ip6')
77
subdir('ipip')
88
subdir('l4')
9+
subdir('srv6')

0 commit comments

Comments
 (0)