clibcni/0001-ignore-proxy-envs.patch
haozi007 87fae8c24d fix ignore http proxy envs errors
Signed-off-by: haozi007 <liuhao27@huawei.com>
2020-11-18 16:47:21 +08:00

42 lines
1.2 KiB
Diff

From 6af19b52f4867cfb722425ab702162af0f81d0ab Mon Sep 17 00:00:00 2001
From: haozi007 <liuhao27@huawei.com>
Date: Fri, 4 Sep 2020 09:53:37 +0800
Subject: [PATCH 1/2] ignore proxy envs
do not inherit proxy envs from isulad
Signed-off-by: haozi007 <liuhao27@huawei.com>
---
src/invoke/args.c | 8 ++++++++
1 file changed, 8 insertions(+)
diff --git a/src/invoke/args.c b/src/invoke/args.c
index 96f0b81..f95d444 100644
--- a/src/invoke/args.c
+++ b/src/invoke/args.c
@@ -156,6 +156,9 @@ free_out:
char **as_env(const struct cni_args *cniargs)
{
+#define NO_PROXY_KEY "no_proxy"
+#define HTTP_PROXY_KEY "http_proxy"
+#define HTTPS_PROXY_KEY "https_proxy"
char **result = NULL;
char **pos = NULL;
size_t len = 0;
@@ -188,6 +191,11 @@ char **as_env(const struct cni_args *cniargs)
/* inherit environs of parent */
for (pos = envir; pos != NULL && *pos != NULL && i < len; pos++) {
+ // ignore proxy environs
+ if (strcasecmp(*pos, NO_PROXY_KEY) == 0 || strcasecmp(*pos, HTTP_PROXY_KEY) == 0 ||
+ strcasecmp(*pos, HTTPS_PROXY_KEY) == 0) {
+ continue;
+ }
result[i] = clibcni_util_strdup_s(*pos);
i++;
}
--
2.25.1