diff options
author | Amerigo Wang <amwang@redhat.com> | 2012-10-28 20:13:19 -0400 |
---|---|---|
committer | David S. Miller <davem@davemloft.net> | 2012-11-03 14:59:05 -0400 |
commit | 94e187c01512c9cf29e2ff54bf1a1b045f38293d (patch) | |
tree | 2149f4652fb0fc997ce5728f9574e1ab5351f0e5 /include/net/ip6_fib.h | |
parent | 6da025fa23bb10c82f80de319c837ed2b02306e4 (diff) |
ipv6: introduce ip6_rt_put()
As suggested by Eric, we could introduce a helper function
for ipv6 too, to avoid checking if rt is NULL before
dst_release().
Cc: Eric Dumazet <eric.dumazet@gmail.com>
Cc: David S. Miller <davem@davemloft.net>
Signed-off-by: Cong Wang <amwang@redhat.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'include/net/ip6_fib.h')
-rw-r--r-- | include/net/ip6_fib.h | 9 |
1 files changed, 9 insertions, 0 deletions
diff --git a/include/net/ip6_fib.h b/include/net/ip6_fib.h index 20210d79e36a..d1327e4d126b 100644 --- a/include/net/ip6_fib.h +++ b/include/net/ip6_fib.h | |||
@@ -213,6 +213,15 @@ static inline void rt6_set_from(struct rt6_info *rt, struct rt6_info *from) | |||
213 | dst_hold(new); | 213 | dst_hold(new); |
214 | } | 214 | } |
215 | 215 | ||
216 | static inline void ip6_rt_put(struct rt6_info *rt) | ||
217 | { | ||
218 | /* dst_release() accepts a NULL parameter. | ||
219 | * We rely on dst being first structure in struct rt6_info | ||
220 | */ | ||
221 | BUILD_BUG_ON(offsetof(struct rt6_info, dst) != 0); | ||
222 | dst_release(&rt->dst); | ||
223 | } | ||
224 | |||
216 | struct fib6_walker_t { | 225 | struct fib6_walker_t { |
217 | struct list_head lh; | 226 | struct list_head lh; |
218 | struct fib6_node *root, *node; | 227 | struct fib6_node *root, *node; |