Skip to content

feat: implement ipv6 addr flags#155

Merged
shellrow merged 3 commits into
shellrow:mainfrom
dignifiedquire:feat/ipv6-addr-flags
Apr 7, 2026
Merged

feat: implement ipv6 addr flags#155
shellrow merged 3 commits into
shellrow:mainfrom
dignifiedquire:feat/ipv6-addr-flags

Conversation

@dignifiedquire
Copy link
Copy Markdown
Contributor

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_interfaces example.

I need this to detect deprecated addresses in iroh, n0-computer/iroh#4071 for better information about addresses.

Copy link
Copy Markdown

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 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".

Comment thread src/os/linux/interface.rs Outdated
Comment on lines +85 to +87
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);
Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P2 Badge 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 👍 / 👎.

@shellrow
Copy link
Copy Markdown
Owner

shellrow commented Apr 7, 2026

Thanks! Looks great overall.

Before merging: push_ipv6 can skip entries (e.g. duplicates or invalid ones), but ipv6_scope_ids and ipv6_addr_flags are still always appended. This can break the intended 1:1 alignment with Interface::ipv6.

Could you update this so scope IDs and flags are only pushed when the IPv6 entry is actually inserted?
It looks like the Android path may need the same adjustment as well.

@dignifiedquire
Copy link
Copy Markdown
Contributor Author

Could you update this so scope IDs and flags are only pushed when the IPv6 entry is actually inserted?
It looks like the Android path may need the same adjustment as well.

yes, I missed that, should be fixed now

@shellrow shellrow merged commit 006a55f into shellrow:main Apr 7, 2026
10 checks passed
@dignifiedquire dignifiedquire deleted the feat/ipv6-addr-flags branch April 8, 2026 09:33
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants