diff options
author | Vincent Whitchurch <vincent.whitchurch@axis.com> | 2018-09-03 10:23:36 -0400 |
---|---|---|
committer | David S. Miller <davem@davemloft.net> | 2018-09-06 01:09:37 -0400 |
commit | fa788d986a3aac5069378ed04697bd06f83d3488 (patch) | |
tree | e335abac12b88e196f4c7c9e1012a66e93f53830 /include/linux/netdevice.h | |
parent | 05dcc71298643256948a2e17db7dbecc748719d2 (diff) |
packet: add sockopt to ignore outgoing packets
Currently, the only way to ignore outgoing packets on a packet socket is
via the BPF filter. With MSG_ZEROCOPY, packets that are looped into
AF_PACKET are copied in dev_queue_xmit_nit(), and this copy happens even
if the filter run from packet_rcv() would reject them. So the presence
of a packet socket on the interface takes away the benefits of
MSG_ZEROCOPY, even if the packet socket is not interested in outgoing
packets. (Even when MSG_ZEROCOPY is not used, the skb is unnecessarily
cloned, but the cost for that is much lower.)
Add a socket option to allow AF_PACKET sockets to ignore outgoing
packets to solve this. Note that the *BSDs already have something
similar: BIOCSSEESENT/BIOCSDIRECTION and BIOCSDIRFILT.
The first intended user is lldpd.
Signed-off-by: Vincent Whitchurch <vincent.whitchurch@axis.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'include/linux/netdevice.h')
-rw-r--r-- | include/linux/netdevice.h | 1 |
1 files changed, 1 insertions, 0 deletions
diff --git a/include/linux/netdevice.h b/include/linux/netdevice.h index 4271f6b4e419..e2b3bd750c98 100644 --- a/include/linux/netdevice.h +++ b/include/linux/netdevice.h | |||
@@ -2343,6 +2343,7 @@ static inline struct sk_buff *call_gro_receive_sk(gro_receive_sk_t cb, | |||
2343 | 2343 | ||
2344 | struct packet_type { | 2344 | struct packet_type { |
2345 | __be16 type; /* This is really htons(ether_type). */ | 2345 | __be16 type; /* This is really htons(ether_type). */ |
2346 | bool ignore_outgoing; | ||
2346 | struct net_device *dev; /* NULL is wildcarded here */ | 2347 | struct net_device *dev; /* NULL is wildcarded here */ |
2347 | int (*func) (struct sk_buff *, | 2348 | int (*func) (struct sk_buff *, |
2348 | struct net_device *, | 2349 | struct net_device *, |