lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20091207134108.GA23087@amd64.fatal.se>
Date:	Mon, 7 Dec 2009 14:41:08 +0100
From:	Andreas Henriksson <andreas@...al.se>
To:	netdev@...r.kernel.org
Cc:	Hideaki YOSHIFUJI <yoshfuji@...ux-ipv6.org>
Subject: [PATCH/RFC] Adding IP(v6) address with scope link creates global
 address

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);
 	}
 
--
To unsubscribe from this list: send the line "unsubscribe netdev" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ