See https://gerrit.osmocom.org/c/libosmocore/+/20509 - this code could never have been tested even once.
Even with the patch applied, there's now a segfault:
20201009153944364 DLNS DEBUG NSEI=1234 Rx SNS PDU type SNS-ADD (gprs_ns2_sns.c:1370)
20201009153944364 DLNS DEBUG GPRS-NS2-SNS-BSS[0x555555643c30]{CONFIGURED}: Received Event ADD (gprs_ns2_sns.c:1393)
20201009153944364 DLGLOBAL DEBUG validating counter group 0x7ffff7f87780(ns:nsvc) with 12 counters (rate_ctr.c:87)
20201009153944364 DLNS DEBUG GPRS-NS2-VC[0x5555556f4690]{UNCONFIGURED}: Allocated (fsm.c:461)
20201009153944364 DLNS DEBUG GPRS-NS2-VC[0x5555556f4690]{UNCONFIGURED}: Received Event START (gprs_ns2_vc_fsm.c:595)
20201009153944364 DLNS DEBUG GPRS-NS2-VC[0x5555556f4690]{UNCONFIGURED}: state_chg to ALIVE (gprs_ns2_vc_fsm.c:223)
20201009153944364 DLNS DEBUG NSEI=1234 Tx NS ALIVE (NSVCI=0) (gprs_ns2_message.c:372)
20201009153944367 DLNS INFO Ignoring NS ALIVE ACK from newconnection for non-existing NS-VC (gprs_ns2.c:640)
Program received signal SIGSEGV, Segmentation fault.
ns2_create_vc (bind=bind@entry=0x5555556eff90, msg=msg@entry=0x5555556f2e20, logname=logname@entry=0x7ffff7f7f167 "newconnection",
reject=reject@entry=0x7fffffffdd68, success=success@entry=0x7fffffffdd60) at gprs_ns2.c:698
698 nse = gprs_ns2_nse_by_nsei(bind->nsi, nsei);
(gdb) bt full
#0 ns2_create_vc (bind=bind@entry=0x5555556eff90, msg=msg@entry=0x5555556f2e20, logname=logname@entry=0x7ffff7f7f167 "newconnection",
reject=reject@entry=0x7fffffffdd68, success=success@entry=0x7fffffffdd60) at gprs_ns2.c:698
nsh = <optimized out>
tp = {lv = {{len = 0, val = 0x0} <repeats 256 times>}}
nsvc = <optimized out>
nse = <optimized out>
nsvci = <optimized out>
nsei = <error reading variable nsei (Cannot access memory at address 0x0)>
rc = <optimized out>
#1 0x00007ffff7f710c4 in handle_nsip_read (bfd=0x55555565e680) at gprs_ns2_udp.c:223
nsvc = 0x0
msg = 0x5555556f2e20
rc = <optimized out>
error = <optimized out>
bind = 0x5555556eff90
saddr = {u = {sa = {sa_family = 2, sa_data = "Y\332\177\000\000\001\000\000\000\000\000\000\000"}, sas = {ss_family = 2,
__ss_padding = "Y\332\177\000\000\001\000\000\000\000\000\000\000\000\036\000\000\000\000\000\000\000(>\347\367\377\177\000\000 h\200_\000\000\000\000\345\377\004\000\000\000\000\000\350\354^UUU\000\000\340\335\377\377\377\177\000\000\001\000\000\000\000\000\000\000i\b\375\367\377\177\000\000 h\200_\000\000\000\000i\b\375\367\377\177\000\000h\367\223\367\377\177\000\000\300\336\377\377\377\177\000\000\000\336\377\377\377\177\000",
__ss_align = 140737352515625}, sin = {sin_family = 2, sin_port = 55897, sin_addr = {s_addr = 16777343},
sin_zero = "\000\000\000\000\000\000\000"}, sin6 = {sin6_family = 2, sin6_port = 55897, sin6_flowinfo = 16777343, sin6_addr = {__in6_u = {
__u6_addr8 = "\000\000\000\000\000\000\000\000\036\000\000\000\000\000\000", __u6_addr16 = {0, 0, 0, 0, 30, 0, 0, 0}, __u6_addr32 = {0, 0,
30, 0}}}, sin6_scope_id = 4159127080}}}
reject = 0x10
rc = <optimized out>
error = <optimized out>
bind = <optimized out>
saddr = <optimized out>
nsvc = <optimized out>
msg = <optimized out>
reject = <optimized out>
I'm stopping here. please fix.