diff options
author | Alexander Drozdov <al.drozdov@gmail.com> | 2015-03-23 02:11:13 -0400 |
---|---|---|
committer | David S. Miller <davem@davemloft.net> | 2015-03-23 22:01:28 -0400 |
commit | 682f048bd49449f4ab978664a7f69a44a74e3caa (patch) | |
tree | 4b623e8ddd2e4f874947e3c9f128591661dd10e8 /net/packet | |
parent | 68c2e5de360411674d9821ee2b46f5d8ee965161 (diff) |
af_packet: pass checksum validation status to the user
Introduce TP_STATUS_CSUM_VALID tp_status flag to tell the
af_packet user that at least the transport header checksum
has been already validated.
For now, the flag may be set for incoming packets only.
Signed-off-by: Alexander Drozdov <al.drozdov@gmail.com>
Cc: Willem de Bruijn <willemb@google.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'net/packet')
-rw-r--r-- | net/packet/af_packet.c | 9 |
1 files changed, 9 insertions, 0 deletions
diff --git a/net/packet/af_packet.c b/net/packet/af_packet.c index 9d854c5ce0b5..5102c3cc4eec 100644 --- a/net/packet/af_packet.c +++ b/net/packet/af_packet.c | |||
@@ -1924,6 +1924,10 @@ static int tpacket_rcv(struct sk_buff *skb, struct net_device *dev, | |||
1924 | 1924 | ||
1925 | if (skb->ip_summed == CHECKSUM_PARTIAL) | 1925 | if (skb->ip_summed == CHECKSUM_PARTIAL) |
1926 | status |= TP_STATUS_CSUMNOTREADY; | 1926 | status |= TP_STATUS_CSUMNOTREADY; |
1927 | else if (skb->pkt_type != PACKET_OUTGOING && | ||
1928 | (skb->ip_summed == CHECKSUM_COMPLETE || | ||
1929 | skb_csum_unnecessary(skb))) | ||
1930 | status |= TP_STATUS_CSUM_VALID; | ||
1927 | 1931 | ||
1928 | if (snaplen > res) | 1932 | if (snaplen > res) |
1929 | snaplen = res; | 1933 | snaplen = res; |
@@ -3031,6 +3035,11 @@ static int packet_recvmsg(struct socket *sock, struct msghdr *msg, size_t len, | |||
3031 | aux.tp_status = TP_STATUS_USER; | 3035 | aux.tp_status = TP_STATUS_USER; |
3032 | if (skb->ip_summed == CHECKSUM_PARTIAL) | 3036 | if (skb->ip_summed == CHECKSUM_PARTIAL) |
3033 | aux.tp_status |= TP_STATUS_CSUMNOTREADY; | 3037 | aux.tp_status |= TP_STATUS_CSUMNOTREADY; |
3038 | else if (skb->pkt_type != PACKET_OUTGOING && | ||
3039 | (skb->ip_summed == CHECKSUM_COMPLETE || | ||
3040 | skb_csum_unnecessary(skb))) | ||
3041 | aux.tp_status |= TP_STATUS_CSUM_VALID; | ||
3042 | |||
3034 | aux.tp_len = origlen; | 3043 | aux.tp_len = origlen; |
3035 | aux.tp_snaplen = skb->len; | 3044 | aux.tp_snaplen = skb->len; |
3036 | aux.tp_mac = 0; | 3045 | aux.tp_mac = 0; |