aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--include/linux/netdevice.h3
-rw-r--r--net/core/dev.c17
2 files changed, 19 insertions, 1 deletions
diff --git a/include/linux/netdevice.h b/include/linux/netdevice.h
index 79cc3dab4be7..f193aba30384 100644
--- a/include/linux/netdevice.h
+++ b/include/linux/netdevice.h
@@ -516,6 +516,9 @@ struct net_device
516 void *saddr, 516 void *saddr,
517 unsigned len); 517 unsigned len);
518 int (*rebuild_header)(struct sk_buff *skb); 518 int (*rebuild_header)(struct sk_buff *skb);
519#define HAVE_CHANGE_RX_FLAGS
520 void (*change_rx_flags)(struct net_device *dev,
521 int flags);
519#define HAVE_SET_RX_MODE 522#define HAVE_SET_RX_MODE
520 void (*set_rx_mode)(struct net_device *dev); 523 void (*set_rx_mode)(struct net_device *dev);
521#define HAVE_MULTICAST 524#define HAVE_MULTICAST
diff --git a/net/core/dev.c b/net/core/dev.c
index 96443055324e..59ec811d2b54 100644
--- a/net/core/dev.c
+++ b/net/core/dev.c
@@ -2521,6 +2521,8 @@ static void __dev_set_promiscuity(struct net_device *dev, int inc)
2521{ 2521{
2522 unsigned short old_flags = dev->flags; 2522 unsigned short old_flags = dev->flags;
2523 2523
2524 ASSERT_RTNL();
2525
2524 if ((dev->promiscuity += inc) == 0) 2526 if ((dev->promiscuity += inc) == 0)
2525 dev->flags &= ~IFF_PROMISC; 2527 dev->flags &= ~IFF_PROMISC;
2526 else 2528 else
@@ -2535,6 +2537,9 @@ static void __dev_set_promiscuity(struct net_device *dev, int inc)
2535 dev->name, (dev->flags & IFF_PROMISC), 2537 dev->name, (dev->flags & IFF_PROMISC),
2536 (old_flags & IFF_PROMISC), 2538 (old_flags & IFF_PROMISC),
2537 audit_get_loginuid(current->audit_context)); 2539 audit_get_loginuid(current->audit_context));
2540
2541 if (dev->change_rx_flags)
2542 dev->change_rx_flags(dev, IFF_PROMISC);
2538 } 2543 }
2539} 2544}
2540 2545
@@ -2573,11 +2578,16 @@ void dev_set_allmulti(struct net_device *dev, int inc)
2573{ 2578{
2574 unsigned short old_flags = dev->flags; 2579 unsigned short old_flags = dev->flags;
2575 2580
2581 ASSERT_RTNL();
2582
2576 dev->flags |= IFF_ALLMULTI; 2583 dev->flags |= IFF_ALLMULTI;
2577 if ((dev->allmulti += inc) == 0) 2584 if ((dev->allmulti += inc) == 0)
2578 dev->flags &= ~IFF_ALLMULTI; 2585 dev->flags &= ~IFF_ALLMULTI;
2579 if (dev->flags ^ old_flags) 2586 if (dev->flags ^ old_flags) {
2587 if (dev->change_rx_flags)
2588 dev->change_rx_flags(dev, IFF_ALLMULTI);
2580 dev_set_rx_mode(dev); 2589 dev_set_rx_mode(dev);
2590 }
2581} 2591}
2582 2592
2583/* 2593/*
@@ -2778,6 +2788,8 @@ int dev_change_flags(struct net_device *dev, unsigned flags)
2778 int ret, changes; 2788 int ret, changes;
2779 int old_flags = dev->flags; 2789 int old_flags = dev->flags;
2780 2790
2791 ASSERT_RTNL();
2792
2781 /* 2793 /*
2782 * Set the flags on our device. 2794 * Set the flags on our device.
2783 */ 2795 */
@@ -2792,6 +2804,9 @@ int dev_change_flags(struct net_device *dev, unsigned flags)
2792 * Load in the correct multicast list now the flags have changed. 2804 * Load in the correct multicast list now the flags have changed.
2793 */ 2805 */
2794 2806
2807 if (dev->change_rx_flags && (dev->flags ^ flags) & IFF_MULTICAST)
2808 dev->change_rx_flags(dev, IFF_MULTICAST);
2809
2795 dev_set_rx_mode(dev); 2810 dev_set_rx_mode(dev);
2796 2811
2797 /* 2812 /*