summaryrefslogtreecommitdiff
path: root/linux/dev/net
diff options
context:
space:
mode:
authorSamuel Thibault <samuel.thibault@ens-lyon.org>2008-08-09 14:35:27 +0000
committerThomas Schwinge <tschwinge@gnu.org>2009-06-18 00:27:18 +0200
commit5a97027c99163974a16614363dafc18a63b990e0 (patch)
tree544f2bea96a5d04c238b51b08ffb54b5f87421bf /linux/dev/net
parent511300311b1a57ad7279f91ab11d1bcf6fe202da (diff)
2008-07-29 Zheng Da <zhengda1936@gmail.com>
Manuel Menal <mmenal@hurdfr.org> * include/device/net_status.h (NET_FLAGS): New macro. * linux/dev/glue/net.c (device_get_status): Handle NET_FLAGS case. (device_set_status): Likewise, calls dev_change_flags. * linux/dev/include/linux/netdevice.h (dev_change_flags): Declare function. * linux/dev/net/core/dev.c (dev_change_flags): Add function.
Diffstat (limited to 'linux/dev/net')
-rw-r--r--linux/dev/net/core/dev.c28
1 files changed, 28 insertions, 0 deletions
diff --git a/linux/dev/net/core/dev.c b/linux/dev/net/core/dev.c
index efe0246..cbdf8cc 100644
--- a/linux/dev/net/core/dev.c
+++ b/linux/dev/net/core/dev.c
@@ -1618,3 +1618,31 @@ int net_dev_init(void)
init_bh(NET_BH, net_bh);
return 0;
}
+
+/*
+ * Change the flags of device DEV to FLAGS.
+ */
+int dev_change_flags (struct device *dev, short flags)
+{
+ if (securelevel > 0)
+ flags &= ~IFF_PROMISC;
+
+ /*
+ * Set the flags on our device.
+ */
+
+ dev->flags = (flags &
+ (IFF_BROADCAST | IFF_DEBUG | IFF_LOOPBACK |
+ IFF_POINTOPOINT | IFF_NOTRAILERS | IFF_RUNNING |
+ IFF_NOARP | IFF_PROMISC | IFF_ALLMULTI | IFF_SLAVE
+ | IFF_MASTER | IFF_MULTICAST))
+ | (dev->flags & (IFF_SOFTHEADERS|IFF_UP));
+
+ /* The flags are taken into account (multicast, promiscuous, ...)
+ in the set_multicast_list handler. */
+ if ((dev->flags & IFF_UP) && dev->set_multicast_list != NULL)
+ dev->set_multicast_list (dev);
+
+ return 0;
+}
+