diff options
| author | YOSHIFUJI Hideaki <yoshfuji@linux-ipv6.org> | 2013-03-15 05:51:58 -0400 |
|---|---|---|
| committer | Pablo Neira Ayuso <pablo@netfilter.org> | 2013-03-15 06:02:04 -0400 |
| commit | 2d2fd8c50a28b82481d193dca1c373907ea70965 (patch) | |
| tree | 287080fa845cf7262ba9761fcbe3964fa3cafb55 /net | |
| parent | 1e32b0c65c9e3f1a09cb5d1bcc0c5becf849d85f (diff) | |
netfilter: ip6t_NPT: Use csum_partial()
[ Some fixes went into mainstream before this patch, so I needed
to rebase it upon the current tree, that's why it's different from
the original one posted on the list --pablo ]
Signed-off-by: YOSHIFUJI Hideaki <yoshfuji@linux-ipv6.org>
Signed-off-by: Pablo Neira Ayuso <pablo@netfilter.org>
Diffstat (limited to 'net')
| -rw-r--r-- | net/ipv6/netfilter/ip6t_NPT.c | 11 |
1 files changed, 3 insertions, 8 deletions
diff --git a/net/ipv6/netfilter/ip6t_NPT.c b/net/ipv6/netfilter/ip6t_NPT.c index 83acc1405a18..59286a1de850 100644 --- a/net/ipv6/netfilter/ip6t_NPT.c +++ b/net/ipv6/netfilter/ip6t_NPT.c | |||
| @@ -18,9 +18,8 @@ | |||
| 18 | static int ip6t_npt_checkentry(const struct xt_tgchk_param *par) | 18 | static int ip6t_npt_checkentry(const struct xt_tgchk_param *par) |
| 19 | { | 19 | { |
| 20 | struct ip6t_npt_tginfo *npt = par->targinfo; | 20 | struct ip6t_npt_tginfo *npt = par->targinfo; |
| 21 | __wsum src_sum = 0, dst_sum = 0; | ||
| 22 | struct in6_addr pfx; | 21 | struct in6_addr pfx; |
| 23 | unsigned int i; | 22 | __wsum src_sum, dst_sum; |
| 24 | 23 | ||
| 25 | if (npt->src_pfx_len > 64 || npt->dst_pfx_len > 64) | 24 | if (npt->src_pfx_len > 64 || npt->dst_pfx_len > 64) |
| 26 | return -EINVAL; | 25 | return -EINVAL; |
| @@ -33,12 +32,8 @@ static int ip6t_npt_checkentry(const struct xt_tgchk_param *par) | |||
| 33 | if (!ipv6_addr_equal(&pfx, &npt->dst_pfx.in6)) | 32 | if (!ipv6_addr_equal(&pfx, &npt->dst_pfx.in6)) |
| 34 | return -EINVAL; | 33 | return -EINVAL; |
| 35 | 34 | ||
| 36 | for (i = 0; i < ARRAY_SIZE(npt->src_pfx.in6.s6_addr16); i++) { | 35 | src_sum = csum_partial(&npt->src_pfx.in6, sizeof(npt->src_pfx.in6), 0); |
| 37 | src_sum = csum_add(src_sum, | 36 | dst_sum = csum_partial(&npt->dst_pfx.in6, sizeof(npt->dst_pfx.in6), 0); |
| 38 | (__force __wsum)npt->src_pfx.in6.s6_addr16[i]); | ||
| 39 | dst_sum = csum_add(dst_sum, | ||
| 40 | (__force __wsum)npt->dst_pfx.in6.s6_addr16[i]); | ||
| 41 | } | ||
| 42 | 37 | ||
| 43 | npt->adjustment = ~csum_fold(csum_sub(src_sum, dst_sum)); | 38 | npt->adjustment = ~csum_fold(csum_sub(src_sum, dst_sum)); |
| 44 | return 0; | 39 | return 0; |
