Commit 88eea539 authored by Daniel Borkmann's avatar Daniel Borkmann Committed by Stephen Hemminger

tc: {f,m}_bpf: allow to retrieve uds path from env

Allow to retrieve uds path from the environment, facilitates
also dealing with export a bit.
Signed-off-by: default avatarDaniel Borkmann <daniel@iogearbox.net>
parent 473d7840
......@@ -122,6 +122,7 @@ opt_bpf:
NEXT_ARG();
if (ebpf) {
bpf_uds_name = secure_getenv(BPF_ENV_UDS);
bpf_obj = *argv;
NEXT_ARG();
......@@ -131,8 +132,9 @@ opt_bpf:
bpf_sec_name = *argv;
NEXT_ARG();
}
if (strcmp(*argv, "export") == 0 ||
strcmp(*argv, "exp") == 0) {
if (!bpf_uds_name &&
(strcmp(*argv, "export") == 0 ||
strcmp(*argv, "exp") == 0)) {
NEXT_ARG();
bpf_uds_name = *argv;
NEXT_ARG();
......
......@@ -105,6 +105,7 @@ opt_bpf:
NEXT_ARG();
if (ebpf) {
bpf_uds_name = secure_getenv(BPF_ENV_UDS);
bpf_obj = *argv;
NEXT_ARG();
......@@ -114,8 +115,9 @@ opt_bpf:
bpf_sec_name = *argv;
NEXT_ARG();
}
if (strcmp(*argv, "export") == 0 ||
strcmp(*argv, "exp") == 0) {
if (!bpf_uds_name &&
(strcmp(*argv, "export") == 0 ||
strcmp(*argv, "exp") == 0)) {
NEXT_ARG();
bpf_uds_name = *argv;
NEXT_ARG();
......
......@@ -25,6 +25,8 @@
#include "utils.h"
#include "bpf_scm.h"
#define BPF_ENV_UDS "TC_BPF_UDS"
int bpf_parse_string(char *arg, bool from_file, __u16 *bpf_len,
char **bpf_string, bool *need_release,
const char separator);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment