diff options
| author | Kees Cook <[email protected]> | 2025-07-22 17:18:31 +0000 |
|---|---|---|
| committer | Jakub Kicinski <[email protected]> | 2025-07-25 22:29:58 +0000 |
| commit | 463deed51796fd0995d08d8b6aa793d7ab5a2059 (patch) | |
| tree | e3ee506ebb06c9a88664d1052d08de900d186d50 /drivers/platform/x86/intel/pmt/class.c | |
| parent | Merge branch 'net-mlx5e-misc-changes-2025-07-22' (diff) | |
| download | kernel-463deed51796fd0995d08d8b6aa793d7ab5a2059.tar.gz kernel-463deed51796fd0995d08d8b6aa793d7ab5a2059.zip | |
ipv6: Add sockaddr_inet unified address structure
There are cases in networking (e.g. wireguard, sctp) where a union is
used to provide coverage for either IPv4 or IPv6 network addresses,
and they include an embedded "struct sockaddr" as well (for "sa_family"
and raw "sa_data" access). The current struct sockaddr contains a
flexible array, which means these unions should not be further embedded
in other structs because they do not technically have a fixed size (and
are generating warnings for the coming -Wflexible-array-not-at-end flag
addition). But the future changes to make struct sockaddr a fixed size
(i.e. with a 14 byte sa_data member) make the "sa_data" uses with an IPv6
address a potential place for the compiler to get upset about object size
mismatches. Therefore, we need a sockaddr that cleanly provides both an
sa_family member and an appropriately fixed-sized sa_data member that does
not bloat member usage via the potential alternative of sockaddr_storage
to cover both IPv4 and IPv6, to avoid unseemly churn in the affected code
bases.
Introduce sockaddr_inet as a unified structure for holding both IPv4 and
IPv6 addresses (i.e. large enough to accommodate sockaddr_in6).
The structure is defined in linux/in6.h since its max size is sized
based on sockaddr_in6 and provides a more specific alternative to the
generic sockaddr_storage for IPv4 with IPv6 address family handling.
The "sa_family" member doesn't use the sa_family_t type to avoid needing
layer violating header inclusions.
Signed-off-by: Kees Cook <[email protected]>
Link: https://patch.msgid.link/[email protected]
Signed-off-by: Jakub Kicinski <[email protected]>
Diffstat (limited to 'drivers/platform/x86/intel/pmt/class.c')
0 files changed, 0 insertions, 0 deletions
