diff mbox

[1/1] ipv6 : ip6mr.c : Fix can't match the IPv6 multicast packets with input net device in netfilter FORWARD chain.

Message ID 1343912455-4444-1-git-send-email-mypopydev@gmail.com
State Rejected, archived
Delegated to: David Miller
Headers show

Commit Message

Jun Zhao Aug. 2, 2012, 1 p.m. UTC
Current kernel change the skb's net device with output device before netfilter FORWARD chain,
that will lead to can't match the IPv6 multicast packets with input net device in netfilter
FORWARD chain.

the test case for reproduce this issue as follow:

IPv6 multicast udp stream from eth0(input device) to eth1(output device)

Dst Addr: Port
{ff03::4}:6789 --->

                    Router
         +---------------------------+
-------> | [eth0] --FORWARD--> [eth1]| ------->
         +---------------------------+

ip6tables -I FORWARD -p udp -i eth0 -o eth1 --dst ff03::4 -j ACCEPT [first rules ]
ip6tables -A FORWARD -p udp -i eth1 -o eth1 --dst ff03::4 -j ACCEPT [second rules]

Before fix this issue, it will match the second rules not the first rules. you can used
command "ip6tables -L -vnx" to check the match result.

Signed-off-by: Jun Zhao <mypopydev@gmail.com>
---
 net/ipv6/ip6mr.c |    2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)

Comments

David Miller Aug. 2, 2012, 11:20 p.m. UTC | #1
From: Jun Zhao <mypopydev@gmail.com>
Date: Thu,  2 Aug 2012 21:00:55 +0800

> Current kernel change the skb's net device with output device before netfilter FORWARD chain,
> that will lead to can't match the IPv6 multicast packets with input net device in netfilter
> FORWARD chain.
> 
> the test case for reproduce this issue as follow:
> 
> IPv6 multicast udp stream from eth0(input device) to eth1(output device)

Your change means we now can't match on the VIF device in this situation.

I'm not applying this patch, it breaks as much as it fixes.
--
To unsubscribe from this list: send the line "unsubscribe netdev" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Jun Zhao Aug. 3, 2012, 6:10 a.m. UTC | #2
On Thu, 2012-08-02 at 16:20 -0700, David Miller wrote:
> From: Jun Zhao <mypopydev@gmail.com>
> Date: Thu,  2 Aug 2012 21:00:55 +0800
> 
> > Current kernel change the skb's net device with output device before netfilter FORWARD chain,
> > that will lead to can't match the IPv6 multicast packets with input net device in netfilter
> > FORWARD chain.
> > 
> > the test case for reproduce this issue as follow:
> > 
> > IPv6 multicast udp stream from eth0(input device) to eth1(output device)
> 
> Your change means we now can't match on the VIF device in this situation.
> 
> I'm not applying this patch, it breaks as much as it fixes.

Hi, David:

Maybe I need to used conservative approach to fix it and don't breaks
much more, I will supply the version 2 patch for this issue.

Tks.


--
To unsubscribe from this list: send the line "unsubscribe netdev" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
diff mbox

Patch

diff --git a/net/ipv6/ip6mr.c b/net/ipv6/ip6mr.c
index 4532973..a9d3dd7 100644
--- a/net/ipv6/ip6mr.c
+++ b/net/ipv6/ip6mr.c
@@ -1946,7 +1946,7 @@  static int ip6mr_forward2(struct net *net, struct mr6_table *mrt,
 	 * result in receiving multiple packets.
 	 */
 	dev = vif->dev;
-	skb->dev = dev;
+
 	vif->pkt_out++;
 	vif->bytes_out += skb->len;