aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorYOSHIFUJI Hideaki <yoshfuji@linux-ipv6.org>2006-03-20 16:55:51 -0800
committerDavid S. Miller <davem@davemloft.net>2006-03-20 16:55:51 -0800
commit95a9a5ba0219a4d4237fb39703bfa58626c6fe72 (patch)
tree005fb501c7561e3028ae7a3865dd2afc16c59fc2
parent[IPV6]: ADDRCONF: Add accept_ra_pinfo sysctl. (diff)
downloadlinux-dev-95a9a5ba0219a4d4237fb39703bfa58626c6fe72.tar.xz
linux-dev-95a9a5ba0219a4d4237fb39703bfa58626c6fe72.zip
[IPV6]: ROUTE: Split up rt6_cow() for future changes.
Signed-off-by: YOSHIFUJI Hideaki <yoshfuji@linux-ipv6.org> Signed-off-by: David S. Miller <davem@davemloft.net>
-rw-r--r--net/ipv6/route.c32
1 files changed, 21 insertions, 11 deletions
diff --git a/net/ipv6/route.c b/net/ipv6/route.c
index e0d3ad02ffb5..e8855706980f 100644
--- a/net/ipv6/route.c
+++ b/net/ipv6/route.c
@@ -401,10 +401,9 @@ int ip6_ins_rt(struct rt6_info *rt, struct nlmsghdr *nlh,
with dst->error set to errno value.
*/
-static struct rt6_info *rt6_cow(struct rt6_info *ort, struct in6_addr *daddr,
- struct in6_addr *saddr, struct netlink_skb_parms *req)
+static struct rt6_info *rt6_alloc_cow(struct rt6_info *ort, struct in6_addr *daddr,
+ struct in6_addr *saddr)
{
- int err;
struct rt6_info *rt;
/*
@@ -435,18 +434,29 @@ static struct rt6_info *rt6_cow(struct rt6_info *ort, struct in6_addr *daddr,
rt->rt6i_nexthop = ndisc_get_neigh(rt->rt6i_dev, &rt->rt6i_gateway);
- dst_hold(&rt->u.dst);
+ }
- err = ip6_ins_rt(rt, NULL, NULL, req);
- if (err == 0)
- return rt;
+ return rt;
+}
- rt->u.dst.error = err;
+static struct rt6_info *rt6_cow(struct rt6_info *ort, struct in6_addr *daddr,
+ struct in6_addr *saddr, struct netlink_skb_parms *req)
+{
+ struct rt6_info *rt = rt6_alloc_cow(ort, daddr, saddr);
+ int err;
- return rt;
+ if (!rt) {
+ dst_hold(&ip6_null_entry.u.dst);
+ return &ip6_null_entry;
}
- dst_hold(&ip6_null_entry.u.dst);
- return &ip6_null_entry;
+
+ dst_hold(&rt->u.dst);
+
+ err = ip6_ins_rt(rt, NULL, NULL, req);
+ if (err)
+ rt->u.dst.error = err;
+
+ return rt;
}
#define BACKTRACK() \