lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-Id: <20220408200337.718067-3-vladimir.oltean@nxp.com>
Date:   Fri,  8 Apr 2022 23:03:33 +0300
From:   Vladimir Oltean <vladimir.oltean@....com>
To:     netdev@...r.kernel.org
Cc:     Jakub Kicinski <kuba@...nel.org>,
        "David S. Miller" <davem@...emloft.net>,
        Florian Fainelli <f.fainelli@...il.com>,
        Andrew Lunn <andrew@...n.ch>,
        Vivien Didelot <vivien.didelot@...il.com>,
        Vladimir Oltean <olteanv@...il.com>,
        UNGLinuxDriver@...rochip.com, Paolo Abeni <pabeni@...hat.com>,
        Roopa Prabhu <roopa@...dia.com>,
        Nikolay Aleksandrov <nikolay@...dia.com>,
        Jiri Pirko <jiri@...dia.com>, Ido Schimmel <idosch@...dia.com>,
        Tobias Waldekranz <tobias@...dekranz.com>,
        Mattias Forsblad <mattias.forsblad@...il.com>
Subject: [PATCH net-next 2/6] net: emit NETDEV_CHANGE for changes to IFF_PROMISC | IFF_ALLMULTI

Some drivers may be interested in the change in promiscuity on other
devices, like for example switchdev drivers may be interested in a
promiscuity change on the bridge. In fact this was also suggested as a
valid thing to do a while ago by Jiri Pirko:
https://lore.kernel.org/all/20190829182957.GA17530@lunn.ch/t/#m6de7937f694ab1375723bab7c53a7fb2d3595332

yet it doesn't work. This is because, for probably legacy reasons,
__dev_notify_flags() omits changes to IFF_PROMISC | IFF_ALLMULTI
(RX flags), as well as a bunch of other flags (maybe simply because it
wasn't needed, maybe because of other reasons).

It may be tempting to hook this into (actually remove the restriction
from) __dev_notify_flags(), but that is an unreliable place to put it,
since __dev_set_promiscuity() may be called with "notify=false" and we'd
still like to emit the NETDEV_CHANGE anyway.

So put the netdev notifier call right next to the dev_change_rx_flags()
call, for both IFF_PROMISC and IFF_ALLMULTI.

Signed-off-by: Vladimir Oltean <vladimir.oltean@....com>
---
 net/core/dev.c | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/net/core/dev.c b/net/core/dev.c
index 433f006a796b..2fc754018a2e 100644
--- a/net/core/dev.c
+++ b/net/core/dev.c
@@ -8252,6 +8252,7 @@ static int __dev_set_promiscuity(struct net_device *dev, int inc, bool notify)
 		}
 
 		dev_change_rx_flags(dev, IFF_PROMISC);
+		__netdev_state_change(dev, IFF_PROMISC);
 	}
 	if (notify)
 		__dev_notify_flags(dev, old_flags, IFF_PROMISC);
@@ -8306,6 +8307,7 @@ static int __dev_set_allmulti(struct net_device *dev, int inc, bool notify)
 	}
 	if (dev->flags ^ old_flags) {
 		dev_change_rx_flags(dev, IFF_ALLMULTI);
+		__netdev_state_change(dev, IFF_ALLMULTI);
 		dev_set_rx_mode(dev);
 		if (notify)
 			__dev_notify_flags(dev, old_flags,
-- 
2.25.1

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ