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 7448AA00C2; Mon, 2 Jan 2023 17:58:29 +0100 (CET) Received: from mails.dpdk.org (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id 6585840693; Mon, 2 Jan 2023 17:58:29 +0100 (CET) Received: from mail-pj1-f41.google.com (mail-pj1-f41.google.com [209.85.216.41]) by mails.dpdk.org (Postfix) with ESMTP id 2516840689 for ; Mon, 2 Jan 2023 17:58:28 +0100 (CET) Received: by mail-pj1-f41.google.com with SMTP id a11-20020a17090a740b00b00223f7eba2c4so906403pjg.5 for ; Mon, 02 Jan 2023 08:58:28 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=networkplumber-org.20210112.gappssmtp.com; s=20210112; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:subject:cc:to:from:date:from:to:cc:subject:date :message-id:reply-to; bh=+Th2LGSmKb32UbHx5JstvQJdOO2wMmAllbd5eLKG7uk=; b=750KS9cn0ivSpVK75eY0TPblaoDgBt8N2qjostOIaInmz4Jbl5Ps2hE71kqjz64q/b 8V5YueNjeRnHaymleDbPpSnnKyn/gGeY04x6zem38icTz/aOEJmvOQc3m6ITRIB3VLj1 os4KAEgJgTk+cHg9hF7lAyzZc0q6QCAx0oks5m0hd/LEGLsRYoWdLmn9ymo0u/h99aUm p1hwXad7/9HLdFJFKlYdg9l33Hekh6V6SGxVssYepXAuH0z3NEzweQUjsB7Fck01cd0A bwq+GO2j9WH8Ab5vNTDSDug3V9ptstXG3MIp4IYArIPgu6wu4zqa5LTT8PDZT3hoEtPq MxEw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:subject:cc:to:from:date:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=+Th2LGSmKb32UbHx5JstvQJdOO2wMmAllbd5eLKG7uk=; b=wpenpHgRpNfVtyEKDHb8SgnrdJWHu7yh5n18EZw1iBytnb4nEYpo2esEe8XBJ6G75G xB2jNOBSEDCjSYUEwlW+Wo7eSV1CaHPDSWEpmhGu82yptHAy+Ivm0oetKxQXTJ2/LRdN BJCOVf8B20TsVTk/kd4cG7iKkJ8iyYM0FfWei4IGhiAnNbUCGS3xlv+GIP9t6KJftZ30 V2O+Qbc4dRbSbcpskp5ZacUBKxRhSDn3HkQ4cYOSwBfIftACXiIjFM3TvSHe7SMpxpKL olAeANTlxi/hZUIxt1l2RyyStAF8UePQtgK6aWTFrgwOpf6Ch2m1Q8BPI8xBR0Mc8lW2 qGGQ== X-Gm-Message-State: AFqh2kqfaHJVZ2/esBg670oIzfIHL6+cE8QP8Z61hUv+YRvTGEjmw2OD 6UNfaaFko0GCVxGbEFPWJqMfJg== X-Google-Smtp-Source: AMrXdXtLDcytILiL1HGNjjC9OJQBi7QTG9GWClITm+FB6aCgTuKq2EEZ8f4ph1ddL7UoNYHfWd/wCw== X-Received: by 2002:a17:902:6b89:b0:189:cf92:6f5c with SMTP id p9-20020a1709026b8900b00189cf926f5cmr45238457plk.52.1672678707361; Mon, 02 Jan 2023 08:58:27 -0800 (PST) Received: from hermes.local (204-195-120-218.wavecable.com. [204.195.120.218]) by smtp.gmail.com with ESMTPSA id b14-20020a170902650e00b001868d4600b8sm20486974plk.158.2023.01.02.08.58.26 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 02 Jan 2023 08:58:27 -0800 (PST) Date: Mon, 2 Jan 2023 08:58:26 -0800 From: Stephen Hemminger To: Ben Magistro Cc: dev@dpdk.org, ben.magistro@trinitycyber.com, stable@dpdk.org Subject: Re: [PATCH 3/6] app/dumpcap: fix preserving promiscuous mode Message-ID: <20230102085826.320be627@hermes.local> In-Reply-To: <20230102162441.6205-3-koncept1@gmail.com> References: <20230102162441.6205-1-koncept1@gmail.com> <20230102162441.6205-3-koncept1@gmail.com> MIME-Version: 1.0 Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: 7bit X-BeenThere: dev@dpdk.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: DPDK patches and discussions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: dev-bounces@dpdk.org On Mon, 2 Jan 2023 16:24:38 +0000 Ben Magistro wrote: > When stopping dumpcap and the main application set an interface to > promiscuous mode, it would be disabled when dumpcap performed its > cleanup. This results in a change of behavior for the main application > after running/utilizing dumpcap. The initial promiscuous mode is now > stored and compared when cleaning up allowing that to be preserved. > > Fixes: d59fb4d ("app/dumpcap: add new packet capture application") > Cc: stephen@networkplumber.org > Cc: stable@dpdk.org > > Signed-off-by: Ben Magistro > --- > app/dumpcap/main.c | 5 ++++- > 1 file changed, 4 insertions(+), 1 deletion(-) > > diff --git a/app/dumpcap/main.c b/app/dumpcap/main.c > index aaee9349b1..26c641df61 100644 > --- a/app/dumpcap/main.c > +++ b/app/dumpcap/main.c > @@ -84,6 +84,7 @@ struct interface { > TAILQ_ENTRY(interface) next; > uint16_t port; > char name[RTE_ETH_NAME_MAX_LEN]; > + int promiscuous_exit; /* 1 when promicuous is set prior to starting dumpcap */ > > struct rte_rxtx_callback *rx_cb[RTE_MAX_QUEUES_PER_PORT]; > }; > @@ -204,6 +205,8 @@ static void add_interface(uint16_t port, const char *name) > memset(intf, 0, sizeof(*intf)); > intf->port = port; > rte_strscpy(intf->name, name, sizeof(intf->name)); > + // not checking error here; should only error if given an invalid port id > + intf->promiscuous_exit = rte_eth_promiscuous_get(port); > > printf("Capturing on '%s'\n", name); > > @@ -462,7 +465,7 @@ cleanup_pdump_resources(void) > TAILQ_FOREACH(intf, &interfaces, next) { > rte_pdump_disable(intf->port, > RTE_PDUMP_ALL_QUEUES, RTE_PDUMP_FLAG_RXTX); > - if (promiscuous_mode) > + if (!intf->promiscuous_exit && promiscuous_mode) > rte_eth_promiscuous_disable(intf->port); > } > } Thanks, could you test mine instead.