When the user modifies an SRv6 SID and then removes all SIDs, staticd
crashes:
```
2025/03/23 08:37:22.691860 STATIC: lib/memory.c:74: mt_count_free(): assertion (mt->n_alloc) failed
STATIC: Received signal 6 at 1742715442 (si_addr 0x8200007cf0); aborting...
STATIC: zlog_signal+0x390 fcc704a844b8 ffffd7450390 /usr/lib/frr/libfrr.so.0 (mapped at 0xfcc704800000)
STATIC: core_handler+0x1f8 fcc704b79990 ffffd7450590 /usr/lib/frr/libfrr.so.0 (mapped at 0xfcc704800000)
STATIC: ---- signal ----
STATIC: ? fcc705c008f8 ffffd74507a0 linux-vdso.so.1 (mapped at 0xfcc705c00000)
STATIC: pthread_key_delete+0x1a0 fcc70458f1f0 ffffd7451a00 /lib/aarch64-linux-gnu/libc.so.6 (mapped at 0xfcc704510000)
STATIC: raise+0x1c fcc70454a67c ffffd7451ad0 /lib/aarch64-linux-gnu/libc.so.6 (mapped at 0xfcc704510000)
STATIC: abort+0xe4 fcc704537130 ffffd7451af0 /lib/aarch64-linux-gnu/libc.so.6 (mapped at 0xfcc704510000)
STATIC: _zlog_assert_failed+0x3c4 fcc704c407c8 ffffd7451c40 /usr/lib/frr/libfrr.so.0 (mapped at 0xfcc704800000)
STATIC: mt_count_free+0x12c fcc704a93c74 ffffd7451dc0 /usr/lib/frr/libfrr.so.0 (mapped at 0xfcc704800000)
STATIC: qfree+0x28 fcc704a93fa0 ffffd7451e70 /usr/lib/frr/libfrr.so.0 (mapped at 0xfcc704800000)
STATIC: static_srv6_sid_free+0x1c adc1df8fa544 ffffd7451e90 /usr/lib/frr/staticd (mapped at 0xadc1df8a0000)
STATIC: delete_static_srv6_sid+0x14 adc1df8faafc ffffd7451eb0 /usr/lib/frr/staticd (mapped at 0xadc1df8a0000)
STATIC: list_delete_all_node+0x104 fcc704a60eec ffffd7451ed0 /usr/lib/frr/libfrr.so.0 (mapped at 0xfcc704800000)
STATIC: list_delete+0x8c fcc704a61054 ffffd7451f00 /usr/lib/frr/libfrr.so.0 (mapped at 0xfcc704800000)
STATIC: static_srv6_cleanup+0x20 adc1df8fabdc ffffd7451f20 /usr/lib/frr/staticd (mapped at 0xadc1df8a0000)
STATIC: sigint+0x40 adc1df8be544 ffffd7451f30 /usr/lib/frr/staticd (mapped at 0xadc1df8a0000)
STATIC: frr_sigevent_process+0x148 fcc704b79460 ffffd7451f40 /usr/lib/frr/libfrr.so.0 (mapped at 0xfcc704800000)
STATIC: event_fetch+0x1c4 fcc704bc0834 ffffd7451f60 /usr/lib/frr/libfrr.so.0 (mapped at 0xfcc704800000)
STATIC: frr_run+0x650 fcc704a5d230 ffffd7452080 /usr/lib/frr/libfrr.so.0 (mapped at 0xfcc704800000)
STATIC: main+0x1d0 adc1df8be75c ffffd7452270 /usr/lib/frr/staticd (mapped at 0xadc1df8a0000)
STATIC: __libc_init_first+0x7c fcc7045373fc ffffd74522b0 /lib/aarch64-linux-gnu/libc.so.6 (mapped at 0xfcc704510000)
STATIC: __libc_start_main+0x98 fcc7045374cc ffffd74523c0 /lib/aarch64-linux-gnu/libc.so.6 (mapped at 0xfcc704510000)
STATIC: _start+0x30 adc1df8be0f0 ffffd7452420 /usr/lib/frr/staticd (mapped at 0xadc1df8a0000)
```
Tracking this down, the crash occurs because every time we modify a
SID, staticd executes some callbacks to modify the SID and finally it
calls `apply_finish`, which re-adds the SID to the list `srv6_sids`.
This leads to having the same SID multiple times in the `srv6_sids`
list. When we delete all SIDs, staticd attempts to deallocate the same
SID multiple times, which leads to the crash.
This commit fixes the issue by moving the code that adds the SID to the
list from the `apply_finish` callback to the `create` callback.
This ensures that the SID is inserted into the list only once, when it
is created. For all subsequent modifications, the SID is modified but
not added to the list.
Signed-off-by: Carmine Scarpitta <cscarpit@cisco.com>
When running valgrind, the following error is observed.
```
==2474568== Memcheck, a memory error detector
==2474568== Copyright (C) 2002-2017, and GNU GPL'd, by Julian Seward et al.
==2474568== Using Valgrind-3.18.1 and LibVEX; rerun with -h for copyright info
==2474568== Command: /usr/lib/frr/staticd --command-log-always --log file:staticd.log --log-level debug -d
==2474568== Parent PID: 2474525
==2474568==
==2474568== Conditional jump or move depends on uninitialised value(s)
==2474568== at 0x490B32A: inet_ntop (ntop.c:105)
==2474568== by 0x49AB9CB: printfrr_i6 (prefix.c:1614)
==2474568== by 0x4A24B19: printfrr_extp (glue.c:220)
==2474568== by 0x4A2286E: vbprintfrr (vfprintf.c:626)
==2474568== by 0x4A12AE2: zlog_msg_text (zlog.c:838)
==2474568== by 0x4A11B83: vzlog_tls (zlog.c:497)
==2474568== by 0x4A12561: vzlogx (zlog.c:722)
==2474568== by 0x129AE8: zlog_ref (zlog.h:84)
==2474568== by 0x12BD35: routing_control_plane_protocols_control_plane_protocol_staticd_segment_routing_srv6_local_sids_sid_paths_next_hop_modify (static_nb_config.c:1299)
==2474568== by 0x498ABF8: nb_callback_modify (northbound.c:1579)
==2474568== by 0x498BB35: nb_callback_configuration (northbound.c:1930)
==2474568== by 0x498A03C: nb_candidate_validate_code (northbound.c:1287)
==2474568== by 0x498A2C1: nb_candidate_commit_prepare (northbound.c:1358)
==2474568== by 0x496F414: mgmt_be_txn_cfg_prepare (mgmt_be_client.c:579)
==2474568== by 0x496FBB8: mgmt_be_process_cfgdata_req (mgmt_be_client.c:717)
==2474568== by 0x49703A9: mgmt_be_client_handle_msg (mgmt_be_client.c:851)
==2474568== by 0x49718B9: mgmt_be_client_process_msg (mgmt_be_client.c:1261)
==2474568== by 0x4976810: mgmt_msg_procbufs (mgmt_msg.c:193)
==2474568== by 0x497771A: msg_conn_proc_msgs (mgmt_msg.c:526)
==2474568== by 0x49E40E2: event_call (event.c:2019)
==2474568== by 0x4958AD9: frr_run (libfrr.c:1246)
==2474568== by 0x11581D: main (static_main.c:193)
==2474568==
==2474568== Conditional jump or move depends on uninitialised value(s)
==2474568== at 0x490B334: inet_ntop (ntop.c:105)
==2474568== by 0x49AB9CB: printfrr_i6 (prefix.c:1614)
==2474568== by 0x4A24B19: printfrr_extp (glue.c:220)
==2474568== by 0x4A2286E: vbprintfrr (vfprintf.c:626)
==2474568== by 0x4A12AE2: zlog_msg_text (zlog.c:838)
==2474568== by 0x4A11B83: vzlog_tls (zlog.c:497)
==2474568== by 0x4A12561: vzlogx (zlog.c:722)
==2474568== by 0x129AE8: zlog_ref (zlog.h:84)
==2474568== by 0x12BD35: routing_control_plane_protocols_control_plane_protocol_staticd_segment_routing_srv6_local_sids_sid_paths_next_hop_modify (static_nb_config.c:1299)
==2474568== by 0x498ABF8: nb_callback_modify (northbound.c:1579)
==2474568== by 0x498BB35: nb_callback_configuration (northbound.c:1930)
==2474568== by 0x498A03C: nb_candidate_validate_code (northbound.c:1287)
==2474568== by 0x498A2C1: nb_candidate_commit_prepare (northbound.c:1358)
==2474568== by 0x496F414: mgmt_be_txn_cfg_prepare (mgmt_be_client.c:579)
==2474568== by 0x496FBB8: mgmt_be_process_cfgdata_req (mgmt_be_client.c:717)
==2474568== by 0x49703A9: mgmt_be_client_handle_msg (mgmt_be_client.c:851)
==2474568== by 0x49718B9: mgmt_be_client_process_msg (mgmt_be_client.c:1261)
==2474568== by 0x4976810: mgmt_msg_procbufs (mgmt_msg.c:193)
==2474568== by 0x497771A: msg_conn_proc_msgs (mgmt_msg.c:526)
==2474568== by 0x49E40E2: event_call (event.c:2019)
==2474568== by 0x4958AD9: frr_run (libfrr.c:1246)
==2474568== by 0x11581D: main (static_main.c:193)
==2474568==
==2474568== Conditional jump or move depends on uninitialised value(s)
==2474568== at 0x490B343: inet_ntop (ntop.c:105)
==2474568== by 0x49AB9CB: printfrr_i6 (prefix.c:1614)
==2474568== by 0x4A24B19: printfrr_extp (glue.c:220)
==2474568== by 0x4A2286E: vbprintfrr (vfprintf.c:626)
==2474568== by 0x4A12AE2: zlog_msg_text (zlog.c:838)
==2474568== by 0x4A11B83: vzlog_tls (zlog.c:497)
==2474568== by 0x4A12561: vzlogx (zlog.c:722)
==2474568== by 0x129AE8: zlog_ref (zlog.h:84)
==2474568== by 0x12BD35: routing_control_plane_protocols_control_plane_protocol_staticd_segment_routing_srv6_local_sids_sid_paths_next_hop_modify (static_nb_config.c:1299)
==2474568== by 0x498ABF8: nb_callback_modify (northbound.c:1579)
==2474568== by 0x498BB35: nb_callback_configuration (northbound.c:1930)
==2474568== by 0x498A03C: nb_candidate_validate_code (northbound.c:1287)
==2474568== by 0x498A2C1: nb_candidate_commit_prepare (northbound.c:1358)
==2474568== by 0x496F414: mgmt_be_txn_cfg_prepare (mgmt_be_client.c:579)
==2474568== by 0x496FBB8: mgmt_be_process_cfgdata_req (mgmt_be_client.c:717)
==2474568== by 0x49703A9: mgmt_be_client_handle_msg (mgmt_be_client.c:851)
==2474568== by 0x49718B9: mgmt_be_client_process_msg (mgmt_be_client.c:1261)
==2474568== by 0x4976810: mgmt_msg_procbufs (mgmt_msg.c:193)
==2474568== by 0x497771A: msg_conn_proc_msgs (mgmt_msg.c:526)
==2474568== by 0x49E40E2: event_call (event.c:2019)
==2474568== by 0x4958AD9: frr_run (libfrr.c:1246)
==2474568== by 0x11581D: main (static_main.c:193)
==2474568==
==2474568== Conditional jump or move depends on uninitialised value(s)
==2474568== at 0x490B34D: inet_ntop (ntop.c:105)
==2474568== by 0x49AB9CB: printfrr_i6 (prefix.c:1614)
==2474568== by 0x4A24B19: printfrr_extp (glue.c:220)
==2474568== by 0x4A2286E: vbprintfrr (vfprintf.c:626)
==2474568== by 0x4A12AE2: zlog_msg_text (zlog.c:838)
==2474568== by 0x4A11B83: vzlog_tls (zlog.c:497)
==2474568== by 0x4A12561: vzlogx (zlog.c:722)
==2474568== by 0x129AE8: zlog_ref (zlog.h:84)
==2474568== by 0x12BD35: routing_control_plane_protocols_control_plane_protocol_staticd_segment_routing_srv6_local_sids_sid_paths_next_hop_modify (static_nb_config.c:1299)
==2474568== by 0x498ABF8: nb_callback_modify (northbound.c:1579)
==2474568== by 0x498BB35: nb_callback_configuration (northbound.c:1930)
==2474568== by 0x498A03C: nb_candidate_validate_code (northbound.c:1287)
==2474568== by 0x498A2C1: nb_candidate_commit_prepare (northbound.c:1358)
==2474568== by 0x496F414: mgmt_be_txn_cfg_prepare (mgmt_be_client.c:579)
==2474568== by 0x496FBB8: mgmt_be_process_cfgdata_req (mgmt_be_client.c:717)
==2474568== by 0x49703A9: mgmt_be_client_handle_msg (mgmt_be_client.c:851)
==2474568== by 0x49718B9: mgmt_be_client_process_msg (mgmt_be_client.c:1261)
==2474568== by 0x4976810: mgmt_msg_procbufs (mgmt_msg.c:193)
==2474568== by 0x497771A: msg_conn_proc_msgs (mgmt_msg.c:526)
==2474568== by 0x49E40E2: event_call (event.c:2019)
==2474568== by 0x4958AD9: frr_run (libfrr.c:1246)
==2474568== by 0x11581D: main (static_main.c:193)
==2474568==
==2474568== Conditional jump or move depends on uninitialised value(s)
==2474568== at 0x490B35B: inet_ntop (ntop.c:105)
==2474568== by 0x49AB9CB: printfrr_i6 (prefix.c:1614)
==2474568== by 0x4A24B19: printfrr_extp (glue.c:220)
==2474568== by 0x4A2286E: vbprintfrr (vfprintf.c:626)
==2474568== by 0x4A12AE2: zlog_msg_text (zlog.c:838)
==2474568== by 0x4A11B83: vzlog_tls (zlog.c:497)
==2474568== by 0x4A12561: vzlogx (zlog.c:722)
==2474568== by 0x129AE8: zlog_ref (zlog.h:84)
==2474568== by 0x12BD35: routing_control_plane_protocols_control_plane_protocol_staticd_segment_routing_srv6_local_sids_sid_paths_next_hop_modify (static_nb_config.c:1299)
==2474568== by 0x498ABF8: nb_callback_modify (northbound.c:1579)
==2474568== by 0x498BB35: nb_callback_configuration (northbound.c:1930)
==2474568== by 0x498A03C: nb_candidate_validate_code (northbound.c:1287)
==2474568== by 0x498A2C1: nb_candidate_commit_prepare (northbound.c:1358)
==2474568== by 0x496F414: mgmt_be_txn_cfg_prepare (mgmt_be_client.c:579)
==2474568== by 0x496FBB8: mgmt_be_process_cfgdata_req (mgmt_be_client.c:717)
==2474568== by 0x49703A9: mgmt_be_client_handle_msg (mgmt_be_client.c:851)
==2474568== by 0x49718B9: mgmt_be_client_process_msg (mgmt_be_client.c:1261)
==2474568== by 0x4976810: mgmt_msg_procbufs (mgmt_msg.c:193)
==2474568== by 0x497771A: msg_conn_proc_msgs (mgmt_msg.c:526)
==2474568== by 0x49E40E2: event_call (event.c:2019)
==2474568== by 0x4958AD9: frr_run (libfrr.c:1246)
==2474568== by 0x11581D: main (static_main.c:193)
==2474568==
==2474568== Conditional jump or move depends on uninitialised value(s)
==2474568== at 0x490B367: inet_ntop (ntop.c:105)
==2474568== by 0x49AB9CB: printfrr_i6 (prefix.c:1614)
==2474568== by 0x4A24B19: printfrr_extp (glue.c:220)
==2474568== by 0x4A2286E: vbprintfrr (vfprintf.c:626)
==2474568== by 0x4A12AE2: zlog_msg_text (zlog.c:838)
==2474568== by 0x4A11B83: vzlog_tls (zlog.c:497)
==2474568== by 0x4A12561: vzlogx (zlog.c:722)
==2474568== by 0x129AE8: zlog_ref (zlog.h:84)
==2474568== by 0x12BD35: routing_control_plane_protocols_control_plane_protocol_staticd_segment_routing_srv6_local_sids_sid_paths_next_hop_modify (static_nb_config.c:1299)
==2474568== by 0x498ABF8: nb_callback_modify (northbound.c:1579)
==2474568== by 0x498BB35: nb_callback_configuration (northbound.c:1930)
==2474568== by 0x498A03C: nb_candidate_validate_code (northbound.c:1287)
==2474568== by 0x498A2C1: nb_candidate_commit_prepare (northbound.c:1358)
==2474568== by 0x496F414: mgmt_be_txn_cfg_prepare (mgmt_be_client.c:579)
==2474568== by 0x496FBB8: mgmt_be_process_cfgdata_req (mgmt_be_client.c:717)
==2474568== by 0x49703A9: mgmt_be_client_handle_msg (mgmt_be_client.c:851)
==2474568== by 0x49718B9: mgmt_be_client_process_msg (mgmt_be_client.c:1261)
==2474568== by 0x4976810: mgmt_msg_procbufs (mgmt_msg.c:193)
==2474568== by 0x497771A: msg_conn_proc_msgs (mgmt_msg.c:526)
==2474568== by 0x49E40E2: event_call (event.c:2019)
==2474568== by 0x4958AD9: frr_run (libfrr.c:1246)
==2474568== by 0x11581D: main (static_main.c:193)
==2474568==
==2474568== Conditional jump or move depends on uninitialised value(s)
==2474568== at 0x490B6B9: inet_ntop (ntop.c:105)
==2474568== by 0x49AB9CB: printfrr_i6 (prefix.c:1614)
==2474568== by 0x4A24B19: printfrr_extp (glue.c:220)
==2474568== by 0x4A2286E: vbprintfrr (vfprintf.c:626)
==2474568== by 0x4A12AE2: zlog_msg_text (zlog.c:838)
==2474568== by 0x4A11B83: vzlog_tls (zlog.c:497)
==2474568== by 0x4A12561: vzlogx (zlog.c:722)
==2474568== by 0x129AE8: zlog_ref (zlog.h:84)
==2474568== by 0x12BD35: routing_control_plane_protocols_control_plane_protocol_staticd_segment_routing_srv6_local_sids_sid_paths_next_hop_modify (static_nb_config.c:1299)
==2474568== by 0x498ABF8: nb_callback_modify (northbound.c:1579)
==2474568== by 0x498BB35: nb_callback_configuration (northbound.c:1930)
==2474568== by 0x498A03C: nb_candidate_validate_code (northbound.c:1287)
==2474568== by 0x498A2C1: nb_candidate_commit_prepare (northbound.c:1358)
==2474568== by 0x496F414: mgmt_be_txn_cfg_prepare (mgmt_be_client.c:579)
==2474568== by 0x496FBB8: mgmt_be_process_cfgdata_req (mgmt_be_client.c:717)
==2474568== by 0x49703A9: mgmt_be_client_handle_msg (mgmt_be_client.c:851)
==2474568== by 0x49718B9: mgmt_be_client_process_msg (mgmt_be_client.c:1261)
==2474568== by 0x4976810: mgmt_msg_procbufs (mgmt_msg.c:193)
==2474568== by 0x497771A: msg_conn_proc_msgs (mgmt_msg.c:526)
==2474568== by 0x49E40E2: event_call (event.c:2019)
==2474568== by 0x4958AD9: frr_run (libfrr.c:1246)
==2474568== by 0x11581D: main (static_main.c:193)
==2474568==
==2474568== Conditional jump or move depends on uninitialised value(s)
==2474568== at 0x490B6C6: inet_ntop (ntop.c:105)
==2474568== by 0x49AB9CB: printfrr_i6 (prefix.c:1614)
==2474568== by 0x4A24B19: printfrr_extp (glue.c:220)
==2474568== by 0x4A2286E: vbprintfrr (vfprintf.c:626)
==2474568== by 0x4A12AE2: zlog_msg_text (zlog.c:838)
==2474568== by 0x4A11B83: vzlog_tls (zlog.c:497)
==2474568== by 0x4A12561: vzlogx (zlog.c:722)
==2474568== by 0x129AE8: zlog_ref (zlog.h:84)
==2474568== by 0x12BD35: routing_control_plane_protocols_control_plane_protocol_staticd_segment_routing_srv6_local_sids_sid_paths_next_hop_modify (static_nb_config.c:1299)
==2474568== by 0x498ABF8: nb_callback_modify (northbound.c:1579)
==2474568== by 0x498BB35: nb_callback_configuration (northbound.c:1930)
==2474568== by 0x498A03C: nb_candidate_validate_code (northbound.c:1287)
==2474568== by 0x498A2C1: nb_candidate_commit_prepare (northbound.c:1358)
==2474568== by 0x496F414: mgmt_be_txn_cfg_prepare (mgmt_be_client.c:579)
==2474568== by 0x496FBB8: mgmt_be_process_cfgdata_req (mgmt_be_client.c:717)
==2474568== by 0x49703A9: mgmt_be_client_handle_msg (mgmt_be_client.c:851)
==2474568== by 0x49718B9: mgmt_be_client_process_msg (mgmt_be_client.c:1261)
==2474568== by 0x4976810: mgmt_msg_procbufs (mgmt_msg.c:193)
==2474568== by 0x497771A: msg_conn_proc_msgs (mgmt_msg.c:526)
==2474568== by 0x49E40E2: event_call (event.c:2019)
==2474568== by 0x4958AD9: frr_run (libfrr.c:1246)
==2474568== by 0x11581D: main (static_main.c:193)
==2474568==
==2474568== Conditional jump or move depends on uninitialised value(s)
==2474568== at 0x490B3AA: inet_ntop (ntop.c:105)
==2474568== by 0x49AB9CB: printfrr_i6 (prefix.c:1614)
==2474568== by 0x4A24B19: printfrr_extp (glue.c:220)
==2474568== by 0x4A2286E: vbprintfrr (vfprintf.c:626)
==2474568== by 0x4A12AE2: zlog_msg_text (zlog.c:838)
==2474568== by 0x4A11B83: vzlog_tls (zlog.c:497)
==2474568== by 0x4A12561: vzlogx (zlog.c:722)
==2474568== by 0x129AE8: zlog_ref (zlog.h:84)
==2474568== by 0x12BD35: routing_control_plane_protocols_control_plane_protocol_staticd_segment_routing_srv6_local_sids_sid_paths_next_hop_modify (static_nb_config.c:1299)
==2474568== by 0x498ABF8: nb_callback_modify (northbound.c:1579)
==2474568== by 0x498BB35: nb_callback_configuration (northbound.c:1930)
==2474568== by 0x498A03C: nb_candidate_validate_code (northbound.c:1287)
==2474568== by 0x498A2C1: nb_candidate_commit_prepare (northbound.c:1358)
==2474568== by 0x496F414: mgmt_be_txn_cfg_prepare (mgmt_be_client.c:579)
==2474568== by 0x496FBB8: mgmt_be_process_cfgdata_req (mgmt_be_client.c:717)
==2474568== by 0x49703A9: mgmt_be_client_handle_msg (mgmt_be_client.c:851)
==2474568== by 0x49718B9: mgmt_be_client_process_msg (mgmt_be_client.c:1261)
==2474568== by 0x4976810: mgmt_msg_procbufs (mgmt_msg.c:193)
==2474568== by 0x497771A: msg_conn_proc_msgs (mgmt_msg.c:526)
==2474568== by 0x49E40E2: event_call (event.c:2019)
==2474568== by 0x4958AD9: frr_run (libfrr.c:1246)
==2474568== by 0x11581D: main (static_main.c:193)
==2474568==
==2474568== Conditional jump or move depends on uninitialised value(s)
==2474568== at 0x490B708: inet_ntop (ntop.c:105)
==2474568== by 0x49AB9CB: printfrr_i6 (prefix.c:1614)
==2474568== by 0x4A24B19: printfrr_extp (glue.c:220)
==2474568== by 0x4A2286E: vbprintfrr (vfprintf.c:626)
==2474568== by 0x4A12AE2: zlog_msg_text (zlog.c:838)
==2474568== by 0x4A11B83: vzlog_tls (zlog.c:497)
==2474568== by 0x4A12561: vzlogx (zlog.c:722)
==2474568== by 0x129AE8: zlog_ref (zlog.h:84)
==2474568== by 0x12BD35: routing_control_plane_protocols_control_plane_protocol_staticd_segment_routing_srv6_local_sids_sid_paths_next_hop_modify (static_nb_config.c:1299)
==2474568== by 0x498ABF8: nb_callback_modify (northbound.c:1579)
==2474568== by 0x498BB35: nb_callback_configuration (northbound.c:1930)
==2474568== by 0x498A03C: nb_candidate_validate_code (northbound.c:1287)
==2474568== by 0x498A2C1: nb_candidate_commit_prepare (northbound.c:1358)
==2474568== by 0x496F414: mgmt_be_txn_cfg_prepare (mgmt_be_client.c:579)
==2474568== by 0x496FBB8: mgmt_be_process_cfgdata_req (mgmt_be_client.c:717)
==2474568== by 0x49703A9: mgmt_be_client_handle_msg (mgmt_be_client.c:851)
==2474568== by 0x49718B9: mgmt_be_client_process_msg (mgmt_be_client.c:1261)
==2474568== by 0x4976810: mgmt_msg_procbufs (mgmt_msg.c:193)
==2474568== by 0x497771A: msg_conn_proc_msgs (mgmt_msg.c:526)
==2474568== by 0x49E40E2: event_call (event.c:2019)
==2474568== by 0x4958AD9: frr_run (libfrr.c:1246)
==2474568== by 0x11581D: main (static_main.c:193)
==2474568==
==2474568== Conditional jump or move depends on uninitialised value(s)
==2474568== at 0x490B711: inet_ntop (ntop.c:105)
==2474568== by 0x49AB9CB: printfrr_i6 (prefix.c:1614)
==2474568== by 0x4A24B19: printfrr_extp (glue.c:220)
==2474568== by 0x4A2286E: vbprintfrr (vfprintf.c:626)
==2474568== by 0x4A12AE2: zlog_msg_text (zlog.c:838)
==2474568== by 0x4A11B83: vzlog_tls (zlog.c:497)
==2474568== by 0x4A12561: vzlogx (zlog.c:722)
==2474568== by 0x129AE8: zlog_ref (zlog.h:84)
==2474568== by 0x12BD35: routing_control_plane_protocols_control_plane_protocol_staticd_segment_routing_srv6_local_sids_sid_paths_next_hop_modify (static_nb_config.c:1299)
==2474568== by 0x498ABF8: nb_callback_modify (northbound.c:1579)
==2474568== by 0x498BB35: nb_callback_configuration (northbound.c:1930)
==2474568== by 0x498A03C: nb_candidate_validate_code (northbound.c:1287)
==2474568== by 0x498A2C1: nb_candidate_commit_prepare (northbound.c:1358)
==2474568== by 0x496F414: mgmt_be_txn_cfg_prepare (mgmt_be_client.c:579)
==2474568== by 0x496FBB8: mgmt_be_process_cfgdata_req (mgmt_be_client.c:717)
==2474568== by 0x49703A9: mgmt_be_client_handle_msg (mgmt_be_client.c:851)
==2474568== by 0x49718B9: mgmt_be_client_process_msg (mgmt_be_client.c:1261)
==2474568== by 0x4976810: mgmt_msg_procbufs (mgmt_msg.c:193)
==2474568== by 0x497771A: msg_conn_proc_msgs (mgmt_msg.c:526)
==2474568== by 0x49E40E2: event_call (event.c:2019)
==2474568== by 0x4958AD9: frr_run (libfrr.c:1246)
==2474568== by 0x11581D: main (static_main.c:193)
==2474568==
==2474568== Conditional jump or move depends on uninitialised value(s)
==2474568== at 0x490B3DE: inet_ntop (ntop.c:105)
==2474568== by 0x49AB9CB: printfrr_i6 (prefix.c:1614)
==2474568== by 0x4A24B19: printfrr_extp (glue.c:220)
==2474568== by 0x4A2286E: vbprintfrr (vfprintf.c:626)
==2474568== by 0x4A12AE2: zlog_msg_text (zlog.c:838)
==2474568== by 0x4A11B83: vzlog_tls (zlog.c:497)
==2474568== by 0x4A12561: vzlogx (zlog.c:722)
==2474568== by 0x129AE8: zlog_ref (zlog.h:84)
==2474568== by 0x12BD35: routing_control_plane_protocols_control_plane_protocol_staticd_segment_routing_srv6_local_sids_sid_paths_next_hop_modify (static_nb_config.c:1299)
==2474568== by 0x498ABF8: nb_callback_modify (northbound.c:1579)
==2474568== by 0x498BB35: nb_callback_configuration (northbound.c:1930)
==2474568== by 0x498A03C: nb_candidate_validate_code (northbound.c:1287)
==2474568== by 0x498A2C1: nb_candidate_commit_prepare (northbound.c:1358)
==2474568== by 0x496F414: mgmt_be_txn_cfg_prepare (mgmt_be_client.c:579)
==2474568== by 0x496FBB8: mgmt_be_process_cfgdata_req (mgmt_be_client.c:717)
==2474568== by 0x49703A9: mgmt_be_client_handle_msg (mgmt_be_client.c:851)
==2474568== by 0x49718B9: mgmt_be_client_process_msg (mgmt_be_client.c:1261)
==2474568== by 0x4976810: mgmt_msg_procbufs (mgmt_msg.c:193)
==2474568== by 0x497771A: msg_conn_proc_msgs (mgmt_msg.c:526)
==2474568== by 0x49E40E2: event_call (event.c:2019)
==2474568== by 0x4958AD9: frr_run (libfrr.c:1246)
==2474568== by 0x11581D: main (static_main.c:193)
==2474568==
==2474568== Conditional jump or move depends on uninitialised value(s)
==2474568== at 0x490B3E8: inet_ntop (ntop.c:105)
==2474568== by 0x49AB9CB: printfrr_i6 (prefix.c:1614)
==2474568== by 0x4A24B19: printfrr_extp (glue.c:220)
==2474568== by 0x4A2286E: vbprintfrr (vfprintf.c:626)
==2474568== by 0x4A12AE2: zlog_msg_text (zlog.c:838)
==2474568== by 0x4A11B83: vzlog_tls (zlog.c:497)
==2474568== by 0x4A12561: vzlogx (zlog.c:722)
==2474568== by 0x129AE8: zlog_ref (zlog.h:84)
==2474568== by 0x12BD35: routing_control_plane_protocols_control_plane_protocol_staticd_segment_routing_srv6_local_sids_sid_paths_next_hop_modify (static_nb_config.c:1299)
==2474568== by 0x498ABF8: nb_callback_modify (northbound.c:1579)
==2474568== by 0x498BB35: nb_callback_configuration (northbound.c:1930)
==2474568== by 0x498A03C: nb_candidate_validate_code (northbound.c:1287)
==2474568== by 0x498A2C1: nb_candidate_commit_prepare (northbound.c:1358)
==2474568== by 0x496F414: mgmt_be_txn_cfg_prepare (mgmt_be_client.c:579)
==2474568== by 0x496FBB8: mgmt_be_process_cfgdata_req (mgmt_be_client.c:717)
==2474568== by 0x49703A9: mgmt_be_client_handle_msg (mgmt_be_client.c:851)
==2474568== by 0x49718B9: mgmt_be_client_process_msg (mgmt_be_client.c:1261)
==2474568== by 0x4976810: mgmt_msg_procbufs (mgmt_msg.c:193)
==2474568== by 0x497771A: msg_conn_proc_msgs (mgmt_msg.c:526)
==2474568== by 0x49E40E2: event_call (event.c:2019)
==2474568== by 0x4958AD9: frr_run (libfrr.c:1246)
==2474568== by 0x11581D: main (static_main.c:193)
==2474568==
==2474568== Conditional jump or move depends on uninitialised value(s)
==2474568== at 0x490B499: puthex (ntop.c:64)
==2474568== by 0x490B499: inet_ntop (ntop.c:150)
==2474568== by 0x49AB9CB: printfrr_i6 (prefix.c:1614)
==2474568== by 0x4A24B19: printfrr_extp (glue.c:220)
==2474568== by 0x4A2286E: vbprintfrr (vfprintf.c:626)
==2474568== by 0x4A12AE2: zlog_msg_text (zlog.c:838)
==2474568== by 0x4A11B83: vzlog_tls (zlog.c:497)
==2474568== by 0x4A12561: vzlogx (zlog.c:722)
==2474568== by 0x129AE8: zlog_ref (zlog.h:84)
==2474568== by 0x12BD35: routing_control_plane_protocols_control_plane_protocol_staticd_segment_routing_srv6_local_sids_sid_paths_next_hop_modify (static_nb_config.c:1299)
==2474568== by 0x498ABF8: nb_callback_modify (northbound.c:1579)
==2474568== by 0x498BB35: nb_callback_configuration (northbound.c:1930)
==2474568== by 0x498A03C: nb_candidate_validate_code (northbound.c:1287)
==2474568== by 0x498A2C1: nb_candidate_commit_prepare (northbound.c:1358)
==2474568== by 0x496F414: mgmt_be_txn_cfg_prepare (mgmt_be_client.c:579)
==2474568== by 0x496FBB8: mgmt_be_process_cfgdata_req (mgmt_be_client.c:717)
==2474568== by 0x49703A9: mgmt_be_client_handle_msg (mgmt_be_client.c:851)
==2474568== by 0x49718B9: mgmt_be_client_process_msg (mgmt_be_client.c:1261)
==2474568== by 0x4976810: mgmt_msg_procbufs (mgmt_msg.c:193)
==2474568== by 0x497771A: msg_conn_proc_msgs (mgmt_msg.c:526)
==2474568== by 0x49E40E2: event_call (event.c:2019)
==2474568== by 0x4958AD9: frr_run (libfrr.c:1246)
==2474568== by 0x11581D: main (static_main.c:193)
==2474568==
==2474568== Conditional jump or move depends on uninitialised value(s)
==2474568== at 0x490B73D: puthex (ntop.c:66)
==2474568== by 0x490B73D: inet_ntop (ntop.c:150)
==2474568== by 0x49AB9CB: printfrr_i6 (prefix.c:1614)
==2474568== by 0x4A24B19: printfrr_extp (glue.c:220)
==2474568== by 0x4A2286E: vbprintfrr (vfprintf.c:626)
==2474568== by 0x4A12AE2: zlog_msg_text (zlog.c:838)
==2474568== by 0x4A11B83: vzlog_tls (zlog.c:497)
==2474568== by 0x4A12561: vzlogx (zlog.c:722)
==2474568== by 0x129AE8: zlog_ref (zlog.h:84)
==2474568== by 0x12BD35: routing_control_plane_protocols_control_plane_protocol_staticd_segment_routing_srv6_local_sids_sid_paths_next_hop_modify (static_nb_config.c:1299)
==2474568== by 0x498ABF8: nb_callback_modify (northbound.c:1579)
==2474568== by 0x498BB35: nb_callback_configuration (northbound.c:1930)
==2474568== by 0x498A03C: nb_candidate_validate_code (northbound.c:1287)
==2474568== by 0x498A2C1: nb_candidate_commit_prepare (northbound.c:1358)
==2474568== by 0x496F414: mgmt_be_txn_cfg_prepare (mgmt_be_client.c:579)
==2474568== by 0x496FBB8: mgmt_be_process_cfgdata_req (mgmt_be_client.c:717)
==2474568== by 0x49703A9: mgmt_be_client_handle_msg (mgmt_be_client.c:851)
==2474568== by 0x49718B9: mgmt_be_client_process_msg (mgmt_be_client.c:1261)
==2474568== by 0x4976810: mgmt_msg_procbufs (mgmt_msg.c:193)
==2474568== by 0x497771A: msg_conn_proc_msgs (mgmt_msg.c:526)
==2474568== by 0x49E40E2: event_call (event.c:2019)
==2474568== by 0x4958AD9: frr_run (libfrr.c:1246)
==2474568== by 0x11581D: main (static_main.c:193)
==2474568==
==2474568== Conditional jump or move depends on uninitialised value(s)
==2474568== at 0x490B747: puthex (ntop.c:68)
==2474568== by 0x490B747: inet_ntop (ntop.c:150)
==2474568== by 0x49AB9CB: printfrr_i6 (prefix.c:1614)
==2474568== by 0x4A24B19: printfrr_extp (glue.c:220)
==2474568== by 0x4A2286E: vbprintfrr (vfprintf.c:626)
==2474568== by 0x4A12AE2: zlog_msg_text (zlog.c:838)
==2474568== by 0x4A11B83: vzlog_tls (zlog.c:497)
==2474568== by 0x4A12561: vzlogx (zlog.c:722)
==2474568== by 0x129AE8: zlog_ref (zlog.h:84)
==2474568== by 0x12BD35: routing_control_plane_protocols_control_plane_protocol_staticd_segment_routing_srv6_local_sids_sid_paths_next_hop_modify (static_nb_config.c:1299)
==2474568== by 0x498ABF8: nb_callback_modify (northbound.c:1579)
==2474568== by 0x498BB35: nb_callback_configuration (northbound.c:1930)
==2474568== by 0x498A03C: nb_candidate_validate_code (northbound.c:1287)
==2474568== by 0x498A2C1: nb_candidate_commit_prepare (northbound.c:1358)
==2474568== by 0x496F414: mgmt_be_txn_cfg_prepare (mgmt_be_client.c:579)
==2474568== by 0x496FBB8: mgmt_be_process_cfgdata_req (mgmt_be_client.c:717)
==2474568== by 0x49703A9: mgmt_be_client_handle_msg (mgmt_be_client.c:851)
==2474568== by 0x49718B9: mgmt_be_client_process_msg (mgmt_be_client.c:1261)
==2474568== by 0x4976810: mgmt_msg_procbufs (mgmt_msg.c:193)
==2474568== by 0x497771A: msg_conn_proc_msgs (mgmt_msg.c:526)
==2474568== by 0x49E40E2: event_call (event.c:2019)
==2474568== by 0x4958AD9: frr_run (libfrr.c:1246)
==2474568== by 0x11581D: main (static_main.c:193)
==2474568==
==2474568== Use of uninitialised value of size 8
==2474568== at 0x490B4D2: puthex (ntop.c:69)
==2474568== by 0x490B4D2: inet_ntop (ntop.c:150)
==2474568== by 0x49AB9CB: printfrr_i6 (prefix.c:1614)
==2474568== by 0x4A24B19: printfrr_extp (glue.c:220)
==2474568== by 0x4A2286E: vbprintfrr (vfprintf.c:626)
==2474568== by 0x4A12AE2: zlog_msg_text (zlog.c:838)
==2474568== by 0x4A11B83: vzlog_tls (zlog.c:497)
==2474568== by 0x4A12561: vzlogx (zlog.c:722)
==2474568== by 0x129AE8: zlog_ref (zlog.h:84)
==2474568== by 0x12BD35: routing_control_plane_protocols_control_plane_protocol_staticd_segment_routing_srv6_local_sids_sid_paths_next_hop_modify (static_nb_config.c:1299)
==2474568== by 0x498ABF8: nb_callback_modify (northbound.c:1579)
==2474568== by 0x498BB35: nb_callback_configuration (northbound.c:1930)
==2474568== by 0x498A03C: nb_candidate_validate_code (northbound.c:1287)
==2474568== by 0x498A2C1: nb_candidate_commit_prepare (northbound.c:1358)
==2474568== by 0x496F414: mgmt_be_txn_cfg_prepare (mgmt_be_client.c:579)
==2474568== by 0x496FBB8: mgmt_be_process_cfgdata_req (mgmt_be_client.c:717)
==2474568== by 0x49703A9: mgmt_be_client_handle_msg (mgmt_be_client.c:851)
==2474568== by 0x49718B9: mgmt_be_client_process_msg (mgmt_be_client.c:1261)
==2474568== by 0x4976810: mgmt_msg_procbufs (mgmt_msg.c:193)
==2474568== by 0x497771A: msg_conn_proc_msgs (mgmt_msg.c:526)
==2474568== by 0x49E40E2: event_call (event.c:2019)
==2474568== by 0x4958AD9: frr_run (libfrr.c:1246)
==2474568== by 0x11581D: main (static_main.c:193)
==2474568==
==2474568== Use of uninitialised value of size 8
==2474568== at 0x490B4DD: puthex (ntop.c:70)
==2474568== by 0x490B4DD: inet_ntop (ntop.c:150)
==2474568== by 0x49AB9CB: printfrr_i6 (prefix.c:1614)
==2474568== by 0x4A24B19: printfrr_extp (glue.c:220)
==2474568== by 0x4A2286E: vbprintfrr (vfprintf.c:626)
==2474568== by 0x4A12AE2: zlog_msg_text (zlog.c:838)
==2474568== by 0x4A11B83: vzlog_tls (zlog.c:497)
==2474568== by 0x4A12561: vzlogx (zlog.c:722)
==2474568== by 0x129AE8: zlog_ref (zlog.h:84)
==2474568== by 0x12BD35: routing_control_plane_protocols_control_plane_protocol_staticd_segment_routing_srv6_local_sids_sid_paths_next_hop_modify (static_nb_config.c:1299)
==2474568== by 0x498ABF8: nb_callback_modify (northbound.c:1579)
==2474568== by 0x498BB35: nb_callback_configuration (northbound.c:1930)
==2474568== by 0x498A03C: nb_candidate_validate_code (northbound.c:1287)
==2474568== by 0x498A2C1: nb_candidate_commit_prepare (northbound.c:1358)
==2474568== by 0x496F414: mgmt_be_txn_cfg_prepare (mgmt_be_client.c:579)
==2474568== by 0x496FBB8: mgmt_be_process_cfgdata_req (mgmt_be_client.c:717)
==2474568== by 0x49703A9: mgmt_be_client_handle_msg (mgmt_be_client.c:851)
==2474568== by 0x49718B9: mgmt_be_client_process_msg (mgmt_be_client.c:1261)
==2474568== by 0x4976810: mgmt_msg_procbufs (mgmt_msg.c:193)
==2474568== by 0x497771A: msg_conn_proc_msgs (mgmt_msg.c:526)
==2474568== by 0x49E40E2: event_call (event.c:2019)
==2474568== by 0x4958AD9: frr_run (libfrr.c:1246)
==2474568== by 0x11581D: main (static_main.c:193)
==2474568==
==2474568== Use of uninitialised value of size 8
==2474568== at 0x490B4A8: puthex (ntop.c:65)
==2474568== by 0x490B4A8: inet_ntop (ntop.c:150)
==2474568== by 0x49AB9CB: printfrr_i6 (prefix.c:1614)
==2474568== by 0x4A24B19: printfrr_extp (glue.c:220)
==2474568== by 0x4A2286E: vbprintfrr (vfprintf.c:626)
==2474568== by 0x4A12AE2: zlog_msg_text (zlog.c:838)
==2474568== by 0x4A11B83: vzlog_tls (zlog.c:497)
==2474568== by 0x4A12561: vzlogx (zlog.c:722)
==2474568== by 0x129AE8: zlog_ref (zlog.h:84)
==2474568== by 0x12BD35: routing_control_plane_protocols_control_plane_protocol_staticd_segment_routing_srv6_local_sids_sid_paths_next_hop_modify (static_nb_config.c:1299)
==2474568== by 0x498ABF8: nb_callback_modify (northbound.c:1579)
==2474568== by 0x498BB35: nb_callback_configuration (northbound.c:1930)
==2474568== by 0x498A03C: nb_candidate_validate_code (northbound.c:1287)
==2474568== by 0x498A2C1: nb_candidate_commit_prepare (northbound.c:1358)
==2474568== by 0x496F414: mgmt_be_txn_cfg_prepare (mgmt_be_client.c:579)
==2474568== by 0x496FBB8: mgmt_be_process_cfgdata_req (mgmt_be_client.c:717)
==2474568== by 0x49703A9: mgmt_be_client_handle_msg (mgmt_be_client.c:851)
==2474568== by 0x49718B9: mgmt_be_client_process_msg (mgmt_be_client.c:1261)
==2474568== by 0x4976810: mgmt_msg_procbufs (mgmt_msg.c:193)
==2474568== by 0x497771A: msg_conn_proc_msgs (mgmt_msg.c:526)
==2474568== by 0x49E40E2: event_call (event.c:2019)
==2474568== by 0x4958AD9: frr_run (libfrr.c:1246)
==2474568== by 0x11581D: main (static_main.c:193)
==2474568==
==2474568== Use of uninitialised value of size 8
==2474568== at 0x490B4BC: puthex (ntop.c:67)
==2474568== by 0x490B4BC: inet_ntop (ntop.c:150)
==2474568== by 0x49AB9CB: printfrr_i6 (prefix.c:1614)
==2474568== by 0x4A24B19: printfrr_extp (glue.c:220)
==2474568== by 0x4A2286E: vbprintfrr (vfprintf.c:626)
==2474568== by 0x4A12AE2: zlog_msg_text (zlog.c:838)
==2474568== by 0x4A11B83: vzlog_tls (zlog.c:497)
==2474568== by 0x4A12561: vzlogx (zlog.c:722)
==2474568== by 0x129AE8: zlog_ref (zlog.h:84)
==2474568== by 0x12BD35: routing_control_plane_protocols_control_plane_protocol_staticd_segment_routing_srv6_local_sids_sid_paths_next_hop_modify (static_nb_config.c:1299)
==2474568== by 0x498ABF8: nb_callback_modify (northbound.c:1579)
==2474568== by 0x498BB35: nb_callback_configuration (northbound.c:1930)
==2474568== by 0x498A03C: nb_candidate_validate_code (northbound.c:1287)
==2474568== by 0x498A2C1: nb_candidate_commit_prepare (northbound.c:1358)
==2474568== by 0x496F414: mgmt_be_txn_cfg_prepare (mgmt_be_client.c:579)
==2474568== by 0x496FBB8: mgmt_be_process_cfgdata_req (mgmt_be_client.c:717)
==2474568== by 0x49703A9: mgmt_be_client_handle_msg (mgmt_be_client.c:851)
==2474568== by 0x49718B9: mgmt_be_client_process_msg (mgmt_be_client.c:1261)
==2474568== by 0x4976810: mgmt_msg_procbufs (mgmt_msg.c:193)
==2474568== by 0x497771A: msg_conn_proc_msgs (mgmt_msg.c:526)
==2474568== by 0x49E40E2: event_call (event.c:2019)
==2474568== by 0x4958AD9: frr_run (libfrr.c:1246)
==2474568== by 0x11581D: main (static_main.c:193)
==2474568==
==2474568==
==2474568== HEAP SUMMARY:
==2474568== in use at exit: 2,098 bytes in 8 blocks
==2474568== total heap usage: 48,668 allocs, 48,660 frees, 15,837,383 bytes allocated
==2474568==
==2474568== 69 bytes in 1 blocks are still reachable in loss record 3 of 8
==2474568== at 0x4848899: malloc (in /usr/libexec/valgrind/vgpreload_memcheck-amd64-linux.so)
==2474568== by 0x4D2058E: strdup (strdup.c:42)
==2474568== by 0x496CA96: qstrdup (memory.c:118)
==2474568== by 0x4A1DD4B: zlog_file_set_filename (zlog_targets.c:244)
==2474568== by 0x4969ADA: set_log_file (log_vty.c:371)
==2474568== by 0x4969CD0: command_setup_early_logging (log_vty.c:419)
==2474568== by 0x49576FE: frr_init (libfrr.c:770)
==2474568== by 0x1156C6: main (static_main.c:164)
==2474568==
==2474568== 69 bytes in 1 blocks are still reachable in loss record 4 of 8
==2474568== at 0x4848899: malloc (in /usr/libexec/valgrind/vgpreload_memcheck-amd64-linux.so)
==2474568== by 0x4D2058E: strdup (strdup.c:42)
==2474568== by 0x496CA96: qstrdup (memory.c:118)
==2474568== by 0x4A1DD4B: zlog_file_set_filename (zlog_targets.c:244)
==2474568== by 0x4969ADA: set_log_file (log_vty.c:371)
==2474568== by 0x496A052: config_log_file_magic (log_vty.c:542)
==2474568== by 0x496845F: config_log_file (log_vty_clippy.c:148)
==2474568== by 0x4915E8B: cmd_execute_command_real (command.c:1003)
==2474568== by 0x4916004: cmd_execute_command (command.c:1062)
==2474568== by 0x49165B4: cmd_execute (command.c:1228)
==2474568== by 0x49EB7EA: vty_command (vty.c:626)
==2474568== by 0x49ED70E: vty_execute (vty.c:1389)
==2474568== by 0x49EFF39: vtysh_read (vty.c:2408)
==2474568== by 0x49E40E2: event_call (event.c:2019)
==2474568== by 0x4958AD9: frr_run (libfrr.c:1246)
==2474568== by 0x11581D: main (static_main.c:193)
==2474568==
==2474568== LEAK SUMMARY:
==2474568== definitely lost: 0 bytes in 0 blocks
==2474568== indirectly lost: 0 bytes in 0 blocks
==2474568== possibly lost: 0 bytes in 0 blocks
==2474568== still reachable: 138 bytes in 2 blocks
==2474568== suppressed: 1,960 bytes in 6 blocks
==2474568==
==2474568== Use --track-origins=yes to see where uninitialised values come from
==2474568== For lists of detected and suppressed errors, rerun with: -s
==2474568== ERROR SUMMARY: 41 errors from 20 contexts (suppressed: 0 from 0)
```
The error is caused by staticd attempting to log the `nexthop` variable
before it is initialized.
Since logging that variable currently does not work and would not
provide any useful information anyway, this commit fixes the problem by
changing the staticd code to not log that variable.
Signed-off-by: Carmine Scarpitta <cscarpit@cisco.com>
An SRv6 uA SID is associated with the interface and (optionally) the
IPv6 address of the nexthop.
This commit adds the modify and destroy nortbound callbacks required to
set the nexthop.
Signed-off-by: Carmine Scarpitta <cscarpit@cisco.com>
An SRv6 uA SID is associated with the interface and (optionally) the
IPv6 address of the nexthop.
This commit adds the modify and destroy nortbound callbacks required to
set the interface.
Signed-off-by: Carmine Scarpitta <cscarpit@cisco.com>
The staticd YANG conversion completely f*cked up dst-src routes.
Stupidly enough, the correct thing is much simpler as seen by the amount
of deletes in this commit.
This does, unfortunately, involve a rather annoying YANG edge case with
what should reasonably be an optional leaf as part of a list key, which
is not possible. It uses `::/0` as unconditional filler instead, since
that is semantically correct.
The `test_yang_mgmt` topotest needed to be adjusted after this to add
`src-prefix='::/0'`.
Fixes: 88fa5104a0 ("staticd : Configuration northbound implementation")
Signed-off-by: David Lamparter <equinox@opensourcerouting.org>
Currently, staticd configuration is tightly coupled with VRF existence.
Because of that, it has to use a hack in NB infrastructure to create a
VRF configuration when at least one static route is configured for this
VRF. This hack is incompatible with mgmtd, because mgmtd doesn't execute
configuration callbacks. Because of that, the configuration may become
out of sync between mgmtd and staticd. There are two main cases:
1. Create static route in a VRF. The VRF data node will be created
automatically in staticd by the NB hack, but not in mgmtd.
2. Delete VRF which has some static routes configured. The static route
configuration will be deleted from staticd by the NB hack, but not
from mgmtd.
To fix the problem, decouple configuration of static routes from VRF
configuration. Now it is possible to configure static routes even if the
VRF doesn't exist yet. Once the VRF is created, staticd applies all the
preconfigured routes.
This change also fixes the problem with static routes being preserved in
the system when staticd "control-plane-protocol" container is deleted
but the VRF is still configured.
Signed-off-by: Igor Ryzhov <iryzhov@nfware.com>
When interface is not set in "ip route" command, CLI passes "(null)" as
an interface name instead of an empty string. The actual code in turn
uses "nh->ifname[0] != 0" to check if the interface name was set. Fix
the problem by changing the "(null)" string into an empty string when
populating the nexthop structure.
Signed-off-by: Igor Ryzhov <iryzhov@nfware.com>
This reverts commit 76b2bc97e7.
This change is wrong for several reasons:
- it is backwards incompatible - previously it was always possible to
create blackhole/reject routes using shortened versions of the words
and it suddenly became impossible if there's an interface in the
system with the same name
- it uses operational data for validation which is prohibited
- it doesn't really solve the problem with inability to create routes
using interface names like `bla` or `rej`
When monitoring a static route with BFD multi-hop, the source IP can be
either configured or retrieved from NextHop-Tracking (NHT). After
removing a configured source, the source is supposed to be retrieved
from NHT but it remains to the previous value. This is problematic if
the user desires to fix the configuration of a incorrect source IP.
For example, theses two commands results in the incorrect state:
> ip route 10.0.0.0/24 10.1.0.1 bfd multi-hop source 10.2.2.2
> ip route 10.0.0.0/24 10.1.0.1 bfd multi-hop
When removing the source, BFD is unable to find the source from NHT via
bfd_nht_update() were called.
Force zebra to resend the information to BFD by unregistering and
registering again NHT. The (...)/frr-nexthops/nexthop northbound
apply_finish function will trigger a call to static_install_nexthop()
that does a call to static_zebra_nht_register(nh, true);
Fixes: b7ca809d1c ("lib: BFD automatic source selection")
Signed-off-by: Louis Scalbert <louis.scalbert@6wind.com>
If VRF is not found by the given name, validate it and return an error.
Fixes: 76b2bc97e7 ("staticd: Accept full blackhole typed keywords for ip_route_cmd")
Signed-off-by: Donatas Abraitis <donatas@opensourcerouting.org>
Before this patch we allow entering next-hop interface address as any string.
Like, we can type: `ip route 10.10.10.10/32 bla`, but this will create a blackhole
route instead of using an interface `bla`.
The same is with reject.
After the patch:
```
$ vtysh -c 'con' -c 'ip route 10.10.10.100/32 bla'
ERROR: SET_CONFIG request failed, Error: nexthop interface name must be (reject, blackhole)
$ ip link show dev bla
472: bla: <NO-CARRIER,BROADCAST,MULTICAST,UP> mtu 1500 qdisc fq_codel state DOWN mode DEFAULT group default qlen 1000
link/ether fa:45:bd:f1:f8:f0 brd ff:ff:ff:ff:ff:ff
$ vtysh -c 'sh run | include ip route'
$ vtysh -c 'con' -c 'ip route 10.10.10.100/32 blac'
$ vtysh -c 'sh run | include ip route'
ip route 10.10.10.100/32 blackhole
$ vtysh -c 'con' -c 'no ip route 10.10.10.100/32 blac'
$ vtysh -c 'sh run | include ip route'
$ vtysh -c 'con' -c 'ip route 10.10.10.100/32 blackhole'
$ vtysh -c 'sh run | include ip route'
ip route 10.10.10.100/32 blackhole
$ vtysh -c 'con' -c 'no ip route 10.10.10.100/32 blackhole'
$ vtysh -c 'sh run | include ip route'
$ vtysh -c 'con' -c 'ip route 10.10.10.100/32 Null0'
$ vtysh -c 'sh run | include ip route'
ip route 10.10.10.100/32 Null0
$ vtysh -c 'con' -c 'no ip route 10.10.10.100/32 Null0'
$ vtysh -c 'sh run | include ip route'
$
```
Signed-off-by: Donatas Abraitis <donatas@opensourcerouting.org>
Implement all BFD integration northbound callbacks and integrate BFD
with `staticd` route installation procedure.
Signed-off-by: Rafael Zalamena <rzalamena@opensourcerouting.org>
There exists some nexthop attributes that are not the unique
part of the nexthop and if you change the static route
with those values then the route is not being updated
in zebra with the new values:
Example of brokenness:
eva# conf
eva(config)# ip route 1.2.3.9/32 192.168.119.1 enp39s0 label 16020
eva(config)# do show ip route 1.2.3.9
Routing entry for 1.2.3.9/32
Known via "static", distance 1, metric 0, best
Last update 00:00:05 ago
* 192.168.119.1, via enp39s0, label 16020, weight 1
eva(config)# ip route 1.2.3.9/32 192.168.119.1 enp39s0 label 16040
eva(config)# do show ip route 1.2.3.9
Routing entry for 1.2.3.9/32
Known via "static", distance 1, metric 0, best
Last update 00:00:12 ago
* 192.168.119.1, via enp39s0, label 16020, weight 1
Fixed behavior:
eva# conf
eva(config)# ip route 1.2.3.10/32 192.168.119.1 enp39s0 label 16020
eva(config)# do show ip route 1.2.3.10
Routing entry for 1.2.3.10/32
Known via "static", distance 1, metric 0, best
Last update 00:00:04 ago
* 192.168.119.1, via enp39s0, label 16020, weight 1
eva(config)# ip route 1.2.3.10/32 192.168.119.1 enp39s0 label 16040
eva(config)# do show ip route 1.2.3.10
Routing entry for 1.2.3.10/32
Known via "static", distance 1, metric 0, best
Last update 00:00:01 ago
* 192.168.119.1, via enp39s0, label 16040, weight 1
I've gone through most of the items in staticd that can change
the nexthop
Signed-off-by: Donald Sharp <sharpd@nvidia.com>
Restrict the number of nexthops for a route to the compiled-in
limit. Be careful with the zapi route struct's array of nexthops
too.
Signed-off-by: Mark Stapp <mstapp@nvidia.com>
If there's no route table in a VRF, it's a hard bug - staticd will crash
on any subsequent action with this route anyway. So let's assert the
existence of a route table instead of returning an unrecoverable error.
Signed-off-by: Igor Ryzhov <iryzhov@nfware.com>
Add a couple of back pointers to static route/path/nexthop structures to
simplify the NB code and save ~200 lines.
Signed-off-by: Igor Ryzhov <iryzhov@nfware.com>
Compile with v2.0.0 tag of `libyang2` branch of:
https://github.com/CESNET/libyang
staticd init load time of 10k routes now 6s vs ly1 time of 150s
Signed-off-by: Christian Hopps <chopps@labn.net>
`config.h` has all the defines from autoconf, which may include things
that switch behavior of other included headers (e.g. _GNU_SOURCE
enabling prototypes for additional functions.)
So, the first include in any `.c` file must be either `config.h` (with
the appropriate guard) or `zebra.h` (which includes `config.h` first
thing.)
Signed-off-by: David Lamparter <equinox@opensourcerouting.org>
Currently, staticd creates a VRF for the nexthop it is trying to install.
Later, when this nexthop is deleted, the VRF stays in the system and can
not be deleted by the user because "no vrf" command doesn't work for this
VRF because it was not created through northbound code.
There is no need to create the VRF. Just set nh_vrf_id to VRF_UNKNOWN
when the VRF doesn't exist.
Signed-off-by: Igor Ryzhov <iryzhov@nfware.com>
When checking for local connected address used as a nexthop gateway, we
should check nexthop VRF, not route VRF.
Signed-off-by: Igor Ryzhov <iryzhov@nfware.com>
At present, libyang validate api takes longer time to complete
for a transaction to complete if the same config is re-applied.
For instance if set of static routes are reapplied the config
completion takes longer than it took initial time.
One of the solution is to remove when statement from staticd nexthop yang OM.
When condition adds peformance toll on libyang's validate api.
The same when condition checks are done in frr northbound
validation phase (which are must faster).
With this change, if the same static routes are configured
agian and again, the time to completion does not go up and
perfomance does not degrade.
Ticket:CM-32530
Testing Done:
Configure 400 static routes across two vrfs and keep re-applying them.
The time to complete the config remains in few seconds.
Before:
root@bharat:~/stash/frr4# time vtysh -f static_route_cfg
real 0m19.877s
user 0m0.263s
sys 0m0.014s
After:
root@bharat:~/stash/frr4# time vtysh -f static_route_cfg
real 0m3.857s
user 0m0.239s
sys 0m0.034s
Co-developed-by: VishalDhingra <vdhingra@vmware.com>
Signed-off-by: Chirag Shah <chirag@nvidia.com>
problem: table-id gets overwritten for a given route.
RCA: table-id was getting overwritten from the NB layer,
So route was getting installed with the latest table-id.
Fix: make the table-id as the key in the NB layer.
This will program the route in zebra correctly.
- Removed the table-id modify callbacks.
- Moved the validate and apply table-id changes to path-list creation
issue #7347
Signed-off-by: vishaldhingra <vdhingra@vmware.com>
During the yangification of staticd, refactoring of code
around static_hold_route data struct has been done, In this
context warning log message when VRF is not ready had been
removed. This should not be removed, adding it back.
I have missed one MPLS validation too, adding it back.
Signed-off-by: vishaldhingra <vdhingra@vmware.com>
Configuration example:
ip route 9.9.9.9/32 6.6.6.6 color 123
The SR Policy to be chosen is uniquely identified by the policy
endpoint (6.6.6.6) and the SR-TE color (123). Traffic will be
augmented with an MPLS label stack according to the active
candidate path of that particular policy.
Co-authored-by: GalaxyGorilla <sascha@netdef.org>
Signed-off-by: Sebastien Merle <sebastien@netdef.org>
To address the ip mroute command there is a need to add
safi as a key. So adding the afi-safi-type identityref
as a key.
Signed-off-by: VishalDhingra <vdhingra@vmware.com>
1. Modifies the data structs to make the distance, tag and table-id
property of a route, i.e created a hireachical data struct to save
route and nexthop information.
2. Backend northbound implementation
Signed-off-by: VishalDhingra <vdhingra@vmware.com>