Skip to content

Add dual-stack mDNS and Samba link handling#139

Merged
jamesyc merged 6 commits into
mainfrom
ipv6-support
May 21, 2026
Merged

Add dual-stack mDNS and Samba link handling#139
jamesyc merged 6 commits into
mainfrom
ipv6-support

Conversation

@jamesyc
Copy link
Copy Markdown
Owner

@jamesyc jamesyc commented May 21, 2026

Summary

  • Add dual-stack interface inventory for Samba and mDNS, including explicit Samba address/prefix bind tokens.
  • Add IPv6 mDNS socket support with per-link ff02::fb joins, scoped sends, and link-valid A/AAAA record selection.
  • Update boot/watchdog/doctor probes, tests, manifests, and rebuilt NetBSD mdns/nbns artifacts.

Validation

  • .venv/bin/pytest (1062 passed, 9 skipped)
  • NetBSD VM: ./build/mdns.sh && ./build/mdnsoldle.sh && ./build/mdnsoldbe.sh && ./build/nbns.sh && ./build/nbnsoldle.sh && ./build/nbnsoldbe.sh
  • NetBSD 6 deploy: cp .env.backup6 .env && .venv/bin/tcapsule deploy --debug-logging --yes && .venv/bin/tcapsule doctor
  • Manual dns-sd -G v4v6 jamess-airport-time-capsule.local: ULA AAAA, 192.168 A, and 169.254 A; no fe80 AAAA advertised.

Inventory IPv4 and IPv6 links for Samba and mDNS, keeping Samba bind tokens explicit while preserving IPv4 link-local support.

Add UDP6 mDNS participation with per-link ff02::fb joins, scoped IPv6 sends, and link-valid A/AAAA advertising.

Update watchdog, doctor probes, tests, manifests, and rebuilt NetBSD mdns/nbns artifacts.
Copy link
Copy Markdown
Contributor

@gemini-code-assist gemini-code-assist Bot left a comment

Choose a reason for hiding this comment

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

Code Review

This pull request introduces dual-stack (IPv4 and IPv6) support for Samba and mDNS services. Key changes include new C utility functions for IPv6 address manipulation and interface enumeration in auto-ip-common.inc, updated shell scripts for network discovery and service monitoring, and enhanced device probing logic to verify both IPv4 and IPv6 bindings. Feedback highlights a critical buffer over-read and limitations in the legacy ioctl-based interface enumeration, suggesting a move to getifaddrs(3). Additionally, the reviewer recommended avoiding hardcoded prefix fallbacks in IPv6 mask calculations and refactoring duplicated process binding check logic in the shell scripts.

Comment thread build/auto-ip-common.inc
Comment thread build/auto-ip-common.inc
Comment thread src/timecapsulesmb/assets/boot/samba4/common.d/70-smbd-service.sh
Parse SIOCGIFCONF entries through a checked raw sockaddr view so NetBSD 4 IPv6 addresses are not truncated or overread.

Use explicit IPv6 netmask ioctls, keep unknown prefixes out of Samba/AAAA output, normalize IPv4 link-local masks, and share fstat socket checks.

Rebuild mdns/nbns artifacts and extend tests for raw ifconf entries, invalid masks, and socket scanning.
@jamesyc
Copy link
Copy Markdown
Owner Author

jamesyc commented May 21, 2026

/gemini review

Copy link
Copy Markdown
Contributor

@gemini-code-assist gemini-code-assist Bot left a comment

Choose a reason for hiding this comment

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

Code Review

This pull request introduces dual-stack (IPv4 and IPv6) support for Samba and mDNS advertising. Key changes include a refactored interface enumeration system in C that supports IPv6 and link-local addresses, updated shell scripts for protocol-agnostic bind discovery and normalization, and enhanced probing logic to verify service listeners on both address families. Additionally, the manifest is updated with new binary hashes, and the test suite is expanded with dual-stack validation cases. I have no feedback to provide.

Fix Ubuntu CI portability by marking BSD-only ifreq parameters as intentionally unused on platforms that do not expose sockaddr lengths.

Improve mdns-advertiser's runtime socket update path with rollback for partial multicast joins, IPv4 fallback when IPv6 transport setup fails, capacity truncation reporting, bounded stack-only log truncation, and known-answer suppression that does not hide other link-valid A/AAAA records.

Rebuild mdns and nbns NetBSD artifacts and refresh the artifact manifest.
@jamesyc
Copy link
Copy Markdown
Owner Author

jamesyc commented May 21, 2026

/gemini review

Copy link
Copy Markdown
Contributor

@gemini-code-assist gemini-code-assist Bot left a comment

Choose a reason for hiding this comment

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

Code Review

This pull request introduces comprehensive dual-stack IPv4 and IPv6 support across the networking, service management, and diagnostic components. Key changes include refactoring interface enumeration and address validation in the shared C headers, updating boot scripts to manage IPv6 CIDRs and socket families, and enhancing the watchdog and device probing logic to monitor both address families. The advertiser binaries have been updated, and the test suite has been extensively expanded to verify the new functionality. I have no feedback to provide.

jamesyc added 2 commits May 21, 2026 01:09
Plan mDNS responses from the active link inventory before applying known-answer suppression and packet writing.

Keep broken per-link socket failures scoped to that link/family, preserve IPv4-only watchdog checks, and rebuild the affected NetBSD artifacts.
Handle service type enumeration, ANY-class questions, legacy unicast question sections, multicast response delays, and unicast hop limits in the planned RRset response path.

Rebuild the NetBSD 6 and NetBSD 4 mDNS artifacts and expand tests for mDNS query routing, service enumeration, startup spacing, socket options, and NBSTAT response shape.
@jamesyc jamesyc marked this pull request as ready for review May 21, 2026 09:55
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: dc422c0a13

ℹ️ 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/timecapsulesmb/assets/boot/samba4/common.d/70-smbd-service.sh Outdated
Comment thread src/timecapsulesmb/device/probe.py
@jamesyc
Copy link
Copy Markdown
Owner Author

jamesyc commented May 21, 2026

/gemini review

Copy link
Copy Markdown
Contributor

@gemini-code-assist gemini-code-assist Bot left a comment

Choose a reason for hiding this comment

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

Code Review

This pull request introduces IPv6 support for Samba and mDNS services. Key changes include the addition of IPv6 address enumeration and filtering logic in the common C header, updates to shell scripts for handling IPv6 CIDRs and socket family probing, and expanded watchdog health checks to verify service bindings across both IPv4 and IPv6. Additionally, binary artifacts have been updated, and the test suite has been adjusted to reflect these improvements. I have no feedback to provide as there were no review comments to assess.

@jamesyc jamesyc merged commit 9e63cd4 into main May 21, 2026
12 checks passed
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.

1 participant