From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mails.dpdk.org (mails.dpdk.org [217.70.189.124]) by inbox.dpdk.org (Postfix) with ESMTP id 019594569C for ; Wed, 24 Jul 2024 13:34:53 +0200 (CEST) Received: from mails.dpdk.org (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id EDC2942D89; Wed, 24 Jul 2024 13:34:52 +0200 (CEST) Received: from mail-wr1-f45.google.com (mail-wr1-f45.google.com [209.85.221.45]) by mails.dpdk.org (Postfix) with ESMTP id D135D433DE for ; Wed, 24 Jul 2024 13:34:49 +0200 (CEST) Received: by mail-wr1-f45.google.com with SMTP id ffacd0b85a97d-368712acb8dso3277698f8f.2 for ; Wed, 24 Jul 2024 04:34:49 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1721820889; x=1722425689; darn=dpdk.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=27dTR+rCPu7FlO2T7RcPQ5MPr1cV6MPXeU8WJNi9uRE=; b=bXmFvxLQ4PMJfcP4ONmD1HRLga/BY4r8lcgdLYq4IKfbcwr9Gvk2xwW4Z8SKb3oAhT lPKMWJ1/RutKcu0d9fgFsKRMOYZbppnFeH2LyS0qMVo5q2ovoaa/zF6ebtbtq0UkFfbi AvziTQZuWS7YkZJMm0CTZ9r100ttxHvEKMNw68hKMXETxsB0PkdqYyArCwEKPPvmncOd 45t47erIEw8VtH3Un0brrjGpcTSOvLHHgnFysswnCi4TxEUe/kKyadhTtZxyD8Icql2h olbt4blTp4/VAQLtwgyVcs3BRzhASnFBJJCOL4Zu2GTs7cRKpX1W9zNiIW6YcSe8b8i+ 595g== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1721820889; x=1722425689; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=27dTR+rCPu7FlO2T7RcPQ5MPr1cV6MPXeU8WJNi9uRE=; b=jXtb6xus4I5J8pE0/pWpHUaU7ktZkmzdPnf3CpPqhJET39bV7ug8CIPUveevKggkbI xbk63Et/7cjhZIpT7wPGCcH0IgPZMfZchsJq12O+J5y68CfDCqBLN1imjJEUmh4EEPaA cD12bvQL8XlI9goTKSG3S4sNzjEE1O6ax+HMb9/Fy8hiZvQgec0K6ACpnYqe4K2u/Kot skTCxYF7YrMP1KwGiNeFU0z3ilbUGS98sFqGdPM3bT1ZKFj0pMM0Et7aMtJ7H0h8+blD lVw+ZtX6jRaXDRjjpN+dIGNijsMyJ0v/D+sF02jYHdSsKovm1/T+mEQRrhhVLsujdGZW fTeQ== X-Gm-Message-State: AOJu0YyxIHSAAHAt1ixDQWnqU9TFlc2uJSkZGE8GaUr5kVSMZQrMmJs4 VmUyqf7B7ZCbXylpdeomOmT3kHjyRMKmA/OJ/CUYgJsw7XJMRe8ujgthewuS X-Google-Smtp-Source: AGHT+IGpAKRBYj0fmDQxxJ9M9Y4orpbgz1uxCT09UHH+63yDRiuPMAubAIrX7qKmNYuXsPiM/myGnA== X-Received: by 2002:adf:ce10:0:b0:368:6598:131e with SMTP id ffacd0b85a97d-369dec1e727mr3805265f8f.38.1721820889354; Wed, 24 Jul 2024 04:34:49 -0700 (PDT) Received: from localhost ([2a01:4b00:d036:ae00:7aef:1aaa:3dff:d546]) by smtp.gmail.com with ESMTPSA id ffacd0b85a97d-36878695165sm14058719f8f.62.2024.07.24.04.34.48 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 24 Jul 2024 04:34:48 -0700 (PDT) From: luca.boccassi@gmail.com To: Stephen Hemminger Cc: dpdk stable Subject: patch 'app/dumpcap: handle SIGTERM and SIGHUP' has been queued to stable release 22.11.6 Date: Wed, 24 Jul 2024 12:33:07 +0100 Message-Id: <20240724113318.616754-29-luca.boccassi@gmail.com> X-Mailer: git-send-email 2.39.2 In-Reply-To: <20240724113318.616754-1-luca.boccassi@gmail.com> References: <20240715152704.2229503-86-luca.boccassi@gmail.com> <20240724113318.616754-1-luca.boccassi@gmail.com> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-BeenThere: stable@dpdk.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: patches for DPDK stable branches List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: stable-bounces@dpdk.org 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 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 --- 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@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();