Re: [PATCH RFC 0/5] sockaddr usage removal

From
Jakub Kicinski <kuba@kernel.org>
Date
2024-11-06 01:16:08
Also in
linux-hardening, lkml
Reply to
Kees Cook, 2024-11-04
On Mon,  4 Nov 2024 14:25:02 -0800 Kees Cook wrote:
I think for getname() (and similar interfaces) we *do* want to use
sockaddr_storage, but there is kind of an argument to instead use
a struct with a flexible array, e.g.:

struct sockaddr_unspec {
        sa_family_t	sa_family;
	char		sa_data[];
};

If this was done, then all these APIs would switch their casts from
"(struct sockaddr *)" to "(struct sockaddr_unspec *)", even though in
most cases the object is actully a struct sockaddr_storage.
struct sockaddr_unspec was my knee-jerk reaction but looking at the code
- indeed passing struct sockaddr_storage seems cleaner.
What do folks think?
Looks nice, and feels like the right direction :)

FWIW if the conversion work is too tedious I think I can find some
people that could help.
Thread (9 messages) 9 messages, 3 authors, last reply 2024-12-17
Keyboard shortcuts
hback out one level
jnext message in thread / next series-diff position
kprevious message in thread / previous series-diff position
ldrill in
Escclose help / fold thread tree
?toggle this help