diff options
| author | Hideaki Yoshifuji <yoshfuji@linux-ipv6.org> | 2003-04-22 09:57:57 -0700 |
|---|---|---|
| committer | Arnaldo Carvalho de Melo <acme@conectiva.com.br> | 2003-04-22 09:57:57 -0700 |
| commit | 021a762730fa8cbd67d2840356c881795067b184 (patch) | |
| tree | 14e741f55eea3398b3485fee5bc2f4d55e550cc5 | |
| parent | 39b69c03b3f9e243b3002473c9698715574e7ce8 (diff) | |
[IPV6]: dst_alloc() clean-up.
| -rw-r--r-- | include/net/ip6_route.h | 2 | ||||
| -rw-r--r-- | net/ipv6/ndisc.c | 6 | ||||
| -rw-r--r-- | net/ipv6/route.c | 18 |
3 files changed, 14 insertions, 12 deletions
diff --git a/include/net/ip6_route.h b/include/net/ip6_route.h index 1a5c99c5afa2..1af054ea6385 100644 --- a/include/net/ip6_route.h +++ b/include/net/ip6_route.h @@ -59,7 +59,7 @@ extern struct rt6_info *rt6_lookup(struct in6_addr *daddr, struct in6_addr *saddr, 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 diff --git a/net/ipv6/ndisc.c b/net/ipv6/ndisc.c index c5b38160717d..7688f0ce1e5b 100644 --- a/net/ipv6/ndisc.c +++ b/net/ipv6/ndisc.c @@ -427,7 +427,7 @@ static void ndisc_send_na(struct net_device *dev, struct neighbour *neigh, len = sizeof(struct icmp6hdr) + sizeof(struct in6_addr); - rt = ndisc_get_dummy_rt(); + rt = ip6_dst_alloc(); if (!rt) return; @@ -524,7 +524,7 @@ void ndisc_send_ns(struct net_device *dev, struct neighbour *neigh, saddr = &addr_buf; } - rt = ndisc_get_dummy_rt(); + rt = ip6_dst_alloc(); if (!rt) return; @@ -595,7 +595,7 @@ void ndisc_send_rs(struct net_device *dev, struct in6_addr *saddr, int len; int err; - rt = ndisc_get_dummy_rt(); + rt = ip6_dst_alloc(); if (!rt) return; diff --git a/net/ipv6/route.c b/net/ipv6/route.c index c855580c278a..67eae08db2ca 100644 --- a/net/ipv6/route.c +++ b/net/ipv6/route.c @@ -130,12 +130,17 @@ struct fib6_node ip6_routing_table = { rwlock_t rt6_lock = RW_LOCK_UNLOCKED; -/* Dummy rt for ndisc */ -struct rt6_info *ndisc_get_dummy_rt() +/* allocate dst with ip6_dst_ops */ +static __inline__ struct rt6_info *__ip6_dst_alloc(void) { return dst_alloc(&ip6_dst_ops); } +struct rt6_info *ip6_dst_alloc(void) +{ + return __ip6_dst_alloc(); +} + /* * Route lookup. Any rt6_lock is implied. */ @@ -640,7 +645,7 @@ int ip6_route_add(struct in6_rtmsg *rtmsg, struct nlmsghdr *nlh) if (rtmsg->rtmsg_metric == 0) rtmsg->rtmsg_metric = IP6_RT_PRIO_USER; - rt = dst_alloc(&ip6_dst_ops); + rt = __ip6_dst_alloc(); if (rt == NULL) return -ENOMEM; @@ -1035,9 +1040,7 @@ out: static struct rt6_info * ip6_rt_copy(struct rt6_info *ort) { - struct rt6_info *rt; - - rt = dst_alloc(&ip6_dst_ops); + struct rt6_info *rt = __ip6_dst_alloc(); if (rt) { rt->u.dst.input = ort->u.dst.input; @@ -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) { - struct rt6_info *rt; + struct rt6_info *rt = __ip6_dst_alloc(); - rt = dst_alloc(&ip6_dst_ops); if (rt == NULL) return -ENOMEM; |
