feat: implement ipv6 addr flags#155
Conversation
1788175 to
3f13d71
Compare
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 3f13d71460
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
| push_ipv6(&mut iface.ipv6, (a, p)); | ||
| iface.ipv6_scope_ids.push(calc_v6_scope_id(&a, iface.index)); | ||
| let raw = r.ipv6_addr_flags.get(i).copied().unwrap_or(0); |
There was a problem hiding this comment.
Align IPv6 flags with deduplicated address entries
This loop always appends to ipv6_scope_ids and ipv6_addr_flags even when push_ipv6 rejects a duplicate (addr, prefix) pair. In the duplicate case, iface.ipv6 is not extended but ipv6_addr_flags is, so indexing flags by IPv6 position can shift and report incorrect flags for later addresses. That violates the documented 1:1 alignment between Interface::ipv6 and Interface::ipv6_addr_flags (the Android path mirrors this pattern as well).
Useful? React with 👍 / 👎.
|
Thanks! Looks great overall. Before merging: Could you update this so scope IDs and flags are only pushed when the IPv6 entry is actually inserted? |
yes, I missed that, should be fixed now |
This implements detection of IPv6 flags and adding them to the interface.
I tried to mirror the existing code on the OS specific queries, happy to adjust as you would like.
I have tested this on linux, macos and windows 11 manually, and confirmed it working using the
list_interfacesexample.I need this to detect
deprecatedaddresses in iroh, n0-computer/iroh#4071 for better information about addresses.