netfilter-devel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH net-2.6] netfilter: ebt_ip6: Use ipv6_masked_addr_cmp().
@ 2010-03-07  8:39 YOSHIFUJI Hideaki
  2010-03-07 23:27 ` David Miller
  2010-03-08  8:25 ` Bart De Schuymer
  0 siblings, 2 replies; 4+ messages in thread
From: YOSHIFUJI Hideaki @ 2010-03-07  8:39 UTC (permalink / raw)
  To: bart.de.schuymer, kaber, davem
  Cc: ebtables-devel, netfilter-devel, netdev, yoshfuji

Signed-off-by: YOSHIFUJI Hideaki <yoshfuji@linux-ipv6.org>
---
 net/bridge/netfilter/ebt_ip6.c |   18 ++++--------------
 1 files changed, 4 insertions(+), 14 deletions(-)

diff --git a/net/bridge/netfilter/ebt_ip6.c b/net/bridge/netfilter/ebt_ip6.c
index bbf2534..4644cc9 100644
--- a/net/bridge/netfilter/ebt_ip6.c
+++ b/net/bridge/netfilter/ebt_ip6.c
@@ -35,8 +35,6 @@ ebt_ip6_mt(const struct sk_buff *skb, const struct xt_match_param *par)
 	struct ipv6hdr _ip6h;
 	const struct tcpudphdr *pptr;
 	struct tcpudphdr _ports;
-	struct in6_addr tmp_addr;
-	int i;
 
 	ih6 = skb_header_pointer(skb, 0, sizeof(_ip6h), &_ip6h);
 	if (ih6 == NULL)
@@ -44,18 +42,10 @@ ebt_ip6_mt(const struct sk_buff *skb, const struct xt_match_param *par)
 	if (info->bitmask & EBT_IP6_TCLASS &&
 	   FWINV(info->tclass != ipv6_get_dsfield(ih6), EBT_IP6_TCLASS))
 		return false;
-	for (i = 0; i < 4; i++)
-		tmp_addr.in6_u.u6_addr32[i] = ih6->saddr.in6_u.u6_addr32[i] &
-			info->smsk.in6_u.u6_addr32[i];
-	if (info->bitmask & EBT_IP6_SOURCE &&
-		FWINV((ipv6_addr_cmp(&tmp_addr, &info->saddr) != 0),
-			EBT_IP6_SOURCE))
-		return false;
-	for (i = 0; i < 4; i++)
-		tmp_addr.in6_u.u6_addr32[i] = ih6->daddr.in6_u.u6_addr32[i] &
-			info->dmsk.in6_u.u6_addr32[i];
-	if (info->bitmask & EBT_IP6_DEST &&
-	   FWINV((ipv6_addr_cmp(&tmp_addr, &info->daddr) != 0), EBT_IP6_DEST))
+	if (FWINV(ipv6_masked_addr_cmp(&ih6->saddr, &info->smsk,
+				       &info->saddr), EBT_IP6_SOURCE) ||
+	    FWINV(ipv6_masked_addr_cmp(&ih6->daddr, &info->dmsk,
+				       &info->daddr), EBT_IP6_DEST))
 		return false;
 	if (info->bitmask & EBT_IP6_PROTO) {
 		uint8_t nexthdr = ih6->nexthdr;
-- 
1.5.6.5


^ permalink raw reply related	[flat|nested] 4+ messages in thread

* Re: [PATCH net-2.6] netfilter: ebt_ip6: Use ipv6_masked_addr_cmp().
  2010-03-07  8:39 [PATCH net-2.6] netfilter: ebt_ip6: Use ipv6_masked_addr_cmp() YOSHIFUJI Hideaki
@ 2010-03-07 23:27 ` David Miller
  2010-03-08  8:25 ` Bart De Schuymer
  1 sibling, 0 replies; 4+ messages in thread
From: David Miller @ 2010-03-07 23:27 UTC (permalink / raw)
  To: yoshfuji; +Cc: bart.de.schuymer, kaber, ebtables-devel, netfilter-devel, netdev

From: YOSHIFUJI Hideaki <yoshfuji@linux-ipv6.org>
Date: Sun, 7 Mar 2010 17:39:10 +0900

> Signed-off-by: YOSHIFUJI Hideaki <yoshfuji@linux-ipv6.org>

Patrick, I assume you'll get this.

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [PATCH net-2.6] netfilter: ebt_ip6: Use ipv6_masked_addr_cmp().
  2010-03-07  8:39 [PATCH net-2.6] netfilter: ebt_ip6: Use ipv6_masked_addr_cmp() YOSHIFUJI Hideaki
  2010-03-07 23:27 ` David Miller
@ 2010-03-08  8:25 ` Bart De Schuymer
  2010-03-08 12:16   ` Patrick McHardy
  1 sibling, 1 reply; 4+ messages in thread
From: Bart De Schuymer @ 2010-03-08  8:25 UTC (permalink / raw)
  To: YOSHIFUJI Hideaki
  Cc: bart.de.schuymer, kaber, davem, ebtables-devel, netfilter-devel,
	netdev

YOSHIFUJI Hideaki schreef:
> Signed-off-by: YOSHIFUJI Hideaki <yoshfuji@linux-ipv6.org>
> ---
>  net/bridge/netfilter/ebt_ip6.c |   18 ++++--------------
>  1 files changed, 4 insertions(+), 14 deletions(-)
>
> diff --git a/net/bridge/netfilter/ebt_ip6.c b/net/bridge/netfilter/ebt_ip6.c
> index bbf2534..4644cc9 100644
> --- a/net/bridge/netfilter/ebt_ip6.c
> +++ b/net/bridge/netfilter/ebt_ip6.c
> @@ -35,8 +35,6 @@ ebt_ip6_mt(const struct sk_buff *skb, const struct xt_match_param *par)
>  	struct ipv6hdr _ip6h;
>  	const struct tcpudphdr *pptr;
>  	struct tcpudphdr _ports;
> -	struct in6_addr tmp_addr;
> -	int i;
>  
>  	ih6 = skb_header_pointer(skb, 0, sizeof(_ip6h), &_ip6h);
>  	if (ih6 == NULL)
> @@ -44,18 +42,10 @@ ebt_ip6_mt(const struct sk_buff *skb, const struct xt_match_param *par)
>  	if (info->bitmask & EBT_IP6_TCLASS &&
>  	   FWINV(info->tclass != ipv6_get_dsfield(ih6), EBT_IP6_TCLASS))
>  		return false;
> -	for (i = 0; i < 4; i++)
> -		tmp_addr.in6_u.u6_addr32[i] = ih6->saddr.in6_u.u6_addr32[i] &
> -			info->smsk.in6_u.u6_addr32[i];
> -	if (info->bitmask & EBT_IP6_SOURCE &&
> -		FWINV((ipv6_addr_cmp(&tmp_addr, &info->saddr) != 0),
> -			EBT_IP6_SOURCE))
> -		return false;
> -	for (i = 0; i < 4; i++)
> -		tmp_addr.in6_u.u6_addr32[i] = ih6->daddr.in6_u.u6_addr32[i] &
> -			info->dmsk.in6_u.u6_addr32[i];
> -	if (info->bitmask & EBT_IP6_DEST &&
> -	   FWINV((ipv6_addr_cmp(&tmp_addr, &info->daddr) != 0), EBT_IP6_DEST))
> +	if (FWINV(ipv6_masked_addr_cmp(&ih6->saddr, &info->smsk,
> +				       &info->saddr), EBT_IP6_SOURCE) ||
> +	    FWINV(ipv6_masked_addr_cmp(&ih6->daddr, &info->dmsk,
> +				       &info->daddr), EBT_IP6_DEST))
>  		return false;
>  	if (info->bitmask & EBT_IP6_PROTO) {
>  		uint8_t nexthdr = ih6->nexthdr;
>   
Signed-off-by: Bart De Schuymer <bdschuym@pandora.be>

Looks OK to me.


cheers,
Bart


-- 
Bart De Schuymer
www.artinalgorithms.be


^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [PATCH net-2.6] netfilter: ebt_ip6: Use ipv6_masked_addr_cmp().
  2010-03-08  8:25 ` Bart De Schuymer
@ 2010-03-08 12:16   ` Patrick McHardy
  0 siblings, 0 replies; 4+ messages in thread
From: Patrick McHardy @ 2010-03-08 12:16 UTC (permalink / raw)
  To: Bart De Schuymer
  Cc: YOSHIFUJI Hideaki, bart.de.schuymer, davem, ebtables-devel,
	netfilter-devel, netdev

Bart De Schuymer wrote:
> YOSHIFUJI Hideaki schreef:
>> Signed-off-by: YOSHIFUJI Hideaki <yoshfuji@linux-ipv6.org>
>> ---
>>  net/bridge/netfilter/ebt_ip6.c |   18 ++++--------------
>>  1 files changed, 4 insertions(+), 14 deletions(-)
>>
> Signed-off-by: Bart De Schuymer <bdschuym@pandora.be>
> 
> Looks OK to me.

Applied, thanks.

^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2010-03-08 12:16 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2010-03-07  8:39 [PATCH net-2.6] netfilter: ebt_ip6: Use ipv6_masked_addr_cmp() YOSHIFUJI Hideaki
2010-03-07 23:27 ` David Miller
2010-03-08  8:25 ` Bart De Schuymer
2010-03-08 12:16   ` Patrick McHardy

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).