Fix IPv6 portal parsing in connectTarget and Disconnect #102
All Vouch review confidence checks passed
Residual risk 0.30 = Change Risk (0.54) × (1 − Review Confidence (0.45)).
Review depth and reviewer attention state are adequate.
Model 1 · Change Risk (XGBoost)
Score: 0.54 · 494 lines diff across 6 files
Model 2 · Review Depth (DistilBERT)
Depth Score: 0.02 · 1 substantive comment(s)
Model 3 · Review Timing & Attention
Session adequacy: 100% · Reviewer familiarity: 35%
Bedrock Claude 3 · Risk Narration
(disconnected)
Groq Risk Narration
AWS Bedrock is currently disconnected. Generate high-confidence PR triage narration on-demand using Groq.
Model 1 · Change Risk Attribution
SHAP Weights
Diff Size
diff_size
0.371
Shallow Review Depth
shallow_review_depth
0.344
Real PR Conversation Timeline
1 comments
"Review active on #102"
general
weight: 0.35
kginonredhat
Fixes #94
connectTargetparsed the portal withstrings.Split(target, ":")and took field[0]as the host and[1]as the port. For an IPv6 portal that splits mid-address, and the mangled parts were then rejoined to build the/dev/disk/by-path/ip-...path, which could never match the udev symlink.Disconnecttook the host the same way and passed an unbracketed IPv6 literal toiscsiadm.This adds
parsePortal, usingnet.SplitHostPortwith a fallback todefaultPortwhen the portal carries no port, andbracketHostfor the call sites that hand a host toiscsiadm. As @estenrye points out in the issue, the two representations genuinely differ and both are needed: iscsiadm expects a bracketed IPv6 literal, while udev names the by-path link with the bare one.Before / after, running the old and new parsing over the same inputs and showing the by-path that gets constructed:
IPv4 and hostname portals are byte-identical before and after. Only IPv6 inputs change, and they change from unusable to correct.
Testing
Test_parsePortalcovers IPv4 with and without a port, a hostname, and IPv6 bracketed with a port, bracketed without one, and bare. Each case asserts both representations — the barehost:portthat goes into the by-path link and thenet.JoinHostPortform that goes to iscsiadm.Test_bracketHostcovers the bracketing helper.go test ./...passes,go vetis clean, and both changed files aregofmtclean. (iscsi/iscsiadm.gois reported unformatted bygofmt -l, but that is pre-existing on master and untouched here.)One judgement call worth flagging
A bare, unbracketed IPv6 portal with a port appended —
2001:db8::1:3260— is genuinely ambiguous: it is also a syntactically valid IPv6 address.net.SplitHostPortrejects it, so this change treats the whole string as the host and appliesdefaultPort. The reference implementation linked in the issue useslastIndexOf(":")instead, which would read the last field as a port but then mis-parses a bare IPv6 address with no port. I went with the unambiguous reading, which is also what the issue's own proposed fix suggests, but I am happy to switch if you would rather match democratic-csi's behaviour.What I did and did not verify
I do not have an IPv6-only iSCSI target, so I have not reproduced the original end-to-end failure or confirmed the fix against real hardware. What I verified is the parsing and the constructed device path, by unit test and by running the old and new logic side by side, as shown above. The end-to-end evidence in the issue is @estenrye's.
Disclosure: an AI assistant helped me trace the call path and draft the tests. The before/after table is output I ran, and I checked the code paths in the tree myself.
``
release-noteconnectTargetFix IPv6 iSCSI portal parsing.
andDisconnectsplit the portal on every:, mangling IPv6 addresses so the constructed/dev/disk/by-pathlink never matched andConnectfailed with "failed to find device path". IPv4 and hostname portals are unaffected.
``