!34 sync from openeuler

From: @duguhaotian
Reviewed-by: @lifeng2221dd1
Signed-off-by: @lifeng2221dd1
This commit is contained in:
openeuler-ci-bot 2020-11-28 14:31:06 +08:00 committed by Gitee
commit f9277cd7ef
4 changed files with 60 additions and 3 deletions

View File

@ -1,7 +1,7 @@
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
Subject: [PATCH 1/3] ignore proxy envs
do not inherit proxy envs from isulad

View File

@ -1,7 +1,7 @@
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
Subject: [PATCH 2/3] ignore http proxy env for cni plugin
Signed-off-by: haozi007 <liuhao27@huawei.com>
---

View File

@ -0,0 +1,50 @@
From d194158130c6824fa048c07783f470f83ec9d8ae Mon Sep 17 00:00:00 2001
From: haozi007 <liuhao27@huawei.com>
Date: Thu, 26 Nov 2020 15:11:05 +0800
Subject: [PATCH 3/3] fix invalid ipv6 format
Signed-off-by: haozi007 <liuhao27@huawei.com>
---
README.md | 2 +-
src/types/types.c | 12 ++++++++----
2 files changed, 9 insertions(+), 5 deletions(-)
diff --git a/README.md b/README.md
index bcc0368..d52e27e 100644
--- a/README.md
+++ b/README.md
@@ -1,7 +1,7 @@
# clibcni
CNI (Container Network Interface), a Cloud Native Computing Foundation project.
-clibcni is a library used by iSulad to configure network interfaces in containers, following
+clibcni is a library used by [iSulad](https://gitee.com/openeuler/iSulad) to configure network interfaces in containers, following
the specification of CNI (Container Network Interface), a Cloud Native Computing Foundation project.
## How to Contribute
diff --git a/src/types/types.c b/src/types/types.c
index 60a63c3..a9a04e7 100644
--- a/src/types/types.c
+++ b/src/types/types.c
@@ -313,10 +313,14 @@ static void generate_ip_string(const uint8_t *ip, int e0, int e1, char **result)
} else if (i > 0) {
(*result)[j++] = ':';
}
- int nret = (ip[i] >> 4);
- (*result)[j++] = g_HEX_DICT[nret];
- nret = (ip[i] & 0x0f);
- (*result)[j++] = g_HEX_DICT[nret];
+ uint32_t nret = (ip[i] << 8) | ip[i + 1];
+ if (sprintf((*result) + j, "%x", nret) < 0) {
+ ERROR("sprint ip failed");
+ free(*result);
+ *result = NULL;
+ return;
+ }
+ j = strlen(*result);
}
return;
}
--
2.25.1

View File

@ -1,5 +1,5 @@
%global _version 2.0.3
%global _release 20201118.164602.gitdd73f4ba
%global _release 20201128.142102.git866f22d3
Name: clibcni
Version: %{_version}
Release: %{_release}
@ -12,6 +12,7 @@ BuildRoot: %{_tmppath}/%{name}-%{version}
Patch9001: 0001-ignore-proxy-envs.patch
Patch9002: 0002-ignore-http-proxy-env-for-cni-plugin.patch
Patch9003: 0003-fix-invalid-ipv6-format.patch
BuildRequires: gcc
BuildRequires: cmake
@ -88,6 +89,12 @@ rm -rf %{buildroot}
%{_libdir}/pkgconfig/%{name}.pc
%changelog
* Sat Nov 28 2020 haozi007 <liuhao27@huawei.com> - 2.0.3-20201128.142102.git866f22d3
- Type:bugfix
- ID:NA
- SUG:NA
- DESC: fix parse ipv6 format error
* Thu Nov 12 2020 gaohuatao <gaohuatao@huawei.com> - 2.0.3-20201112.165252.gitc4aadda4
- Type:enhancement
- ID:NA