diff options
author | Davor Emard <devnull@localhost> | 2003-02-23 18:56:59 +0000 |
---|---|---|
committer | Davor Emard <devnull@localhost> | 2003-02-23 18:56:59 +0000 |
commit | 1c619fbb50649e2ca430fca425e0df4fc44b4932 (patch) | |
tree | d46aca8088e32e2cd7e66ae3c2d42378188f6d82 /linux/drivers/media/dvb | |
parent | b01856d0825ac217cbf60d11052f0339fda9e78d (diff) | |
download | mediapointer-dvb-s2-1c619fbb50649e2ca430fca425e0df4fc44b4932.tar.gz mediapointer-dvb-s2-1c619fbb50649e2ca430fca425e0df4fc44b4932.tar.bz2 |
Before changing promiscuous/multi state (and temporarily stopping
the network feed), check if there's any difference compared to previous
setting which is already set
Diffstat (limited to 'linux/drivers/media/dvb')
-rw-r--r-- | linux/drivers/media/dvb/dvb-core/dvb_net.c | 77 |
1 files changed, 47 insertions, 30 deletions
diff --git a/linux/drivers/media/dvb/dvb-core/dvb_net.c b/linux/drivers/media/dvb/dvb-core/dvb_net.c index ca6bc2eeb..c785ec004 100644 --- a/linux/drivers/media/dvb/dvb-core/dvb_net.c +++ b/linux/drivers/media/dvb/dvb-core/dvb_net.c @@ -280,48 +280,63 @@ dvb_net_feed_stop(struct net_device *dev) } static int -dvb_set_mc_filter(struct net_device *dev, struct dev_mc_list *mc) +dvb_add_mc_filter(struct net_device *dev, struct dev_mc_list *mc) { struct dvb_net_priv *priv = (struct dvb_net_priv*) dev->priv; + int ret; - if (priv->multi_num==DVB_NET_MULTICAST_MAX) + if (priv->multi_num >= DVB_NET_MULTICAST_MAX) return -ENOMEM; + ret = memcmp(priv->multi_macs[priv->multi_num], mc->dmi_addr, 6); memcpy(priv->multi_macs[priv->multi_num], mc->dmi_addr, 6); - + priv->multi_num++; - return 0; + + return ret; } static void dvb_net_set_multi(struct net_device *dev) { struct dvb_net_priv *priv = (struct dvb_net_priv*) dev->priv; + struct dev_mc_list *mc; + int mci; + int update = 0; + + if(dev->flags & IFF_PROMISC) { +// printk("%s: promiscuous mode\n", dev->name); + if(priv->mode != 3) + update = 1; + priv->mode = 3; + } else if(dev->flags & IFF_ALLMULTI) { +// printk("%s: allmulti mode\n", dev->name); + if(priv->mode != 2) + update = 1; + priv->mode = 2; + } else if(dev->mc_count > 0) { +// printk("%s: set_mc_list, %d entries\n", +// dev->name, dev->mc_count); + if(priv->mode != 1) + update = 1; + priv->mode = 1; + priv->multi_num = 0; + for (mci = 0, mc=dev->mc_list; + mci < dev->mc_count; + mc=mc->next, mci++) + if(dvb_add_mc_filter(dev, mc) != 0) + update = 1; + } else { + if(priv->mode != 0) + update = 1; + priv->mode = 0; + } - dvb_net_feed_stop(dev); - - priv->mode=0; - if (dev->flags&IFF_PROMISC) { - printk("%s: promiscuous mode\n", dev->name); - priv->mode=3; - } else if((dev->flags&IFF_ALLMULTI)) { - printk("%s: allmulti mode\n", dev->name); - priv->mode=2; - } else if(dev->mc_count) { - int mci; - struct dev_mc_list *mc; - - printk("%s: set_mc_list, %d entries\n", - dev->name, dev->mc_count); - priv->mode=1; - priv->multi_num=0; - for (mci=0, mc=dev->mc_list; - mci<dev->mc_count; - mc=mc->next, mci++) { - dvb_set_mc_filter(dev, mc); - } + if(netif_running(dev) != 0 && update > 0) + { + dvb_net_feed_stop(dev); + dvb_net_feed_start(dev); } - dvb_net_feed_start(dev); } static int @@ -336,13 +351,15 @@ static int dvb_net_set_mac(struct net_device *dev, void *p) { struct sockaddr *addr=p; + int update; + update = memcmp(dev->dev_addr, addr->sa_data, dev->addr_len); memcpy(dev->dev_addr, addr->sa_data, dev->addr_len); - if (netif_running(dev)) { - dvb_net_feed_stop(dev); + if (netif_running(dev) != 0 && update > 0) { + dvb_net_feed_stop(dev); dvb_net_feed_start(dev); } - return 0; + return 0; } |