* [RFC][PATCH 3/3]ipv6:fix the outgoing interface selection order in udpv6_sendmsg()
@ 2008-12-09 7:12 Yang Hongyang
2008-12-09 7:32 ` Rémi Denis-Courmont
0 siblings, 1 reply; 9+ messages in thread
From: Yang Hongyang @ 2008-12-09 7:12 UTC (permalink / raw)
To: netdev, David S. Miller
1.When no interface is specified in an IPV6_PKTINFO ancillary data
item, the interface specified in an IPV6_PKTINFO sticky optionis
is used.
RFC3542:
6.7. Summary of Outgoing Interface Selection
This document and [RFC-3493] specify various methods that affect the
selection of the packet's outgoing interface. This subsection
summarizes the ordering among those in order to ensure deterministic
behavior.
For a given outgoing packet on a given socket, the outgoing interface
is determined in the following order:
1. if an interface is specified in an IPV6_PKTINFO ancillary data
item, the interface is used.
2. otherwise, if an interface is specified in an IPV6_PKTINFO sticky
option, the interface is used.
Signed-off-by: Yang Hongyang<yanghy@cn.fujitsu.com>
---
net/ipv6/udp.c | 3 +++
1 files changed, 3 insertions(+), 0 deletions(-)
diff --git a/net/ipv6/udp.c b/net/ipv6/udp.c
index 8b48512..addd856 100644
--- a/net/ipv6/udp.c
+++ b/net/ipv6/udp.c
@@ -761,6 +761,9 @@ do_udp_sendmsg:
}
if (!fl.oif)
+ fl.oif = np->sticky_pktinfo.ipi6_ifindex;
+
+ if (!fl.oif)
fl.oif = sk->sk_bound_dev_if;
if (msg->msg_controllen) {
--
1.6.0.1
^ permalink raw reply related [flat|nested] 9+ messages in thread* Re: [RFC][PATCH 3/3]ipv6:fix the outgoing interface selection order in udpv6_sendmsg()
2008-12-09 7:12 [RFC][PATCH 3/3]ipv6:fix the outgoing interface selection order in udpv6_sendmsg() Yang Hongyang
@ 2008-12-09 7:32 ` Rémi Denis-Courmont
2008-12-10 0:42 ` Yang Hongyang
0 siblings, 1 reply; 9+ messages in thread
From: Rémi Denis-Courmont @ 2008-12-09 7:32 UTC (permalink / raw)
To: ext Yang Hongyang; +Cc: netdev, David S. Miller
On Tuesday 09 December 2008 09:12:59 ext Yang Hongyang, you wrote:
> 1.When no interface is specified in an IPV6_PKTINFO ancillary data
> item, the interface specified in an IPV6_PKTINFO sticky optionis
> is used.
> diff --git a/net/ipv6/udp.c b/net/ipv6/udp.c
> index 8b48512..addd856 100644
> --- a/net/ipv6/udp.c
> +++ b/net/ipv6/udp.c
> @@ -761,6 +761,9 @@ do_udp_sendmsg:
> }
>
> if (!fl.oif)
> + fl.oif = np->sticky_pktinfo.ipi6_ifindex;
> +
> + if (!fl.oif)
> fl.oif = sk->sk_bound_dev_if;
>
> if (msg->msg_controllen) {
I believe overriding the outgoing interface is only allowed for link-local
destinations, _or_ with privileges (as with SO_BINDTODEVICE).
This patch seems to change this, and I am not convinced it's a good idea.
--
Rémi Denis-Courmont
Maemo Software, Nokia Devices R&D
^ permalink raw reply [flat|nested] 9+ messages in thread* Re: [RFC][PATCH 3/3]ipv6:fix the outgoing interface selection order in udpv6_sendmsg()
2008-12-09 7:32 ` Rémi Denis-Courmont
@ 2008-12-10 0:42 ` Yang Hongyang
2008-12-10 6:16 ` David Miller
0 siblings, 1 reply; 9+ messages in thread
From: Yang Hongyang @ 2008-12-10 0:42 UTC (permalink / raw)
To: Rémi Denis-Courmont; +Cc: netdev, David S. Miller
Rémi Denis-Courmont wrote:
> On Tuesday 09 December 2008 09:12:59 ext Yang Hongyang, you wrote:
>> 1.When no interface is specified in an IPV6_PKTINFO ancillary data
>> item, the interface specified in an IPV6_PKTINFO sticky optionis
>> is used.
>
>> diff --git a/net/ipv6/udp.c b/net/ipv6/udp.c
>> index 8b48512..addd856 100644
>> --- a/net/ipv6/udp.c
>> +++ b/net/ipv6/udp.c
>> @@ -761,6 +761,9 @@ do_udp_sendmsg:
>> }
>>
>> if (!fl.oif)
>> + fl.oif = np->sticky_pktinfo.ipi6_ifindex;
>> +
>> + if (!fl.oif)
>> fl.oif = sk->sk_bound_dev_if;
>>
>> if (msg->msg_controllen) {
>
> I believe overriding the outgoing interface is only allowed for link-local
> destinations, _or_ with privileges (as with SO_BINDTODEVICE).
>
> This patch seems to change this, and I am not convinced it's a good idea.
>
It does not overriding the outgoing interface.
when no interface is specified in an IPV6_PKTINFO ancillary data item(as with
SO_BINDTODEVICE), the interface specified in an IPV6_PKTINFO sticky
optionins is used.
If outgoing interface is set with SO_BINDTODEVICE and also sticky pktinfo
the outgoing interface is exactly what SO_BINDTODEVICE set,because in my
first patch,when set sticy pktinfo,outgoing interface set by SO_BINDTODEVICE
is checked:
+ if(sk->sk_bound_dev_if && pkt.ipi6_ifindex != sk->sk_bound_dev_if)
+ goto e_inval;
^ permalink raw reply [flat|nested] 9+ messages in thread* Re: [RFC][PATCH 3/3]ipv6:fix the outgoing interface selection order in udpv6_sendmsg()
2008-12-10 0:42 ` Yang Hongyang
@ 2008-12-10 6:16 ` David Miller
2008-12-10 6:33 ` Yang Hongyang
0 siblings, 1 reply; 9+ messages in thread
From: David Miller @ 2008-12-10 6:16 UTC (permalink / raw)
To: yanghy; +Cc: remi.denis-courmont, netdev
From: Yang Hongyang <yanghy@cn.fujitsu.com>
Date: Wed, 10 Dec 2008 08:42:20 +0800
> If outgoing interface is set with SO_BINDTODEVICE and also sticky pktinfo
> the outgoing interface is exactly what SO_BINDTODEVICE set,because in my
> first patch,when set sticy pktinfo,outgoing interface set by SO_BINDTODEVICE
> is checked:
>
> + if(sk->sk_bound_dev_if && pkt.ipi6_ifindex != sk->sk_bound_dev_if)
> + goto e_inval;
>
You may be checking this, but these two values can become out of sync
if the application next makes a SO_BINDTODEVICE setsockopt() call to
change the index setting.
Nothing makes sure the sticky ipv6 socket information is updated
if that happens. And the most obvious ways to handle that are
very ugly, doing some kind of call into ipv6 from the generic
socket SO_BINDTODEVICE setsockopt() handler.
^ permalink raw reply [flat|nested] 9+ messages in thread
* Re: [RFC][PATCH 3/3]ipv6:fix the outgoing interface selection order in udpv6_sendmsg()
2008-12-10 6:16 ` David Miller
@ 2008-12-10 6:33 ` Yang Hongyang
2008-12-10 6:38 ` Yang Hongyang
0 siblings, 1 reply; 9+ messages in thread
From: Yang Hongyang @ 2008-12-10 6:33 UTC (permalink / raw)
To: David Miller; +Cc: remi.denis-courmont, netdev
David Miller wrote:
> From: Yang Hongyang <yanghy@cn.fujitsu.com>
> Date: Wed, 10 Dec 2008 08:42:20 +0800
>
>> If outgoing interface is set with SO_BINDTODEVICE and also sticky pktinfo
>> the outgoing interface is exactly what SO_BINDTODEVICE set,because in my
>> first patch,when set sticy pktinfo,outgoing interface set by SO_BINDTODEVICE
>> is checked:
>>
>> + if(sk->sk_bound_dev_if && pkt.ipi6_ifindex != sk->sk_bound_dev_if)
>> + goto e_inval;
>>
>
> You may be checking this, but these two values can become out of sync
> if the application next makes a SO_BINDTODEVICE setsockopt() call to
> change the index setting.
>
> Nothing makes sure the sticky ipv6 socket information is updated
> if that happens. And the most obvious ways to handle that are
> very ugly, doing some kind of call into ipv6 from the generic
> socket SO_BINDTODEVICE setsockopt() handler.
>
>
Hum..can we just ignore the sync of the sticky option and the SO_BINDTODEVICE,
when send a message,first check sk_bound_dev_if,If it is specified,use it,otherwise
use sticky option?This was what i ment. and in my patch ,the outgoing interface
specified by sticky options will be overrided by the interface specified by
SO_BINDTODEVICE.
^ permalink raw reply [flat|nested] 9+ messages in thread
* Re: [RFC][PATCH 3/3]ipv6:fix the outgoing interface selection order in udpv6_sendmsg()
2008-12-10 6:33 ` Yang Hongyang
@ 2008-12-10 6:38 ` Yang Hongyang
2008-12-10 9:15 ` David Miller
0 siblings, 1 reply; 9+ messages in thread
From: Yang Hongyang @ 2008-12-10 6:38 UTC (permalink / raw)
To: David Miller; +Cc: remi.denis-courmont, netdev
Yang Hongyang wrote:
> David Miller wrote:
>> From: Yang Hongyang <yanghy@cn.fujitsu.com>
>> Date: Wed, 10 Dec 2008 08:42:20 +0800
>>
>>> If outgoing interface is set with SO_BINDTODEVICE and also sticky pktinfo
>>> the outgoing interface is exactly what SO_BINDTODEVICE set,because in my
>>> first patch,when set sticy pktinfo,outgoing interface set by SO_BINDTODEVICE
>>> is checked:
>>>
>>> + if(sk->sk_bound_dev_if && pkt.ipi6_ifindex != sk->sk_bound_dev_if)
>>> + goto e_inval;
>>>
>> You may be checking this, but these two values can become out of sync
>> if the application next makes a SO_BINDTODEVICE setsockopt() call to
>> change the index setting.
>>
>> Nothing makes sure the sticky ipv6 socket information is updated
>> if that happens. And the most obvious ways to handle that are
>> very ugly, doing some kind of call into ipv6 from the generic
>> socket SO_BINDTODEVICE setsockopt() handler.
>>
>>
>
> Hum..can we just ignore the sync of the sticky option and the SO_BINDTODEVICE,
> when send a message,first check sk_bound_dev_if,If it is specified,use it,otherwise
> use sticky option?This was what i ment. and in my patch ,the outgoing interface
> specified by sticky options will be overrided by the interface specified by
> SO_BINDTODEVICE.
If this is the solution, i'll post a updated patch.
> --
> 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: [RFC][PATCH 3/3]ipv6:fix the outgoing interface selection order in udpv6_sendmsg()
2008-12-10 6:38 ` Yang Hongyang
@ 2008-12-10 9:15 ` David Miller
2008-12-10 9:41 ` Yang Hongyang
0 siblings, 1 reply; 9+ messages in thread
From: David Miller @ 2008-12-10 9:15 UTC (permalink / raw)
To: yanghy; +Cc: remi.denis-courmont, netdev
From: Yang Hongyang <yanghy@cn.fujitsu.com>
Date: Wed, 10 Dec 2008 14:38:25 +0800
> Yang Hongyang wrote:
> > David Miller wrote:
> >> From: Yang Hongyang <yanghy@cn.fujitsu.com>
> >> Date: Wed, 10 Dec 2008 08:42:20 +0800
> >>
> >>> If outgoing interface is set with SO_BINDTODEVICE and also sticky pktinfo
> >>> the outgoing interface is exactly what SO_BINDTODEVICE set,because in my
> >>> first patch,when set sticy pktinfo,outgoing interface set by SO_BINDTODEVICE
> >>> is checked:
> >>>
> >>> + if(sk->sk_bound_dev_if && pkt.ipi6_ifindex != sk->sk_bound_dev_if)
> >>> + goto e_inval;
> >>>
> >> You may be checking this, but these two values can become out of sync
> >> if the application next makes a SO_BINDTODEVICE setsockopt() call to
> >> change the index setting.
> >>
> >> Nothing makes sure the sticky ipv6 socket information is updated
> >> if that happens. And the most obvious ways to handle that are
> >> very ugly, doing some kind of call into ipv6 from the generic
> >> socket SO_BINDTODEVICE setsockopt() handler.
> >>
> >>
> >
> > Hum..can we just ignore the sync of the sticky option and the SO_BINDTODEVICE,
> > when send a message,first check sk_bound_dev_if,If it is specified,use it,otherwise
> > use sticky option?This was what i ment. and in my patch ,the outgoing interface
> > specified by sticky options will be overrided by the interface specified by
> > SO_BINDTODEVICE.
>
> If this is the solution, i'll post a updated patch.
Please do, this sounds like the correct approach.
^ permalink raw reply [flat|nested] 9+ messages in thread
* Re: [RFC][PATCH 3/3]ipv6:fix the outgoing interface selection order in udpv6_sendmsg()
2008-12-10 9:15 ` David Miller
@ 2008-12-10 9:41 ` Yang Hongyang
2008-12-16 10:09 ` David Miller
0 siblings, 1 reply; 9+ messages in thread
From: Yang Hongyang @ 2008-12-10 9:41 UTC (permalink / raw)
To: David Miller; +Cc: remi.denis-courmont, netdev
David Miller wrote:
> From: Yang Hongyang <yanghy@cn.fujitsu.com>
> Date: Wed, 10 Dec 2008 14:38:25 +0800
>
...snip...
>>>>
>>> Hum..can we just ignore the sync of the sticky option and the SO_BINDTODEVICE,
>>> when send a message,first check sk_bound_dev_if,If it is specified,use it,otherwise
>>> use sticky option?This was what i ment. and in my patch ,the outgoing interface
>>> specified by sticky options will be overrided by the interface specified by
>>> SO_BINDTODEVICE.
>> If this is the solution, i'll post a updated patch.
>
> Please do, this sounds like the correct approach.
>
Thanks for your comment,here is the updated patch:
1.When no interface is specified in an IPV6_PKTINFO ancillary data
item, the interface specified in an IPV6_PKTINFO sticky optionis
is used.
RFC3542:
6.7. Summary of Outgoing Interface Selection
This document and [RFC-3493] specify various methods that affect the
selection of the packet's outgoing interface. This subsection
summarizes the ordering among those in order to ensure deterministic
behavior.
For a given outgoing packet on a given socket, the outgoing interface
is determined in the following order:
1. if an interface is specified in an IPV6_PKTINFO ancillary data
item, the interface is used.
2. otherwise, if an interface is specified in an IPV6_PKTINFO sticky
option, the interface is used.
Signed-off-by: Yang Hongyang<yanghy@cn.fujitsu.com>
---
net/ipv6/udp.c | 3 +++
1 files changed, 3 insertions(+), 0 deletions(-)
diff --git a/net/ipv6/udp.c b/net/ipv6/udp.c
index 8b48512..6b06421 100644
--- a/net/ipv6/udp.c
+++ b/net/ipv6/udp.c
@@ -763,6 +763,9 @@ do_udp_sendmsg:
if (!fl.oif)
fl.oif = sk->sk_bound_dev_if;
+ if (!fl.oif)
+ fl.oif = np->sticky_pktinfo.ipi6_ifindex;
+
if (msg->msg_controllen) {
opt = &opt_space;
memset(opt, 0, sizeof(struct ipv6_txoptions));
--
1.6.0.1
^ permalink raw reply related [flat|nested] 9+ messages in thread
end of thread, other threads:[~2008-12-16 10:09 UTC | newest]
Thread overview: 9+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2008-12-09 7:12 [RFC][PATCH 3/3]ipv6:fix the outgoing interface selection order in udpv6_sendmsg() Yang Hongyang
2008-12-09 7:32 ` Rémi Denis-Courmont
2008-12-10 0:42 ` Yang Hongyang
2008-12-10 6:16 ` David Miller
2008-12-10 6:33 ` Yang Hongyang
2008-12-10 6:38 ` Yang Hongyang
2008-12-10 9:15 ` David Miller
2008-12-10 9:41 ` Yang Hongyang
2008-12-16 10:09 ` David Miller
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).