summaryrefslogtreecommitdiffstats
path: root/source/n/NetworkManager/patches
diff options
context:
space:
mode:
Diffstat (limited to 'source/n/NetworkManager/patches')
-rw-r--r--source/n/NetworkManager/patches/dhcpcd.graceful.exit.patch88
1 files changed, 88 insertions, 0 deletions
diff --git a/source/n/NetworkManager/patches/dhcpcd.graceful.exit.patch b/source/n/NetworkManager/patches/dhcpcd.graceful.exit.patch
new file mode 100644
index 000000000..6abc3e468
--- /dev/null
+++ b/source/n/NetworkManager/patches/dhcpcd.graceful.exit.patch
@@ -0,0 +1,88 @@
+--- ./src/core/dhcp/nm-dhcp-client.h.orig 2024-02-22 00:44:13.335158315 -0600
++++ ./src/core/dhcp/nm-dhcp-client.h 2024-02-22 19:41:56.134066083 -0600
+@@ -249,7 +249,7 @@
+ /* Backend helpers for subclasses */
+ void nm_dhcp_client_stop_existing(const char *pid_file, const char *binary_name);
+
+-void nm_dhcp_client_stop_pid(pid_t pid, const char *iface);
++void nm_dhcp_client_stop_pid(pid_t pid, const char *iface, int sig);
+
+ void nm_dhcp_client_start_timeout(NMDhcpClient *self);
+
+--- ./src/core/dhcp/nm-dhcp-dhcpcd.c.orig 2024-02-22 19:41:56.134066083 -0600
++++ ./src/core/dhcp/nm-dhcp-dhcpcd.c 2024-02-22 19:47:18.556073296 -0600
+@@ -158,31 +158,17 @@
+ {
+ NMDhcpDhcpcd *self = NM_DHCP_DHCPCD(client);
+ pid_t pid;
+- int sig, errsv;
++ int sig;
+
+ pid = nm_dhcp_client_get_pid(client);
+ if (pid > 1) {
+ sig = release ? SIGALRM : SIGTERM;
+ _LOGD("sending %s to dhcpcd pid %d", sig == SIGALRM ? "SIGALRM" : "SIGTERM", pid);
+
+- /* dhcpcd-9.x features privilege separation.
+- * It's not our job to track all these processes so we rely on dhcpcd
+- * to always cleanup after itself.
+- * Because it also re-parents itself to PID 1, the process cannot be
+- * reaped or waited for.
+- * As such, just send the correct signal.
+- */
+- if (kill(pid, sig) == -1) {
+- errsv = errno;
+- _LOGE("failed to kill dhcpcd %d:%s", errsv, nm_strerror_native(errsv));
+- }
+-
+- /* When this function exits NM expects the PID to be -1.
+- * This means we also need to stop watching the pid.
+- * If we need to know the exit status then we need to refactor NM
+- * to allow a non -1 to mean we're waiting to exit still.
+- */
++ /* We need to remove the watch before stopping the process */
+ nm_dhcp_client_stop_watch_child(client, pid);
++
++ nm_dhcp_client_stop_pid(pid, nm_dhcp_client_get_iface(client), sig);
+ }
+ }
+
+--- ./src/core/dhcp/nm-dhcp-dhclient.c.orig 2024-02-22 00:44:13.335158315 -0600
++++ ./src/core/dhcp/nm-dhcp-dhclient.c 2024-02-22 19:41:56.134066083 -0600
+@@ -622,7 +622,7 @@
+
+ if (dhclient_start(client, FALSE, TRUE, FALSE, &rpid, NULL)) {
+ /* Wait a few seconds for the release to happen */
+- nm_dhcp_client_stop_pid(rpid, nm_dhcp_client_get_iface(client));
++ nm_dhcp_client_stop_pid(rpid, nm_dhcp_client_get_iface(client), SIGTERM);
+ }
+ }
+ }
+--- ./src/core/dhcp/nm-dhcp-client.c.orig 2024-02-22 00:44:13.334158313 -0600
++++ ./src/core/dhcp/nm-dhcp-client.c 2024-02-22 19:41:56.134066083 -0600
+@@ -367,14 +367,14 @@
+ }
+
+ void
+-nm_dhcp_client_stop_pid(pid_t pid, const char *iface)
++nm_dhcp_client_stop_pid(pid_t pid, const char *iface, int sig)
+ {
+ char *name = iface ? g_strdup_printf("dhcp-client-%s", iface) : NULL;
+
+ g_return_if_fail(pid > 1);
+
+ nm_utils_kill_child_sync(pid,
+- SIGTERM,
++ sig,
+ LOGD_DHCP,
+ name ?: "dhcp-client",
+ NULL,
+@@ -395,7 +395,7 @@
+ if (priv->pid > 0) {
+ /* Clean up the watch handler since we're explicitly killing the daemon */
+ watch_cleanup(self);
+- nm_dhcp_client_stop_pid(priv->pid, priv->config.iface);
++ nm_dhcp_client_stop_pid(priv->pid, priv->config.iface, SIGTERM);
+ }
+ priv->pid = -1;
+ }