Skip to content

Support multiple interfaces - #5414

Open
coot wants to merge 5 commits into
mainfrom
coot/multiple-interfaces
Open

Support multiple interfaces#5414
coot wants to merge 5 commits into
mainfrom
coot/multiple-interfaces

Conversation

@coot

@coot coot commented Aug 3, 2026

Copy link
Copy Markdown
Contributor

Description

Adds support for running diffusion on multiple network interfaces at once, rather than at most one IPv4 and one IPv6 address.

  • Diffusion.Configuration.dcAddresses :: Either (NonEmpty ntnFd) (NonEmpty ntnAddr) replaces the separate dcIPv4Address/dcIPv6Address fields. A server socket is opened on every configured address (or systemd socket); outbound connections pick a random configured interface matching the peer's address family. The readIPAndPort command-line parser moved from cardano-ping into ouroboros-network so it can be reused for parsing these addresses.

  • Simplified Snocket.AddressFamily to a plain AFInet | AFInet6 | AFLocal enum, dropping the TestFamily/TestAddress GADT indexing. ConnectionManager.Arguments's addressType field is removed in favour of Snocket.addrFamily.

    • Why: addrFamily and addressType were two separate, redundant classifications of the same address that could silently disagree — addrFamily reflects an address's real family, while addressType was supplied independently (and in test code, often hardcoded to a constant). That divergence is exactly the kind of bug this closes off; a single source of truth removes the failure class outright.
  • Simulation.Network.Snocket is now monomorphic over a concrete NetworkAddress type (ported from the diffusion testnet), simplifying the simulated-network test code.

    • Why: the previous TestAddress addr + GlobalAddressScheme addr typeclass indirection gave each test module its own ad-hoc family classification
      (e.g. even/odd on an Int) unrelated to the address's real shape. A concrete type with genuine EphIPv4Addr/EphIPv6Addr/IPAddr/LocalAddr constructors lets tests exercise real, distinguishable address-family behaviour — which is what multiple-interface support actually needs to be tested against.
  • Updates framework-sim-tests to generate consistent AFInet/AFInet6 multi-node scripts, now that addrFamily reflects real address families instead of a constant.

Breaking changes

  • Diffusion.Configuration: dcIPv4Address/dcIPv6AddressdcAddresses.
  • ConnectionManager.Arguments: ipv4Address/ipv6Address are now [peerAddr] lists; addressType removed (use Snocket.addrFamily).
  • Snocket.AddressFamily is no longer indexed by address type; TestAddress removed.

Checklist

Quality

  • Commit sequence makes sense and have useful messages, see ref.
  • New tests are added and existing tests are updated.
  • Self-reviewed the PR.

Maintenance

  • Linked an issue or added the PR to the current sprint of ouroboros-network project.
  • Added labels.
  • Updated changelog files.
  • The documentation has been properly updated, see ref.

@coot
coot requested a review from a team as a code owner August 3, 2026 15:37
@github-project-automation github-project-automation Bot moved this to In Progress in Ouroboros Network Aug 3, 2026
@coot
coot force-pushed the coot/multiple-interfaces branch from a084d71 to 7d8efb7 Compare August 3, 2026 16:29
@coot coot added ouroboros-diffusion Issues / PRs related to diffusion layer cardano-diffusion Issues/PRs related to cardano-diffusion. labels Aug 3, 2026
@coot coot self-assigned this Aug 3, 2026
@coot
coot force-pushed the coot/multiple-interfaces branch 3 times, most recently from 5bbb118 to 58f2c71 Compare August 6, 2026 14:50
@coot
coot force-pushed the coot/multiple-interfaces branch from 58f2c71 to 23d33eb Compare August 17, 2026 15:08
Diffusion now supports multiple interfaces.  Outbound connections will
use a random interface.  On all given addresses / systemd sockets we
will run a server accepting connections.

`Configuration` type now accepts `dcAddresses :: [Either ntnFd ntnAddr]`
which is a list of supported addresses / systemd sockets.  One can use
`readIPAndPort` parser to parse addresses on a command line.
@coot
coot force-pushed the coot/multiple-interfaces branch 2 times, most recently from db586db to 69a05dc Compare August 18, 2026 11:49
coot added 3 commits August 18, 2026 14:27
`addrFamily` doesn't provide what it needs, and there's a confusing
choice between `addrFamily` and `addressType`, which is can be a source
of bugs and/or at test failures.  As a side effect, `addrFamily` gets
simpler.
We can use `addrFamily` from `Snocket` API now.
@coot
coot force-pushed the coot/multiple-interfaces branch from 69a05dc to 8c33875 Compare August 18, 2026 12:27
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

cardano-diffusion Issues/PRs related to cardano-diffusion. ouroboros-diffusion Issues / PRs related to diffusion layer

Projects

Status: In Progress

Development

Successfully merging this pull request may close these issues.

1 participant