2024-03-08 11:27:12

by Juntong Deng

[permalink] [raw]
Subject: [PATCH net-next] net/packet: Add getsockopt support for PACKET_COPY_THRESH

Currently getsockopt does not support PACKET_COPY_THRESH,
and we are unable to get the value of PACKET_COPY_THRESH
socket option through getsockopt.

This patch adds getsockopt support for PACKET_COPY_THRESH.

Signed-off-by: Juntong Deng <[email protected]>
---
net/packet/af_packet.c | 3 +++
1 file changed, 3 insertions(+)

diff --git a/net/packet/af_packet.c b/net/packet/af_packet.c
index 0db31ca4982d..65042edd1a97 100644
--- a/net/packet/af_packet.c
+++ b/net/packet/af_packet.c
@@ -4090,6 +4090,9 @@ static int packet_getsockopt(struct socket *sock, int level, int optname,
case PACKET_VNET_HDR_SZ:
val = READ_ONCE(po->vnet_hdr_sz);
break;
+ case PACKET_COPY_THRESH:
+ val = pkt_sk(sk)->copy_thresh;
+ break;
case PACKET_VERSION:
val = po->tp_version;
break;
--
2.39.2