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 57C3FA00C4 for ; Mon, 2 Jan 2023 17:58:30 +0100 (CET) Received: from mails.dpdk.org (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id 5293842D22; Mon, 2 Jan 2023 17:58:30 +0100 (CET) Received: from mail-pl1-f182.google.com (mail-pl1-f182.google.com [209.85.214.182]) by mails.dpdk.org (Postfix) with ESMTP id 2778340693 for ; Mon, 2 Jan 2023 17:58:28 +0100 (CET) Received: by mail-pl1-f182.google.com with SMTP id m4so30059513pls.4 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=G9yboHcFH0PxRZ6Xv4y7AsBgT9qnsqjIQw40O2lLQ5BeeDa4muze9QUakjoXD3ge3K uYxfIjXuSu2wZCNgqg4wkAdRBSsemiuXwOBcBomadmlXHOhqFucpVh+ltXiNVkPLTWEi pZYVxhJs8n66RKuNMLx6uytdR4ZkUx/5ZOATRv4YghZovJSdVsEXTsDP6mjXQJ4KbErT PdHWXjedDLzI/QPZBU0gomBCbY5+qpVQD0kQ8182VC8/sXqvm15syG96ZJMSyuWzfxtF sj8k1zG44m00linDSNJkHaVtqIRnWVcAamyTOQGky43jPgsDraQF+fDsZY19Yi5H8ZdV G0sQ== X-Gm-Message-State: AFqh2kp48bw/rOUJNRtahrPPTfBTqXfM3OhGD9uFeB89gpNsWo87TX/L MSKPMQhT0Z6AxTLl3bssf22nng== 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: 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 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.