* [RFC PATCH 2/4] netfilter: ip6t_NPT: Use csum_partial().
@ 2013-01-26 18:36 YOSHIFUJI Hideaki
0 siblings, 0 replies; 4+ messages in thread
From: YOSHIFUJI Hideaki @ 2013-01-26 18:36 UTC (permalink / raw)
To: netfilter-devel; +Cc: jm, fw, yoshfuji
Signed-off-by: YOSHIFUJI Hideaki <yoshfuji@linux-ipv6.org>
---
net/ipv6/netfilter/ip6t_NPT.c | 11 +++--------
1 file changed, 3 insertions(+), 8 deletions(-)
diff --git a/net/ipv6/netfilter/ip6t_NPT.c b/net/ipv6/netfilter/ip6t_NPT.c
index 3ff281b..b1bf3ed 100644
--- a/net/ipv6/netfilter/ip6t_NPT.c
+++ b/net/ipv6/netfilter/ip6t_NPT.c
@@ -17,18 +17,13 @@
static int ip6t_npt_checkentry(const struct xt_tgchk_param *par)
{
struct ip6t_npt_tginfo *npt = par->targinfo;
- __wsum src_sum = 0, dst_sum = 0;
- unsigned int i;
+ __wsum src_sum, dst_sum;
if (npt->src_pfx_len > 64 || npt->dst_pfx_len > 64)
return -EINVAL;
- for (i = 0; i < ARRAY_SIZE(npt->src_pfx.in6.s6_addr16); i++) {
- src_sum = csum_add(src_sum,
- (__force __wsum)npt->src_pfx.in6.s6_addr16[i]);
- dst_sum = csum_add(dst_sum,
- (__force __wsum)npt->dst_pfx.in6.s6_addr16[i]);
- }
+ src_sum = csum_partial(&npt->src_pfx.in6, sizeof(npt->src_pfx.in6), 0);
+ dst_sum = csum_partial(&npt->dst_pfx.in6, sizeof(npt->dst_pfx.in6), 0);
npt->adjustment = csum_fold(csum_sub(src_sum, dst_sum));
return 0;
--
1.7.9.5
^ permalink raw reply related [flat|nested] 4+ messages in thread
* [RFC PATCH 2/4] netfilter: ip6t_NPT: Use csum_partial().
@ 2013-01-26 18:36 YOSHIFUJI Hideaki
2013-02-07 18:16 ` Pablo Neira Ayuso
2013-03-15 11:52 ` Pablo Neira Ayuso
0 siblings, 2 replies; 4+ messages in thread
From: YOSHIFUJI Hideaki @ 2013-01-26 18:36 UTC (permalink / raw)
To: netfilter-devel; +Cc: jm, fw, yoshfuji
Signed-off-by: YOSHIFUJI Hideaki <yoshfuji@linux-ipv6.org>
---
net/ipv6/netfilter/ip6t_NPT.c | 11 +++--------
1 file changed, 3 insertions(+), 8 deletions(-)
diff --git a/net/ipv6/netfilter/ip6t_NPT.c b/net/ipv6/netfilter/ip6t_NPT.c
index 3ff281b..b1bf3ed 100644
--- a/net/ipv6/netfilter/ip6t_NPT.c
+++ b/net/ipv6/netfilter/ip6t_NPT.c
@@ -17,18 +17,13 @@
static int ip6t_npt_checkentry(const struct xt_tgchk_param *par)
{
struct ip6t_npt_tginfo *npt = par->targinfo;
- __wsum src_sum = 0, dst_sum = 0;
- unsigned int i;
+ __wsum src_sum, dst_sum;
if (npt->src_pfx_len > 64 || npt->dst_pfx_len > 64)
return -EINVAL;
- for (i = 0; i < ARRAY_SIZE(npt->src_pfx.in6.s6_addr16); i++) {
- src_sum = csum_add(src_sum,
- (__force __wsum)npt->src_pfx.in6.s6_addr16[i]);
- dst_sum = csum_add(dst_sum,
- (__force __wsum)npt->dst_pfx.in6.s6_addr16[i]);
- }
+ src_sum = csum_partial(&npt->src_pfx.in6, sizeof(npt->src_pfx.in6), 0);
+ dst_sum = csum_partial(&npt->dst_pfx.in6, sizeof(npt->dst_pfx.in6), 0);
npt->adjustment = csum_fold(csum_sub(src_sum, dst_sum));
return 0;
--
1.7.9.5
^ permalink raw reply related [flat|nested] 4+ messages in thread
* Re: [RFC PATCH 2/4] netfilter: ip6t_NPT: Use csum_partial().
2013-01-26 18:36 YOSHIFUJI Hideaki
@ 2013-02-07 18:16 ` Pablo Neira Ayuso
2013-03-15 11:52 ` Pablo Neira Ayuso
1 sibling, 0 replies; 4+ messages in thread
From: Pablo Neira Ayuso @ 2013-02-07 18:16 UTC (permalink / raw)
To: YOSHIFUJI Hideaki; +Cc: netfilter-devel, jm, fw
Will pass this patch to net-next, as it is a cleanup.
On Sun, Jan 27, 2013 at 03:36:48AM +0900, YOSHIFUJI Hideaki wrote:
> Signed-off-by: YOSHIFUJI Hideaki <yoshfuji@linux-ipv6.org>
> ---
> net/ipv6/netfilter/ip6t_NPT.c | 11 +++--------
> 1 file changed, 3 insertions(+), 8 deletions(-)
>
> diff --git a/net/ipv6/netfilter/ip6t_NPT.c b/net/ipv6/netfilter/ip6t_NPT.c
> index 3ff281b..b1bf3ed 100644
> --- a/net/ipv6/netfilter/ip6t_NPT.c
> +++ b/net/ipv6/netfilter/ip6t_NPT.c
> @@ -17,18 +17,13 @@
> static int ip6t_npt_checkentry(const struct xt_tgchk_param *par)
> {
> struct ip6t_npt_tginfo *npt = par->targinfo;
> - __wsum src_sum = 0, dst_sum = 0;
> - unsigned int i;
> + __wsum src_sum, dst_sum;
>
> if (npt->src_pfx_len > 64 || npt->dst_pfx_len > 64)
> return -EINVAL;
>
> - for (i = 0; i < ARRAY_SIZE(npt->src_pfx.in6.s6_addr16); i++) {
> - src_sum = csum_add(src_sum,
> - (__force __wsum)npt->src_pfx.in6.s6_addr16[i]);
> - dst_sum = csum_add(dst_sum,
> - (__force __wsum)npt->dst_pfx.in6.s6_addr16[i]);
> - }
> + src_sum = csum_partial(&npt->src_pfx.in6, sizeof(npt->src_pfx.in6), 0);
> + dst_sum = csum_partial(&npt->dst_pfx.in6, sizeof(npt->dst_pfx.in6), 0);
>
> npt->adjustment = csum_fold(csum_sub(src_sum, dst_sum));
> return 0;
> --
> 1.7.9.5
>
>
> --
> To unsubscribe from this list: send the line "unsubscribe netfilter-devel" in
> the body of a message to majordomo@vger.kernel.org
> More majordomo info at http://vger.kernel.org/majordomo-info.html
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [RFC PATCH 2/4] netfilter: ip6t_NPT: Use csum_partial().
2013-01-26 18:36 YOSHIFUJI Hideaki
2013-02-07 18:16 ` Pablo Neira Ayuso
@ 2013-03-15 11:52 ` Pablo Neira Ayuso
1 sibling, 0 replies; 4+ messages in thread
From: Pablo Neira Ayuso @ 2013-03-15 11:52 UTC (permalink / raw)
To: YOSHIFUJI Hideaki; +Cc: netfilter-devel, jm, fw
I have applied a port to current of this patch. At the time it was
posted, the merge window was closed IIRC.
Thanks.
On Sun, Jan 27, 2013 at 03:36:48AM +0900, YOSHIFUJI Hideaki wrote:
> Signed-off-by: YOSHIFUJI Hideaki <yoshfuji@linux-ipv6.org>
> ---
> net/ipv6/netfilter/ip6t_NPT.c | 11 +++--------
> 1 file changed, 3 insertions(+), 8 deletions(-)
>
> diff --git a/net/ipv6/netfilter/ip6t_NPT.c b/net/ipv6/netfilter/ip6t_NPT.c
> index 3ff281b..b1bf3ed 100644
> --- a/net/ipv6/netfilter/ip6t_NPT.c
> +++ b/net/ipv6/netfilter/ip6t_NPT.c
> @@ -17,18 +17,13 @@
> static int ip6t_npt_checkentry(const struct xt_tgchk_param *par)
> {
> struct ip6t_npt_tginfo *npt = par->targinfo;
> - __wsum src_sum = 0, dst_sum = 0;
> - unsigned int i;
> + __wsum src_sum, dst_sum;
>
> if (npt->src_pfx_len > 64 || npt->dst_pfx_len > 64)
> return -EINVAL;
>
> - for (i = 0; i < ARRAY_SIZE(npt->src_pfx.in6.s6_addr16); i++) {
> - src_sum = csum_add(src_sum,
> - (__force __wsum)npt->src_pfx.in6.s6_addr16[i]);
> - dst_sum = csum_add(dst_sum,
> - (__force __wsum)npt->dst_pfx.in6.s6_addr16[i]);
> - }
> + src_sum = csum_partial(&npt->src_pfx.in6, sizeof(npt->src_pfx.in6), 0);
> + dst_sum = csum_partial(&npt->dst_pfx.in6, sizeof(npt->dst_pfx.in6), 0);
>
> npt->adjustment = csum_fold(csum_sub(src_sum, dst_sum));
> return 0;
> --
> 1.7.9.5
>
>
> --
> To unsubscribe from this list: send the line "unsubscribe netfilter-devel" in
> the body of a message to majordomo@vger.kernel.org
> More majordomo info at http://vger.kernel.org/majordomo-info.html
^ permalink raw reply [flat|nested] 4+ messages in thread
end of thread, other threads:[~2013-03-15 11:53 UTC | newest]
Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2013-01-26 18:36 [RFC PATCH 2/4] netfilter: ip6t_NPT: Use csum_partial() YOSHIFUJI Hideaki
-- strict thread matches above, loose matches on Subject: below --
2013-01-26 18:36 YOSHIFUJI Hideaki
2013-02-07 18:16 ` Pablo Neira Ayuso
2013-03-15 11:52 ` Pablo Neira Ayuso
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).