[PATCH v4 2/7] landlock: Add UDP connect() access control

Matthieu Buffet matthieu at buffet.re
Sat Jun 6 17:04:09 UTC 2026


On 5/22/2026 11:18 PM, Mickaël Salaün wrote:
>> +	/*
>> +	 * Construct a struct sockaddr* with port 0 to pretend the
>> +	 * process tried to bind() on that address.
>> +	 */
>> +	port0.ss_family = sock->sk->__sk_common.skc_family;
>> +	switch (port0.ss_family) {
>> +	case AF_INET: {
>> +		((struct sockaddr_in *)&port0)->sin_port = 0;
> 
> Why is this useful? The struct is already initialized to 0.

Indeed, I will only leave a proper initialization of the necessary 
fields instead.

-- 
Matthieu



More information about the Linux-security-module-archive mailing list