From: "YOSHIFUJI Hideaki / 吉藤英明" <yoshfuji@linux-ipv6.org>
To: davem@davemloft.net, felix-linuxkernel@fefe.de
Cc: linux-kernel@vger.kernel.org, netdev@oss.sgi.com,
yoshfuji@linux-ipv6.org
Subject: [PATCH] [IPV6] Fix address/interface handling according to the scoping architecture (is Re: 2.6.11: USB broken on nforce4, ipv6 still broken, centrino speedstep even more broken than in 2.6.10)
Date: Thu, 24 Mar 2005 20:59:02 +0900 (JST) [thread overview]
Message-ID: <20050324.205902.119922975.yoshfuji@linux-ipv6.org> (raw)
In-Reply-To: <20050311173308.7a076e8f.akpm@osdl.org>
In article <20050311173308.7a076e8f.akpm@osdl.org> (at Fri, 11 Mar 2005 17:33:08 -0800), Andrew Morton <akpm@osdl.org> says:
> Felix von Leitner <felix-linuxkernel@fefe.de> wrote:
> >
> > Now about IPv6: npush and npoll are two applications I wrote. npush
> > sends multicast announcements and opens a TCP socket. npoll receives
> > the multicast announcement and connects to the source IP/port/scope_id
> > of the announcement. If both are run on the same machine, npoll sees
> > the link local address of eth0 as source IP, and the interface number of
> > eth0 as scope_id. So far so good. Trying to connect() however hangs.
> > Since this has been broken in different ways for as long as I can
> > remember in Linux, and I keep complaining about it every half a year or
> > so. Can't someone fix this once and for all? IPv4 checks whether we
> > are connecting to our own address and reroutes through loopback, why
> > can't IPv6?
I think this has been there for long time (maybe since 2.4...).
With the following patch, I can connect local link-local address.
- Change incoming interface according to the scoping architecture
- Choose source address on appropriate interface, according to the
scoping architecture.
Signed-off-by: Hideaki YOSHIFUJI <yoshfuji@linux-ipv6.org>
===== net/ipv6/ip6_input.c 1.23 vs edited =====
--- 1.23/net/ipv6/ip6_input.c 2005-03-10 14:12:11 +09:00
+++ edited/net/ipv6/ip6_input.c 2005-03-24 17:49:15 +09:00
@@ -71,10 +71,18 @@
goto out;
}
- /* Store incoming device index. When the packet will
- be queued, we cannot refer to skb->dev anymore.
+ /*
+ * Store incoming device index. When the packet will
+ * be queued, we cannot refer to skb->dev anymore.
+ *
+ * BTW, when we send a packet for our own local address on a
+ * non-loopback interface (e.g. ethX), it is being delivered
+ * via the loopback interface (lo) here; skb->dev = &loopback_dev.
+ * It, however, should be considered as if it is being
+ * arrived via the sending interface (ethX), because of the
+ * nature of scoping architecture. --yoshfuji
*/
- IP6CB(skb)->iif = dev->ifindex;
+ IP6CB(skb)->iif = skb->dst ? ((struct rt6_info *)skb->dst)->rt6i_idev->dev->ifindex : dev->ifindex;
if (skb->len < sizeof(struct ipv6hdr))
goto err;
===== net/ipv6/addrconf.c 1.134 vs edited =====
--- 1.134/net/ipv6/addrconf.c 2005-03-15 14:21:11 +09:00
+++ edited/net/ipv6/addrconf.c 2005-03-24 11:52:17 +09:00
@@ -942,7 +942,7 @@
int ipv6_get_saddr(struct dst_entry *dst,
struct in6_addr *daddr, struct in6_addr *saddr)
{
- return ipv6_dev_get_saddr(dst ? dst->dev : NULL, daddr, saddr);
+ return ipv6_dev_get_saddr(dst ? ((struct rt6_info *)dst)->rt6i_idev->dev : NULL, daddr, saddr);
}
--
Hideaki YOSHIFUJI @ USAGI Project <yoshfuji@linux-ipv6.org>
GPG FP: 9022 65EB 1ECF 3AD1 0BDF 80D8 4807 F894 E062 0EEA
next prev parent reply other threads:[~2005-03-24 11:58 UTC|newest]
Thread overview: 23+ messages / expand[flat|nested] mbox.gz Atom feed top
2005-03-11 20:21 2.6.11: USB broken on nforce4, ipv6 still broken, centrino speedstep even more broken than in 2.6.10 Felix von Leitner
2005-03-12 1:32 ` Andrew Morton
2005-03-13 21:30 ` Felix von Leitner
2005-03-12 1:33 ` Andrew Morton
2005-03-22 0:33 ` Andrew Morton
2005-03-22 2:18 ` Johannes Stezenbach
2005-03-22 16:22 ` Johannes Stezenbach
2005-03-24 11:59 ` YOSHIFUJI Hideaki / 吉藤英明 [this message]
2005-04-25 19:57 ` IPv6 has trouble assigning an interface Felix von Leitner
2005-04-25 21:00 ` Pekka Savola
2005-04-26 6:10 ` Felix von Leitner
2005-04-27 22:57 ` Kyle Moffett
2005-04-27 23:31 ` David Stevens
2005-03-12 1:35 ` 2.6.11: USB broken on nforce4, ipv6 still broken, centrino speedstep even more broken than in 2.6.10 Andrew Morton
2005-03-12 3:54 ` Adam Belay
2005-03-22 0:32 ` Andrew Morton
2005-03-22 1:20 ` Adam Belay
2005-03-22 22:29 ` Felix von Leitner
2005-03-24 23:33 ` Jeremy Fitzhardinge
2005-03-25 0:17 ` Felix von Leitner
2005-03-25 13:37 ` Bruno Ducrot
2005-03-13 21:31 ` Felix von Leitner
2005-03-12 3:51 ` Adam Belay
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=20050324.205902.119922975.yoshfuji@linux-ipv6.org \
--to=yoshfuji@linux-ipv6.org \
--cc=davem@davemloft.net \
--cc=felix-linuxkernel@fefe.de \
--cc=linux-kernel@vger.kernel.org \
--cc=netdev@oss.sgi.com \
/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
all inboxes | Powered by JetHome®