From 0992a61cafb0f3def3b6997f7c3670a4474f479b Mon Sep 17 00:00:00 2001 From: Samuel Thibault Date: Tue, 26 Mar 2013 01:01:04 +0100 Subject: Fix tunnel and dummy interfaces * pfinet/linux-src/include/linux/netdevice.h (netdevice): Add `change_flags' field. * pfinet/ethernet.c (ethernet_change_flags): Make function static. (setup_ethernet_device): Set `change_flags' field of `dev' to ethernet_change_flags. * pfinet/linux-src/net/core/dev.c (dev_change_flags): Call `change_flags' field of `dev' if non-nul, instead of calling ethernet_change_flags. * pfinet/pfinet.h (ethernet_change_flags): Remove function prototype. --- pfinet/ethernet.c | 4 +++- pfinet/linux-src/include/linux/netdevice.h | 2 ++ pfinet/linux-src/net/core/dev.c | 4 ++-- pfinet/pfinet.h | 1 - 4 files changed, 7 insertions(+), 4 deletions(-) diff --git a/pfinet/ethernet.c b/pfinet/ethernet.c index 5d080730..768d5282 100644 --- a/pfinet/ethernet.c +++ b/pfinet/ethernet.c @@ -250,7 +250,7 @@ ethernet_xmit (struct sk_buff *skb, struct device *dev) } /* Set device flags (e.g. promiscuous) */ -int +static int ethernet_change_flags (struct device *dev, short flags) { error_t err = 0; @@ -313,6 +313,8 @@ setup_ethernet_device (char *name, struct device **device) ethernet_set_multi. */ dev->flags |= IFF_ALLMULTI; + dev->change_flags = ethernet_change_flags; + dev_init_buffers (dev); ethernet_open (dev); diff --git a/pfinet/linux-src/include/linux/netdevice.h b/pfinet/linux-src/include/linux/netdevice.h index 86f84a90..0b6af203 100644 --- a/pfinet/linux-src/include/linux/netdevice.h +++ b/pfinet/linux-src/include/linux/netdevice.h @@ -317,6 +317,8 @@ struct device /* Semi-private data. Keep it at the end of device struct. */ struct dst_entry *fastpath[NETDEV_FASTROUTE_HMASK+1]; #endif + + int (*change_flags)(struct device *dev, short flags); }; diff --git a/pfinet/linux-src/net/core/dev.c b/pfinet/linux-src/net/core/dev.c index ff16e827..b47c5027 100644 --- a/pfinet/linux-src/net/core/dev.c +++ b/pfinet/linux-src/net/core/dev.c @@ -1452,8 +1452,8 @@ int dev_change_flags(struct device *dev, unsigned flags) dev_set_allmulti(dev, inc); } - if (!ret) - ret = ethernet_change_flags(dev, dev->flags); + if (!ret && dev->change_flags) + ret = dev->change_flags(dev, dev->flags); return ret; } diff --git a/pfinet/pfinet.h b/pfinet/pfinet.h index 66353956..9725dabc 100644 --- a/pfinet/pfinet.h +++ b/pfinet/pfinet.h @@ -68,7 +68,6 @@ uid_t pfinet_group; void ethernet_initialize (void); int ethernet_demuxer (mach_msg_header_t *, mach_msg_header_t *); -int ethernet_change_flags (struct device *, short); void setup_ethernet_device (char *, struct device **); void setup_dummy_device (char *, struct device **); void setup_tunnel_device (char *, struct device **); -- cgit v1.2.3