Files
linux/include/linux
Kees Cook 463deed517 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 <kees@kernel.org>
Link: https://patch.msgid.link/20250722171836.1078436-1-kees@kernel.org
Signed-off-by: Jakub Kicinski <kuba@kernel.org>
2025-07-25 15:29:58 -07:00
..
2025-04-03 21:35:32 +02:00
2025-05-11 17:54:10 -07:00
2025-06-15 21:19:08 +05:30
2025-02-21 17:31:45 -06:00
2025-02-21 09:54:01 +01:00
2024-11-11 10:45:03 +01:00
2025-04-21 10:27:59 +02:00
2025-04-29 15:58:38 -04:00
2025-04-29 15:58:38 -04:00
2025-04-29 15:58:38 -04:00
2025-05-19 08:17:08 -07:00
2025-04-17 10:50:55 -07:00
2025-03-08 14:37:39 +01:00
2025-02-26 12:10:48 +01:00
2025-05-21 13:41:03 +02:00
2025-05-21 13:39:45 +02:00
2025-02-06 11:27:16 -07:00
2025-03-17 22:06:41 -07:00
2025-04-11 18:58:10 -07:00
2025-05-20 05:34:27 +02:00
2025-06-27 16:38:02 -07:00
2025-04-17 10:56:11 +02:00
2025-02-24 12:08:51 +02:00
2025-04-10 10:39:14 +01:00
2025-05-15 20:24:40 +02:00
2024-11-28 14:49:28 +01:00
2025-05-22 11:07:05 +02:00
2024-11-24 17:05:27 -08:00
2025-06-11 11:57:14 -07:00
2025-01-14 19:45:35 +01:00
2024-12-13 08:49:31 -07:00
2025-03-08 12:13:25 +01:00
2024-12-09 13:48:23 -08:00
2025-05-11 17:48:29 -07:00
2025-02-20 15:24:13 +01:00
2025-02-07 23:15:01 +05:30
2025-06-17 18:18:46 -07:00
2025-03-17 13:54:50 +00:00
2025-06-04 09:51:10 +02:00
2025-02-18 11:51:22 -05:00
2024-11-05 16:56:26 -08:00
2024-11-16 10:09:30 -06:00
2025-05-21 16:46:37 +02:00
2025-07-09 19:32:30 -07:00
2025-04-26 08:28:03 +02:00
2025-03-10 08:53:40 +01:00
2025-05-02 11:03:18 +05:30
2025-03-12 20:41:14 +01:00
2025-01-10 11:59:00 +01:00
2025-01-07 15:16:48 +01:00
2025-03-16 17:40:22 -07:00
2025-01-02 10:37:14 -06:00
2025-05-03 12:02:04 +02:00
2024-12-09 14:44:59 -08:00
2025-05-11 17:54:09 -07:00
2025-05-06 11:11:45 -06:00
2025-03-17 11:52:25 +01:00
2025-04-25 15:53:59 +02:00
2025-04-07 09:36:49 +02:00
2025-07-08 08:37:15 -07:00
2025-01-29 13:32:23 -08:00
2025-04-10 18:34:05 -07:00
2025-07-21 17:48:32 -07:00
2025-02-28 11:51:26 -08:00
2025-05-15 04:49:15 +03:00
2025-03-20 08:00:50 -07:00
2025-02-28 11:51:26 -08:00
2025-02-12 12:12:27 +01:00
2025-06-19 12:36:19 +02:00
2025-07-08 18:04:58 +02:00
2024-12-09 14:44:59 -08:00
2024-11-06 12:59:44 -05:00
2025-03-13 13:25:58 -07:00
2025-03-13 13:25:58 -07:00
2025-03-13 13:25:58 -07:00