ComboAddress needs to be refactored
- Program: Authoritative, Recursor, dnsdist
- Issue type: refactoring needed
Short description
Our ComboAddress object is a union of IPv4 and IPv6 structures. This does not fly well with clang-tidy's cppcoreguidelines-pro-type-union-access which has a very strong opinion on unions.
As discussed in https://github.com/PowerDNS/pdns/pull/12726#issuecomment-1534880862, we have several options to get rid of the union, but the ComboAddress object is used in a lot of places and completely exposes its internal fields, so the refactoring is going to be a huge task that will conflict badly with work happening in parallel.
Existing code also assumes the sin_family (and maybe also sin_port) of sockaddr_in and sockaddr_in6 overlap, which adds extra complexity when refactoring this.
sin_port as well, yes. I think our best bet is to stop exposing the internal fields and provide proper accessors. It's going to take a fair amount of work, though. We should probably agree on the interface first.
Reminder to re-enable the corresponding check once this has been fixed: https://github.com/PowerDNS/pdns/pull/12812