Skip to content

Commit c86ee67

Browse files
Shan Weikaber
authored andcommitted
netfilter: kill redundant check code in which setting ip_summed value
If the returned csum value is 0, We has set ip_summed with CHECKSUM_UNNECESSARY flag in __skb_checksum_complete_head(). So this patch kills the check and changes to return to upper caller directly. Signed-off-by: Shan Wei <shanwei@cn.fujitsu.com> Signed-off-by: Patrick McHardy <kaber@trash.net>
1 parent f5c5440 commit c86ee67

File tree

2 files changed

+2
-6
lines changed

2 files changed

+2
-6
lines changed

net/ipv4/netfilter.c

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -212,9 +212,7 @@ static __sum16 nf_ip_checksum_partial(struct sk_buff *skb, unsigned int hook,
212212
skb->csum = csum_tcpudp_nofold(iph->saddr, iph->daddr, protocol,
213213
skb->len - dataoff, 0);
214214
skb->ip_summed = CHECKSUM_NONE;
215-
csum = __skb_checksum_complete_head(skb, dataoff + len);
216-
if (!csum)
217-
skb->ip_summed = CHECKSUM_UNNECESSARY;
215+
return __skb_checksum_complete_head(skb, dataoff + len);
218216
}
219217
return csum;
220218
}

net/ipv6/netfilter.c

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -151,9 +151,7 @@ static __sum16 nf_ip6_checksum_partial(struct sk_buff *skb, unsigned int hook,
151151
protocol,
152152
csum_sub(0, hsum)));
153153
skb->ip_summed = CHECKSUM_NONE;
154-
csum = __skb_checksum_complete_head(skb, dataoff + len);
155-
if (!csum)
156-
skb->ip_summed = CHECKSUM_UNNECESSARY;
154+
return __skb_checksum_complete_head(skb, dataoff + len);
157155
}
158156
return csum;
159157
};

0 commit comments

Comments
 (0)