fix: accept bracketed IPv6 host literals (#251) - #253
Merged
Conversation
Teach hostlist parsing to treat bracket groups as IPv6 only when the full contents parse as a valid IPv6 address, so numeric hostlist ranges keep their existing meaning while bracketed IPv6 literals pass through untouched. Normalize bracketed IPv6 handling through the CLI destination parser, node parsing, and YAML cluster resolution so user, host, and port components stay consistent across command-line and config-driven entry points. Bare IPv6 literals now fail with guidance to use brackets because an unbracketed trailing segment cannot be distinguished from a port. Document the bracket requirement in the CLI help and man page, and add focused parser, expander, node, config, and end-to-end resolution tests that cover accepted bracketed forms and the new rejection guidance. Refs #251
SSH compatibility mode was using the optional destination parser, which dropped parser errors and turned an unbracketed IPv6 literal such as ::1 into a generic invalid destination message. Use the error-preserving parser in node resolution so SSH-style destinations follow the same bracket guidance as -H, and cover bracketed ssh:// plus bare literal cases through the real resolver flow. Validation: cargo test --bin bssh ipv6_tests
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.
Summary
Accept bracketed IPv6 address literals in hostlist expressions and preserve their host, user, and port boundaries through CLI and YAML node resolution.
What changed
node[1-3].-H, SSH-style destinations, and simple or detailed cluster node entries.resolve_nodesregression coverage.Test plan
cargo test --lib ipv6(18 passed)cargo test --lib hostlist::expander::tests::test_expand_simple_range(1 passed)cargo test --bin bssh ipv6_tests(6 passed)cargo check --lib --testscargo clippy --lib --tests -- -D warningsCloses #251