提交 c2f17e82 编写于 作者: H Hannes Frederic Sowa 提交者: David S. Miller

ipv6: probe routes asynchronous in rt6_probe

Routes need to be probed asynchronous otherwise the call stack gets
exhausted when the kernel attemps to deliver another skb inline, like
e.g. xt_TEE does, and we probe at the same time.

We update neigh->updated still at once, otherwise we would send to
many probes.

Cc: Julian Anastasov <ja@ssi.bg>
Signed-off-by: NHannes Frederic Sowa <hannes@stressinduktion.org>
Signed-off-by: NDavid S. Miller <davem@davemloft.net>
上级 3a70417c
...@@ -476,6 +476,24 @@ static inline struct rt6_info *rt6_device_match(struct net *net, ...@@ -476,6 +476,24 @@ static inline struct rt6_info *rt6_device_match(struct net *net,
} }
#ifdef CONFIG_IPV6_ROUTER_PREF #ifdef CONFIG_IPV6_ROUTER_PREF
struct __rt6_probe_work {
struct work_struct work;
struct in6_addr target;
struct net_device *dev;
};
static void rt6_probe_deferred(struct work_struct *w)
{
struct in6_addr mcaddr;
struct __rt6_probe_work *work =
container_of(w, struct __rt6_probe_work, work);
addrconf_addr_solict_mult(&work->target, &mcaddr);
ndisc_send_ns(work->dev, NULL, &work->target, &mcaddr, NULL);
dev_put(work->dev);
kfree(w);
}
static void rt6_probe(struct rt6_info *rt) static void rt6_probe(struct rt6_info *rt)
{ {
struct neighbour *neigh; struct neighbour *neigh;
...@@ -499,17 +517,23 @@ static void rt6_probe(struct rt6_info *rt) ...@@ -499,17 +517,23 @@ static void rt6_probe(struct rt6_info *rt)
if (!neigh || if (!neigh ||
time_after(jiffies, neigh->updated + rt->rt6i_idev->cnf.rtr_probe_interval)) { time_after(jiffies, neigh->updated + rt->rt6i_idev->cnf.rtr_probe_interval)) {
struct in6_addr mcaddr; struct __rt6_probe_work *work;
struct in6_addr *target;
work = kmalloc(sizeof(*work), GFP_ATOMIC);
if (neigh) { if (neigh && work)
neigh->updated = jiffies; neigh->updated = jiffies;
if (neigh)
write_unlock(&neigh->lock); write_unlock(&neigh->lock);
}
target = (struct in6_addr *)&rt->rt6i_gateway; if (work) {
addrconf_addr_solict_mult(target, &mcaddr); INIT_WORK(&work->work, rt6_probe_deferred);
ndisc_send_ns(rt->dst.dev, NULL, target, &mcaddr, NULL); work->target = rt->rt6i_gateway;
dev_hold(rt->dst.dev);
work->dev = rt->dst.dev;
schedule_work(&work->work);
}
} else { } else {
out: out:
write_unlock(&neigh->lock); write_unlock(&neigh->lock);
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册