There is a race condition here as node->ip
is not set until immediately after bbs_node_request
, at which point the node list is unlocked. So there is a small portion of time during which it is possible to encounter a node with a NULL IP. The existing code assumes this can never be NULL.
Rather than allowing it to be NULL and checking for it, the best solution here is probably to store the IP on the node as part of bbs_node_request
. This will require more code changes.
Thread 1 (Thread 0x7fc2537fe6c0 (LWP 899985)):
#0 __strcmp_avx2 () at ../sysdeps/x86_64/multiarch/strcmp-avx2.S:287
#1 0x0000555848332bdf in bbs_node_ip_count (sinaddr=sinaddr@entry=0x7fc2537fdb10) at node.c:198
node = 0x7fc26006be70
count = 5
addrstr = "REDACTED", '\000' <repeats 19 times>, "\b\000\000\000\000\000\000\000\200:\000\000\000\000\000\000\021\003\000\000\302\177\000\000\000\342\374\234\354\255O\223"
__func__ = "bbs_node_ip_count"
#2 0x000055584833ecfe in tcp_multilistener (unused=unused@entry=0x0) at socket.c:798
You must be
11/14/2024 9:11 AM — InterLinked
Autoresolved by code commit on GitHub:
node.c: Set node IP address and socket fd at request time.
https://github.com/InterLinked1/lbbs/commit/1062eb19ceb1e893052c2cf0286d80570142fa3b