[UDP]: Only increment counter on first peek/recv
The previous move of the the UDP inDatagrams counter caused each peek of the same packet to be counted separately. This may be undesirable. This patch fixes this by adding a bit to sk_buff to record whether this packet has already been seen through skb_recv_datagram. We then only increment the counter when the packet is seen for the first time. The only dodgy part is the fact that skb_recv_datagram doesn't have a good way of returning this new bit of information. So I've added a new function __skb_recv_datagram that does return this and made skb_recv_datagram a wrapper around it. The plan is to eventually replace all uses of skb_recv_datagram with this new function at which time it can be renamed its proper name. Signed-off-by: Herbert Xu <herbert@gondor.apana.org.au> Signed-off-by: David S. Miller <davem@davemloft.net>
This commit is contained in:
committed by
David S. Miller
parent
1781f7f580
commit
a59322be07
@@ -288,6 +288,7 @@ struct sk_buff {
|
||||
__u8 pkt_type:3,
|
||||
fclone:2,
|
||||
ipvs_property:1,
|
||||
peeked:1,
|
||||
nf_trace:1;
|
||||
__be16 protocol;
|
||||
|
||||
@@ -1538,6 +1539,8 @@ static inline int pskb_trim_rcsum(struct sk_buff *skb, unsigned int len)
|
||||
skb = skb->prev)
|
||||
|
||||
|
||||
extern struct sk_buff *__skb_recv_datagram(struct sock *sk, unsigned flags,
|
||||
int *peeked, int *err);
|
||||
extern struct sk_buff *skb_recv_datagram(struct sock *sk, unsigned flags,
|
||||
int noblock, int *err);
|
||||
extern unsigned int datagram_poll(struct file *file, struct socket *sock,
|
||||
|
Reference in New Issue
Block a user