Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add support for publishing on IPv6 networks #19

Merged
merged 2 commits into from
Jun 19, 2024

Conversation

adriancable
Copy link
Contributor

@adriancable adriancable commented Jan 17, 2022

♻️ Current situation

Ciao, while it can publish AAAA records over IPv4, cannot publish any records at all over IPv6. This means that on IPv6-only networks, or people who are using routers with broken IPv4 multicast support (Arris and CenturyLink - I am talking about you!), Ciao does not work. 'No Response'!

💡 Proposed solution

I recently made a PR for HAP-NodeJS which adds Avahi/D-Bus as a new advertiser. This supports IPv6 and generally I would recommend it. But some platforms don't/can't have Avahi, e.g. macOS and Windows. So there's still a hole.

So here is a PR to bridge that gap, and add IPv6 publishing to Ciao (which otherwise is pretty complete).

⚙️ Release Notes

MDNSServer.options now adds a new advertiseIpv6 option. It defaults to false, but if you set it to true it'll publish over IPv6.

Testing

Not done much, but I have tested these things on macOS and Linux, and they at least superficially work: (adding, deleting, updating records)

  • advertising IPv4 only on IPv4-only networks
  • advertising IPv6 only on IPv6-only networks
  • advertising IPv4 only on dual stack networks
  • advertising IPv6 only on dual stack networks
  • advertising IPv4 and IPv6 on dual stack networks

I made the decision to implement IPv6 support by effectively creating "wrapper interfaces" around IPv6-capable network interfaces, which then get special treatment to handle IPv6 vs. IPv4 differences. Out of all possible approaches this keeps the largest proportion of the existing Ciao code intact, which I felt was important because it is very easy with mDNS to subtly break things. (I don't promise I haven't already done that, unfortunately.)

For completeness, it is probably worth adding equivalents to Avahi's publish-aaaa-on-ipv4 and publish-a-on-ipv6 options.

@coveralls
Copy link

coveralls commented Jan 17, 2022

Pull Request Test Coverage Report for Build 9588896269

Warning: This coverage report may be inaccurate.

This pull request's base commit is no longer the HEAD commit of its target branch. This means it includes changes from outside the original pull request, including, potentially, unrelated coverage changes.

Details

  • 0 of 73 (0.0%) changed or added relevant lines in 2 files are covered.
  • 6 unchanged lines in 2 files lost coverage.
  • Overall coverage decreased (-0.7%) to 34.956%

Changes Missing Coverage Covered Lines Changed/Added Lines %
src/Responder.ts 0 12 0.0%
src/MDNSServer.ts 0 61 0.0%
Files with Coverage Reduction New Missed Lines %
src/Responder.ts 1 0.0%
src/MDNSServer.ts 5 6.92%
Totals Coverage Status
Change from base Build 9588870648: -0.7%
Covered Lines: 1200
Relevant Lines: 3086

💛 - Coveralls

@california444
Copy link

HI,
are there any plans to merge this PR to support IPv6 for ciao in the near future?
Thanks!

@donavanbecker donavanbecker changed the base branch from latest to beta-1.3.0 June 19, 2024 22:38
@donavanbecker
Copy link
Contributor

going to merge into the beta branch for now.

@donavanbecker donavanbecker merged commit 7930f69 into homebridge:beta-1.3.0 Jun 19, 2024
4 checks passed
@donavanbecker donavanbecker mentioned this pull request Jul 6, 2024
donavanbecker added a commit that referenced this pull request Jul 9, 2024
## v1.3.0 (2024-07-08)

### Added

- Add support for publishing on IPv6 networks (#19) (@adriancable)
- Add support for IPv4-mapped IPv6 addresses (#43) (@donavanbecker & @hjdhjd)

### Changed

- update dependencies
- update dependencies, fix typedoc (#44)
- update changelog, fix lint
- Fix: minor housekeeping. (#48) (@@hjdhjd)
donavanbecker added a commit that referenced this pull request Jul 9, 2024
Co-authored-by: Donavan Becker <donavan.becker@icloud.com>
donavanbecker added a commit that referenced this pull request Jul 9, 2024
## v1.3.0 (2024-07-08)

### Added

- Add support for publishing on IPv6 networks (#19) (@adriancable)
- Add support for IPv4-mapped IPv6 addresses (#43) (@donavanbecker & @hjdhjd)

### Changed

- update dependencies
- update dependencies, fix typedoc (#44)
- update changelog, fix lint
- Fix: minor housekeeping. (#48) (@@hjdhjd)
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.

4 participants