提交 556e6256 编写于 作者: C Cong Wang 提交者: David S. Miller

netpoll: use the net namespace of current process instead of init_net

This will allow us to setup netconsole in a different namespace
rather than where init_net is.

Cc: Eric W. Biederman <ebiederm@xmission.com>
Cc: David S. Miller <davem@davemloft.net>
Signed-off-by: NCong Wang <amwang@redhat.com>
Signed-off-by: NDavid S. Miller <davem@davemloft.net>
上级 faeed828
...@@ -1049,8 +1049,10 @@ int netpoll_setup(struct netpoll *np) ...@@ -1049,8 +1049,10 @@ int netpoll_setup(struct netpoll *np)
int err; int err;
rtnl_lock(); rtnl_lock();
if (np->dev_name) if (np->dev_name) {
ndev = __dev_get_by_name(&init_net, np->dev_name); struct net *net = current->nsproxy->net_ns;
ndev = __dev_get_by_name(net, np->dev_name);
}
if (!ndev) { if (!ndev) {
np_err(np, "%s doesn't exist, aborting\n", np->dev_name); np_err(np, "%s doesn't exist, aborting\n", np->dev_name);
err = -ENODEV; err = -ENODEV;
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册