Commit 98b0e84a authored by Changli Gao's avatar Changli Gao Committed by Patrick McHardy

netfilter: ipt_REJECT: postpone the checksum calculation.

postpone the checksum calculation, then if the output NIC supports checksum
offloading, we can utlize it. And though the output NIC doesn't support
checksum offloading, but we'll mangle this packet, this can free us from
updating the checksum, as the checksum calculation occurs later.
Signed-off-by: default avatarChangli Gao <xiaosuo@gmail.com>
Signed-off-by: default avatarPatrick McHardy <kaber@trash.net>
parent ea8fbe8f
...@@ -95,10 +95,11 @@ static void send_reset(struct sk_buff *oldskb, int hook) ...@@ -95,10 +95,11 @@ static void send_reset(struct sk_buff *oldskb, int hook)
} }
tcph->rst = 1; tcph->rst = 1;
tcph->check = tcp_v4_check(sizeof(struct tcphdr), tcph->check = ~tcp_v4_check(sizeof(struct tcphdr), niph->saddr,
niph->saddr, niph->daddr, niph->daddr, 0);
csum_partial(tcph, nskb->ip_summed = CHECKSUM_PARTIAL;
sizeof(struct tcphdr), 0)); nskb->csum_start = (unsigned char *)tcph - nskb->head;
nskb->csum_offset = offsetof(struct tcphdr, check);
addr_type = RTN_UNSPEC; addr_type = RTN_UNSPEC;
if (hook != NF_INET_FORWARD if (hook != NF_INET_FORWARD
...@@ -115,7 +116,6 @@ static void send_reset(struct sk_buff *oldskb, int hook) ...@@ -115,7 +116,6 @@ static void send_reset(struct sk_buff *oldskb, int hook)
goto free_nskb; goto free_nskb;
niph->ttl = dst_metric(skb_dst(nskb), RTAX_HOPLIMIT); niph->ttl = dst_metric(skb_dst(nskb), RTAX_HOPLIMIT);
nskb->ip_summed = CHECKSUM_NONE;
/* "Never happens" */ /* "Never happens" */
if (nskb->len > dst_mtu(skb_dst(nskb))) if (nskb->len > dst_mtu(skb_dst(nskb)))
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment