From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mga11.intel.com (mga11.intel.com [192.55.52.93]) by dpdk.org (Postfix) with ESMTP id 60E93C39A for ; Wed, 17 Jun 2015 05:58:53 +0200 (CEST) Received: from orsmga003.jf.intel.com ([10.7.209.27]) by fmsmga102.fm.intel.com with ESMTP; 16 Jun 2015 20:58:43 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.13,630,1427785200"; d="scan'208";a="589293634" Received: from pgsmsx108.gar.corp.intel.com ([10.221.44.103]) by orsmga003.jf.intel.com with ESMTP; 16 Jun 2015 20:58:41 -0700 Received: from shsmsx103.ccr.corp.intel.com (10.239.4.69) by PGSMSX108.gar.corp.intel.com (10.221.44.103) with Microsoft SMTP Server (TLS) id 14.3.224.2; Wed, 17 Jun 2015 11:58:40 +0800 Received: from shsmsx104.ccr.corp.intel.com ([169.254.5.129]) by SHSMSX103.ccr.corp.intel.com ([169.254.4.46]) with mapi id 14.03.0224.002; Wed, 17 Jun 2015 11:58:39 +0800 From: "Zhang, Helin" To: Wenfeng Liu Thread-Topic: [PATCH] kni: Passing task_pid_vnr(current) to get_net_ns_by_pid() in kni_ioctl_create() Thread-Index: AQHQpyED7TxdXZ0E4EyEmKchsiCJ7J2wEOnw Date: Wed, 17 Jun 2015 03:58:38 +0000 Message-ID: References: <1434341253-3227-1-git-send-email-liuwf@arraynetworks.com.cn> In-Reply-To: <1434341253-3227-1-git-send-email-liuwf@arraynetworks.com.cn> Accept-Language: en-US Content-Language: en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: x-originating-ip: [10.239.127.40] Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 Cc: "dev@dpdk.org" Subject: Re: [dpdk-dev] [PATCH] kni: Passing task_pid_vnr(current) to get_net_ns_by_pid() in kni_ioctl_create() X-BeenThere: dev@dpdk.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: patches and discussions about DPDK List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 17 Jun 2015 03:58:53 -0000 > -----Original Message----- > From: Wenfeng Liu [mailto:liuwf@arraynetworks.com.cn] > Sent: Monday, June 15, 2015 12:08 PM > To: Zhang, Helin; dev@dpdk.org > Subject: [PATCH] kni: Passing task_pid_vnr(current) to get_net_ns_by_pid(= ) in > kni_ioctl_create() >=20 > In containers like docker, current->pid returns current process's global = PID > instead of its own PID under containers's PID namespace, and > get_net_ns_by_pid() suppose to accept a virtual PID under its own namespa= ce, > so we should use task_pid_vnr(current) to get current process's virtual P= ID > instead of current->pid. >=20 > Signed-off-by: Wenfeng Liu > --- > lib/librte_eal/linuxapp/kni/kni_misc.c | 2 +- > 1 file changed, 1 insertion(+), 1 deletion(-) >=20 > diff --git a/lib/librte_eal/linuxapp/kni/kni_misc.c > b/lib/librte_eal/linuxapp/kni/kni_misc.c > index 1935d32..18fb677 100644 > --- a/lib/librte_eal/linuxapp/kni/kni_misc.c > +++ b/lib/librte_eal/linuxapp/kni/kni_misc.c > @@ -359,7 +359,7 @@ kni_ioctl_create(unsigned int ioctl_num, unsigned lon= g > ioctl_param) > return -EBUSY; > } >=20 > - net =3D get_net_ns_by_pid(current->pid); > + net =3D get_net_ns_by_pid(task_pid_vnr(current)); Have you tried it on a very old kernel versions? E.g. 2.6.33 Helin > if (IS_ERR(net)) { > free_netdev(net_dev); > return PTR_ERR(net); > -- > 1.8.3.1