system-common-macros: Allow quotes in NS_EXEC().
authorJoe Stringer <joestringer@nicira.com>
Wed, 12 Aug 2015 21:01:26 +0000 (14:01 -0700)
committerJoe Stringer <joestringer@nicira.com>
Wed, 19 Aug 2015 18:58:51 +0000 (11:58 -0700)
This allows arbitrary commands to be passed into the NS_EXEC macro to be
executed within a namespace, including commands that have quotes and
commands chained together.

Signed-off-by: Joe Stringer <joestringer@nicira.com>
Acked-by: Daniele Di Proietto <diproiettod@vmware.com>
tests/system-common-macros.at

index 1321e58..293aed7 100644 (file)
@@ -25,8 +25,9 @@ m4_define([ADD_NAMESPACES],
 #
 # Execute 'command' in 'namespace'
 m4_define([NS_EXEC],
-    [ip netns exec $1 bash -c "$2"]
-)
+    [ip netns exec $1 sh << NS_EXEC_HEREDOC
+$2
+NS_EXEC_HEREDOC])
 
 # NS_CHECK_EXEC([namespace], [command], other_params...)
 #