Commit 5e5f3f0f authored by YOSHIFUJI Hideaki's avatar YOSHIFUJI Hideaki

[IPV6] ADDRCONF: Convert ipv6_get_saddr() to ipv6_dev_get_saddr().

Since most users of ipv6_get_saddr() pass non-NULL as
dst argument, use ipv6_dev_get_saddr() directly.
Signed-off-by: default avatarYOSHIFUJI Hideaki <yoshfuji@linux-ipv6.org>
parent 8082c37c
...@@ -73,9 +73,6 @@ extern struct inet6_ifaddr *ipv6_get_ifaddr(struct net *net, ...@@ -73,9 +73,6 @@ extern struct inet6_ifaddr *ipv6_get_ifaddr(struct net *net,
struct net_device *dev, struct net_device *dev,
int strict); int strict);
extern int ipv6_get_saddr(struct dst_entry *dst,
struct in6_addr *daddr,
struct in6_addr *saddr);
extern int ipv6_dev_get_saddr(struct net_device *dev, extern int ipv6_dev_get_saddr(struct net_device *dev,
struct in6_addr *daddr, struct in6_addr *daddr,
struct in6_addr *saddr); struct in6_addr *saddr);
......
...@@ -1167,14 +1167,7 @@ int ipv6_dev_get_saddr(struct net_device *daddr_dev, ...@@ -1167,14 +1167,7 @@ int ipv6_dev_get_saddr(struct net_device *daddr_dev,
return 0; return 0;
} }
EXPORT_SYMBOL(ipv6_dev_get_saddr);
int ipv6_get_saddr(struct dst_entry *dst,
struct in6_addr *daddr, struct in6_addr *saddr)
{
return ipv6_dev_get_saddr(dst ? ip6_dst_idev(dst)->dev : NULL, daddr, saddr);
}
EXPORT_SYMBOL(ipv6_get_saddr);
int ipv6_get_lladdr(struct net_device *dev, struct in6_addr *addr, int ipv6_get_lladdr(struct net_device *dev, struct in6_addr *addr,
unsigned char banned_flags) unsigned char banned_flags)
......
...@@ -85,8 +85,8 @@ static int fib6_rule_action(struct fib_rule *rule, struct flowi *flp, ...@@ -85,8 +85,8 @@ static int fib6_rule_action(struct fib_rule *rule, struct flowi *flp,
if ((rule->flags & FIB_RULE_FIND_SADDR) && if ((rule->flags & FIB_RULE_FIND_SADDR) &&
r->src.plen && !(flags & RT6_LOOKUP_F_HAS_SADDR)) { r->src.plen && !(flags & RT6_LOOKUP_F_HAS_SADDR)) {
struct in6_addr saddr; struct in6_addr saddr;
if (ipv6_get_saddr(&rt->u.dst, &flp->fl6_dst, if (ipv6_dev_get_saddr(ip6_dst_idev(&rt->u.dst)->dev,
&saddr)) &flp->fl6_dst, &saddr))
goto again; goto again;
if (!ipv6_prefix_equal(&saddr, &r->src.addr, if (!ipv6_prefix_equal(&saddr, &r->src.addr,
r->src.plen)) r->src.plen))
......
...@@ -919,7 +919,8 @@ static int ip6_dst_lookup_tail(struct sock *sk, ...@@ -919,7 +919,8 @@ static int ip6_dst_lookup_tail(struct sock *sk,
goto out_err_release; goto out_err_release;
if (ipv6_addr_any(&fl->fl6_src)) { if (ipv6_addr_any(&fl->fl6_src)) {
err = ipv6_get_saddr(*dst, &fl->fl6_dst, &fl->fl6_src); err = ipv6_dev_get_saddr(ip6_dst_idev(*dst)->dev,
&fl->fl6_dst, &fl->fl6_src);
if (err) if (err)
goto out_err_release; goto out_err_release;
} }
......
...@@ -2122,7 +2122,8 @@ static int rt6_fill_node(struct sk_buff *skb, struct rt6_info *rt, ...@@ -2122,7 +2122,8 @@ static int rt6_fill_node(struct sk_buff *skb, struct rt6_info *rt,
NLA_PUT_U32(skb, RTA_IIF, iif); NLA_PUT_U32(skb, RTA_IIF, iif);
else if (dst) { else if (dst) {
struct in6_addr saddr_buf; struct in6_addr saddr_buf;
if (ipv6_get_saddr(&rt->u.dst, dst, &saddr_buf) == 0) if (ipv6_dev_get_saddr(ip6_dst_idev(&rt->u.dst)->dev,
dst, &saddr_buf) == 0)
NLA_PUT(skb, RTA_PREFSRC, 16, &saddr_buf); NLA_PUT(skb, RTA_PREFSRC, 16, &saddr_buf);
} }
......
...@@ -57,8 +57,9 @@ static int xfrm6_get_saddr(xfrm_address_t *saddr, xfrm_address_t *daddr) ...@@ -57,8 +57,9 @@ static int xfrm6_get_saddr(xfrm_address_t *saddr, xfrm_address_t *daddr)
if (IS_ERR(dst)) if (IS_ERR(dst))
return -EHOSTUNREACH; return -EHOSTUNREACH;
ipv6_get_saddr(dst, (struct in6_addr *)&daddr->a6, ipv6_dev_get_saddr(ip6_dst_idev(dst)->dev,
(struct in6_addr *)&saddr->a6); (struct in6_addr *)&daddr->a6,
(struct in6_addr *)&saddr->a6);
dst_release(dst); dst_release(dst);
return 0; return 0;
} }
......
...@@ -313,7 +313,8 @@ static void sctp_v6_get_saddr(struct sctp_association *asoc, ...@@ -313,7 +313,8 @@ static void sctp_v6_get_saddr(struct sctp_association *asoc,
__FUNCTION__, asoc, dst, NIP6(daddr->v6.sin6_addr)); __FUNCTION__, asoc, dst, NIP6(daddr->v6.sin6_addr));
if (!asoc) { if (!asoc) {
ipv6_get_saddr(dst, &daddr->v6.sin6_addr,&saddr->v6.sin6_addr); ipv6_dev_get_saddr(dst ? ip6_dst_idev(dst)->dev : NULL,
&daddr->v6.sin6_addr, &saddr->v6.sin6_addr);
SCTP_DEBUG_PRINTK("saddr from ipv6_get_saddr: " NIP6_FMT "\n", SCTP_DEBUG_PRINTK("saddr from ipv6_get_saddr: " NIP6_FMT "\n",
NIP6(saddr->v6.sin6_addr)); NIP6(saddr->v6.sin6_addr));
return; return;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment