aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorYOSHIFUJI Hideaki <yoshfuji@linux-ipv6.org>2006-03-20 19:58:32 -0500
committerDavid S. Miller <davem@davemloft.net>2006-03-20 19:58:32 -0500
commit299d9939089126f764090a202f2d6c69934bcf66 (patch)
tree935527062a094537c66a82808e86a806abed4608
parent76f9edd17d90e11ef04d20fe457dd172fe8157a6 (diff)
[IPV6]: ROUTE: Add rt6_alloc_clone() for cloning route allocation.
Signed-off-by: YOSHIFUJI Hideaki <yoshfuji@linux-ipv6.org> Signed-off-by: David S. Miller <davem@davemloft.net>
-rw-r--r--net/ipv6/route.c27
1 files changed, 18 insertions, 9 deletions
diff --git a/net/ipv6/route.c b/net/ipv6/route.c
index 6d506230622a..4a8cb041f075 100644
--- a/net/ipv6/route.c
+++ b/net/ipv6/route.c
@@ -459,6 +459,21 @@ static struct rt6_info *rt6_cow(struct rt6_info *ort, struct in6_addr *daddr,
459 return rt; 459 return rt;
460} 460}
461 461
462static struct rt6_info *rt6_alloc_clone(struct rt6_info *ort, struct in6_addr *daddr)
463{
464 struct rt6_info *rt = ip6_rt_copy(ort);
465 if (rt) {
466 ipv6_addr_copy(&rt->rt6i_dst.addr, daddr);
467 rt->rt6i_dst.plen = 128;
468 rt->rt6i_flags |= RTF_CACHE;
469 if (rt->rt6i_flags & RTF_REJECT)
470 rt->u.dst.error = ort->u.dst.error;
471 rt->u.dst.flags |= DST_HOST;
472 rt->rt6i_nexthop = neigh_clone(ort->rt6i_nexthop);
473 }
474 return rt;
475}
476
462#define BACKTRACK() \ 477#define BACKTRACK() \
463if (rt == &ip6_null_entry && strict) { \ 478if (rt == &ip6_null_entry && strict) { \
464 while ((fn = fn->parent) != NULL) { \ 479 while ((fn = fn->parent) != NULL) { \
@@ -1240,17 +1255,11 @@ void rt6_pmtu_discovery(struct in6_addr *daddr, struct in6_addr *saddr,
1240 1255
1241 ip6_ins_rt(nrt, NULL, NULL, NULL); 1256 ip6_ins_rt(nrt, NULL, NULL, NULL);
1242 } else { 1257 } else {
1243 nrt = ip6_rt_copy(rt); 1258 nrt = rt6_alloc_clone(rt, daddr);
1244 if (nrt == NULL) 1259 if (!nrt)
1245 goto out; 1260 goto out;
1246 ipv6_addr_copy(&nrt->rt6i_dst.addr, daddr);
1247 nrt->rt6i_dst.plen = 128;
1248 nrt->u.dst.flags |= DST_HOST;
1249 nrt->rt6i_nexthop = neigh_clone(rt->rt6i_nexthop);
1250 dst_set_expires(&nrt->u.dst, ip6_rt_mtu_expires); 1261 dst_set_expires(&nrt->u.dst, ip6_rt_mtu_expires);
1251 nrt->rt6i_flags |= RTF_DYNAMIC|RTF_CACHE|RTF_EXPIRES; 1262 nrt->rt6i_flags |= RTF_DYNAMIC|RTF_EXPIRES;
1252 if (nrt->rt6i_flags & RTF_REJECT)
1253 nrt->u.dst.error = rt->u.dst.error;
1254 nrt->u.dst.metrics[RTAX_MTU-1] = pmtu; 1263 nrt->u.dst.metrics[RTAX_MTU-1] = pmtu;
1255 if (allfrag) 1264 if (allfrag)
1256 nrt->u.dst.metrics[RTAX_FEATURES-1] |= RTAX_FEATURE_ALLFRAG; 1265 nrt->u.dst.metrics[RTAX_FEATURES-1] |= RTAX_FEATURE_ALLFRAG;