aboutsummaryrefslogtreecommitdiffstats
path: root/net/ipv6
diff options
context:
space:
mode:
authorThomas Graf <tgraf@suug.ch>2006-08-22 03:00:21 -0400
committerDavid S. Miller <davem@sunset.davemloft.net>2006-09-22 17:55:11 -0400
commite0a1ad73d34fd6dfdb630479400511e9879069c0 (patch)
treeeda7611d42a7184131056e08b0bfb13d18b0e24e /net/ipv6
parente9ce1cd3cf6cf35b21d0ce990f2e738f35907386 (diff)
[IPv6] route: Simplify ip6_del_rt()
Provide a simple ip6_del_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')
-rw-r--r--net/ipv6/addrconf.c6
-rw-r--r--net/ipv6/ndisc.c4
-rw-r--r--net/ipv6/route.c18
3 files changed, 17 insertions, 11 deletions
diff --git a/net/ipv6/addrconf.c b/net/ipv6/addrconf.c
index f1ede9004887..27f2e3309598 100644
--- a/net/ipv6/addrconf.c
+++ b/net/ipv6/addrconf.c
@@ -736,7 +736,7 @@ static void ipv6_del_addr(struct inet6_ifaddr *ifp)
736 736
737 if (rt && ((rt->rt6i_flags & (RTF_GATEWAY | RTF_DEFAULT)) == 0)) { 737 if (rt && ((rt->rt6i_flags & (RTF_GATEWAY | RTF_DEFAULT)) == 0)) {
738 if (onlink == 0) { 738 if (onlink == 0) {
739 ip6_del_rt(rt, NULL, NULL, NULL); 739 ip6_del_rt(rt);
740 rt = NULL; 740 rt = NULL;
741 } else if (!(rt->rt6i_flags & RTF_EXPIRES)) { 741 } else if (!(rt->rt6i_flags & RTF_EXPIRES)) {
742 rt->rt6i_expires = expires; 742 rt->rt6i_expires = expires;
@@ -1662,7 +1662,7 @@ void addrconf_prefix_rcv(struct net_device *dev, u8 *opt, int len)
1662 if (rt && ((rt->rt6i_flags & (RTF_GATEWAY | RTF_DEFAULT)) == 0)) { 1662 if (rt && ((rt->rt6i_flags & (RTF_GATEWAY | RTF_DEFAULT)) == 0)) {
1663 if (rt->rt6i_flags&RTF_EXPIRES) { 1663 if (rt->rt6i_flags&RTF_EXPIRES) {
1664 if (valid_lft == 0) { 1664 if (valid_lft == 0) {
1665 ip6_del_rt(rt, NULL, NULL, NULL); 1665 ip6_del_rt(rt);
1666 rt = NULL; 1666 rt = NULL;
1667 } else { 1667 } else {
1668 rt->rt6i_expires = jiffies + rt_expires; 1668 rt->rt6i_expires = jiffies + rt_expires;
@@ -3557,7 +3557,7 @@ static void __ipv6_ifa_notify(int event, struct inet6_ifaddr *ifp)
3557 addrconf_leave_anycast(ifp); 3557 addrconf_leave_anycast(ifp);
3558 addrconf_leave_solict(ifp->idev, &ifp->addr); 3558 addrconf_leave_solict(ifp->idev, &ifp->addr);
3559 dst_hold(&ifp->rt->u.dst); 3559 dst_hold(&ifp->rt->u.dst);
3560 if (ip6_del_rt(ifp->rt, NULL, NULL, NULL)) 3560 if (ip6_del_rt(ifp->rt))
3561 dst_free(&ifp->rt->u.dst); 3561 dst_free(&ifp->rt->u.dst);
3562 break; 3562 break;
3563 } 3563 }
diff --git a/net/ipv6/ndisc.c b/net/ipv6/ndisc.c
index 5743e8bffefd..419d65163819 100644
--- a/net/ipv6/ndisc.c
+++ b/net/ipv6/ndisc.c
@@ -961,7 +961,7 @@ static void ndisc_recv_na(struct sk_buff *skb)
961 struct rt6_info *rt; 961 struct rt6_info *rt;
962 rt = rt6_get_dflt_router(saddr, dev); 962 rt = rt6_get_dflt_router(saddr, dev);
963 if (rt) 963 if (rt)
964 ip6_del_rt(rt, NULL, NULL, NULL); 964 ip6_del_rt(rt);
965 } 965 }
966 966
967out: 967out:
@@ -1114,7 +1114,7 @@ static void ndisc_router_discovery(struct sk_buff *skb)
1114 1114
1115 if (rt && lifetime == 0) { 1115 if (rt && lifetime == 0) {
1116 neigh_clone(neigh); 1116 neigh_clone(neigh);
1117 ip6_del_rt(rt, NULL, NULL, NULL); 1117 ip6_del_rt(rt);
1118 rt = NULL; 1118 rt = NULL;
1119 } 1119 }
1120 1120
diff --git a/net/ipv6/route.c b/net/ipv6/route.c
index 1aca787ead85..8d511de0db1b 100644
--- a/net/ipv6/route.c
+++ b/net/ipv6/route.c
@@ -457,7 +457,7 @@ int rt6_route_rcv(struct net_device *dev, u8 *opt, int len,
457 rt = rt6_get_route_info(prefix, rinfo->prefix_len, gwaddr, dev->ifindex); 457 rt = rt6_get_route_info(prefix, rinfo->prefix_len, gwaddr, dev->ifindex);
458 458
459 if (rt && !lifetime) { 459 if (rt && !lifetime) {
460 ip6_del_rt(rt, NULL, NULL, NULL); 460 ip6_del_rt(rt);
461 rt = NULL; 461 rt = NULL;
462 } 462 }
463 463
@@ -813,7 +813,7 @@ static struct dst_entry *ip6_negative_advice(struct dst_entry *dst)
813 813
814 if (rt) { 814 if (rt) {
815 if (rt->rt6i_flags & RTF_CACHE) 815 if (rt->rt6i_flags & RTF_CACHE)
816 ip6_del_rt(rt, NULL, NULL, NULL); 816 ip6_del_rt(rt);
817 else 817 else
818 dst_release(dst); 818 dst_release(dst);
819 } 819 }
@@ -1218,7 +1218,8 @@ out:
1218 return err; 1218 return err;
1219} 1219}
1220 1220
1221int ip6_del_rt(struct rt6_info *rt, struct nlmsghdr *nlh, void *_rtattr, struct netlink_skb_parms *req) 1221static int __ip6_del_rt(struct rt6_info *rt, struct nlmsghdr *nlh,
1222 void *_rtattr, struct netlink_skb_parms *req)
1222{ 1223{
1223 int err; 1224 int err;
1224 struct fib6_table *table; 1225 struct fib6_table *table;
@@ -1237,6 +1238,11 @@ int ip6_del_rt(struct rt6_info *rt, struct nlmsghdr *nlh, void *_rtattr, struct
1237 return err; 1238 return err;
1238} 1239}
1239 1240
1241int ip6_del_rt(struct rt6_info *rt)
1242{
1243 return __ip6_del_rt(rt, NULL, NULL, NULL);
1244}
1245
1240static int ip6_route_del(struct in6_rtmsg *rtmsg, struct nlmsghdr *nlh, 1246static int ip6_route_del(struct in6_rtmsg *rtmsg, struct nlmsghdr *nlh,
1241 void *_rtattr, struct netlink_skb_parms *req, 1247 void *_rtattr, struct netlink_skb_parms *req,
1242 u32 table_id) 1248 u32 table_id)
@@ -1271,7 +1277,7 @@ static int ip6_route_del(struct in6_rtmsg *rtmsg, struct nlmsghdr *nlh,
1271 dst_hold(&rt->u.dst); 1277 dst_hold(&rt->u.dst);
1272 read_unlock_bh(&table->tb6_lock); 1278 read_unlock_bh(&table->tb6_lock);
1273 1279
1274 return ip6_del_rt(rt, nlh, _rtattr, req); 1280 return __ip6_del_rt(rt, nlh, _rtattr, req);
1275 } 1281 }
1276 } 1282 }
1277 read_unlock_bh(&table->tb6_lock); 1283 read_unlock_bh(&table->tb6_lock);
@@ -1395,7 +1401,7 @@ restart:
1395 call_netevent_notifiers(NETEVENT_REDIRECT, &netevent); 1401 call_netevent_notifiers(NETEVENT_REDIRECT, &netevent);
1396 1402
1397 if (rt->rt6i_flags&RTF_CACHE) { 1403 if (rt->rt6i_flags&RTF_CACHE) {
1398 ip6_del_rt(rt, NULL, NULL, NULL); 1404 ip6_del_rt(rt);
1399 return; 1405 return;
1400 } 1406 }
1401 1407
@@ -1631,7 +1637,7 @@ restart:
1631 if (rt->rt6i_flags & (RTF_DEFAULT | RTF_ADDRCONF)) { 1637 if (rt->rt6i_flags & (RTF_DEFAULT | RTF_ADDRCONF)) {
1632 dst_hold(&rt->u.dst); 1638 dst_hold(&rt->u.dst);
1633 read_unlock_bh(&table->tb6_lock); 1639 read_unlock_bh(&table->tb6_lock);
1634 ip6_del_rt(rt, NULL, NULL, NULL); 1640 ip6_del_rt(rt);
1635 goto restart; 1641 goto restart;
1636 } 1642 }
1637 } 1643 }