提交 149d0774 编写于 作者: T Tom Herbert 提交者: David S. Miller

tcp: Call skb_gro_checksum_validate

In tcp[64]_gro_receive call skb_gro_checksum_validate to validate TCP
checksum in the gro context.
Signed-off-by: NTom Herbert <therbert@google.com>
Signed-off-by: NDavid S. Miller <davem@davemloft.net>
上级 758f75d1
...@@ -288,35 +288,14 @@ static int tcp_v4_gso_send_check(struct sk_buff *skb) ...@@ -288,35 +288,14 @@ static int tcp_v4_gso_send_check(struct sk_buff *skb)
static struct sk_buff **tcp4_gro_receive(struct sk_buff **head, struct sk_buff *skb) static struct sk_buff **tcp4_gro_receive(struct sk_buff **head, struct sk_buff *skb)
{ {
/* Use the IP hdr immediately proceeding for this transport */
const struct iphdr *iph = skb_gro_network_header(skb);
__wsum wsum;
/* Don't bother verifying checksum if we're going to flush anyway. */ /* Don't bother verifying checksum if we're going to flush anyway. */
if (NAPI_GRO_CB(skb)->flush) if (!NAPI_GRO_CB(skb)->flush &&
goto skip_csum; skb_gro_checksum_validate(skb, IPPROTO_TCP,
inet_gro_compute_pseudo)) {
wsum = NAPI_GRO_CB(skb)->csum;
switch (skb->ip_summed) {
case CHECKSUM_NONE:
wsum = skb_checksum(skb, skb_gro_offset(skb), skb_gro_len(skb),
0);
/* fall through */
case CHECKSUM_COMPLETE:
if (!tcp_v4_check(skb_gro_len(skb), iph->saddr, iph->daddr,
wsum)) {
skb->ip_summed = CHECKSUM_UNNECESSARY;
break;
}
NAPI_GRO_CB(skb)->flush = 1; NAPI_GRO_CB(skb)->flush = 1;
return NULL; return NULL;
} }
skip_csum:
return tcp_gro_receive(head, skb); return tcp_gro_receive(head, skb);
} }
......
...@@ -35,34 +35,14 @@ static int tcp_v6_gso_send_check(struct sk_buff *skb) ...@@ -35,34 +35,14 @@ static int tcp_v6_gso_send_check(struct sk_buff *skb)
static struct sk_buff **tcp6_gro_receive(struct sk_buff **head, static struct sk_buff **tcp6_gro_receive(struct sk_buff **head,
struct sk_buff *skb) struct sk_buff *skb)
{ {
const struct ipv6hdr *iph = skb_gro_network_header(skb);
__wsum wsum;
/* Don't bother verifying checksum if we're going to flush anyway. */ /* Don't bother verifying checksum if we're going to flush anyway. */
if (NAPI_GRO_CB(skb)->flush) if (!NAPI_GRO_CB(skb)->flush &&
goto skip_csum; skb_gro_checksum_validate(skb, IPPROTO_TCP,
ip6_gro_compute_pseudo)) {
wsum = NAPI_GRO_CB(skb)->csum;
switch (skb->ip_summed) {
case CHECKSUM_NONE:
wsum = skb_checksum(skb, skb_gro_offset(skb), skb_gro_len(skb),
wsum);
/* fall through */
case CHECKSUM_COMPLETE:
if (!tcp_v6_check(skb_gro_len(skb), &iph->saddr, &iph->daddr,
wsum)) {
skb->ip_summed = CHECKSUM_UNNECESSARY;
break;
}
NAPI_GRO_CB(skb)->flush = 1; NAPI_GRO_CB(skb)->flush = 1;
return NULL; return NULL;
} }
skip_csum:
return tcp_gro_receive(head, skb); return tcp_gro_receive(head, skb);
} }
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册