From 5a97027c99163974a16614363dafc18a63b990e0 Mon Sep 17 00:00:00 2001 From: Samuel Thibault Date: Sat, 9 Aug 2008 14:35:27 +0000 Subject: 2008-07-29 Zheng Da Manuel Menal * 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. --- linux/dev/net/core/dev.c | 28 ++++++++++++++++++++++++++++ 1 file changed, 28 insertions(+) (limited to 'linux/dev/net') 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; +} + -- cgit v1.2.3