Skip to content

Commit

Permalink
af_packet: make tpacket_rcv to not set status value before run_filter
Browse files Browse the repository at this point in the history
It is just an optimization. We don't need the value of status variable
if the packet is filtered.

Signed-off-by: Alexander Drozdov <al.drozdov@gmail.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
  • Loading branch information
Alexander Drozdov authored and David S. Miller committed Mar 24, 2015
1 parent c697366 commit 68c2e5d
Showing 1 changed file with 4 additions and 3 deletions.
7 changes: 4 additions & 3 deletions net/packet/af_packet.c
Original file line number Diff line number Diff line change
Expand Up @@ -1916,14 +1916,15 @@ static int tpacket_rcv(struct sk_buff *skb, struct net_device *dev,
}
}

if (skb->ip_summed == CHECKSUM_PARTIAL)
status |= TP_STATUS_CSUMNOTREADY;

snaplen = skb->len;

res = run_filter(skb, sk, snaplen);
if (!res)
goto drop_n_restore;

if (skb->ip_summed == CHECKSUM_PARTIAL)
status |= TP_STATUS_CSUMNOTREADY;

if (snaplen > res)
snaplen = res;

Expand Down

0 comments on commit 68c2e5d

Please sign in to comment.