sync from openeuler

Signed-off-by: haozi007 <liuhao27@huawei.com>
This commit is contained in:
haozi007 2020-11-06 10:59:46 +08:00
parent fa07d6aab2
commit 06584db0b3
2 changed files with 44 additions and 1 deletions

View File

@ -0,0 +1,41 @@
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] 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

View File

@ -1,5 +1,5 @@
%global _version 2.0.3 %global _version 2.0.3
%global _release 20200904.104745.git413e6757 %global _release 20201106.105935.gitfa07d6aa
Name: clibcni Name: clibcni
Version: %{_version} Version: %{_version}
Release: %{_release} Release: %{_release}
@ -10,6 +10,8 @@ URL: https://gitee.com/openeuler/clibcni
Source0: https://gitee.com/openeuler/clibcni/repository/archive/v%{version}.tar.gz Source0: https://gitee.com/openeuler/clibcni/repository/archive/v%{version}.tar.gz
BuildRoot: %{_tmppath}/%{name}-%{version} BuildRoot: %{_tmppath}/%{name}-%{version}
Patch9000: 0001-ignore-proxy-envs.patch
BuildRequires: gcc BuildRequires: gcc
BuildRequires: cmake BuildRequires: cmake
BuildRequires: lcr-devel yajl-devel BuildRequires: lcr-devel yajl-devel