diff options
author | Juhee Kang <claudiajkang@gmail.com> | 2021-08-12 18:08:12 +0300 |
---|---|---|
committer | David S. Miller <davem@davemloft.net> | 2021-08-16 13:02:09 +0300 |
commit | 7caeabd726f22e6a6c44c434574fb489986e5baa (patch) | |
tree | 3d3c6d4d3526b02a54edb86e693b4c05e7ac5710 /arch/m68k | |
parent | cbbb7abdd00ed583bec374526967b09d8840e264 (diff) | |
download | linux-7caeabd726f22e6a6c44c434574fb489986e5baa.tar.xz |
samples: pktgen: pass the environment variable of normal user to sudo
All pktgen samples can use the environment variable instead of option
parameters(eg. $DEV is able to use instead of '-i' option).
This is results of running sample as root and user:
// running as root
# DEV=eth0 DEST_IP=10.1.0.1 DST_MAC=00:11:22:33:44:55 ./pktgen_sample01_simple.sh -v -n 1
Running... ctrl^C to stop
// running as normal user
$ DEV=eth0 DEST_IP=10.1.0.1 DST_MAC=00:11:22:33:44:55 ./pktgen_sample01_simple.sh -v -n 1
[...]
ERROR: Please specify output device
This results show the sample doesn't work properly when the sample runs
as normal user. Because the sample is restarted by the function
(root_check_run_with_sudo) to run with sudo. In this process, the
environment variable of normal user doesn't propagate to sudo.
It can be solved by using "-E"(--preserve-env) option of "sudo", which
preserve normal user's existing environment variables. So this commit
adds "-E" option in the function (root_check_run_with_sudo).
Signed-off-by: Juhee Kang <claudiajkang@gmail.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'arch/m68k')
0 files changed, 0 insertions, 0 deletions