diff mbox series

[net-next,v1,2/2] net/core: refactor promiscuous mode message

Message ID 20230214210117.23123-3-jesse.brandeburg@intel.com (mailing list archive)
State Accepted
Commit 3ba0bf47edf955d6f52fdb16b54acd1932cb9445
Delegated to: Netdev Maintainers
Headers show
Series net/core: commmon prints for promisc | expand

Checks

Context Check Description
netdev/tree_selection success Clearly marked for net-next
netdev/fixes_present success Fixes tag not required for -next series
netdev/subject_prefix success Link
netdev/cover_letter success Series has a cover letter
netdev/patch_count success Link
netdev/header_inline success No static functions without inline keyword in header files
netdev/build_32bit success Errors and warnings before: 8 this patch: 8
netdev/cc_maintainers warning 1 maintainers not CCed: petrm@nvidia.com
netdev/build_clang success Errors and warnings before: 1 this patch: 1
netdev/module_param success Was 0 now: 0
netdev/verify_signedoff success Signed-off-by tag matches author and committer
netdev/check_selftest success No net selftest shell script
netdev/verify_fixes success No Fixes tag
netdev/build_allmodconfig_warn success Errors and warnings before: 8 this patch: 8
netdev/checkpatch success total: 0 errors, 0 warnings, 0 checks, 11 lines checked
netdev/kdoc success Errors and warnings before: 0 this patch: 0
netdev/source_inline success Was 0 now: 0

Commit Message

Jesse Brandeburg Feb. 14, 2023, 9:01 p.m. UTC
The kernel stack can be more consistent by printing the IFF_PROMISC
aka promiscuous enable/disable messages with the standard netdev_info
message which can include bus and driver info as well as the device.

typical command usage from user space looks like:
ip link set eth0 promisc <on|off>

But lots of utilities such as bridge, tcpdump, etc put the interface into
promiscuous mode.

old message:
[  406.034418] device eth0 entered promiscuous mode
[  408.424703] device eth0 left promiscuous mode

new message:
[  406.034431] ice 0000:17:00.0 eth0: entered promiscuous mode
[  408.424715] ice 0000:17:00.0 eth0: left promiscuous mode

Signed-off-by: Jesse Brandeburg <jesse.brandeburg@intel.com>
---
I'm unsure about this one because it's changing a long standard kernel
message to a slightly different format. I think the new way looks better
and has more information.
---
 net/core/dev.c | 5 ++---
 1 file changed, 2 insertions(+), 3 deletions(-)

Comments

Paolo Abeni Feb. 16, 2023, 9:10 a.m. UTC | #1
On Tue, 2023-02-14 at 13:01 -0800, Jesse Brandeburg wrote:
> The kernel stack can be more consistent by printing the IFF_PROMISC
> aka promiscuous enable/disable messages with the standard netdev_info
> message which can include bus and driver info as well as the device.
> 
> typical command usage from user space looks like:
> ip link set eth0 promisc <on|off>
> 
> But lots of utilities such as bridge, tcpdump, etc put the interface into
> promiscuous mode.
> 
> old message:
> [  406.034418] device eth0 entered promiscuous mode
> [  408.424703] device eth0 left promiscuous mode
> 
> new message:
> [  406.034431] ice 0000:17:00.0 eth0: entered promiscuous mode
> [  408.424715] ice 0000:17:00.0 eth0: left promiscuous mode
> 
> Signed-off-by: Jesse Brandeburg <jesse.brandeburg@intel.com>
> ---
> I'm unsure about this one because it's changing a long standard kernel
> message to a slightly different format. I think the new way looks better
> and has more information.

I guess the relevant question here is if such kind of messages are
somewhat implicitly part of uAPI.

AFAIK the answer is "no", at least for info-level msg, so the patch
LGTM.

Thanks,

Paolo
diff mbox series

Patch

diff --git a/net/core/dev.c b/net/core/dev.c
index ad1e6482e1c1..357081b0113c 100644
--- a/net/core/dev.c
+++ b/net/core/dev.c
@@ -8321,9 +8321,8 @@  static int __dev_set_promiscuity(struct net_device *dev, int inc, bool notify)
 		}
 	}
 	if (dev->flags != old_flags) {
-		pr_info("device %s %s promiscuous mode\n",
-			dev->name,
-			dev->flags & IFF_PROMISC ? "entered" : "left");
+		netdev_info(dev, "%s promiscuous mode\n",
+			    dev->flags & IFF_PROMISC ? "entered" : "left");
 		if (audit_enabled) {
 			current_uid_gid(&uid, &gid);
 			audit_log(audit_context(), GFP_ATOMIC,