Skip to contentSkip to conversation

(usagi-core 34062) fix for eui64 match

DISCUSSION Yasuyuki KOZAKAI 2 participants 2 messages Dec 26, 2007 – Dec 28, 2007 4 messages not in the archive

Subsystems (2)
lore
Share & tools
lore

A message that is not in the archive (sent off-list or not yet received): [email protected]

A message that is not in the archive (sent off-list or not yet received): [email protected]

A message that is not in the archive (sent off-list or not yet received): [email protected]

#3 lore raw

# Sorry, I forgot replacing list address, so I resend

Hi,

Thanks for a patch. But the patch could not be applied because all tabs are replaced with spaces. I've fixed them for 2.6 and 2.4 tree.

Patrick, please apply the attached patches (the first for linux-2.6 tree at a few hours ago, the later is for 2.4).

BTW, Peter, netfilter-devel list was moved to
[email protected]

Please subscribe and send messages to it next time.

Regards,

-- Yasuyuki Kozakai

From: Peter Ivancik <[email protected]>
Date: Tue, 18 Dec 2007 14:26:07 +0100

Quoted 50 lines

Sorry, my stupid mistake. Here's correct version:

####################################################################################
diff -u net/ipv6/netfilter/ip6t_eui64.c.orig net/ipv6/netfilter/ip6t_eui64.c

ipv6/netfilter/ip6t_eui64.c 2007-12-18 10:38:23.000000000 +0100 renamed from ipv6/netfilter/ip6t_eui64.c.orig 2007-12-18 12:47:00.000000000 +0100 +1 -1
@@ -47,7 +47,7 @@
                        memcpy(eui64 + 5, eth_hdr(skb)->h_source + 3, 3);
                        eui64[3] = 0xff;
                        eui64[4] = 0xfe;
-                       eui64[0] |= 0x02;
+                       eui64[0] ^= 0x02;
 
                        i = 0;
                        while (ipv6_hdr(skb)->saddr.s6_addr[8 + i] == eui64[i]

####################################################################################

Peter

Quoted 30 lines · On Tue, Dec 18, 2007 at 09:07:58PM +0900, YOSHIFUJI Hideaki / ?$B5HF#1QL@ wrote:

In article <[email protected]> (at Tue, 18 Dec 2007 13:01:29 +0100), Peter Ivancik <[email protected]> says:

Quoted 11 lines

I send you (after 3 years:) another report&fix for eui64 ip6tables module in linux kernel. There's mistake while testing complement
of second least bit in firt byte. There must be
XOR operation (RFC 2464 - paragraph 4.). So, now in code is line "eui64[0] |= 0x02;"
and correct is
"eui64[0] ^= 0x02;"
of linux/net/ipv6/netfilter/ip6t_eui64.c source file.

I hope it's correct. If yes, fix this problem in
the next patch please.

Yup.

ipv6/netfilter/ip6t_eui64.c.orig 2007-12-18 12:47:00.000000000 +0100

Quoted 10 lines

--
diff -u net/ipv6/netfilter/ip6t_eui64.c net/ipv6/netfilter/ip6t_eui64.c.orig

ipv6/netfilter/ip6t_eui64.c.orig 2007-12-18 12:47:00.000000000 +0100 renamed from ipv6/netfilter/ip6t_eui64.c 2007-12-18 10:38:23.000000000 +0100 +0 -0
			eui64[4] = 0xfe;
ipv6/netfilter/ip6t_eui64.c.orig 2007-12-18 12:47:00.000000000 +0100 renamed from ipv6/netfilter/ip6t_eui64.c 2007-12-18 10:38:23.000000000 +0100 +1 -1
-                       eui64[0] ^= 0x02;
+			eui64[0] |= 0x02;

Please send us forward patch (not reverse patch).
Please do not convert tabs into spaces.

Quoted 4 lines
Quoted 3 lines

Regards,

--yoshfuji

From 9a58ccbfd268f509d56b201fb2b5f7f9c4a9040d Mon Sep 17 00:00:00 2001

From: Yasuyuki Kozakai <[email protected]>
Date: Wed, 26 Dec 2007 15:57:39 +0900
Subject: [NETFILTER]: ip6t_eui64: Fixes calculation of Universal/Local bit

RFC2464 says that the next to lowerst order bit of the first octet of the Interface Identifier is formed by complementing
the Universal/Local bit of the EUI-64. But ip6t_eui64 uses OR not XOR.

Thanks Peter Ivancik for reporing this bug and posting a patch for it.

---
 net/ipv6/netfilter/ip6t_eui64.c |    2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)
net/ipv6/netfilter/ip6t_eui64.c +1 -1
index 34ba150..41df9a5 100644
@@ -47,7 +47,7 @@ match(const struct sk_buff *skb,
 			memcpy(eui64 + 5, eth_hdr(skb)->h_source + 3, 3);
 			eui64[3] = 0xff;
 			eui64[4] = 0xfe;
-			eui64[0] |= 0x02;
+			eui64[0] ^= 0x02;
 
 			i = 0;
 			while (ipv6_hdr(skb)->saddr.s6_addr[8 + i] == eui64[i]
Signature · 1 line
1.5.3.6
Quoted 1 line

From acb6e566b07c8f8494ca2f66c1d56d92ed6876bc Mon Sep 17 00:00:00 2001

From: Yasuyuki Kozakai <[email protected]>
Date: Wed, 26 Dec 2007 16:05:44 +0900
Subject: [NETFILTER]: ip6t_eui64: Fixes calculation of Universal/Local bit

RFC2464 says that the next to lowerst order bit of the first octet of the Interface Identifier is formed by complementing
the Universal/Local bit of the EUI-64. But ip6t_eui64 uses OR not XOR.

Thanks Peter Ivancik for reporing this bug and posting a patch for it.

---
 net/ipv6/netfilter/ip6t_eui64.c |    2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)
net/ipv6/netfilter/ip6t_eui64.c +1 -1
index 5f91a5b..32dee34 100644
@@ -35,7 +35,7 @@ match(const struct sk_buff *skb,
          memcpy(eui64 + 5, skb->mac.ethernet->h_source + 3, 3);
 	 eui64[3]=0xff;
 	 eui64[4]=0xfe;
-	 eui64[0] |= 0x02;
+	 eui64[0] ^= 0x02;
 
 	 i=0;
 	 while ((skb->nh.ipv6h->saddr.in6_u.u6_addr8[8+i] ==
Signature · 1 line
1.5.3.6

A message that is not in the archive (sent off-list or not yet received): [email protected]

#5 lore raw
Quoted 9 lines · Yasuyuki KOZAKAI

# Sorry, I forgot replacing list address, so I resend

Hi,

Thanks for a patch. But the patch could not be applied because all tabs are replaced with spaces. I've fixed them for 2.6 and 2.4 tree.

Patrick, please apply the attached patches (the first for linux-2.6 tree at a few hours ago, the later is for 2.4).

Both patches applied, thanks Yasuyuki.