summaryrefslogtreecommitdiffstats
path: root/net/ipv6/route.c
diff options
context:
space:
mode:
authorMartin KaFai Lau <kafai@fb.com>2015-10-15 19:39:57 -0400
committerDavid S. Miller <davem@davemloft.net>2015-10-16 03:39:14 -0400
commitebfa45f0d952e5e7bb30a7f9daaad681de138728 (patch)
treef600bd8f17980fb8c2d3f3b97e5580593daa6789 /net/ipv6/route.c
parent53ca376eec4eb635e2249c8e89093f499e180731 (diff)
ipv6: Move common init code for rt6_info to a new function rt6_info_init()
Introduce rt6_info_init() to do the common init work for 'struct rt6_info' (after calling dst_alloc). It is a prep work to fix the rt6_info init logic in the ip6_blackhole_route(). Signed-off-by: Martin KaFai Lau <kafai@fb.com> Cc: Hannes Frederic Sowa <hannes@stressinduktion.org> Cc: Julian Anastasov <ja@ssi.bg> Cc: Phil Sutter <phil@nwl.cc> Cc: Steffen Klassert <steffen.klassert@secunet.com> Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'net/ipv6/route.c')
-rw-r--r--net/ipv6/route.c17
1 files changed, 11 insertions, 6 deletions
diff --git a/net/ipv6/route.c b/net/ipv6/route.c
index ed04e29a6aa3..4198017a5aa7 100644
--- a/net/ipv6/route.c
+++ b/net/ipv6/route.c
@@ -319,6 +319,15 @@ static const struct rt6_info ip6_blk_hole_entry_template = {
319 319
320#endif 320#endif
321 321
322static void rt6_info_init(struct rt6_info *rt)
323{
324 struct dst_entry *dst = &rt->dst;
325
326 memset(dst + 1, 0, sizeof(*rt) - sizeof(*dst));
327 INIT_LIST_HEAD(&rt->rt6i_siblings);
328 INIT_LIST_HEAD(&rt->rt6i_uncached);
329}
330
322/* allocate dst with ip6_dst_ops */ 331/* allocate dst with ip6_dst_ops */
323static struct rt6_info *__ip6_dst_alloc(struct net *net, 332static struct rt6_info *__ip6_dst_alloc(struct net *net,
324 struct net_device *dev, 333 struct net_device *dev,
@@ -327,13 +336,9 @@ static struct rt6_info *__ip6_dst_alloc(struct net *net,
327 struct rt6_info *rt = dst_alloc(&net->ipv6.ip6_dst_ops, dev, 336 struct rt6_info *rt = dst_alloc(&net->ipv6.ip6_dst_ops, dev,
328 0, DST_OBSOLETE_FORCE_CHK, flags); 337 0, DST_OBSOLETE_FORCE_CHK, flags);
329 338
330 if (rt) { 339 if (rt)
331 struct dst_entry *dst = &rt->dst; 340 rt6_info_init(rt);
332 341
333 memset(dst + 1, 0, sizeof(*rt) - sizeof(*dst));
334 INIT_LIST_HEAD(&rt->rt6i_siblings);
335 INIT_LIST_HEAD(&rt->rt6i_uncached);
336 }
337 return rt; 342 return rt;
338} 343}
339 344