Commit 021a7627 authored by Hideaki Yoshifuji's avatar Hideaki Yoshifuji Committed by Arnaldo Carvalho de Melo

[IPV6]: dst_alloc() clean-up.

parent 39b69c03
...@@ -59,7 +59,7 @@ extern struct rt6_info *rt6_lookup(struct in6_addr *daddr, ...@@ -59,7 +59,7 @@ extern struct rt6_info *rt6_lookup(struct in6_addr *daddr,
struct in6_addr *saddr, struct in6_addr *saddr,
int oif, int flags); int oif, int flags);
extern struct rt6_info *ndisc_get_dummy_rt(void); extern struct rt6_info *ip6_dst_alloc(void);
/* /*
* support functions for ND * support functions for ND
......
...@@ -427,7 +427,7 @@ static void ndisc_send_na(struct net_device *dev, struct neighbour *neigh, ...@@ -427,7 +427,7 @@ static void ndisc_send_na(struct net_device *dev, struct neighbour *neigh,
len = sizeof(struct icmp6hdr) + sizeof(struct in6_addr); len = sizeof(struct icmp6hdr) + sizeof(struct in6_addr);
rt = ndisc_get_dummy_rt(); rt = ip6_dst_alloc();
if (!rt) if (!rt)
return; return;
...@@ -524,7 +524,7 @@ void ndisc_send_ns(struct net_device *dev, struct neighbour *neigh, ...@@ -524,7 +524,7 @@ void ndisc_send_ns(struct net_device *dev, struct neighbour *neigh,
saddr = &addr_buf; saddr = &addr_buf;
} }
rt = ndisc_get_dummy_rt(); rt = ip6_dst_alloc();
if (!rt) if (!rt)
return; return;
...@@ -595,7 +595,7 @@ void ndisc_send_rs(struct net_device *dev, struct in6_addr *saddr, ...@@ -595,7 +595,7 @@ void ndisc_send_rs(struct net_device *dev, struct in6_addr *saddr,
int len; int len;
int err; int err;
rt = ndisc_get_dummy_rt(); rt = ip6_dst_alloc();
if (!rt) if (!rt)
return; return;
......
...@@ -130,12 +130,17 @@ struct fib6_node ip6_routing_table = { ...@@ -130,12 +130,17 @@ struct fib6_node ip6_routing_table = {
rwlock_t rt6_lock = RW_LOCK_UNLOCKED; rwlock_t rt6_lock = RW_LOCK_UNLOCKED;
/* Dummy rt for ndisc */ /* allocate dst with ip6_dst_ops */
struct rt6_info *ndisc_get_dummy_rt() static __inline__ struct rt6_info *__ip6_dst_alloc(void)
{ {
return dst_alloc(&ip6_dst_ops); return dst_alloc(&ip6_dst_ops);
} }
struct rt6_info *ip6_dst_alloc(void)
{
return __ip6_dst_alloc();
}
/* /*
* Route lookup. Any rt6_lock is implied. * Route lookup. Any rt6_lock is implied.
*/ */
...@@ -640,7 +645,7 @@ int ip6_route_add(struct in6_rtmsg *rtmsg, struct nlmsghdr *nlh) ...@@ -640,7 +645,7 @@ int ip6_route_add(struct in6_rtmsg *rtmsg, struct nlmsghdr *nlh)
if (rtmsg->rtmsg_metric == 0) if (rtmsg->rtmsg_metric == 0)
rtmsg->rtmsg_metric = IP6_RT_PRIO_USER; rtmsg->rtmsg_metric = IP6_RT_PRIO_USER;
rt = dst_alloc(&ip6_dst_ops); rt = __ip6_dst_alloc();
if (rt == NULL) if (rt == NULL)
return -ENOMEM; return -ENOMEM;
...@@ -1035,9 +1040,7 @@ void rt6_pmtu_discovery(struct in6_addr *daddr, struct in6_addr *saddr, ...@@ -1035,9 +1040,7 @@ void rt6_pmtu_discovery(struct in6_addr *daddr, struct in6_addr *saddr,
static struct rt6_info * ip6_rt_copy(struct rt6_info *ort) static struct rt6_info * ip6_rt_copy(struct rt6_info *ort)
{ {
struct rt6_info *rt; struct rt6_info *rt = __ip6_dst_alloc();
rt = dst_alloc(&ip6_dst_ops);
if (rt) { if (rt) {
rt->u.dst.input = ort->u.dst.input; rt->u.dst.input = ort->u.dst.input;
...@@ -1181,9 +1184,8 @@ int ip6_pkt_discard(struct sk_buff *skb) ...@@ -1181,9 +1184,8 @@ int ip6_pkt_discard(struct sk_buff *skb)
int ip6_rt_addr_add(struct in6_addr *addr, struct net_device *dev) int ip6_rt_addr_add(struct in6_addr *addr, struct net_device *dev)
{ {
struct rt6_info *rt; struct rt6_info *rt = __ip6_dst_alloc();
rt = dst_alloc(&ip6_dst_ops);
if (rt == NULL) if (rt == NULL)
return -ENOMEM; return -ENOMEM;
......
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