Message ID | 20221027211014.3581513-1-willemdebruijn.kernel@gmail.com (mailing list archive) |
---|---|
State | Accepted |
Commit | 58ba426388d9fe56aa638f555b01d6e63cada88c |
Delegated to: | Netdev Maintainers |
Headers | show |
Series | [net-next] net/packet: add PACKET_FANOUT_FLAG_IGNORE_OUTGOING | expand |
On Thu, Oct 27, 2022 at 2:10 PM Willem de Bruijn <willemdebruijn.kernel@gmail.com> wrote: > > From: Willem de Bruijn <willemb@google.com> > > Extend packet socket option PACKET_IGNORE_OUTGOING to fanout groups. > ... > Instead, introduce a new fanout group flag with the same behavior. > > Tested with https://github.com/wdebruij/kerneltools/blob/master/tests/test_psock_fanout_ignore_outgoing.c > > Signed-off-by: Willem de Bruijn <willemb@google.com> SGTM, thanks. Reviewed-by: Eric Dumazet <edumazet@google.com>
Hello: This patch was applied to netdev/net-next.git (master) by Jakub Kicinski <kuba@kernel.org>: On Thu, 27 Oct 2022 17:10:14 -0400 you wrote: > From: Willem de Bruijn <willemb@google.com> > > Extend packet socket option PACKET_IGNORE_OUTGOING to fanout groups. > > The socket option sets ptype.ignore_outgoing, which makes > dev_queue_xmit_nit skip the socket. > > [...] Here is the summary with links: - [net-next] net/packet: add PACKET_FANOUT_FLAG_IGNORE_OUTGOING https://git.kernel.org/netdev/net-next/c/58ba426388d9 You are awesome, thank you!
diff --git a/include/uapi/linux/if_packet.h b/include/uapi/linux/if_packet.h index c07caf7b40db6..a8516b3594a44 100644 --- a/include/uapi/linux/if_packet.h +++ b/include/uapi/linux/if_packet.h @@ -70,6 +70,7 @@ struct sockaddr_ll { #define PACKET_FANOUT_EBPF 7 #define PACKET_FANOUT_FLAG_ROLLOVER 0x1000 #define PACKET_FANOUT_FLAG_UNIQUEID 0x2000 +#define PACKET_FANOUT_FLAG_IGNORE_OUTGOING 0x4000 #define PACKET_FANOUT_FLAG_DEFRAG 0x8000 struct tpacket_stats { diff --git a/net/packet/af_packet.c b/net/packet/af_packet.c index 8c5b3da0c29f6..44f20cf8a0c0e 100644 --- a/net/packet/af_packet.c +++ b/net/packet/af_packet.c @@ -1777,6 +1777,7 @@ static int fanout_add(struct sock *sk, struct fanout_args *args) match->prot_hook.af_packet_net = read_pnet(&match->net); match->prot_hook.id_match = match_fanout_group; match->max_num_members = args->max_num_members; + match->prot_hook.ignore_outgoing = type_flags & PACKET_FANOUT_FLAG_IGNORE_OUTGOING; list_add(&match->list, &fanout_list); } err = -EINVAL;