tech-net archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

Re: patch: sockaddr instead of mbuf to carry addresses



hey,

hey,

On 3/24/2015 7:00 PM, Mindaugas Rasiukevicius wrote:

Unfortunately, I have not had time for a careful review, but from a quick
check of the key parts it looks good.  One issue: why struct sockaddr_big?

struct sockaddr_storage isn't "big" enough unfortunately. Specifically we, Linux and others have allowed the creation of AF_UNIX sockets with paths that exceed sizeof(sockaddr_un.sun_path) up to 253 bytes. At the moment sockaddr_storage is only 128 bytes so thus it cannot accommodate.

Rather than using sockaddr_storage everywhere except for AF_UNIX sockets I decided it would be better if a new structure that was large enough be created for consistency across all socket types. The name was suggested by mrg@ since he (rightfully) suggested it be suitably distinct from sockaddr_storage to avoid confusion.

I think the new structure is the right way to go since I can't imagine increasing the size of sockaddr_storage would be fun.

I think we can and should use struct sockaddr_storage for this.  Also, is
there any reason why the address parameter could not be const?

I love const but various places the structure members are passed to non-const things e.g. kauth_authorize_network, also the size of the structure is manipulated (sb_len). There are probably other places, but that's just an initial glance.

Home | Main Index | Thread Index | Old Index