diff options
author | YOSHIFUJI Hideaki <yoshfuji@linux-ipv6.org> | 2007-11-14 07:56:15 +0100 |
---|---|---|
committer | David S. Miller <davem@davemloft.net> | 2008-01-28 23:53:57 +0100 |
commit | 303065a8545bf7524550bd9564afb48e8a685a2d (patch) | |
tree | 0d5918afb77b1a779b119711eb387bd31756dcc2 | |
parent | [IPV6] ADDRCONF: Rename ipv6_saddr_label() to ipv6_addr_label(). (diff) | |
download | linux-303065a8545bf7524550bd9564afb48e8a685a2d.tar.xz linux-303065a8545bf7524550bd9564afb48e8a685a2d.zip |
[IPV6] ADDRCONF: Allow address selection policy with ifindex.
This patch allows ifindex to be a key for address selection policy table.
Signed-off-by: YOSHIFUJI Hideaki <yoshfuji@linux-ipv6.org>
Signed-off-by: David S. Miller <davem@davemloft.net>
-rw-r--r-- | net/ipv6/addrconf.c | 12 |
1 files changed, 8 insertions, 4 deletions
diff --git a/net/ipv6/addrconf.c b/net/ipv6/addrconf.c index 733374b68d2d..e1e591bfbdca 100644 --- a/net/ipv6/addrconf.c +++ b/net/ipv6/addrconf.c @@ -875,7 +875,8 @@ static inline int ipv6_saddr_preferred(int type) } /* static matching label */ -static inline int ipv6_addr_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 @@ -910,7 +911,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_addr_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)); @@ -1084,12 +1086,14 @@ int ipv6_dev_get_saddr(struct net_device *daddr_dev, /* Rule 6: Prefer matching label */ if (hiscore.rule < 6) { if (ipv6_addr_label(&ifa_result->addr, - hiscore.addr_type) == daddr_label) + hiscore.addr_type, + ifa_result->idev->dev->ifindex) == daddr_label) hiscore.attrs |= IPV6_SADDR_SCORE_LABEL; hiscore.rule++; } if (ipv6_addr_label(&ifa->addr, - score.addr_type) == daddr_label) { + 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; |