* ping6 is sent out from wrong interface
@ 2008-06-20 1:42 Naohiro Ooiwa
2008-06-24 20:04 ` YOSHIFUJI Hideaki / 吉藤英明
0 siblings, 1 reply; 9+ messages in thread
From: Naohiro Ooiwa @ 2008-06-20 1:42 UTC (permalink / raw)
To: netdev, usagi-users; +Cc: YOSHIFUJI Hideaki / 吉藤英明
Hi all,
I configured the IPv6 global address for two interfaces,
and sent the ping with "-I <eth1 address>" to the "ff02::1".
# ifconfig eth0 add 2001:2c0:418:1::2/64
# ifconfig eth1 add 2001:2c0:418:2::2/64
# ping6 -I2001:2c0:418:2::2 ff02::1
# /usr/sbin/tcpdump -ieth1 icmp6 -v -e
tcpdump: listening on eth1, link-type EN10MB (Ethernet), capture size 96 bytes
0 packets captured
0 packets received by filter
0 packets dropped by kernel
The ping packets weren't sent from "eth1",
so I captured the packets on the "eth0" by tcpdump.
# /usr/sbin/tcpdump -ieth0 icmp6 -v -e
tcpdump: listening on eth0, link-type EN10MB (Ethernet), capture size 96 bytes
18:16:53.900751 00:19:d1:19:23:af (oui Unknown) > 33:33:00:00:00:01 (oui Unknown), ethertype IPv6 (0x86dd), length
118: (hlim 64, next-header: ICMPv6 (58), length: 64) 2001:2c0:418:2::2 > ff02::1: ICMP6, echo request, length 64, seq 190
18:16:53.957145 00:1d:09:7a:91:19 (oui Unknown) > 33:33:00:00:00:02 (oui Unknown), ethertype IPv6 (0x86dd), length
70: (hlim 255, next-header: ICMPv6 (58), length: 16) fe80::21d:9ff:fe7a:9119 > ff02::2: [icmp6 sum ok] ICMP6, router
solicitation, length 16
source link-address option (1), length 8 (1): 00:1d:09:7a:91:19
::::::
The ping packets were sent out from "eth0"(00:19:d1:19:23:af),
but IPv6 address was "eth1"(2001:2c0:418:2::2).
Why is interface "eth0". Isn't it bug ?
The following is additional information.
# ifconfig eth0
eth0 Link encap:Ethernet HWaddr 00:19:D1:19:23:AF
inet addr:10.1.0.161 Bcast:10.1.255.255 Mask:255.255.0.0
inet6 addr: 2001:2c0:418:1::1/64 Scope:Global
inet6 addr: fe80::219:d1ff:fe19:23af/64 Scope:Link
::::::
# ifconfig eth1
eth1 Link encap:Ethernet HWaddr 00:10:18:0E:0C:B4
inet addr:172.16.255.200 Bcast:172.16.255.255 Mask:255.255.0.0
inet6 addr: 2001:2c0:418:2::2/64 Scope:Global
inet6 addr: fe80::210:18ff:fe0e:cb4/64 Scope:Link
::::::
# route -A inet6
Kernel IPv6 routing table
Destination Next Hop Flags Metric Ref Use Iface
2001:2c0:418:1::/64 * U 256 0 0 eth0
2001:2c0:418:2::/64 * U 256 0 0 eth1
fe80::/64 * U 256 0 0 eth0
fe80::/64 * U 256 0 0 eth1
::::::
2001:2c0:418:1::1/128 * U 0 8 1 lo
2001:2c0:418:2::2/128 * U 0 5 1 lo
::::::
ff00::/8 * U 256 0 0 eth0
ff00::/8 * U 256 0 0 eth1
#
The version used are following:
# uname -r -m
2.6.24.7-92.fc8 i686
# ping6 -V
ping6 utility, iputils-sss20070202
Regards,
Naohiro Ooiwa
^ permalink raw reply [flat|nested] 9+ messages in thread
* Re: ping6 is sent out from wrong interface
2008-06-20 1:42 Naohiro Ooiwa
@ 2008-06-24 20:04 ` YOSHIFUJI Hideaki / 吉藤英明
0 siblings, 0 replies; 9+ messages in thread
From: YOSHIFUJI Hideaki / 吉藤英明 @ 2008-06-24 20:04 UTC (permalink / raw)
To: nooiwa; +Cc: netdev, usagi-users, yoshfuji
In article <485B0B1D.5000603@miraclelinux.com> (at Fri, 20 Jun 2008 10:42:53 +0900), Naohiro Ooiwa <nooiwa@miraclelinux.com> says:
> The ping packets were sent out from "eth0"(00:19:d1:19:23:af),
> but IPv6 address was "eth1"(2001:2c0:418:2::2).
> Why is interface "eth0". Isn't it bug ?
>
> The following is additional information.
>
> # ifconfig eth0
> eth0 Link encap:Ethernet HWaddr 00:19:D1:19:23:AF
> inet addr:10.1.0.161 Bcast:10.1.255.255 Mask:255.255.0.0
> inet6 addr: 2001:2c0:418:1::1/64 Scope:Global
> inet6 addr: fe80::219:d1ff:fe19:23af/64 Scope:Link
> ::::::
> # ifconfig eth1
> eth1 Link encap:Ethernet HWaddr 00:10:18:0E:0C:B4
> inet addr:172.16.255.200 Bcast:172.16.255.255 Mask:255.255.0.0
> inet6 addr: 2001:2c0:418:2::2/64 Scope:Global
> inet6 addr: fe80::210:18ff:fe0e:cb4/64 Scope:Link
> ::::::
-I does not specify interface strictly but source address.
Which means, if you just specify an address, interface is unspecified.
You can give "-I eth1", too.
BTW, we should accept '-I fe80::1%eth0', maybe.
--yoshfuji
^ permalink raw reply [flat|nested] 9+ messages in thread
* Re: ping6 is sent out from wrong interface
@ 2008-06-25 7:02 Naohiro Ooiwa
2008-06-25 7:51 ` (usagi-users 04057) " Fey Marcus
2008-06-27 19:14 ` YOSHIFUJI Hideaki / 吉藤英明
0 siblings, 2 replies; 9+ messages in thread
From: Naohiro Ooiwa @ 2008-06-25 7:02 UTC (permalink / raw)
To: YOSHIFUJI Hideaki / 吉藤英明; +Cc: netdev, usagi-users
Hi YOSHIFUJI-san
Thank you for your reply.
> -I does not specify interface strictly but source address.
> Which means, if you just specify an address, interface is unspecified.
> You can give "-I eth1", too.
I'm not convinced yet.
I don't think it's correct that kernel or ping6 arbitrarily decides outgoing interface.
Is this really an expected behaviour?
Could you explain to me the reason of it, too?
I think the behavior should be similar to IPv4.
The following is my image. ipv6_dev_find() is an imaginary function, which
finds the interface with a given source address.
How do you think?
--- linux-2.6.25/net/ipv6/raw.c.orig 2008-04-17 11:49:44.000000000 +0900
+++ linux-2.6.25/net/ipv6/raw.c 2008-06-25 15:20:27.000000000 +0900
@@ -875,8 +875,13 @@ static int rawv6_sendmsg(struct kiocb *i
final_p = &final;
}
- if (!fl.oif && ipv6_addr_is_multicast(&fl.fl6_dst))
- fl.oif = np->mcast_oif;
+ if (!fl.oif && ipv6_addr_is_multicast(&fl.fl6_dst)) {
+ if (np->mcast_oif)
+ fl.oif = np->mcast_oif;
+ else
+ fl.oif = ipv6_dev_find(oldflp->fl6_src);
+ }
+
security_sk_classify_flow(sk, &fl);
err = ip6_dst_lookup(sk, &dst, &fl);
^ permalink raw reply [flat|nested] 9+ messages in thread
* (usagi-users 04057) Re: ping6 is sent out from wrong interface
2008-06-25 7:02 ping6 is sent out from wrong interface Naohiro Ooiwa
@ 2008-06-25 7:51 ` Fey Marcus
2008-06-25 10:18 ` (usagi-users 04056) " Naohiro Ooiwa
2008-06-27 19:14 ` YOSHIFUJI Hideaki / 吉藤英明
1 sibling, 1 reply; 9+ messages in thread
From: Fey Marcus @ 2008-06-25 7:51 UTC (permalink / raw)
To: usagi-users, YOSHIFUJI Hideaki / 吉藤英明
Cc: netdev, usagi-users
Hi Naohiro,
>I'm not convinced yet.
>I don't think it's correct that kernel or ping6 arbitrarily
>decides outgoing interface.
>
>Is this really an expected behaviour?
>Could you explain to me the reason of it, too?
>
>I think the behavior should be similar to IPv4.
It's due to routing.
Your routing table shows this:
---
# route -A inet6
Kernel IPv6 routing table
Destination Next Hop Flags Metric Ref Use Iface
2001:2c0:418:1::/64 * U 256 0 0 eth0
2001:2c0:418:2::/64 * U 256 0 0 eth1
fe80::/64 * U 256 0 0 eth0
fe80::/64 * U 256 0 0 eth1
::::::
2001:2c0:418:1::1/128 * U 0 8 1 lo
2001:2c0:418:2::2/128 * U 0 5 1 lo
::::::
ff00::/8 * U 256 0 0 eth0
ff00::/8 * U 256 0 0 eth1
#
---
...with eth0 being preferred over eth1 for multicast packets.
You could add a dedicated route for ff02::/16 to make the kernel output the packet via eth1.
Bye,
Marcus
-----------------------------------------
IABG mbH
Sitz der Gesellschaft: Ottobrunn, Registergericht: Amtsgericht Muenchen, HRB 5499
Geschaeftsfuehrung: Prof. Dr.-Ing. Rudolf F. Schwarz
Vorsitzender des Aufsichtsrats: General a. D. Wolfgang Altenburg
^ permalink raw reply [flat|nested] 9+ messages in thread
* Re: (usagi-users 04056) Re: ping6 is sent out from wrong interface
2008-06-25 7:51 ` (usagi-users 04057) " Fey Marcus
@ 2008-06-25 10:18 ` Naohiro Ooiwa
2008-06-25 11:26 ` Fey Marcus
0 siblings, 1 reply; 9+ messages in thread
From: Naohiro Ooiwa @ 2008-06-25 10:18 UTC (permalink / raw)
To: Fey Marcus
Cc: usagi-users, YOSHIFUJI Hideaki / 吉藤英明,
netdev, usagi-users
Hi Marcus
Thank you for your quick reply.
> It's due to routing.
For the reason of selecting 'eth0', I agree.
But, I think the device is specified before
looking up the routing table in this case.
> ...with eth0 being preferred over eth1 for multicast packets.
> You could add a dedicated route for ff02::/16 to make the kernel output the packet via eth1.
This works when using only "eth1" for multicasts.
When multiple I/Fs are connected to separate networks,
this scheme requires changing the route every time
a user need to send ping to different network.
I think kernel can solve this problem better.
Regards,
Naohiro Ooiwa
Fey Marcus さんは書きました:
> Hi Naohiro,
>
>> I'm not convinced yet.
>> I don't think it's correct that kernel or ping6 arbitrarily
>> decides outgoing interface.
>>
>> Is this really an expected behaviour?
>> Could you explain to me the reason of it, too?
>>
>> I think the behavior should be similar to IPv4.
>
> It's due to routing.
>
> Your routing table shows this:
> ---
> # route -A inet6
> Kernel IPv6 routing table
> Destination Next Hop Flags Metric Ref Use Iface
> 2001:2c0:418:1::/64 * U 256 0 0 eth0
> 2001:2c0:418:2::/64 * U 256 0 0 eth1
> fe80::/64 * U 256 0 0 eth0
> fe80::/64 * U 256 0 0 eth1
> ::::::
> 2001:2c0:418:1::1/128 * U 0 8 1 lo
> 2001:2c0:418:2::2/128 * U 0 5 1 lo
> ::::::
> ff00::/8 * U 256 0 0 eth0
> ff00::/8 * U 256 0 0 eth1
> #
> ---
>
> ...with eth0 being preferred over eth1 for multicast packets.
>
> You could add a dedicated route for ff02::/16 to make the kernel output the packet via eth1.
>
> Bye,
>
> Marcus
> -----------------------------------------
> IABG mbH
> Sitz der Gesellschaft: Ottobrunn, Registergericht: Amtsgericht Muenchen, HRB 5499
> Geschaeftsfuehrung: Prof. Dr.-Ing. Rudolf F. Schwarz
> Vorsitzender des Aufsichtsrats: General a. D. Wolfgang Altenburg
>
> --
> 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
>
^ permalink raw reply [flat|nested] 9+ messages in thread
* RE: (usagi-users 04056) Re: ping6 is sent out from wrong interface
2008-06-25 10:18 ` (usagi-users 04056) " Naohiro Ooiwa
@ 2008-06-25 11:26 ` Fey Marcus
2008-06-26 0:48 ` Naohiro Ooiwa
0 siblings, 1 reply; 9+ messages in thread
From: Fey Marcus @ 2008-06-25 11:26 UTC (permalink / raw)
To: Naohiro Ooiwa
Cc: usagi-users, YOSHIFUJI Hideaki / 吉藤英明,
netdev, usagi-users
Hi Naohiro,
>
>Hi Marcus
>
>Thank you for your quick reply.
>
>> It's due to routing.
>
>For the reason of selecting 'eth0', I agree.
>But, I think the device is specified before looking up the
>routing table in this case.
Well, ping's man page reads:
---
-I interface address
Set source address to specified interface address. Argument
may be numeric IP address or name of device. When pinging
IPv6 link-local address this option is required.
---
So you only set the address, not the interface to be used for sending.
>
>> ...with eth0 being preferred over eth1 for multicast packets.
>> You could add a dedicated route for ff02::/16 to make the
>kernel output the packet via eth1.
>
>This works when using only "eth1" for multicasts.
>When multiple I/Fs are connected to separate networks, this
>scheme requires changing the route every time a user need to
>send ping to different network.
>
Ok, my proposition was a bit too general. It would probably be better to set up routes for the exact addresses. So in your case to ff02::1.
Of course, if you wish to send the same packet via several interfaces within a short time, this would still result in adding and deleting the routes over and over again.
>I think kernel can solve this problem better.
>
I don't think this would be intended....
Bye,
Marcus
-----------------------------------------
IABG mbH
Sitz der Gesellschaft: Ottobrunn, Registergericht: Amtsgericht Muenchen, HRB 5499
Geschaeftsfuehrung: Prof. Dr.-Ing. Rudolf F. Schwarz
Vorsitzender des Aufsichtsrats: General a. D. Wolfgang Altenburg
^ permalink raw reply [flat|nested] 9+ messages in thread
* Re: (usagi-users 04056) Re: ping6 is sent out from wrong interface
2008-06-25 11:26 ` Fey Marcus
@ 2008-06-26 0:48 ` Naohiro Ooiwa
0 siblings, 0 replies; 9+ messages in thread
From: Naohiro Ooiwa @ 2008-06-26 0:48 UTC (permalink / raw)
To: Fey Marcus
Cc: usagi-users, YOSHIFUJI Hideaki / 吉藤英明,
netdev, usagi-users
Hi Marcus
Thank you for your comment.
>>
>> Thank you for your quick reply.
>>
>>> It's due to routing.
>> For the reason of selecting 'eth0', I agree.
>> But, I think the device is specified before looking up the
>> routing table in this case.
>
> Well, ping's man page reads:
> ---
> -I interface address
> Set source address to specified interface address. Argument
> may be numeric IP address or name of device. When pinging
> IPv6 link-local address this option is required.
> ---
>
> So you only set the address, not the interface to be used for sending.
Then, the man page doesn't match with the implementation.
>
>>> ...with eth0 being preferred over eth1 for multicast packets.
>>> You could add a dedicated route for ff02::/16 to make the
>> kernel output the packet via eth1.
>>
>> This works when using only "eth1" for multicasts.
>> When multiple I/Fs are connected to separate networks, this
>> scheme requires changing the route every time a user need to
>> send ping to different network.
>>
>
> Ok, my proposition was a bit too general. It would probably be better to set up routes for the exact addresses. So in your case to ff02::1.
>
> Of course, if you wish to send the same packet via several interfaces within a short time, this would still result in adding and deleting the routes over and over again.
>
>> I think kernel can solve this problem better.
>>
>
> I don't think this would be intended....
>
I was just confused by the difference of
source address things between IPv4 and IPv6.
Regards,
Naohiro Ooiwa
^ permalink raw reply [flat|nested] 9+ messages in thread
* Re: (usagi-users 04056) Re: ping6 is sent out from wrong interface
2008-06-25 7:02 ping6 is sent out from wrong interface Naohiro Ooiwa
2008-06-25 7:51 ` (usagi-users 04057) " Fey Marcus
@ 2008-06-27 19:14 ` YOSHIFUJI Hideaki / 吉藤英明
2008-06-30 12:57 ` Naohiro Ooiwa
1 sibling, 1 reply; 9+ messages in thread
From: YOSHIFUJI Hideaki / 吉藤英明 @ 2008-06-27 19:14 UTC (permalink / raw)
To: usagi-users, nooiwa; +Cc: netdev, usagi-users
In article <4861ED72.6080100@miraclelinux.com> (at Wed, 25 Jun 2008 16:02:10 +0900), Naohiro Ooiwa <nooiwa@miraclelinux.com> says:
> Hi YOSHIFUJI-san
>
> Thank you for your reply.
>
> > -I does not specify interface strictly but source address.
> > Which means, if you just specify an address, interface is unspecified.
> > You can give "-I eth1", too.
>
> I'm not convinced yet.
> I don't think it's correct that kernel or ping6 arbitrarily decides outgoing interface.
>
> Is this really an expected behaviour?
> Could you explain to me the reason of it, too?
I have to agree it is rather strange (or not natural), but, I do not
agree with the solution.
In theory, outgoing interface must be selected by routing, if unspecified.
So, I'd propose something like this (not tested, not for real patch).
diff --git a/net/ipv6/route.c b/net/ipv6/route.c
index d1f3e19..81ddf9a 100644
--- a/net/ipv6/route.c
+++ b/net/ipv6/route.c
@@ -239,17 +239,28 @@ static inline int rt6_need_strict(struct in6_addr *daddr)
static inline struct rt6_info *rt6_device_match(struct net *net,
struct rt6_info *rt,
+ struct in6_addr *saddr,
int oif,
int strict)
{
struct rt6_info *local = NULL;
struct rt6_info *sprt;
- if (oif) {
- for (sprt = rt; sprt; sprt = sprt->u.dst.rt6_next) {
- struct net_device *dev = sprt->rt6i_dev;
+ if (!oif && ipv6_addr_any(saddr))
+ saddr = NULL;
+
+ for (sprt = rt; sprt; sprt = sprt->u.dst.rt6_next) {
+ struct net_device *dev = sprt->rt6i_dev;
+
+ if (oif) {
if (dev->ifindex == oif)
return sprt;
+ } else {
+ if (saddr && ipv6_chk_addr(net, saddr, dev, strict))
+ return sprt;
+ }
+
+ if (oif) {
if (dev->flags & IFF_LOOPBACK) {
if (sprt->rt6i_idev == NULL ||
sprt->rt6i_idev->dev->ifindex != oif) {
@@ -261,13 +272,13 @@ static inline struct rt6_info *rt6_device_match(struct net *net,
}
local = sprt;
}
- }
- if (local)
- return local;
+ if (local)
+ return local;
- if (strict)
- return net->ipv6.ip6_null_entry;
+ if (strict)
+ return net->ipv6.ip6_null_entry;
+ }
}
return rt;
}
@@ -541,7 +552,7 @@ static struct rt6_info *ip6_pol_route_lookup(struct net *net,
fn = fib6_lookup(&table->tb6_root, &fl->fl6_dst, &fl->fl6_src);
restart:
rt = fn->leaf;
- rt = rt6_device_match(net, rt, fl->oif, flags);
+ rt = rt6_device_match(net, rt, &fl->fl6_src, fl->oif, flags);
BACKTRACK(net, &fl->fl6_src);
out:
dst_use(&rt->u.dst, jiffies);
--
YOSHIFUJI Hideaki @ USAGI Project <yoshfuji@linux-ipv6.org>
GPG-FP : 9022 65EB 1ECF 3AD1 0BDF 80D8 4807 F894 E062 0EEA
^ permalink raw reply related [flat|nested] 9+ messages in thread
* Re: (usagi-users 04056) Re: ping6 is sent out from wrong interface
2008-06-27 19:14 ` YOSHIFUJI Hideaki / 吉藤英明
@ 2008-06-30 12:57 ` Naohiro Ooiwa
0 siblings, 0 replies; 9+ messages in thread
From: Naohiro Ooiwa @ 2008-06-30 12:57 UTC (permalink / raw)
To: YOSHIFUJI Hideaki / 吉藤英明
Cc: usagi-users, netdev, usagi-users
Hi YOSHIFUJI-san
Thanks for your proposal.
> > In theory, outgoing interface must be selected by routing, if unspecified.
> > So, I'd propose something like this (not tested, not for real patch).
This patch looks good enough to me.
I tested your patch and it works as I expected.
I'm looking forward to seeing your final fix as well.
Thank you so much.
Naohiro Ooiwa
^ permalink raw reply [flat|nested] 9+ messages in thread
end of thread, other threads:[~2008-06-30 12:57 UTC | newest]
Thread overview: 9+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2008-06-25 7:02 ping6 is sent out from wrong interface Naohiro Ooiwa
2008-06-25 7:51 ` (usagi-users 04057) " Fey Marcus
2008-06-25 10:18 ` (usagi-users 04056) " Naohiro Ooiwa
2008-06-25 11:26 ` Fey Marcus
2008-06-26 0:48 ` Naohiro Ooiwa
2008-06-27 19:14 ` YOSHIFUJI Hideaki / 吉藤英明
2008-06-30 12:57 ` Naohiro Ooiwa
-- strict thread matches above, loose matches on Subject: below --
2008-06-20 1:42 Naohiro Ooiwa
2008-06-24 20:04 ` YOSHIFUJI Hideaki / 吉藤英明
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).