diff options
author | YOSHIFUJI Hideaki <yoshfuji@linux-ipv6.org> | 2007-11-14 01:56:15 -0500 |
---|---|---|
committer | David S. Miller <davem@davemloft.net> | 2008-01-28 17:53:57 -0500 |
commit | 303065a8545bf7524550bd9564afb48e8a685a2d (patch) | |
tree | 0d5918afb77b1a779b119711eb387bd31756dcc2 /net/ipv6/addrconf.c | |
parent | c1ee656ccb3b03304d38f852debccdd1567702e6 (diff) |
[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>
Diffstat (limited to 'net/ipv6/addrconf.c')
-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) | |||
875 | } | 875 | } |
876 | 876 | ||
877 | /* static matching label */ | 877 | /* static matching label */ |
878 | static inline int ipv6_addr_label(const struct in6_addr *addr, int type) | 878 | static inline int ipv6_addr_label(const struct in6_addr *addr, int type, |
879 | int ifindex) | ||
879 | { | 880 | { |
880 | /* | 881 | /* |
881 | * prefix (longest match) label | 882 | * prefix (longest match) label |
@@ -910,7 +911,8 @@ int ipv6_dev_get_saddr(struct net_device *daddr_dev, | |||
910 | struct inet6_ifaddr *ifa_result = NULL; | 911 | struct inet6_ifaddr *ifa_result = NULL; |
911 | int daddr_type = __ipv6_addr_type(daddr); | 912 | int daddr_type = __ipv6_addr_type(daddr); |
912 | int daddr_scope = __ipv6_addr_src_scope(daddr_type); | 913 | int daddr_scope = __ipv6_addr_src_scope(daddr_type); |
913 | u32 daddr_label = ipv6_addr_label(daddr, daddr_type); | 914 | int daddr_ifindex = daddr_dev ? daddr_dev->ifindex : 0; |
915 | u32 daddr_label = ipv6_addr_label(daddr, daddr_type, daddr_ifindex); | ||
914 | struct net_device *dev; | 916 | struct net_device *dev; |
915 | 917 | ||
916 | memset(&hiscore, 0, sizeof(hiscore)); | 918 | memset(&hiscore, 0, sizeof(hiscore)); |
@@ -1084,12 +1086,14 @@ int ipv6_dev_get_saddr(struct net_device *daddr_dev, | |||
1084 | /* Rule 6: Prefer matching label */ | 1086 | /* Rule 6: Prefer matching label */ |
1085 | if (hiscore.rule < 6) { | 1087 | if (hiscore.rule < 6) { |
1086 | if (ipv6_addr_label(&ifa_result->addr, | 1088 | if (ipv6_addr_label(&ifa_result->addr, |
1087 | hiscore.addr_type) == daddr_label) | 1089 | hiscore.addr_type, |
1090 | ifa_result->idev->dev->ifindex) == daddr_label) | ||
1088 | hiscore.attrs |= IPV6_SADDR_SCORE_LABEL; | 1091 | hiscore.attrs |= IPV6_SADDR_SCORE_LABEL; |
1089 | hiscore.rule++; | 1092 | hiscore.rule++; |
1090 | } | 1093 | } |
1091 | if (ipv6_addr_label(&ifa->addr, | 1094 | if (ipv6_addr_label(&ifa->addr, |
1092 | score.addr_type) == daddr_label) { | 1095 | score.addr_type, |
1096 | ifa->idev->dev->ifindex) == daddr_label) { | ||
1093 | score.attrs |= IPV6_SADDR_SCORE_LABEL; | 1097 | score.attrs |= IPV6_SADDR_SCORE_LABEL; |
1094 | if (!(hiscore.attrs & IPV6_SADDR_SCORE_LABEL)) { | 1098 | if (!(hiscore.attrs & IPV6_SADDR_SCORE_LABEL)) { |
1095 | score.rule = 6; | 1099 | score.rule = 6; |