fix ignore http proxy envs errors
Signed-off-by: haozi007 <liuhao27@huawei.com>
This commit is contained in:
parent
dd73f4ba53
commit
87fae8c24d
@ -1,7 +1,7 @@
|
|||||||
From 6af19b52f4867cfb722425ab702162af0f81d0ab Mon Sep 17 00:00:00 2001
|
From 6af19b52f4867cfb722425ab702162af0f81d0ab Mon Sep 17 00:00:00 2001
|
||||||
From: haozi007 <liuhao27@huawei.com>
|
From: haozi007 <liuhao27@huawei.com>
|
||||||
Date: Fri, 4 Sep 2020 09:53:37 +0800
|
Date: Fri, 4 Sep 2020 09:53:37 +0800
|
||||||
Subject: [PATCH] ignore proxy envs
|
Subject: [PATCH 1/2] ignore proxy envs
|
||||||
|
|
||||||
do not inherit proxy envs from isulad
|
do not inherit proxy envs from isulad
|
||||||
|
|
||||||
@ -37,5 +37,5 @@ index 96f0b81..f95d444 100644
|
|||||||
i++;
|
i++;
|
||||||
}
|
}
|
||||||
--
|
--
|
||||||
2.20.1
|
2.25.1
|
||||||
|
|
||||||
|
|||||||
177
0002-ignore-http-proxy-env-for-cni-plugin.patch
Normal file
177
0002-ignore-http-proxy-env-for-cni-plugin.patch
Normal file
@ -0,0 +1,177 @@
|
|||||||
|
From 71d2666525ed064f93693ff182cf8a862220a253 Mon Sep 17 00:00:00 2001
|
||||||
|
From: haozi007 <liuhao27@huawei.com>
|
||||||
|
Date: Wed, 18 Nov 2020 16:22:42 +0800
|
||||||
|
Subject: [PATCH 2/2] ignore http proxy env for cni plugin
|
||||||
|
|
||||||
|
Signed-off-by: haozi007 <liuhao27@huawei.com>
|
||||||
|
---
|
||||||
|
src/api.c | 3 ++-
|
||||||
|
src/api.h | 6 ++++--
|
||||||
|
src/invoke/args.c | 5 +++--
|
||||||
|
src/invoke/exec.c | 3 ++-
|
||||||
|
src/types/current.c | 35 ++++++++++++++++++-----------------
|
||||||
|
src/types/types.h | 8 ++++----
|
||||||
|
src/utils.c | 3 ++-
|
||||||
|
7 files changed, 35 insertions(+), 28 deletions(-)
|
||||||
|
|
||||||
|
diff --git a/src/api.c b/src/api.c
|
||||||
|
index abb3791..97d166d 100644
|
||||||
|
--- a/src/api.c
|
||||||
|
+++ b/src/api.c
|
||||||
|
@@ -704,7 +704,8 @@ int cni_add_network_list(const char *net_list_conf_str, const struct runtime_con
|
||||||
|
return ret;
|
||||||
|
}
|
||||||
|
|
||||||
|
-int cni_add_network(const char *cni_net_conf_str, const struct runtime_conf *rc, char **paths, struct result **add_result,
|
||||||
|
+int cni_add_network(const char *cni_net_conf_str, const struct runtime_conf *rc, char **paths,
|
||||||
|
+ struct result **add_result,
|
||||||
|
char **err)
|
||||||
|
{
|
||||||
|
struct network_config *net = NULL;
|
||||||
|
diff --git a/src/api.h b/src/api.h
|
||||||
|
index 392133a..61e56bb 100644
|
||||||
|
--- a/src/api.h
|
||||||
|
+++ b/src/api.h
|
||||||
|
@@ -58,7 +58,8 @@ struct cni_network_list_conf {
|
||||||
|
int cni_add_network_list(const char *net_list_conf_str, const struct runtime_conf *rc, char **paths,
|
||||||
|
struct result **pret, char **err);
|
||||||
|
|
||||||
|
-int cni_add_network(const char *cni_net_conf_str, const struct runtime_conf *rc, char **paths, struct result **add_result,
|
||||||
|
+int cni_add_network(const char *cni_net_conf_str, const struct runtime_conf *rc, char **paths,
|
||||||
|
+ struct result **add_result,
|
||||||
|
char **err);
|
||||||
|
|
||||||
|
int cni_del_network_list(const char *net_list_conf_str, const struct runtime_conf *rc, char **paths, char **err);
|
||||||
|
@@ -75,7 +76,8 @@ int cni_conflist_from_bytes(const char *bytes, struct cni_network_list_conf **li
|
||||||
|
|
||||||
|
int cni_conflist_from_file(const char *filename, struct cni_network_list_conf **list, char **err);
|
||||||
|
|
||||||
|
-int cni_conflist_from_conf(const struct cni_network_conf *cni_net_conf, struct cni_network_list_conf **cni_net_conf_list,
|
||||||
|
+int cni_conflist_from_conf(const struct cni_network_conf *cni_net_conf,
|
||||||
|
+ struct cni_network_list_conf **cni_net_conf_list,
|
||||||
|
char **err);
|
||||||
|
|
||||||
|
void free_cni_network_conf(struct cni_network_conf *val);
|
||||||
|
diff --git a/src/invoke/args.c b/src/invoke/args.c
|
||||||
|
index f95d444..dae484e 100644
|
||||||
|
--- a/src/invoke/args.c
|
||||||
|
+++ b/src/invoke/args.c
|
||||||
|
@@ -192,8 +192,9 @@ 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) {
|
||||||
|
+ if (strncasecmp(*pos, NO_PROXY_KEY, strlen(NO_PROXY_KEY)) == 0 ||
|
||||||
|
+ strncasecmp(*pos, HTTP_PROXY_KEY, strlen(HTTP_PROXY_KEY)) == 0 ||
|
||||||
|
+ strncasecmp(*pos, HTTPS_PROXY_KEY, strlen(HTTPS_PROXY_KEY)) == 0) {
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
result[i] = clibcni_util_strdup_s(*pos);
|
||||||
|
diff --git a/src/invoke/exec.c b/src/invoke/exec.c
|
||||||
|
index 3ad91b5..becba55 100644
|
||||||
|
--- a/src/invoke/exec.c
|
||||||
|
+++ b/src/invoke/exec.c
|
||||||
|
@@ -159,7 +159,8 @@ out:
|
||||||
|
return ret;
|
||||||
|
}
|
||||||
|
|
||||||
|
-static int do_parse_get_version_errmsg(int exec_ret, const cni_exec_error *e_err, struct plugin_info **result, char **err)
|
||||||
|
+static int do_parse_get_version_errmsg(int exec_ret, const cni_exec_error *e_err, struct plugin_info **result,
|
||||||
|
+ char **err)
|
||||||
|
{
|
||||||
|
char *str_err = NULL;
|
||||||
|
|
||||||
|
diff --git a/src/types/current.c b/src/types/current.c
|
||||||
|
index aa04f4d..da6c750 100644
|
||||||
|
--- a/src/types/current.c
|
||||||
|
+++ b/src/types/current.c
|
||||||
|
@@ -94,26 +94,26 @@ struct result *new_curr_result(const char *json_data, char **err)
|
||||||
|
}
|
||||||
|
|
||||||
|
static struct interface *convert_curr_interface(const cni_network_interface *curr_interface)
|
||||||
|
- {
|
||||||
|
- struct interface *result = NULL;
|
||||||
|
-
|
||||||
|
- if (curr_interface == NULL) {
|
||||||
|
- ERROR("Invalid argument");
|
||||||
|
- return NULL;
|
||||||
|
- }
|
||||||
|
+{
|
||||||
|
+ struct interface *result = NULL;
|
||||||
|
|
||||||
|
- result = clibcni_util_common_calloc_s(sizeof(struct interface));
|
||||||
|
- if (result == NULL) {
|
||||||
|
- ERROR("Out of memory");
|
||||||
|
- return NULL;
|
||||||
|
- }
|
||||||
|
+ if (curr_interface == NULL) {
|
||||||
|
+ ERROR("Invalid argument");
|
||||||
|
+ return NULL;
|
||||||
|
+ }
|
||||||
|
|
||||||
|
- result->name = clibcni_util_strdup_s(curr_interface->name);
|
||||||
|
- result->mac = clibcni_util_strdup_s(curr_interface->mac);
|
||||||
|
- result->sandbox = clibcni_util_strdup_s(curr_interface->sandbox);
|
||||||
|
- return result;
|
||||||
|
+ result = clibcni_util_common_calloc_s(sizeof(struct interface));
|
||||||
|
+ if (result == NULL) {
|
||||||
|
+ ERROR("Out of memory");
|
||||||
|
+ return NULL;
|
||||||
|
}
|
||||||
|
|
||||||
|
+ result->name = clibcni_util_strdup_s(curr_interface->name);
|
||||||
|
+ result->mac = clibcni_util_strdup_s(curr_interface->mac);
|
||||||
|
+ result->sandbox = clibcni_util_strdup_s(curr_interface->sandbox);
|
||||||
|
+ return result;
|
||||||
|
+}
|
||||||
|
+
|
||||||
|
static int do_parse_ipnet(const char *cidr_str, const char *ip_str, uint8_t **ip, size_t *ip_len,
|
||||||
|
struct ipnet **ipnet_val, char **err)
|
||||||
|
{
|
||||||
|
@@ -611,7 +611,8 @@ static bool copy_interfaces_from_result_to_json(const struct result *src, cni_re
|
||||||
|
|
||||||
|
res->interfaces_len = 0;
|
||||||
|
|
||||||
|
- res->interfaces = (cni_network_interface **)clibcni_util_smart_calloc_s(src->interfaces_len, sizeof(cni_network_interface *));
|
||||||
|
+ res->interfaces = (cni_network_interface **)clibcni_util_smart_calloc_s(src->interfaces_len,
|
||||||
|
+ sizeof(cni_network_interface *));
|
||||||
|
if (res->interfaces == NULL) {
|
||||||
|
*err = clibcni_util_strdup_s("Out of memory");
|
||||||
|
ERROR("Out of memory");
|
||||||
|
diff --git a/src/types/types.h b/src/types/types.h
|
||||||
|
index 68d074a..ccf2121 100644
|
||||||
|
--- a/src/types/types.h
|
||||||
|
+++ b/src/types/types.h
|
||||||
|
@@ -28,10 +28,10 @@ extern "C" {
|
||||||
|
|
||||||
|
/* define types for version */
|
||||||
|
struct interface {
|
||||||
|
- char *name;
|
||||||
|
- char *mac;
|
||||||
|
- char *sandbox;
|
||||||
|
- };
|
||||||
|
+ char *name;
|
||||||
|
+ char *mac;
|
||||||
|
+ char *sandbox;
|
||||||
|
+};
|
||||||
|
|
||||||
|
struct ipnet {
|
||||||
|
uint8_t *ip;
|
||||||
|
diff --git a/src/utils.c b/src/utils.c
|
||||||
|
index b64b8bd..4308b62 100644
|
||||||
|
--- a/src/utils.c
|
||||||
|
+++ b/src/utils.c
|
||||||
|
@@ -397,7 +397,8 @@ static inline bool check_do_clibcni_util_safe_uint_args(const char *numstr, cons
|
||||||
|
return (err_str == NULL || err_str == numstr || *err_str != '\0');
|
||||||
|
}
|
||||||
|
|
||||||
|
-static int do_clibcni_util_safe_uint(const char *numstr, const char *err_str, unsigned long long ull, unsigned int *converted)
|
||||||
|
+static int do_clibcni_util_safe_uint(const char *numstr, const char *err_str, unsigned long long ull,
|
||||||
|
+ unsigned int *converted)
|
||||||
|
{
|
||||||
|
if (check_do_clibcni_util_safe_uint_args(numstr, err_str)) {
|
||||||
|
return -EINVAL;
|
||||||
|
--
|
||||||
|
2.25.1
|
||||||
|
|
||||||
@ -1,5 +1,5 @@
|
|||||||
%global _version 2.0.3
|
%global _version 2.0.3
|
||||||
%global _release 20201112.165252.gitc4aadda4
|
%global _release 20201118.164602.gitdd73f4ba
|
||||||
Name: clibcni
|
Name: clibcni
|
||||||
Version: %{_version}
|
Version: %{_version}
|
||||||
Release: %{_release}
|
Release: %{_release}
|
||||||
@ -10,7 +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}
|
||||||
|
|
||||||
Patch9001: 0001-ignore-proxy-envs.patch
|
Patch9001: 0001-ignore-proxy-envs.patch
|
||||||
|
Patch9002: 0002-ignore-http-proxy-env-for-cni-plugin.patch
|
||||||
|
|
||||||
BuildRequires: gcc
|
BuildRequires: gcc
|
||||||
BuildRequires: cmake
|
BuildRequires: cmake
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user