* Adding IP(v6) address with scope link creates global address
@ 2009-11-25 13:59 Andreas Henriksson
2009-12-07 13:41 ` [PATCH/RFC] " Andreas Henriksson
0 siblings, 1 reply; 4+ messages in thread
From: Andreas Henriksson @ 2009-11-25 13:59 UTC (permalink / raw)
To: netdev
Hello!
"Jedasothi" reported problems setting scope with iproute on newly added
ipv6 addresses in:
https://bugs.launchpad.net/ubuntu/+source/iproute/+bug/487745
> To reproduce bug run
> ip addr add '::4/64' scope link dev eth0
>
> This results in a line seen with
> ip addr show eth0
> inet6 ::4/64 scope global tentative
>
> The label "global" is seen instead of "link".
This works for me on ipv4 and seems to be only a problem with ipv6.
I think this is a kernel bug. The scope seems to be passed into the
kernel via netlink as specified on the command line.
Looking at the kernel, inet6_rtm_newaddr [1] calls inet6_addr_add [2]
without passing the ifa_scope struct member and then the scope is
generated from the address within the inet6_addr_add function.
It would be nice if someone could verify this and while at it
also whip up a patch and forward to the right person. ;)
[1]: http://lxr.linux.no/#linux+v2.6.31/net/ipv6/addrconf.c#L3263
[2]: http://lxr.linux.no/#linux+v2.6.31/net/ipv6/addrconf.c#L2081
--
Andreas Henriksson
^ permalink raw reply [flat|nested] 4+ messages in thread
* [PATCH/RFC] Adding IP(v6) address with scope link creates global address
2009-11-25 13:59 Adding IP(v6) address with scope link creates global address Andreas Henriksson
@ 2009-12-07 13:41 ` Andreas Henriksson
2009-12-07 17:18 ` Brian Haley
0 siblings, 1 reply; 4+ messages in thread
From: Andreas Henriksson @ 2009-12-07 13:41 UTC (permalink / raw)
To: netdev; +Cc: Hideaki YOSHIFUJI
Hello again!
Replying to myself (see http://www.spinics.net/lists/netdev/msg113943.html)
and attaching an untested patch to see if this sparks more interest.
On Wed, Nov 25, 2009 at 02:59:45PM +0100, Andreas Henriksson wrote:
> "Jedasothi" reported problems setting scope with iproute on newly added
> ipv6 addresses in:
> https://bugs.launchpad.net/ubuntu/+source/iproute/+bug/487745
>
> > To reproduce bug run
> > ip addr add '::4/64' scope link dev eth0
> >
> > This results in a line seen with
> > ip addr show eth0
> > inet6 ::4/64 scope global tentative
> >
> > The label "global" is seen instead of "link".
I'd appreciate if someone could review and test this:
diff --git a/net/ipv6/addrconf.c b/net/ipv6/addrconf.c
index 1fd0a3d..64d6d35 100644
--- a/net/ipv6/addrconf.c
+++ b/net/ipv6/addrconf.c
@@ -2083,13 +2083,12 @@ err_exit:
* Manual configuration of address on an interface
*/
static int inet6_addr_add(struct net *net, int ifindex, struct in6_addr *pfx,
- unsigned int plen, __u8 ifa_flags, __u32 prefered_lft,
- __u32 valid_lft)
+ unsigned int plen, __u8 ifa_flags, int scope,
+ __u32 prefered_lft, __u32 valid_lft)
{
struct inet6_ifaddr *ifp;
struct inet6_dev *idev;
struct net_device *dev;
- int scope;
u32 flags;
clock_t expires;
unsigned long timeout;
@@ -2110,7 +2109,8 @@ static int inet6_addr_add(struct net *net, int ifindex, struct in6_addr *pfx,
if ((idev = addrconf_add_dev(dev)) == NULL)
return -ENOBUFS;
- scope = ipv6_addr_scope(pfx);
+ if (scope == 0)
+ scope = ipv6_addr_scope(pfx);
timeout = addrconf_timeout_fixup(valid_lft, HZ);
if (addrconf_finite_timeout(timeout)) {
@@ -2207,7 +2207,7 @@ int addrconf_add_ifaddr(struct net *net, void __user *arg)
rtnl_lock();
err = inet6_addr_add(net, ireq.ifr6_ifindex, &ireq.ifr6_addr,
- ireq.ifr6_prefixlen, IFA_F_PERMANENT,
+ ireq.ifr6_prefixlen, IFA_F_PERMANENT, 0,
INFINITY_LIFE_TIME, INFINITY_LIFE_TIME);
rtnl_unlock();
return err;
@@ -3328,6 +3328,7 @@ inet6_rtm_newaddr(struct sk_buff *skb, struct nlmsghdr *nlh, void *arg)
*/
return inet6_addr_add(net, ifm->ifa_index, pfx,
ifm->ifa_prefixlen, ifa_flags,
+ ifm->ifa_scope,
preferred_lft, valid_lft);
}
^ permalink raw reply related [flat|nested] 4+ messages in thread
* Re: [PATCH/RFC] Adding IP(v6) address with scope link creates global address
2009-12-07 13:41 ` [PATCH/RFC] " Andreas Henriksson
@ 2009-12-07 17:18 ` Brian Haley
2009-12-07 19:30 ` Andreas Henriksson
0 siblings, 1 reply; 4+ messages in thread
From: Brian Haley @ 2009-12-07 17:18 UTC (permalink / raw)
To: Andreas Henriksson; +Cc: netdev, Hideaki YOSHIFUJI
Hi Andreas,
Andreas Henriksson wrote:
> Hello again!
>
> Replying to myself (see http://www.spinics.net/lists/netdev/msg113943.html)
> and attaching an untested patch to see if this sparks more interest.
>
> On Wed, Nov 25, 2009 at 02:59:45PM +0100, Andreas Henriksson wrote:
>> "Jedasothi" reported problems setting scope with iproute on newly added
>> ipv6 addresses in:
>> https://bugs.launchpad.net/ubuntu/+source/iproute/+bug/487745
>>
>>> To reproduce bug run
>>> ip addr add '::4/64' scope link dev eth0
>>>
>>> This results in a line seen with
>>> ip addr show eth0
>>> inet6 ::4/64 scope global tentative
>>>
>>> The label "global" is seen instead of "link".
>
> I'd appreciate if someone could review and test this:
I tried the patch quickly since I was curious why this is a problem, but
it didn't work exactly right. I could post an update, but I'm not sure
this is the right thing to do - ::4 isn't a link-local address, and other
parts of the network stack (and other systems) aren't going to treat it as
such.
Maybe the submitter can explain exactly how this is breaking something?
Thanks,
-Brian
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [PATCH/RFC] Adding IP(v6) address with scope link creates global address
2009-12-07 17:18 ` Brian Haley
@ 2009-12-07 19:30 ` Andreas Henriksson
0 siblings, 0 replies; 4+ messages in thread
From: Andreas Henriksson @ 2009-12-07 19:30 UTC (permalink / raw)
To: Brian Haley; +Cc: netdev, Hideaki YOSHIFUJI, Jedasothi, Bug 487745
Adding submitter and launchpad bug to CC.
On mån, 2009-12-07 at 12:18 -0500, Brian Haley wrote:
> Hi Andreas,
>
> Andreas Henriksson wrote:
> > Hello again!
> >
> > Replying to myself (see http://www.spinics.net/lists/netdev/msg113943.html)
> > and attaching an untested patch to see if this sparks more interest.
> >
> > On Wed, Nov 25, 2009 at 02:59:45PM +0100, Andreas Henriksson wrote:
> >> "Jedasothi" reported problems setting scope with iproute on newly added
> >> ipv6 addresses in:
> >> https://bugs.launchpad.net/ubuntu/+source/iproute/+bug/487745
> >>
> >>> To reproduce bug run
> >>> ip addr add '::4/64' scope link dev eth0
> >>>
> >>> This results in a line seen with
> >>> ip addr show eth0
> >>> inet6 ::4/64 scope global tentative
> >>>
> >>> The label "global" is seen instead of "link".
> >
> > I'd appreciate if someone could review and test this:
>
> I tried the patch quickly since I was curious why this is a problem, but
> it didn't work exactly right. I could post an update, but I'm not sure
> this is the right thing to do - ::4 isn't a link-local address, and other
> parts of the network stack (and other systems) aren't going to treat it as
> such.
>
> Maybe the submitter can explain exactly how this is breaking something?
>
> Thanks,
>
> -Brian
^ permalink raw reply [flat|nested] 4+ messages in thread
end of thread, other threads:[~2009-12-07 19:28 UTC | newest]
Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2009-11-25 13:59 Adding IP(v6) address with scope link creates global address Andreas Henriksson
2009-12-07 13:41 ` [PATCH/RFC] " Andreas Henriksson
2009-12-07 17:18 ` Brian Haley
2009-12-07 19:30 ` Andreas Henriksson
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).