diff --git a/bugfix-iproute2-change-proc-to-ipnetnsproc-which-is-private.patch b/bugfix-iproute2-change-proc-to-ipnetnsproc-which-is-private.patch index c640f95..6bb7352 100644 --- a/bugfix-iproute2-change-proc-to-ipnetnsproc-which-is-private.patch +++ b/bugfix-iproute2-change-proc-to-ipnetnsproc-which-is-private.patch @@ -116,20 +116,18 @@ index fc58a04..fedc3db 100644 netns = open(net_path, O_RDONLY); if (netns < 0) { fprintf(stderr, "Cannot open network namespace: %s\n", -@@ -917,9 +972,11 @@ static int netns_add(int argc, char **argv, bool create) +@@ -911,9 +965,9 @@ static int netns_add(int argc, char **argv, bool create) + goto out_delete; + } + +- strcpy(proc_path, "/proc/self/ns/net"); ++ snprintf(proc_path, sizeof(proc_path), "/%s/self/ns/net", get_proc_string()); + } else { +- snprintf(proc_path, sizeof(proc_path), "/proc/%d/ns/net", pid); ++ snprintf(proc_path, sizeof(proc_path), "/%s/%d/ns/net", get_proc_string(), pid); } /* Bind the netns last so I can watch for it */ -- if (mount(proc_path, netns_path, "none", MS_BIND, NULL) < 0) { -+ char pid_net_path[MAXPATHLEN]; -+ snprintf(pid_net_path, sizeof(pid_net_path), "%s/self/ns/net", get_proc_string()); -+ if (mount(pid_net_path, netns_path, "none", MS_BIND, NULL) < 0) { - fprintf(stderr, "Bind %s -> %s failed: %s\n", -- proc_path, netns_path, strerror(errno)); -+ pid_net_path, netns_path, strerror(errno)); - goto out_delete; - } - netns_restore(); -- 1.8.3.1 diff --git a/iproute.spec b/iproute.spec index 8ce16d7..7a6387e 100644 --- a/iproute.spec +++ b/iproute.spec @@ -2,7 +2,7 @@ Name: iproute Version: 6.1.0 Epoch: 1 -Release: 5 +Release: 6 Summary: Linux network configuration utilities License: GPLv2+ and Public Domain URL: https://kernel.org/pub/linux/utils/net/iproute2/ @@ -89,6 +89,12 @@ install -m 0644 lib/libnetlink.a %{buildroot}%{_libdir}/libnetlink.a %{_mandir}/* %changelog +* Sat Feb 25 2023 jiangheng - 1:6.1.0-6 +- Type:bugfix +- ID:NA +- SUG:NA +- DESC:fix ip netns attach failed + * Sat Feb 18 2023 gaoxingwang - 1:6.1.0-5 - Type:bugfix - ID:NA