net: selectively purge error queue in IP_RECVERR / IPV6_RECVERR
authorEric Dumazet <edumazet@google.com>
Fri, 18 Aug 2023 17:41:45 +0000 (17:41 +0000)
committerDavid S. Miller <davem@davemloft.net>
Sun, 20 Aug 2023 14:17:47 +0000 (15:17 +0100)
commit0f158b32a9b146c9b86783efccfd9ed02c744623
tree7b0a7ea12da8b4a7bc37f84cb9a9101ec80f60d5
parent412a75dc612a15fc87a755b182bd36f747a70bf6
net: selectively purge error queue in IP_RECVERR / IPV6_RECVERR

Setting IP_RECVERR and IPV6_RECVERR options to zero currently
purges the socket error queue, which was probably not expected
for zerocopy and tx_timestamp users.

I discovered this issue while preparing commit 6b5f43ea0815
("inet: move inet->recverr to inet->inet_flags"), I presume this
change does not need to be backported to stable kernels.

Add skb_errqueue_purge() helper to purge error messages only.

Signed-off-by: Eric Dumazet <edumazet@google.com>
Cc: Willem de Bruijn <willemb@google.com>
Cc: Soheil Hassas Yeganeh <soheil@google.com>
Reviewed-by: Willem de Bruijn <willemb@google.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
include/linux/skbuff.h
net/core/skbuff.c
net/ipv4/ip_sockglue.c
net/ipv6/ipv6_sockglue.c