net/core: refactor promiscuous mode message
authorJesse Brandeburg <jesse.brandeburg@intel.com>
Tue, 14 Feb 2023 21:01:17 +0000 (13:01 -0800)
committerPaolo Abeni <pabeni@redhat.com>
Thu, 16 Feb 2023 09:11:14 +0000 (10:11 +0100)
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>
Signed-off-by: Paolo Abeni <pabeni@redhat.com>
net/core/dev.c

index ad1e6482e1c15c9543cccf97b7c99c37b0637dd4..357081b0113cb5260c6285008821f1bf8be1d084 100644 (file)
@@ -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,