Skip to content

Commit 9f7c824

Browse files
Liping Zhangummakynes
authored andcommitted
netfilter: nf_dup4: remove redundant checksum recalculation
IP header checksum will be recalculated at ip_local_out, so there's no need to calculated it here, remove it. Also update code comments to illustrate it, and delete the misleading comments about checksum recalculation. Signed-off-by: Liping Zhang <[email protected]> Signed-off-by: Pablo Neira Ayuso <[email protected]>
1 parent ceee409 commit 9f7c824

File tree

1 file changed

+4
-6
lines changed

1 file changed

+4
-6
lines changed

net/ipv4/netfilter/nf_dup_ipv4.c

Lines changed: 4 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -74,21 +74,19 @@ void nf_dup_ipv4(struct net *net, struct sk_buff *skb, unsigned int hooknum,
7474
nf_conntrack_get(skb->nfct);
7575
#endif
7676
/*
77-
* If we are in PREROUTING/INPUT, the checksum must be recalculated
78-
* since the length could have changed as a result of defragmentation.
79-
*
80-
* We also decrease the TTL to mitigate potential loops between two
81-
* hosts.
77+
* If we are in PREROUTING/INPUT, decrease the TTL to mitigate potential
78+
* loops between two hosts.
8279
*
8380
* Set %IP_DF so that the original source is notified of a potentially
8481
* decreased MTU on the clone route. IPv6 does this too.
82+
*
83+
* IP header checksum will be recalculated at ip_local_out.
8584
*/
8685
iph = ip_hdr(skb);
8786
iph->frag_off |= htons(IP_DF);
8887
if (hooknum == NF_INET_PRE_ROUTING ||
8988
hooknum == NF_INET_LOCAL_IN)
9089
--iph->ttl;
91-
ip_send_check(iph);
9290

9391
if (nf_dup_ipv4_route(net, skb, gw, oif)) {
9492
__this_cpu_write(nf_skb_duplicated, true);

0 commit comments

Comments
 (0)