Re: [PATCH net-next v2 1/2] inet: Add IP_LOCAL_PORT_RANGE socket option
From: Eric Dumazet <edumazet@google.com>
Date: 2023-01-10 14:29:15
On Tue, Jan 10, 2023 at 2:37 PM Jakub Sitnicki [off-list ref] 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 <redacted> Signed-off-by: Jakub Sitnicki <jakub@cloudflare.com> --- 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. Not clear if selinux_socket_bind() needs any change, I would CC SELINUX maintainers for advice.