aboutsummaryrefslogtreecommitdiffstats
path: root/net/ipv4/netfilter/ipt_TTL.c
diff options
context:
space:
mode:
authorPatrick McHardy <kaber@trash.net>2006-08-22 00:33:09 -0700
committerDavid S. Miller <davem@sunset.davemloft.net>2006-09-22 14:55:29 -0700
commitda878c8e5aae3eeceeee7af8d52633d7bc125edf (patch)
tree27f67c9713e98919e5c38d6cc85a05e9485576e9 /net/ipv4/netfilter/ipt_TTL.c
parent[NETFILTER]: nfnetlink_queue: fix typo in error message (diff)
downloadlinux-dev-da878c8e5aae3eeceeee7af8d52633d7bc125edf.tar.xz
linux-dev-da878c8e5aae3eeceeee7af8d52633d7bc125edf.zip
[NETFILTER]: replace open coded checksum updates
Replace open coded checksum update by nf_csum_update calls and clean up the surrounding code a bit. Signed-off-by: Patrick McHardy <kaber@trash.net> Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to '')
-rw-r--r--net/ipv4/netfilter/ipt_TTL.c9
1 files changed, 3 insertions, 6 deletions
diff --git a/net/ipv4/netfilter/ipt_TTL.c b/net/ipv4/netfilter/ipt_TTL.c
index f48892ae0be5..2afb2a8aa8c5 100644
--- a/net/ipv4/netfilter/ipt_TTL.c
+++ b/net/ipv4/netfilter/ipt_TTL.c
@@ -27,7 +27,6 @@ ipt_ttl_target(struct sk_buff **pskb,
{
struct iphdr *iph;
const struct ipt_TTL_info *info = targinfo;
- u_int16_t diffs[2];
int new_ttl;
if (!skb_make_writable(pskb, (*pskb)->len))
@@ -55,12 +54,10 @@ ipt_ttl_target(struct sk_buff **pskb,
}
if (new_ttl != iph->ttl) {
- diffs[0] = htons(((unsigned)iph->ttl) << 8) ^ 0xFFFF;
+ iph->check = nf_csum_update((iph->ttl << 8) ^ 0xFFFF,
+ new_ttl << 8,
+ iph->check);
iph->ttl = new_ttl;
- diffs[1] = htons(((unsigned)iph->ttl) << 8);
- iph->check = csum_fold(csum_partial((char *)diffs,
- sizeof(diffs),
- iph->check^0xFFFF));
}
return IPT_CONTINUE;