Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux
1
fork

Configure Feed

Select the types of activity you want to include in your feed.

net: psample: skip packet copy if no listeners

If nobody is listening on the multicast group, generating the sample,
which involves copying packet data, seems completely unnecessary.

Return fast in this case.

Reviewed-by: Aaron Conole <aconole@redhat.com>
Acked-by: Eelco Chaudron <echaudro@redhat.com>
Reviewed-by: Ido Schimmel <idosch@nvidia.com>
Reviewed-by: Simon Horman <horms@kernel.org>
Signed-off-by: Adrian Moreno <amorenoz@redhat.com>
Link: https://patch.msgid.link/20240704085710.353845-4-amorenoz@redhat.com
Signed-off-by: Jakub Kicinski <kuba@kernel.org>

authored by

Adrian Moreno and committed by
Jakub Kicinski
c35d86a2 03448444

+4
+4
net/psample/psample.c
··· 376 376 void *data; 377 377 int ret; 378 378 379 + if (!genl_has_listeners(&psample_nl_family, group->net, 380 + PSAMPLE_NL_MCGRP_SAMPLE)) 381 + return; 382 + 379 383 meta_len = (in_ifindex ? nla_total_size(sizeof(u16)) : 0) + 380 384 (out_ifindex ? nla_total_size(sizeof(u16)) : 0) + 381 385 (md->out_tc_valid ? nla_total_size(sizeof(u16)) : 0) +