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 0F996A00C2; Mon, 2 Jan 2023 17:25:45 +0100 (CET) Received: from mails.dpdk.org (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id AB6EB42D31; Mon, 2 Jan 2023 17:25:40 +0100 (CET) Received: from mail-qt1-f174.google.com (mail-qt1-f174.google.com [209.85.160.174]) by mails.dpdk.org (Postfix) with ESMTP id 8D2B742D25; Mon, 2 Jan 2023 17:25:39 +0100 (CET) Received: by mail-qt1-f174.google.com with SMTP id jr11so22725275qtb.7; Mon, 02 Jan 2023 08:25:39 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; 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=cue4JR6FMX+/pboXGHKDBnXpQ6NC2EgNI7ka72U7IZo=; b=kbbDcCE7XbXsZ3o4X0PKRDQp/YmxH5o+I0yDd2mGbb6dyqIJ/9yijDG7b6EDFBTTrq 3ZKQYbLhoaI3obdor6uQh1706LMccWNDjcW7r0yeaZSXPg2PmHHj8deBvxLLq8Dto4EC 91vMW3AYMWi4QjwZ8YqNijd5tsS7jeDHkh8buFqB7tykZGeOwZgzfUfXhPP9BZ5oK9d3 UhM6iw3LSNk7AxhDdH55BX6cNFeMdBPIFQREcf6lhK69h/WlJYLHrvHi0v7g/EThuXit VjalTAlENz2K5/OJhBpD4Oe+i2gYkDmgjirp1E4ija1l/dV3FpR0/mjGRMDf0LcgICQK vOUQ== 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:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=cue4JR6FMX+/pboXGHKDBnXpQ6NC2EgNI7ka72U7IZo=; b=th5ahP1glctPTqI0n6P+4ukEMDiK/dmdR0O76IY4IQ0NxOC9DkTHNe0SCjdjehKTSx +AHkt10QNVqgOGZfHk4YlM3EwkUySX4eWWOytC2Eja4KHftmuv8b6IhuK/9OHFH7yp3W 14t/3LOtJwRPrHICip3o8OBLz1jNcMbCwpOU5DUAAlQXZeWJFFEiaBXNHl4D3FdlUATX cB+UOyLoiBozqLANVXTKpMcrRLy5Gg1KmABtJUdKsqp4VZk5q/neFnHvAQ/E9kQfN1bE GkMnNKw7SUwwWNwxCwCMJeFiEBul5XD5zXlInZkm32KxN3OQNlNZW6VvJfPRJzQiGpTf 0hPg== X-Gm-Message-State: AFqh2koOPMcbflHHPQ30SJmfY/lk0DcC0zHF31/p05kbSMmRqADZMAqY RRHqkv/V8559xzyMtGw3NI0Knh+q9dE= X-Google-Smtp-Source: AMrXdXvSa3wr54btlYR4ftmXw8d+86Cz7lUEF6ocvdPONnQeHl9G+Qm8IwkpC5/5X6LXN4hR/iCHBQ== X-Received: by 2002:ac8:47cd:0:b0:3a7:e4ad:5499 with SMTP id d13-20020ac847cd000000b003a7e4ad5499mr62110128qtr.32.1672676739037; Mon, 02 Jan 2023 08:25:39 -0800 (PST) Received: from lvdi-01-iad-l.blue.trinitycyber.com ([38.142.224.194]) by smtp.gmail.com with ESMTPSA id u2-20020ac80502000000b003a81eef14efsm17678091qtg.45.2023.01.02.08.25.38 (version=TLS1_2 cipher=ECDHE-ECDSA-AES128-GCM-SHA256 bits=128/128); Mon, 02 Jan 2023 08:25:38 -0800 (PST) From: Ben Magistro To: dev@dpdk.org, stephen@networkplumber.org Cc: ben.magistro@trinitycyber.com, Ben Magistro , stable@dpdk.org Subject: [PATCH 3/6] app/dumpcap: fix preserving promiscuous mode Date: Mon, 2 Jan 2023 16:24:38 +0000 Message-Id: <20230102162441.6205-3-koncept1@gmail.com> X-Mailer: git-send-email 2.27.0 In-Reply-To: <20230102162441.6205-1-koncept1@gmail.com> References: <20230102162441.6205-1-koncept1@gmail.com> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit 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 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); } } -- 2.27.0