diff options
author | Petr Machata <petrm@mellanox.com> | 2018-11-19 19:11:10 +0300 |
---|---|---|
committer | David S. Miller <davem@davemloft.net> | 2018-11-20 04:59:43 +0300 |
commit | d0540d1706c3cfbb51769de02858f846d3836389 (patch) | |
tree | a72eb282261d71add64afe0b0297371f38ca1918 /tools/memory-model/Documentation | |
parent | 601bc1c13916899a14e682ada3dfa3ec21b13318 (diff) | |
download | linux-d0540d1706c3cfbb51769de02858f846d3836389.tar.xz |
selftests: forwarding: lib: Add in_ns()
In order to run a certain command inside another network namespace, it's
possible to use "ip netns exec ns command". However then one can't use
functions defined in lib.sh or a test suite.
One option is to do "ip netns exec ns bash -c command", provided that
all functions that one wishes to use (and their dependencies) are
published using "export -f". That may not be practical.
Therefore, introduce a helper in_ns(), which wraps a given command in a
boilerplate of "ip netns exec" and "source lib.sh", thus making all
library functions available. (Custom functions that a script wishes to
run within a namespace still need to be exported.)
Because quotes in "$@" aren't recognized in heredoc, hand-expand the
array in an explicit for loop, leveraging printf %q to handle proper
quoting.
Signed-off-by: Petr Machata <petrm@mellanox.com>
Signed-off-by: Ido Schimmel <idosch@mellanox.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'tools/memory-model/Documentation')
0 files changed, 0 insertions, 0 deletions