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

luca.boccassi at gmail.com luca.boccassi at gmail.com
Wed Jul 24 13:33:07 CEST 2024


Hi,

FYI, your patch has been queued to stable release 22.11.6

Note it hasn't been pushed to http://dpdk.org/browse/dpdk-stable yet.
It will be pushed if I get no objections before 07/26/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://github.com/bluca/dpdk-stable

This queued commit can be viewed at:
https://github.com/bluca/dpdk-stable/commit/7ecd214ddab65f29b6ea9bdcb6d9996836e47bd5

Thanks.

Luca Boccassi

---
>From 7ecd214ddab65f29b6ea9bdcb6d9996836e47bd5 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

[ 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 | 13 +++++++++++++
 1 file changed, 13 insertions(+)

diff --git a/app/dumpcap/main.c b/app/dumpcap/main.c
index 0039aa1975..81c9d7d2f1 100644
--- a/app/dumpcap/main.c
+++ b/app/dumpcap/main.c
@@ -805,6 +805,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;
 
@@ -832,6 +837,14 @@ int main(int argc, char **argv)
 	if (TAILQ_EMPTY(&interfaces))
 		set_default_interface();
 
+	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);
+
 	r = create_ring();
 	mp = create_mempool();
 	out = create_output();
-- 
2.39.2

---
  Diff of the applied patch vs upstream commit (please double-check if non-empty:
---
--- -	2024-07-24 12:29:22.934107800 +0100
+++ 0029-app-dumpcap-handle-SIGTERM-and-SIGHUP.patch	2024-07-24 12:29:20.799026695 +0100
@@ -1 +1 @@
-From b04d11bdc672cf8afb7a544077303a941a6a2baa Mon Sep 17 00:00:00 2001
+From 7ecd214ddab65f29b6ea9bdcb6d9996836e47bd5 Mon Sep 17 00:00:00 2001
@@ -5,0 +6,2 @@
+[ upstream commit b04d11bdc672cf8afb7a544077303a941a6a2baa ]
+
@@ -15 +16,0 @@
-Cc: stable at dpdk.org
@@ -19,2 +20,2 @@
- app/dumpcap/main.c | 14 ++++++++++++--
- 1 file changed, 12 insertions(+), 2 deletions(-)
+ app/dumpcap/main.c | 13 +++++++++++++
+ 1 file changed, 13 insertions(+)
@@ -23 +24 @@
-index b25b95e2fc..ba91ca94d0 100644
+index 0039aa1975..81c9d7d2f1 100644
@@ -26 +27 @@
-@@ -936,6 +936,11 @@ int main(int argc, char **argv)
+@@ -805,6 +805,11 @@ int main(int argc, char **argv)
@@ -38,3 +39,3 @@
-@@ -961,8 +966,13 @@ int main(int argc, char **argv)
- 
- 	compile_filters();
+@@ -832,6 +837,14 @@ int main(int argc, char **argv)
+ 	if (TAILQ_EMPTY(&interfaces))
+ 		set_default_interface();
@@ -42,2 +42,0 @@
--	signal(SIGINT, signal_handler);
--	signal(SIGPIPE, SIG_IGN);
@@ -51,3 +50,4 @@
- 
- 	enable_primary_monitor();
- 
++
+ 	r = create_ring();
+ 	mp = create_mempool();
+ 	out = create_output();


More information about the stable mailing list