Skip to content

srv6: add support for END.X behavior - #677

Draft
christophefontaine wants to merge 2 commits into
DPDK:mainfrom
christophefontaine:srv6_end.x
Draft

srv6: add support for END.X behavior#677
christophefontaine wants to merge 2 commits into
DPDK:mainfrom
christophefontaine:srv6_end.x

Conversation

@christophefontaine

Copy link
Copy Markdown
Collaborator

Implement the SRv6 END.X behavior (RFC 8986 Section 4.10). END.X forwards packets to a specific IPv6 next-hop after processing the segment routing header, bypassing FIB lookup. This is used for ISIS adjacency SIDs in traffic engineering.

FRR integration allows installing END.X nexthops from zebra and exporting them back for display.

Add two smoke tests, standalone, and with FRR/ISIS with uSID.

Closes: #668

@christophefontaine
christophefontaine force-pushed the srv6_end.x branch 2 times, most recently from ab20137 to c742283 Compare August 4, 2026 09:09
Comment thread modules/srv6/control/localsid.c
Comment thread modules/srv6/control/localsid.c Outdated
Comment thread modules/srv6/control/localsid.c Outdated
Comment on lines +32 to +51
// Iterate through all nexthops and find a matching SRv6 local one
while ((nh = nexthop_next(nh)) != NULL) {
if (nh->type != GR_NH_T_SR6_LOCAL)
continue;
if (nh->vrf_id != base->vrf_id)
continue;
if (nh->iface_id != base->iface_id)
continue;

struct nexthop_info_srv6_local *priv = nexthop_info_srv6_local(nh);
if (priv->behavior != target->behavior)
continue;
if (priv->out_vrf_id != target->out_vrf_id)
continue;
if (priv->flags != target->flags)
continue;

// For END.X, match by next-hop address and interface
if (target->behavior == SR_BEHAVIOR_END_X) {
if (priv->endx_iface_id != target->endx_iface_id)

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This seems a bit inefficient. Would it make sense to use a hash table?

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

yes.
I'll ask my friend Claude to look at that, (not much time today ).

Comment thread modules/srv6/control/localsid.c Outdated
Comment thread frr/rt_grout.c Outdated
@christophefontaine
christophefontaine force-pushed the srv6_end.x branch 2 times, most recently from 0fdfb54 to 9720143 Compare August 4, 2026 10:00
Comment thread frr/rt_grout.c
Comment thread frr/rt_grout.c Outdated
Comment thread modules/srv6/control/localsid.c Outdated
Comment thread modules/srv6/control/localsid.c Outdated
@christophefontaine

Copy link
Copy Markdown
Collaborator Author

Reworked a bit to reuse the existing iface_id instead of populating another one, will come back to the hatable later today.

@rjarry

rjarry commented Aug 4, 2026

Copy link
Copy Markdown
Collaborator

Oops :trollface:

+ interface del p0-bis
DEBUG: API: read_cb: pid=52227 id=6 req_type=0xacdc0003 (GR_IFACE_GET) req_len=18 status=0 (Success) resp_len=466
DEBUG: IFACE: iface_event: iface event [0xacdc1003] PRE_REMOVE triggered for iface p0-bis.
DEBUG: ROUTE: rib6_delete: VRF 1: 2001:db8:62::2/128
DEBUG: ROUTE: rib6_delete: VRF 1: 5f00:102::100/128
grout: ../modules/infra/control/nexthop.c:515: nexthop_decref: Assertion `nh->ref_count > 0' failed.
error: command failed: Connection reset by peer (ECONNRESET)
error: fatal: Broken pipe
error: fatal: Broken pipe
...
Thread 1 (Thread 0x7f716f424900 (LWP 50822)):
#0  0x00007f716f29eb2c in pthread_kill () from /lib/x86_64-linux-gnu/libc.so.6
#1  0x00007f716f24527e in raise () from /lib/x86_64-linux-gnu/libc.so.6
#2  0x00007f716f2288ff in abort () from /lib/x86_64-linux-gnu/libc.so.6
#3  0x00007f716f22881b in ?? () from /lib/x86_64-linux-gnu/libc.so.6
#4  0x00007f716f23b517 in __assert_fail () from /lib/x86_64-linux-gnu/libc.so.6
#5  0x0000557e9a4f9005 in nexthop_decref (nh=<optimized out>) at ../modules/infra/control/nexthop.c:515
#6  0x0000557e9a4fa3f3 in nexthop_decref (nh=<optimized out>) at ../modules/infra/control/nexthop.c:514
#7  0x0000557e9a52ca9e in srv6_local_nh_free (nh=0x16d65bc40) at ../modules/srv6/control/localsid.c:170
#8  srv6_local_nh_free (nh=0x16d65bc40) at ../modules/srv6/control/localsid.c:166
#9  0x0000557e9a4f9360 in nexthop_destroy (nh=nh@entry=0x16d65bc40) at ../modules/infra/control/nexthop.c:510
#10 0x0000557e9a4f9538 in nexthop_destroy (nh=0x16d65bc40) at ../modules/infra/control/nexthop.c:489
#11 nexthop_decref (nh=0x16d65bc40) at ../modules/infra/control/nexthop.c:518
#12 nh_cleanup_interface_cb (priv=<optimized out>, nh=0x16d65bc40) at ../modules/infra/control/nexthop.c:477
#13 nh_cleanup_interface_cb (nh=0x16d65bc40, priv=<optimized out>) at ../modules/infra/control/nexthop.c:468
#14 0x0000557e9a6667c2 in rte_mempool_obj_iter (mp=0x16d661400, obj_cb=obj_cb@entry=0x557e9a4f8fb0 <nh_pool_iter_cb>, obj_cb_arg=obj_cb_arg@entry=0x7ffe727f1d10) at ../subprojects/dpdk-stable-25.11.2/lib/mempool/rte_mempool.c:195
#15 0x0000557e9a4f9051 in nexthop_iter (nh_cb=0x557e9a4f94f0 <nh_cleanup_interface_cb>, priv=<optimized out>) at ../modules/infra/control/nexthop.c:436
#16 nexthop_iface_cleanup (data=<optimized out>) at ../modules/infra/control/nexthop.c:483
#17 0x0000557e9a4e7efc in notify_subscribers (obj=0x16f5e92c0, ev_type=2900103171) at ../main/event.c:48
#18 0x0000557e9a4f3baf in iface_destroy (iface=0x16f5e92c0) at ../modules/infra/control/iface.c:702
#19 0x0000557e9a4eb462 in iface_del (request=<optimized out>) at ../modules/infra/api/iface.c:59
#20 0x0000557e9a4e555f in read_cb (bev=0x557e9c670000, priv=0x557e9c6745b0) at ../main/api.c:315
#21 0x00007f716f549834 in bufferevent_run_readcb_ () from /lib/x86_64-linux-gnu/libevent_core-2.1.so.7
#22 0x00007f716f54c5bf in ?? () from /lib/x86_64-linux-gnu/libevent_core-2.1.so.7
#23 0x00007f716f55638c in ?? () from /lib/x86_64-linux-gnu/libevent_core-2.1.so.7
#24 0x00007f716f557faf in event_base_loop () from /lib/x86_64-linux-gnu/libevent_core-2.1.so.7
#25 0x0000557e9a3dc246 in main (argc=2, argv=<optimized out>) at ../main/main.c:349

@rjarry

rjarry commented Aug 4, 2026

Copy link
Copy Markdown
Collaborator

The end.x test (non-frr) is failing

> nh new: type=SRv6-local id=200 iface=p0-bis vrf=main origin=static behavior=end.x endx_addr=2001:db8:62::2 flavor=usd

=================================================================
==55251==ERROR: LeakSanitizer: detected memory leaks

Direct leak of 466 byte(s) in 1 object(s) allocated from:
    #0 0x7f3039efd9c7 in malloc ../../../../src/libsanitizer/asan/asan_malloc_linux.cpp:69
    #1 0x55ab72532078 in gr_api_client_recv ../api/gr_api_client_impl.h:266
    #2 0x55ab724f073a in gr_api_client_send_recv ../api/gr_api.h:75
    #3 0x55ab724f18f2 in iface_from_name ../modules/infra/cli/iface.c:153
    #4 0x55ab7251f1f6 in srv6_localsid_add ../modules/srv6/cli/localsid.c:101
    #5 0x55ab7252d9a9 in exec_strvec ../cli/exec.c:249
    #6 0x55ab7252dd1b in exec_args ../cli/exec.c:320
    #7 0x55ab72533906 in main ../cli/main.c:218
    #8 0x7f3039a2a1c9  (/lib/x86_64-linux-gnu/libc.so.6+0x2a1c9) (BuildId: 8e9fd827446c24067541ac5390e6f527fb5947bb)
    #9 0x7f3039a2a28a in __libc_start_main (/lib/x86_64-linux-gnu/libc.so.6+0x2a28a) (BuildId: 8e9fd827446c24067541ac5390e6f527fb5947bb)
    #10 0x55ab724e80f4 in _start (/home/runner/work/grout/grout/build/grcli+0x3d0f4) (BuildId: 918868a2f49c374532fc44a521d261daf880f74e)

@rjarry

rjarry commented Aug 4, 2026

Copy link
Copy Markdown
Collaborator

Could you squash the hash table addition in the same commit and put the smoke tests separate? Thanks!

Implement the SRv6 END.X behavior (RFC 8986 Section 4.10). END.X
forwards packets to a specific IPv6 next-hop after processing the
segment routing header, bypassing FIB lookup. This is used for ISIS
adjacency SIDs in traffic engineering.

FRR integration allows installing END.X nexthops from zebra and
exporting them back for display.

Closes: DPDK#668
Signed-off-by: Christophe Fontaine <cfontain@redhat.com>
Add test for end.x function, and an ISIS based test.

Signed-off-by: Christophe Fontaine <cfontain@redhat.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Add support for ZEBRA_SEG6_LOCAL_ACTION_END_X (was: "incomplete support for srv6 actions')

2 participants