fix(edge): prevent crash on supernode resolution failure at startup#130
fix(edge): prevent crash on supernode resolution failure at startup#130catoc wants to merge 2 commits into
Conversation
Add a retry loop in edge_init to handle failed supernode DNS resolution. Prevents NULL pointer dereference of eee->curr_sn when no supernodes are available at startup.
|
Creating a loop with a sleep in it is architecturally the wrong solution. Since the resolver can be run at any time during the operation of the vpn, there could be a scenario where the list again ends up empty. Thus the solution should look for the users of eee->curr_sn and avoid dereferencing the NULL |
|
I appreciate the feedback. In this PR, I aimed to follow the principles of minimal intrusion and least modification. My reasoning is based on the current program logic: once the eee->supernodes list is initially established, the background resolver periodically updates curr_sn. If a resolution fails in a real-world environment—which is common—the mechanism maintains the previous valid value of curr_sn rather than clearing it. The fact that no issues have been reported for a long time suggests that this "black box" mechanism is stable once it's past the initialization phase. Therefore, I chose to ensure the system starts correctly without an error, rather than refactoring the dereferencing logic across the entire codebase. This avoids increasing the "surface area" for potential regressions in a proven, mature logic. |
|
looks good for me |
Add a retry loop in edge_init to handle failed supernode DNS resolution. Prevents NULL pointer dereference of eee->curr_sn when no supernodes are available at startup.
#128