Skip site navigation (1)Skip section navigation (2)
Date:      Mon, 05 Aug 2013 07:05:07 +0000
From:      Poul-Henning Kamp <phk@phk.freebsd.dk>
To:        arch@freebsd.org
Subject:   sockaddr API question
Message-ID:  <41764.1375686307@critter.freebsd.dk>

next in thread | raw e-mail | index | archive | help

The theoretical variant of the question:
	Where the length of a sockaddr must be passed to an API,
	library or kernel, is it _always_ legal for the length to
	be larger than the relevant subtype of struct sockaddr ?

The practical variant of the question:
	Can I just use struct sockaddr_storage all over the place
	and give sizeof(struct sockaddr_storage) to sockaddr_len arguments ?

PS: Yes, I realize that there will be inefficiencies related to
moving more data than required, the question is only if it is safe,
not if it is a good idea.

-- 
Poul-Henning Kamp       | UNIX since Zilog Zeus 3.20
phk@FreeBSD.ORG         | TCP/IP since RFC 956
FreeBSD committer       | BSD since 4.3-tahoe
Never attribute to malice what can adequately be explained by incompetence.



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?41764.1375686307>