fix(authority): skip members with incomplete data instead of panicking - #251
Open
eejd wants to merge 1 commit into
Open
fix(authority): skip members with incomplete data instead of panicking#251eejd wants to merge 1 commit into
eejd wants to merge 1 commit into
Conversation
ZTRecord::new() panics via .expect() when a network member lacks a node_id or config, or has an unparseable ip_assignment. A single such member (e.g. an authorized iOS/cellular client with no IPv4 assignment) brings down the whole server; under a process supervisor with restart-on-exit this becomes a crash loop that takes DNS down for the entire network. Make ZTRecord::new total: return an error (caller logs and skips the member) when node_id is missing, treat a missing config as no IP assignments, and filter_map IP parsing so an unparseable address is dropped rather than fatal. This mirrors the defensive filter_map already used in configure_members().
|
Eric DeWitt seems not to be a GitHub user. You need a GitHub account to be able to sign the CLA. If you have already a GitHub account, please add the email address used for this commit to your account. You have signed the CLA already but the status is still pending? Let us recheck it. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Problem
ZTRecord::new()panics via.expect()in three places when a network member has incomplete data:node_idmissing →expect("Node ID for member does not exist")configmissing →expect("Member config does not exist")ip_assignmentthat doesn't parse →IpAddr::from_str(s).expect("Could not parse IP address")A single such member is enough to abort the whole
configure_members()pass. The most common trigger in practice is an authorized member with no IPv4 assignment (e.g. an iOS/cellular client that has joined but not been assigned a managed IP). Becausefind_members()runs on a refresh loop and the process is normally run under a supervisor that restarts it on exit (launchdKeepAlive, systemdRestart=, Dockerrestart:), the panic becomes a crash loop that takes DNS down for the entire network until the offending member is given an IP or deauthorized.Fix
Make
ZTRecord::new()total:Err(the caller logs a warning andcontinues to the next member) whennode_idis missing;configas "no IP assignments";filter_mapIP parsing so an unparseable address is dropped instead of fatal.This mirrors the defensive
filter_mapalready used a few lines up inconfigure_members()for the reverse-PTR path, so the two code paths now handle malformed member data consistently. A member with no usable IPs simply gets a hostname record with no A/AAAA (whichmatch_or_insertalready handles), instead of crashing the server.No behavior change for well-formed members.