aboutsummaryrefslogtreecommitdiffstats
path: root/net/ipv6/route.c
diff options
context:
space:
mode:
authorThomas Graf <tgraf@suug.ch>2006-08-22 03:00:45 -0400
committerDavid S. Miller <davem@sunset.davemloft.net>2006-09-22 17:55:11 -0400
commit40e22e8f3d4d4f1ff68fb03683f007c53ee8b348 (patch)
treee630e465a8fdd12e674d8a160a695a72cf81ca8d /net/ipv6/route.c
parente0a1ad73d34fd6dfdb630479400511e9879069c0 (diff)
[IPv6] route: Simplify ip6_ins_rt()
Provide a simple ip6_ins_rt() for the majority of users and an alternative for the exception via netlink. Avoids code obfuscation. Signed-off-by: Thomas Graf <tgraf@suug.ch> Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'net/ipv6/route.c')
-rw-r--r--net/ipv6/route.c19
1 files changed, 12 insertions, 7 deletions
diff --git a/net/ipv6/route.c b/net/ipv6/route.c
index 8d511de0db1b..9ec348a72a95 100644
--- a/net/ipv6/route.c
+++ b/net/ipv6/route.c
@@ -546,8 +546,8 @@ struct rt6_info *rt6_lookup(struct in6_addr *daddr, struct in6_addr *saddr,
546 be destroyed. 546 be destroyed.
547 */ 547 */
548 548
549int ip6_ins_rt(struct rt6_info *rt, struct nlmsghdr *nlh, 549static int __ip6_ins_rt(struct rt6_info *rt, struct nlmsghdr *nlh,
550 void *_rtattr, struct netlink_skb_parms *req) 550 void *_rtattr, struct netlink_skb_parms *req)
551{ 551{
552 int err; 552 int err;
553 struct fib6_table *table; 553 struct fib6_table *table;
@@ -560,6 +560,11 @@ int ip6_ins_rt(struct rt6_info *rt, struct nlmsghdr *nlh,
560 return err; 560 return err;
561} 561}
562 562
563int ip6_ins_rt(struct rt6_info *rt)
564{
565 return __ip6_ins_rt(rt, NULL, NULL, NULL);
566}
567
563static struct rt6_info *rt6_alloc_cow(struct rt6_info *ort, struct in6_addr *daddr, 568static struct rt6_info *rt6_alloc_cow(struct rt6_info *ort, struct in6_addr *daddr,
564 struct in6_addr *saddr) 569 struct in6_addr *saddr)
565{ 570{
@@ -657,7 +662,7 @@ restart:
657 662
658 dst_hold(&rt->u.dst); 663 dst_hold(&rt->u.dst);
659 if (nrt) { 664 if (nrt) {
660 err = ip6_ins_rt(nrt, NULL, NULL, NULL); 665 err = ip6_ins_rt(nrt);
661 if (!err) 666 if (!err)
662 goto out2; 667 goto out2;
663 } 668 }
@@ -752,7 +757,7 @@ restart:
752 757
753 dst_hold(&rt->u.dst); 758 dst_hold(&rt->u.dst);
754 if (nrt) { 759 if (nrt) {
755 err = ip6_ins_rt(nrt, NULL, NULL, NULL); 760 err = ip6_ins_rt(nrt);
756 if (!err) 761 if (!err)
757 goto out2; 762 goto out2;
758 } 763 }
@@ -1206,7 +1211,7 @@ install_route:
1206 rt->u.dst.dev = dev; 1211 rt->u.dst.dev = dev;
1207 rt->rt6i_idev = idev; 1212 rt->rt6i_idev = idev;
1208 rt->rt6i_table = table; 1213 rt->rt6i_table = table;
1209 return ip6_ins_rt(rt, nlh, _rtattr, req); 1214 return __ip6_ins_rt(rt, nlh, _rtattr, req);
1210 1215
1211out: 1216out:
1212 if (dev) 1217 if (dev)
@@ -1393,7 +1398,7 @@ restart:
1393 nrt->u.dst.metrics[RTAX_MTU-1] = ipv6_get_mtu(neigh->dev); 1398 nrt->u.dst.metrics[RTAX_MTU-1] = ipv6_get_mtu(neigh->dev);
1394 nrt->u.dst.metrics[RTAX_ADVMSS-1] = ipv6_advmss(dst_mtu(&nrt->u.dst)); 1399 nrt->u.dst.metrics[RTAX_ADVMSS-1] = ipv6_advmss(dst_mtu(&nrt->u.dst));
1395 1400
1396 if (ip6_ins_rt(nrt, NULL, NULL, NULL)) 1401 if (ip6_ins_rt(nrt))
1397 goto out; 1402 goto out;
1398 1403
1399 netevent.old = &rt->u.dst; 1404 netevent.old = &rt->u.dst;
@@ -1483,7 +1488,7 @@ void rt6_pmtu_discovery(struct in6_addr *daddr, struct in6_addr *saddr,
1483 dst_set_expires(&nrt->u.dst, ip6_rt_mtu_expires); 1488 dst_set_expires(&nrt->u.dst, ip6_rt_mtu_expires);
1484 nrt->rt6i_flags |= RTF_DYNAMIC|RTF_EXPIRES; 1489 nrt->rt6i_flags |= RTF_DYNAMIC|RTF_EXPIRES;
1485 1490
1486 ip6_ins_rt(nrt, NULL, NULL, NULL); 1491 ip6_ins_rt(nrt);
1487 } 1492 }
1488out: 1493out:
1489 dst_release(&rt->u.dst); 1494 dst_release(&rt->u.dst);