netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [RFC 1/2] [IPV6] ADDRCONF: Preparation for configurable address selection policy with ifindex.
@ 2007-10-30  5:52 YOSHIFUJI Hideaki / 吉藤英明
  2007-10-30  7:42 ` David Miller
  2007-10-30  8:04 ` Krishna Kumar2
  0 siblings, 2 replies; 3+ messages in thread
From: YOSHIFUJI Hideaki / 吉藤英明 @ 2007-10-30  5:52 UTC (permalink / raw)
  To: netdev

Signed-off-by: YOSHIFUJI Hideaki <yoshfuji@linux-ipv6.org>
---
 net/ipv6/addrconf.c |   14 ++++++++++----
 1 files changed, 10 insertions(+), 4 deletions(-)

diff --git a/net/ipv6/addrconf.c b/net/ipv6/addrconf.c
index 348bd8d..8b408b7 100644
--- a/net/ipv6/addrconf.c
+++ b/net/ipv6/addrconf.c
@@ -877,7 +877,8 @@ static inline int ipv6_saddr_preferred(int type)
 }
 
 /* static matching label */
-static inline int ipv6_saddr_label(const struct in6_addr *addr, int type)
+static inline int ipv6_addr_label(const struct in6_addr *addr, int type,
+				  int ifindex)
 {
  /*
   * 	prefix (longest match)	label
@@ -912,7 +913,8 @@ int ipv6_dev_get_saddr(struct net_device *daddr_dev,
 	struct inet6_ifaddr *ifa_result = NULL;
 	int daddr_type = __ipv6_addr_type(daddr);
 	int daddr_scope = __ipv6_addr_src_scope(daddr_type);
-	u32 daddr_label = ipv6_saddr_label(daddr, daddr_type);
+	int daddr_ifindex = daddr_dev ? daddr_dev->ifindex : 0;
+	u32 daddr_label = ipv6_addr_label(daddr, daddr_type, daddr_ifindex);
 	struct net_device *dev;
 
 	memset(&hiscore, 0, sizeof(hiscore));
@@ -1085,11 +1087,15 @@ int ipv6_dev_get_saddr(struct net_device *daddr_dev,
 
 			/* Rule 6: Prefer matching label */
 			if (hiscore.rule < 6) {
-				if (ipv6_saddr_label(&ifa_result->addr, hiscore.addr_type) == daddr_label)
+				if (ipv6_addr_label(&ifa_result->addr,
+						    hiscore.addr_type,
+						    ifa_result->idev->dev->ifindex) == daddr_label)
 					hiscore.attrs |= IPV6_SADDR_SCORE_LABEL;
 				hiscore.rule++;
 			}
-			if (ipv6_saddr_label(&ifa->addr, score.addr_type) == daddr_label) {
+			if (ipv6_addr_label(&ifa->addr,
+					    score.addr_type,
+					    ifa->idev->dev->ifindex) == daddr_label) {
 				score.attrs |= IPV6_SADDR_SCORE_LABEL;
 				if (!(hiscore.attrs & IPV6_SADDR_SCORE_LABEL)) {
 					score.rule = 6;
-- 
1.4.4.4


^ permalink raw reply related	[flat|nested] 3+ messages in thread

* Re: [RFC 1/2] [IPV6] ADDRCONF: Preparation for configurable address selection policy with ifindex.
  2007-10-30  5:52 [RFC 1/2] [IPV6] ADDRCONF: Preparation for configurable address selection policy with ifindex YOSHIFUJI Hideaki / 吉藤英明
@ 2007-10-30  7:42 ` David Miller
  2007-10-30  8:04 ` Krishna Kumar2
  1 sibling, 0 replies; 3+ messages in thread
From: David Miller @ 2007-10-30  7:42 UTC (permalink / raw)
  To: yoshfuji; +Cc: netdev

From: YOSHIFUJI Hideaki / 吉藤英明 <yoshfuji@linux-ipv6.org>
Date: Tue, 30 Oct 2007 14:52:37 +0900 (JST)

> Signed-off-by: YOSHIFUJI Hideaki <yoshfuji@linux-ipv6.org>

What is the substance of this change?  Please add a description of
this to the changelog entry as currently the description is far too
brief and vague.

Even saying simply that the change allows the interface index
to be passed into the address selection routines would be
a great improvement.

Thank you.

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [RFC 1/2] [IPV6] ADDRCONF: Preparation for configurable address selection policy with ifindex.
  2007-10-30  5:52 [RFC 1/2] [IPV6] ADDRCONF: Preparation for configurable address selection policy with ifindex YOSHIFUJI Hideaki / 吉藤英明
  2007-10-30  7:42 ` David Miller
@ 2007-10-30  8:04 ` Krishna Kumar2
  1 sibling, 0 replies; 3+ messages in thread
From: Krishna Kumar2 @ 2007-10-30  8:04 UTC (permalink / raw)
  To: YOSHIFUJI Hideaki / 吉藤英明; +Cc: netdev

Hi Yoshifuji,

YOSHIFUJI Hideaki wrote on 10/30/2007 11:22:37 AM:

> -static inline int ipv6_saddr_label(const struct in6_addr *addr, int
type)
> +static inline int ipv6_addr_label(const struct in6_addr *addr, int type,
> +                                                int ifindex)

This function doesn't use this new argument passed to it. Did you perhaps
intend to use it to
initializing daddr_index?

> +   int daddr_ifindex = daddr_dev ? daddr_dev->ifindex : 0;

Thanks,

- KK


^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2007-10-30  8:49 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2007-10-30  5:52 [RFC 1/2] [IPV6] ADDRCONF: Preparation for configurable address selection policy with ifindex YOSHIFUJI Hideaki / 吉藤英明
2007-10-30  7:42 ` David Miller
2007-10-30  8:04 ` Krishna Kumar2

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).