]> git.ipfire.org Git - thirdparty/iproute2.git/commitdiff
tc: {f,m}_bpf: allow to retrieve uds path from env
authorDaniel Borkmann <daniel@iogearbox.net>
Tue, 2 Jun 2015 21:35:34 +0000 (23:35 +0200)
committerStephen Hemminger <shemming@brocade.com>
Thu, 25 Jun 2015 19:13:16 +0000 (15:13 -0400)
Allow to retrieve uds path from the environment, facilitates
also dealing with export a bit.

Signed-off-by: Daniel Borkmann <daniel@iogearbox.net>
tc/f_bpf.c
tc/m_bpf.c
tc/tc_bpf.h

index 597ef60622d9bc8847eadc29d31949fc0e447788..c21bf33fd25fe2977fd12b950f4d893f3b0e1ec9 100644 (file)
@@ -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();
index 06211578ae7b39d304026f97fc1329480dbc6acd..9ddb6672693cb3a84fdf38fe2080bfed04cf5ffc 100644 (file)
@@ -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();
index 5a697e5cd8350a6d5e6e981a35a76e845200cf2e..2ad881219e68b977b80f3452ae55a8b1d2354b92 100644 (file)
@@ -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);