Bug #81504
openmsg: IPv6 addresses from FreeBSD and macOS daemons are encoded with a non-Linux AF_INET6
0%
Description
`entity_addr_t` (msgr2) and the legacy `sockaddr_storage` encoding carry the address family as a number, and readers assume Linux's values. AF_INET is 2 everywhere, but AF_INET6 is 10 on Linux, 23 on Windows, 28 on FreeBSD and 30 on macOS.
`encode()`/`decode()` in `src/msg/msg_types.h` map AF_INET6 to and from `AF_INET6_LINUX` (10) only under `_WIN32`. So an IPv6 address from a FreeBSD or macOS daemon reaches a Linux peer as family 28 or 30, which it doesn't recognise, and a Linux peer's IPv6 address arrives on FreeBSD/macOS as family 10.
Found while reviewing https://github.com/ceph/ceph/pull/71445 (which fixes the rest of the BSD/macOS address encoding). Most BSD/macOS testing so far has been IPv4-only.
Fix: define `AF_INET6_LINUX` on every platform and map in both encodings (a no-op on Linux).
DV Updated by Dan van der Ster about 2 months ago
- Status changed from New to Fix Under Review
- Pull request ID set to 72446