Skip to content

Commit 149d077

Browse files
Tom Herbertdavem330
authored andcommitted
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: Tom Herbert <[email protected]> Signed-off-by: David S. Miller <[email protected]>
1 parent 758f75d commit 149d077

File tree

2 files changed

+6
-47
lines changed

2 files changed

+6
-47
lines changed

net/ipv4/tcp_offload.c

Lines changed: 3 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -288,35 +288,14 @@ static int tcp_v4_gso_send_check(struct sk_buff *skb)
288288

289289
static struct sk_buff **tcp4_gro_receive(struct sk_buff **head, struct sk_buff *skb)
290290
{
291-
/* Use the IP hdr immediately proceeding for this transport */
292-
const struct iphdr *iph = skb_gro_network_header(skb);
293-
__wsum wsum;
294-
295291
/* Don't bother verifying checksum if we're going to flush anyway. */
296-
if (NAPI_GRO_CB(skb)->flush)
297-
goto skip_csum;
298-
299-
wsum = NAPI_GRO_CB(skb)->csum;
300-
301-
switch (skb->ip_summed) {
302-
case CHECKSUM_NONE:
303-
wsum = skb_checksum(skb, skb_gro_offset(skb), skb_gro_len(skb),
304-
0);
305-
306-
/* fall through */
307-
308-
case CHECKSUM_COMPLETE:
309-
if (!tcp_v4_check(skb_gro_len(skb), iph->saddr, iph->daddr,
310-
wsum)) {
311-
skb->ip_summed = CHECKSUM_UNNECESSARY;
312-
break;
313-
}
314-
292+
if (!NAPI_GRO_CB(skb)->flush &&
293+
skb_gro_checksum_validate(skb, IPPROTO_TCP,
294+
inet_gro_compute_pseudo)) {
315295
NAPI_GRO_CB(skb)->flush = 1;
316296
return NULL;
317297
}
318298

319-
skip_csum:
320299
return tcp_gro_receive(head, skb);
321300
}
322301

net/ipv6/tcpv6_offload.c

Lines changed: 3 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -35,34 +35,14 @@ static int tcp_v6_gso_send_check(struct sk_buff *skb)
3535
static struct sk_buff **tcp6_gro_receive(struct sk_buff **head,
3636
struct sk_buff *skb)
3737
{
38-
const struct ipv6hdr *iph = skb_gro_network_header(skb);
39-
__wsum wsum;
40-
4138
/* Don't bother verifying checksum if we're going to flush anyway. */
42-
if (NAPI_GRO_CB(skb)->flush)
43-
goto skip_csum;
44-
45-
wsum = NAPI_GRO_CB(skb)->csum;
46-
47-
switch (skb->ip_summed) {
48-
case CHECKSUM_NONE:
49-
wsum = skb_checksum(skb, skb_gro_offset(skb), skb_gro_len(skb),
50-
wsum);
51-
52-
/* fall through */
53-
54-
case CHECKSUM_COMPLETE:
55-
if (!tcp_v6_check(skb_gro_len(skb), &iph->saddr, &iph->daddr,
56-
wsum)) {
57-
skb->ip_summed = CHECKSUM_UNNECESSARY;
58-
break;
59-
}
60-
39+
if (!NAPI_GRO_CB(skb)->flush &&
40+
skb_gro_checksum_validate(skb, IPPROTO_TCP,
41+
ip6_gro_compute_pseudo)) {
6142
NAPI_GRO_CB(skb)->flush = 1;
6243
return NULL;
6344
}
6445

65-
skip_csum:
6646
return tcp_gro_receive(head, skb);
6747
}
6848

0 commit comments

Comments
 (0)