[hairpin] fix argument of nsenter

We should use:
	nsenter --net=netnsPath -- -F some_command
instend of:
	nsenter -n netnsPath -- -F some_command
Because "nsenter -n netnsPath" get an error output:
	# nsenter -n /proc/67197/ns/net ip addr
	nsenter: neither filename nor target pid supplied for ns/net

If we really want use -n, we need to use -n in such format:
	# sudo nsenter -n/proc/67197/ns/net ip addr
This commit is contained in:
Cao Shufeng 2016-12-05 07:40:29 -05:00
parent 3a5fd6b6c1
commit ab43e2b809

View File

@ -50,7 +50,7 @@ func SetUpContainerPath(netnsPath string, containerInterfaceName string) error {
if netnsPath[0] != '/' {
return fmt.Errorf("netnsPath path '%s' was invalid", netnsPath)
}
nsenterArgs := []string{"-n", netnsPath}
nsenterArgs := []string{"--net=" + netnsPath}
return setUpContainerInternal(containerInterfaceName, netnsPath, nsenterArgs)
}