patch 'app/dumpcap: handle SIGTERM and SIGHUP' has been queued to stable release 23.11.2

Xueming Li xuemingl at nvidia.com
Mon Aug 12 14:50:17 CEST 2024


Hi,

FYI, your patch has been queued to stable release 23.11.2

Note it hasn't been pushed to http://dpdk.org/browse/dpdk-stable yet.
It will be pushed if I get no objections before 08/14/24. So please
shout if anyone has objections.

Also note that after the patch there's a diff of the upstream commit vs the
patch applied to the branch. This will indicate if there was any rebasing
needed to apply to the stable branch. If there were code changes for rebasing
(ie: not only metadata diffs), please double check that the rebase was
correctly done.

Queued patches are on a temporary branch at:
https://git.dpdk.org/dpdk-stable/log/?h=23.11-staging

This queued commit can be viewed at:
https://git.dpdk.org/dpdk-stable/commit/?h=23.11-staging&id=6bed8020a34aae0ff8b59febdc0d0678c8890067

Thanks.

Xueming Li <xuemingl at nvidia.com>

---
>From 6bed8020a34aae0ff8b59febdc0d0678c8890067 Mon Sep 17 00:00:00 2001
From: Stephen Hemminger <stephen at networkplumber.org>
Date: Wed, 3 Jul 2024 08:45:43 -0700
Subject: [PATCH] app/dumpcap: handle SIGTERM and SIGHUP
Cc: Xueming Li <xuemingl at nvidia.com>

[ upstream commit b04d11bdc672cf8afb7a544077303a941a6a2baa ]

If the dumpcap is killed it does not cleanup which leaves
the ring buffer and the memory pool behind.
Until resource are exhausted devices will continue to fill the ring.

Fix by having the application handle SIGTERM, SIGHUP, and SIGPIPE.
These are the same signals handled in same way by the wireshark
dumpcap application.

Fixes: cbb44143be74 ("app/dumpcap: add new packet capture application")

Signed-off-by: Stephen Hemminger <stephen at networkplumber.org>
---
 app/dumpcap/main.c | 14 ++++++++++++--
 1 file changed, 12 insertions(+), 2 deletions(-)

diff --git a/app/dumpcap/main.c b/app/dumpcap/main.c
index d57db0589a..76c7475114 100644
--- a/app/dumpcap/main.c
+++ b/app/dumpcap/main.c
@@ -939,6 +939,11 @@ int main(int argc, char **argv)
 {
 	struct rte_ring *r;
 	struct rte_mempool *mp;
+	struct sigaction action = {
+		.sa_flags = SA_RESTART,
+		.sa_handler = signal_handler,
+	};
+	struct sigaction origaction;
 	dumpcap_out_t out;
 	char *p;
 
@@ -964,8 +969,13 @@ int main(int argc, char **argv)
 
 	compile_filters();
 
-	signal(SIGINT, signal_handler);
-	signal(SIGPIPE, SIG_IGN);
+	sigemptyset(&action.sa_mask);
+	sigaction(SIGTERM, &action, NULL);
+	sigaction(SIGINT, &action, NULL);
+	sigaction(SIGPIPE, &action, NULL);
+	sigaction(SIGHUP, NULL, &origaction);
+	if (origaction.sa_handler == SIG_DFL)
+		sigaction(SIGHUP, &action, NULL);
 
 	enable_primary_monitor();
 
-- 
2.34.1

---
  Diff of the applied patch vs upstream commit (please double-check if non-empty:
---
--- -	2024-08-12 20:44:06.933993048 +0800
+++ 0140-app-dumpcap-handle-SIGTERM-and-SIGHUP.patch	2024-08-12 20:44:02.555069385 +0800
@@ -1 +1 @@
-From b04d11bdc672cf8afb7a544077303a941a6a2baa Mon Sep 17 00:00:00 2001
+From 6bed8020a34aae0ff8b59febdc0d0678c8890067 Mon Sep 17 00:00:00 2001
@@ -4,0 +5,3 @@
+Cc: Xueming Li <xuemingl at nvidia.com>
+
+[ upstream commit b04d11bdc672cf8afb7a544077303a941a6a2baa ]
@@ -15 +17,0 @@
-Cc: stable at dpdk.org
@@ -23 +25 @@
-index b25b95e2fc..ba91ca94d0 100644
+index d57db0589a..76c7475114 100644
@@ -26 +28 @@
-@@ -936,6 +936,11 @@ int main(int argc, char **argv)
+@@ -939,6 +939,11 @@ int main(int argc, char **argv)
@@ -38 +40 @@
-@@ -961,8 +966,13 @@ int main(int argc, char **argv)
+@@ -964,8 +969,13 @@ int main(int argc, char **argv)


More information about the stable mailing list