From 3d71f2a66ba50c15e980d9cf632f32d035114ffe Mon Sep 17 00:00:00 2001 From: jikai Date: Tue, 19 Sep 2023 21:00:25 +0800 Subject: [PATCH] report low error of call cni plugin --- ...-report-low-error-of-call-cni-plugin.patch | 41 +++++++++++++++++++ clibcni.spec | 9 +++- 2 files changed, 49 insertions(+), 1 deletion(-) create mode 100644 0003-report-low-error-of-call-cni-plugin.patch diff --git a/0003-report-low-error-of-call-cni-plugin.patch b/0003-report-low-error-of-call-cni-plugin.patch new file mode 100644 index 0000000..bb69ea6 --- /dev/null +++ b/0003-report-low-error-of-call-cni-plugin.patch @@ -0,0 +1,41 @@ +From b9793f6ce73cfa3788461b96081389f24dbd2467 Mon Sep 17 00:00:00 2001 +From: haozi007 +Date: Wed, 13 Sep 2023 11:39:59 +0800 +Subject: [PATCH 3/3] report low error of call cni plugin + +Signed-off-by: haozi007 +--- + src/api.c | 14 +++++++------- + 1 file changed, 7 insertions(+), 7 deletions(-) + +diff --git a/src/api.c b/src/api.c +index 4541496..0897869 100644 +--- a/src/api.c ++++ b/src/api.c +@@ -303,16 +303,16 @@ static void format_invoke_err_msg(const char *name, int save_errno, char **err) + { + const char *invoke_err = get_invoke_err_msg(save_errno); + +- if (asprintf(err, "find plugin: \"%s\" failed: %s", name, invoke_err != NULL ? invoke_err : "") < 0) { +- *err = clibcni_util_strdup_s("Out of memory"); ++ if (invoke_err == NULL) { ++ // if not plugin error, only cause by no found plugin ++ invoke_err = "No such file or directory"; + } + +- if (invoke_err != NULL) { +- ERROR("find plugin: \"%s\" failed: %s", name, invoke_err); +- return; ++ if (asprintf(err, "find plugin: \"%s\" failed: %s", name, invoke_err) < 0) { ++ *err = clibcni_util_strdup_s("Out of memory"); + } +- errno = save_errno; +- SYSERROR("find plugin: \"%s\" failed", name); ++ ++ ERROR("find plugin: \"%s\" failed: %s", name, invoke_err); + } + + static int run_cni_plugin(const struct network_config_list *list, size_t i, const char *operator, +-- +2.34.1 + diff --git a/clibcni.spec b/clibcni.spec index b4a0e93..0ac0546 100644 --- a/clibcni.spec +++ b/clibcni.spec @@ -1,5 +1,5 @@ %global _version 2.0.7 -%global _release 7 +%global _release 8 Name: clibcni Version: %{_version} Release: %{_release} @@ -12,6 +12,7 @@ BuildRoot: %{_tmppath}/%{name}-%{version} Patch0001: 0001-46-Check-empty-pointer-before-referenced.patch Patch0002: 0002-47-remove-unnecessary-strerror.patch +Patch0003: 0003-report-low-error-of-call-cni-plugin.patch %define lcrver_lower 2.0.9-0 %define lcrver_upper 2.0.10-0 @@ -91,6 +92,12 @@ rm -rf %{buildroot} %{_libdir}/pkgconfig/%{name}.pc %changelog +* Tue Sep 19 2023 jikai - 2.0.7-8 +- Type:bugfix +- CVE:NA +- SUG:NA +- DESC:report low error of call cni plugin + * Tue Sep 12 2023 jikai - 2.0.7-7 - Type:bugfix - CVE:NA -- Gitee