netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Patrick McHardy <kaber@trash.net>
To: "David S. Miller" <davem@davemloft.net>
Cc: usagi-users@linux-ipv6.org, netdev@oss.sgi.com,
	yasuyuki.kozakai@toshiba.co.jp,
	netfilter-devel@lists.netfilter.org, dlstevens@us.ibm.com,
	laforge@gnumonks.org, pb@bieringer.de
Subject: Re: netfilter6: ICMPv6 type 143 doesn't match
Date: Fri, 06 May 2005 00:50:01 +0200	[thread overview]
Message-ID: <427AA319.1040906@trash.net> (raw)
In-Reply-To: <20050505153118.0d26297c.davem@davemloft.net>

[-- Attachment #1: Type: text/plain, Size: 726 bytes --]

David S. Miller wrote:
> On Fri, 06 May 2005 00:32:31 +0200
> Patrick McHardy <kaber@trash.net> wrote:
> 
>>Is there a reason why these packets never hit the POST_ROUTING hook?
> 
> I think it is an oversight rather than intentional.
> 
> The NDISC lookup stuff wrt. routing went back and forth
> implementation wise.  We used to use a seperate routing
> table for NDISC entries, but that caused all kinds of
> problems wrt. IPSEC (which the seperate routing table
> was ironically meant to fix) so that got undone and now
> NDISC routes and normal routes exist in one table.
> 
> So I think this oversight is just fallout from all of
> those changes.

Thanks, I've added a call to NF_HOOK(NF_IP6_POST_ROUTING) to the patch.


[-- Attachment #2: x --]
[-- Type: text/plain, Size: 2602 bytes --]

Index: net/ipv6/mcast.c
===================================================================
--- 2cfdb1827d9c176f4df42619c693e7b990a61963/net/ipv6/mcast.c  (mode:100644 sha1:393b6e6f50a9626e2894c9a5abd8dafd903e5eba)
+++ uncommitted/net/ipv6/mcast.c  (mode:100644)
@@ -1280,15 +1280,6 @@
 		return NULL;
 
 	skb_reserve(skb, LL_RESERVED_SPACE(dev));
-	if (dev->hard_header) {
-		unsigned char ha[MAX_ADDR_LEN];
-
-		ndisc_mc_map(&mld2_all_mcr, ha, dev, 1);
-		if (dev->hard_header(skb, dev, ETH_P_IPV6,ha,NULL,size) < 0) {
-			kfree_skb(skb);
-			return NULL;
-		}
-	}
 
 	if (ipv6_get_lladdr(dev, &addr_buf)) {
 		/* <draft-ietf-magma-mld-source-05.txt>:
@@ -1312,6 +1303,31 @@
 	return skb;
 }
 
+static inline int mld_dev_queue_xmit2(struct sk_buff *skb)
+{
+	struct net_device *dev = skb->dev;
+
+	if (dev->hard_header) {
+		unsigned char ha[MAX_ADDR_LEN];
+		int err;
+
+		ndisc_mc_map(&skb->nh.ipv6h->daddr, ha, dev, 1);
+		err = dev->hard_header(skb, dev, ETH_P_IPV6, ha, NULL, skb->len);
+		if (err < 0) {
+			IP6_INC_STATS(IPSTATS_MIB_OUTDISCARDS);
+			kfree_skb(skb);
+			return err;
+		}
+	}
+	return dev_queue_xmit(skb);
+}
+
+static inline int mld_dev_queue_xmit(struct sk_buff *skb)
+{
+	return NF_HOOK(PF_INET6, NF_IP6_POST_ROUTING, skb, NULL, skb->dev,
+	               mld_dev_queue_xmit2);
+}
+
 static void mld_sendpack(struct sk_buff *skb)
 {
 	struct ipv6hdr *pip6 = skb->nh.ipv6h;
@@ -1329,7 +1345,7 @@
 	pmr->csum = csum_ipv6_magic(&pip6->saddr, &pip6->daddr, mldlen,
 		IPPROTO_ICMPV6, csum_partial(skb->h.raw, mldlen, 0));
 	err = NF_HOOK(PF_INET6, NF_IP6_LOCAL_OUT, skb, NULL, skb->dev,
-		dev_queue_xmit);
+		mld_dev_queue_xmit);
 	if (!err) {
 		ICMP6_INC_STATS(idev,ICMP6_MIB_OUTMSGS);
 		IP6_INC_STATS(IPSTATS_MIB_OUTMCASTPKTS);
@@ -1635,12 +1651,6 @@
 	}
 
 	skb_reserve(skb, LL_RESERVED_SPACE(dev));
-	if (dev->hard_header) {
-		unsigned char ha[MAX_ADDR_LEN];
-		ndisc_mc_map(snd_addr, ha, dev, 1);
-		if (dev->hard_header(skb, dev, ETH_P_IPV6, ha, NULL, full_len) < 0)
-			goto out;
-	}
 
 	if (ipv6_get_lladdr(dev, &addr_buf)) {
 		/* <draft-ietf-magma-mld-source-05.txt>:
@@ -1668,7 +1678,7 @@
 	idev = in6_dev_get(skb->dev);
 
 	err = NF_HOOK(PF_INET6, NF_IP6_LOCAL_OUT, skb, NULL, skb->dev,
-		dev_queue_xmit);
+		mld_dev_queue_xmit);
 	if (!err) {
 		if (type == ICMPV6_MGM_REDUCTION)
 			ICMP6_INC_STATS(idev, ICMP6_MIB_OUTGROUPMEMBREDUCTIONS);
@@ -1682,10 +1692,6 @@
 	if (likely(idev != NULL))
 		in6_dev_put(idev);
 	return;
-
-out:
-	IP6_INC_STATS(IPSTATS_MIB_OUTDISCARDS);
-	kfree_skb(skb);
 }
 
 static int ip6_mc_del1_src(struct ifmcaddr6 *pmc, int sfmode,

  reply	other threads:[~2005-05-05 22:50 UTC|newest]

Thread overview: 17+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2004-12-25 17:47 netfilter6: ICMPv6 type 143 doesn't match Peter Bieringer
2004-12-27  4:17 ` Yasuyuki Kozakai
2004-12-27  9:02   ` YOSHIFUJI Hideaki / 吉藤英明
2005-01-02  9:12     ` netfilter6: ICMPv6 type 143 doesn't match (130 also not) Peter Bieringer
2005-01-08 11:45     ` (usagi-users 03180) Re: netfilter6: ICMPv6 type 143 doesn't match Peter Bieringer
2005-01-09 17:41       ` (usagi-users 03187) " Peter Bieringer
2005-01-10 13:17       ` (usagi-users 03180) " Olaf Kirch
2005-01-11 19:56         ` (usagi-users 03190) " Peter Bieringer
2005-05-05 19:53   ` Patrick McHardy
2005-05-05 20:20     ` Patrick McHardy
2005-05-05 21:34       ` David S. Miller
2005-05-05 22:26     ` David Stevens
2005-05-05 22:32       ` Patrick McHardy
2005-05-05 22:31         ` David S. Miller
2005-05-05 22:50           ` Patrick McHardy [this message]
2005-05-06 13:22             ` Herbert Xu
2005-05-06 14:39               ` Patrick McHardy

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=427AA319.1040906@trash.net \
    --to=kaber@trash.net \
    --cc=davem@davemloft.net \
    --cc=dlstevens@us.ibm.com \
    --cc=laforge@gnumonks.org \
    --cc=netdev@oss.sgi.com \
    --cc=netfilter-devel@lists.netfilter.org \
    --cc=pb@bieringer.de \
    --cc=usagi-users@linux-ipv6.org \
    --cc=yasuyuki.kozakai@toshiba.co.jp \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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).