Skip to contentSkip to conversation

kni: Passing virtual PID to get_net_ns_by_pid(), so we can create kni interfaces in containers like docker

PATCH In review Wenfeng Liu 2 participants 2 messages Jun 1, 2015 – Jun 15, 2015

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 kni: Passing virtual PID to get_net_ns_by_pid(), so we can create kni interfaces in containers like docker

---
 lib/librte_eal/linuxapp/kni/kni_misc.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
lib/librte_eal/linuxapp/kni/kni_misc.c +1 -1
index 1935d32..18fb677 100644
@@ -359,7 +359,7 @@ kni_ioctl_create(unsigned int ioctl_num, unsigned long ioctl_param)
 		return -EBUSY;
 	}
 
-	net = get_net_ns_by_pid(current->pid);
+	net = get_net_ns_by_pid(task_pid_vnr(current));
 	if (IS_ERR(net)) {
 		free_netdev(net_dev);
 		return PTR_ERR(net);
Signature · 1 line
1.8.3.1
#1 lore raw

Hi Wenfeng

It would be better to describe why 'current->pid' cannot, while 'task_pid_vnr(current)' can be used in containers.
In addition, the title should be brief, and there should be a commit log for the detailed description.

Thanks,
Helin

Quoted 29 lines

-----Original Message-----
From: dev [mailto:[email protected]] On Behalf Of Wenfeng Liu
Sent: Monday, June 1, 2015 1:43 PM
To: [email protected]
Subject: [dpdk-dev] [PATCH] kni: Passing virtual PID to get_net_ns_by_pid(), so we can create kni interfaces in containers like docker

---
 lib/librte_eal/linuxapp/kni/kni_misc.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
lib/librte_eal/linuxapp/kni/kni_misc.c +1 -1
index 1935d32..18fb677 100644
@@ -359,7 +359,7 @@ kni_ioctl_create(unsigned int ioctl_num, unsigned long
 ioctl_param)
 		return -EBUSY;
 	}
 
-	net = get_net_ns_by_pid(current->pid);
+	net = get_net_ns_by_pid(task_pid_vnr(current));
 	if (IS_ERR(net)) {
 		free_netdev(net_dev);

return PTR_ERR(net);
--
1.8.3.1