summaryrefslogtreecommitdiff
path: root/linux/dev
diff options
context:
space:
mode:
Diffstat (limited to 'linux/dev')
-rw-r--r--linux/dev/glue/net.c26
-rw-r--r--linux/dev/include/linux/netdevice.h1
-rw-r--r--linux/dev/net/core/dev.c28
3 files changed, 55 insertions, 0 deletions
diff --git a/linux/dev/glue/net.c b/linux/dev/glue/net.c
index b76e098..20ce754 100644
--- a/linux/dev/glue/net.c
+++ b/linux/dev/glue/net.c
@@ -533,6 +533,17 @@ static io_return_t
device_get_status (void *d, dev_flavor_t flavor, dev_status_t status,
mach_msg_type_number_t *count)
{
+ if (flavor == NET_FLAGS)
+ {
+ struct net_data *net = (struct net_data *) d;
+
+ if (*count != sizeof(short))
+ return D_INVALID_SIZE;
+
+ *(short *) status = net->dev->flags;
+ return D_SUCCESS;
+ }
+
if(flavor >= SIOCIWFIRST && flavor <= SIOCIWLAST)
{
/* handle wireless ioctl */
@@ -592,6 +603,21 @@ static io_return_t
device_set_status(void *d, dev_flavor_t flavor, dev_status_t status,
mach_msg_type_number_t count)
{
+ if (flavor == NET_FLAGS)
+ {
+ if (count != sizeof(short))
+ return D_INVALID_SIZE;
+
+ short flags = *(short *) status;
+ struct net_data *net = (struct net_data *) d;
+
+ dev_change_flags (net->dev, flags);
+
+ /* Change the flags of the Mach device, too. */
+ net->ifnet.if_flags = net->dev->flags;
+ return D_SUCCESS;
+ }
+
if(flavor < SIOCIWFIRST || flavor > SIOCIWLAST)
return D_INVALID_OPERATION;
diff --git a/linux/dev/include/linux/netdevice.h b/linux/dev/include/linux/netdevice.h
index ff25df1..e1a9a34 100644
--- a/linux/dev/include/linux/netdevice.h
+++ b/linux/dev/include/linux/netdevice.h
@@ -271,6 +271,7 @@ extern void net_bh(void);
extern void dev_tint(struct linux_device *dev);
#endif
+extern int dev_change_flags(struct linux_device *dev, short flags);
extern int dev_get_info(char *buffer, char **start, off_t offset, int length, int dummy);
extern int dev_ioctl(unsigned int cmd, void *);
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;
+}
+