Subject: Re: [PATCH net-next v2 1/2] inet: Add IP_LOCAL_PORT_RANGE socket option

From: Jakub Sitnicki <[email-masked]>
Date: Tue, 10 Jan 2023 22:36:33 +0100

On Tue, Jan 10, 2023 at 03:28 PM +01, Eric Dumazet wrote:
> On Tue, Jan 10, 2023 at 2:37 PM Jakub Sitnicki <[email-masked]> wrote:
>>
>> Users who want to share a single public IP address for outgoing connections
>> between several hosts traditionally reach for SNAT. However, SNAT requires
>> state keeping on the node(s) performing the NAT.
>>
>
>> v1 -> v2:
>>  * Fix the corner case when the per-socket range doesn't overlap with the
>>    per-netns range. Fallback correctly to the per-netns range. (Kuniyuki)
>>
>> Reviewed-by: Marek Majkowski <[email-masked]>
>> Signed-off-by: Jakub Sitnicki <[email-masked]>
>> ---
>>  include/net/inet_sock.h         |  4 ++++
>>  include/net/ip.h                |  3 ++-
>>  include/uapi/linux/in.h         |  1 +
>>  net/ipv4/inet_connection_sock.c | 25 +++++++++++++++++++++++--
>>  net/ipv4/inet_hashtables.c      |  2 +-
>>  net/ipv4/ip_sockglue.c          | 18 ++++++++++++++++++
>>  net/ipv4/udp.c                  |  2 +-
>>  7 files changed, 50 insertions(+), 5 deletions(-)
>
>
> Being an INET option, I think net/sctp/socket.c should also be changed.

Will do. Should be a one-liner + test coverage.

> Not clear if selinux_socket_bind() needs any change, I would CC
> SELINUX maintainers for advice.

I will start a thread.

Thank you for taking a look.