Re: [PATCH net-next v2] dev: always advertise rx_flags changes
From: Stephen Hemminger <stephen@networkplumber.org>
Date: 2013-09-24 16:47:12
On Tue, 24 Sep 2013 18:21:32 +0200 Nicolas Dichtel [off-list ref] wrote:
quoted hunk ↗ jump to hunk
diff --git a/net/core/dev.c b/net/core/dev.c index 5c713f2239cc..067bfbe70c4c 100644 --- a/net/core/dev.c +++ b/net/core/dev.c@@ -4822,7 +4822,7 @@ static void dev_change_rx_flags(struct net_device *dev, int flags) ops->ndo_change_rx_flags(dev, flags); } -static int __dev_set_promiscuity(struct net_device *dev, int inc) +static int __dev_set_promiscuity(struct net_device *dev, int inc, bool notif) { unsigned int old_flags = dev->flags; kuid_t uid;@@ -4865,6 +4865,10 @@ static int __dev_set_promiscuity(struct net_device *dev, int inc) dev_change_rx_flags(dev, IFF_PROMISC); } + if (notif) { + call_netdevice_notifiers(NETDEV_CHANGE, dev); + rtmsg_ifinfo(RTM_NEWLINK, dev, IFF_PROMISC); + } return 0; }
This is getting uglier as the conditional is added to each
function. Why not create a helper function and change callers.
static void __dev_notify_flag(dev, int flags)
{
call_netdevice_notifiers(NETDEV_CHANGE, dev);
rtmsg_ifinfo(RTM_NEWLINK, dev, flags);
}