[RFC PATCH 1/3] ipv4: Run a reverse sk_lookup on sendmsg.

2024-09-13 Thread Tiago Lam
xtends the ancilliary messages supported by sendmsg to support the IP_ORIGDSTADDR ancilliary message, reusing the same cmsg and struct used in recvmsg - which already supports specifying a port. Suggested-by: Jakub Sitnicki Signed-off-by: Tiago Lam --- include/net/ip.h | 1 + net/ipv4/ip_

[RFC PATCH 0/3] Allow sk_lookup UDP return traffic to egress.

2024-09-13 Thread Tiago Lam
e can address them. [1] https://blog.cloudflare.com/how-we-built-spectrum/ Suggested-by: Jakub Sitnicki Signed-off-by: Tiago Lam --- Tiago Lam (3): ipv4: Run a reverse sk_lookup on sendmsg. ipv6: Run a reverse sk_lookup on sendmsg. bpf: Add sk_lookup test to use ORIGDS

[RFC PATCH 3/3] bpf: Add sk_lookup test to use ORIGDSTADDR cmsg.

2024-09-13 Thread Tiago Lam
from in a IP_ORIGDSTADDR ancilliary message passed in sendmsg. Signed-off-by: Tiago Lam --- tools/testing/selftests/bpf/prog_tests/sk_lookup.c | 70 +++--- 1 file changed, 48 insertions(+), 22 deletions(-) diff --git a/tools/testing/selftests/bpf/prog_tests/sk_lookup.c b/tools

[RFC PATCH 2/3] ipv6: Run a reverse sk_lookup on sendmsg.

2024-09-13 Thread Tiago Lam
here to support the IPV6_ORIGDSTADDR ancilliary message to be able to specify a source address/port. Suggested-by: Jakub Sitnicki Signed-off-by: Tiago Lam --- net/ipv6/datagram.c | 76 + net/ipv6/udp.c | 8 -- 2 files changed, 82

Re: [RFC PATCH 2/3] ipv6: Run a reverse sk_lookup on sendmsg.

2024-10-11 Thread Tiago Lam
On Tue, Sep 24, 2024 at 04:58:19PM -0700, Martin KaFai Lau wrote: > On 9/17/24 6:15 PM, Tiago Lam wrote: > > On Fri, Sep 13, 2024 at 11:24:09AM -0700, Martin KaFai Lau wrote: > > > On 9/13/24 2:39 AM, Tiago Lam wrote: > > > > This follows the same rationale provided f

Re: [RFC PATCH 3/3] bpf: Add sk_lookup test to use ORIGDSTADDR cmsg.

2024-09-17 Thread Tiago Lam
On Fri, Sep 13, 2024 at 08:10:24PM +0800, Philo Lu wrote: > Hi Tiago, > > On 2024/9/13 17:39, Tiago Lam wrote: > > This patch reuses the framework already in place for sk_lookup, allowing > > it now to send a reply from the server fd directly, instead of having to > > c

Re: [RFC PATCH 2/3] ipv6: Run a reverse sk_lookup on sendmsg.

2024-09-17 Thread Tiago Lam
On Sat, Sep 14, 2024 at 01:40:25PM +0200, Eric Dumazet wrote: > On Fri, Sep 13, 2024 at 11:39 AM Tiago Lam wrote: > > > > This follows the same rationale provided for the ipv4 counterpart, where > > it now runs a reverse socket lookup when source addresses and/or ports > &

Re: [RFC PATCH 2/3] ipv6: Run a reverse sk_lookup on sendmsg.

2024-09-17 Thread Tiago Lam
On Sat, Sep 14, 2024 at 09:59:50AM +0100, Simon Horman wrote: > On Fri, Sep 13, 2024 at 10:39:20AM +0100, Tiago Lam wrote: > > This follows the same rationale provided for the ipv4 counterpart, where > > it now runs a reverse socket lookup when source addresses and/or ports >

Re: [RFC PATCH 2/3] ipv6: Run a reverse sk_lookup on sendmsg.

2024-09-17 Thread Tiago Lam
On Fri, Sep 13, 2024 at 11:24:09AM -0700, Martin KaFai Lau wrote: > On 9/13/24 2:39 AM, Tiago Lam wrote: > > This follows the same rationale provided for the ipv4 counterpart, where > > it now runs a reverse socket lookup when source addresses and/or ports > > are changed,

Re: [RFC PATCH 1/3] ipv4: Run a reverse sk_lookup on sendmsg.

2024-09-20 Thread Tiago Lam
On Wed, Sep 18, 2024 at 08:45:23AM -0400, Willem de Bruijn wrote: > Tiago Lam wrote: > > In order to check if egress traffic should be allowed through, we run a > > reverse socket lookup (i.e. normal socket lookup with the src/dst > > addresses and ports reversed) to check

[RFC PATCH v2 0/3] Allow sk_lookup UDP return traffic to egress when setting src port/address.

2024-09-20 Thread Tiago Lam
ormance measurements are to be taken, but we're reaching out early for feedback to see what the technical concerns are and if we can address them. [1] https://blog.cloudflare.com/how-we-built-spectrum/ Suggested-by: Jakub Sitnicki Signed-off-by: Tiago Lam --- Changes in v2: - Amended commit

[RFC PATCH v2 1/3] ipv4: Support setting src port in sendmsg().

2024-09-20 Thread Tiago Lam
ebpf program is attached and the source address and/or port for the return traffic have been modified using the (newly added) IP_ORIGDSTADDR in sendmsg. Suggested-by: Jakub Sitnicki Signed-off-by: Tiago Lam --- include/net/ip.h | 1 + net/ipv4/ip_sockglue.c | 11 +++ net/ipv4/udp

[RFC PATCH v2 3/3] bpf: Add sk_lookup test to use ORIGDSTADDR cmsg.

2024-09-20 Thread Tiago Lam
from in a IP_ORIGDSTADDR ancillary message passed in sendmsg. Signed-off-by: Tiago Lam --- tools/testing/selftests/bpf/prog_tests/sk_lookup.c | 67 +++--- 1 file changed, 45 insertions(+), 22 deletions(-) diff --git a/tools/testing/selftests/bpf/prog_tests/sk_lookup.c b/tools

[RFC PATCH v2 2/3] ipv6: Support setting src port in sendmsg().

2024-09-20 Thread Tiago Lam
-by: Tiago Lam --- net/ipv6/datagram.c | 79 + net/ipv6/udp.c | 8 -- 2 files changed, 85 insertions(+), 2 deletions(-) diff --git a/net/ipv6/datagram.c b/net/ipv6/datagram.c index fff78496803d..369c64a478ec 100644 --- a/net/ipv6