dumpcap: correctly disable promiscuous mode at exit
PATCH 1/1 dumpcap: correctly disable promiscuous mode at exit
--- app/dumpcap/main.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-)
app/dumpcap/main.c +3 -2
@@ -830,11 +830,12 @@ static void enable_pdump(struct rte_ring *r, struct rte_mempool *mp) intf->opts.promisc_mode = false; }else { ret =rte_eth_promiscuous_enable (intf->port); -if (ret !=0 ) +if (ret !=0 ) {fprintf (stderr,"port %u set promiscuous enable failed: %d\n" , intf->port, ret); - intf->opts.promisc_mode = false; + intf->opts.promisc_mode = false; + } } } ++count;
Signature · 1 line
2.43.2
Quoted 14 lines · On Tue, 27 Feb 2024 11:23:26 +0200 Isaac Boukris <[email protected]> wrote:
Signed-off-by Isaac Boukris <[email protected]>--- app/dumpcap/main.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-)app/dumpcap/main.c +0
-1@@ -830,11 +830,12 @@ static void enable_pdump(struct rte_ring *r, struct rte_mempool *mp) intf->opts.promisc_mode = false; }else { ret =rte_eth_promiscuous_enable (intf->port); -if (ret !=0 )
app/dumpcap/main.c static void enable_pdump(struct rte_ring *r, struct rte_mempool *mp) · line 841
Quoted 10 lines
app/dumpcap/main.c +3
-1+if (ret !=0 ) {fprintf (stderr,"port %u set promiscuous enable failed: %d\n" , intf->port, ret); - intf->opts.promisc_mode = false; + intf->opts.promisc_mode = false; + } } } ++count;
27/02/2024 19:07, Stephen Hemminger:
Quoted 6 lines
Quoted 1 line · On Tue, 27 Feb 2024 11:23:26 +0200 Isaac Boukris <[email protected]> wrote:
Signed-off-by Isaac Boukris <[email protected]>Reviewed-by Stephen Hemminger <[email protected]>
Please could you help providing a message for the commit log?
PATCH v2 1/1 dumpcap: correctly disable promiscuous mode at exit
In reply to Isaac BoukrisFrom: Isaac Boukris <[email protected]>
If request to set promiscious mode failed at startup, then it is not necessary to disable it when shutting down.
This should only be issue if with a buggy driver because if driver does not support setting promiscious it would just ignore request to disable it as well.
---
v2 - add more to commit log, and simplify the logic
app/dumpcap/main.c | 9 +++------ 1 file changed, 3 insertions(+), 6 deletions(-)
app/dumpcap/main.c +3 -6
@@ -828,12 +828,9 @@ static void enable_pdump(struct rte_ring *r, struct rte_mempool *mp)if (rte_eth_promiscuous_get (intf->port) ==1 ) {/* promiscuous already enabled */ intf->opts.promisc_mode = false; - }else { - ret =rte_eth_promiscuous_enable (intf->port); -if (ret !=0 ) -fprintf (stderr, -"port %u set promiscuous enable failed: %d\n" , - intf->port, ret); + }else if (rte_eth_promiscuous_enable (intf->port) <0 ) { +fprintf (stderr,"port %u:%s set promiscuous failed\n" , + intf->port, intf->name); intf->opts.promisc_mode = false; } }
Signature · 1 line
2.43.0
Quoted 40 lines · Stephen Hemminger
From: Isaac Boukris <[email protected]>
If request to set promiscious mode failed at startup, then it is not necessary to disable it when shutting down.
This should only be issue if with a buggy driver because if driver does not support setting promiscious it would just ignore request to disable it as well.
Fixes 6026bfae07d4 ("app/dumpcap: support multiple interfaces")Signed-off-by Isaac Boukris <[email protected]>Signed-off-by Stephen Hemminger <[email protected]>---
v2 - add more to commit log, and simplify the logicapp/dumpcap/main.c | 9 +++------ 1 file changed, 3 insertions(+), 6 deletions(-)app/dumpcap/main.c +3
-7@@ -828,12 +828,9 @@ static void enable_pdump(struct rte_ring *r, struct rte_mempool *mp)if (rte_eth_promiscuous_get (intf->port) ==1 ) {/* promiscuous already enabled */ intf->opts.promisc_mode = false; - }else { - ret =rte_eth_promiscuous_enable (intf->port); -if (ret !=0 ) -fprintf (stderr, -"port %u set promiscuous enable failed: %d\n" , - intf->port, ret); + }else if (rte_eth_promiscuous_enable (intf->port) <0 ) { +fprintf (stderr,"port %u:%s set promiscuous failed\n" , + intf->port, intf->name); intf->opts.promisc_mode = false; } } --
Quoted 2 lines
2.43.0
V2 looks good to me.
Thanks!
Thomas Monjalon
Applied08/03/2024 08:09, Isaac Boukris:
Quoted 12 lines
Quoted 10 lines · Stephen Hemminger
From: Isaac Boukris <[email protected]>
If request to set promiscious mode failed at startup, then it is not necessary to disable it when shutting down.
This should only be issue if with a buggy driver because if driver does not support setting promiscious it would just ignore request to disable it as well.
Quoted 7 lines
Quoted 3 lines
Fixes 6026bfae07d4 ("app/dumpcap: support multiple interfaces")Signed-off-by Isaac Boukris <[email protected]>Signed-off-by Stephen Hemminger <[email protected]>V2 looks good to me.
Thanks!
Applied, thanks.