]> git.kernelconcepts.de Git - karo-tx-linux.git/commitdiff
[netdrvr] Drivers should not set IFF_* flag themselves
authorWang Chen <wangchen@cn.fujitsu.com>
Tue, 22 Jul 2008 05:13:12 +0000 (13:13 +0800)
committerJeff Garzik <jgarzik@redhat.com>
Thu, 7 Aug 2008 06:23:19 +0000 (02:23 -0400)
Some hardware set promisc when they are requested to set IFF_ALLMULTI flag.
It's ok, but if drivers set IFF_PROMISC flag when they set promisc,
it will broken upper layer handle for promisc and allmulti.
In addition, drivers can use their own hardware programming to make it.
So do not allow drivers to set IFF_* flags.

This is a general driver fix, so I didn't split it to pieces and send
to specific driver maintainers.

Signed-off-by: Wang Chen <wangchen@cn.fujitsu.com>
Signed-off-by: Jeff Garzik <jgarzik@redhat.com>
13 files changed:
drivers/net/3c523.c
drivers/net/3c527.c
drivers/net/atp.c
drivers/net/de620.c
drivers/net/eepro.c
drivers/net/eth16i.c
drivers/net/lp486e.c
drivers/net/ni5010.c
drivers/net/ni52.c
drivers/net/sun3_82586.c
drivers/net/wireless/orinoco.c
drivers/net/wireless/wavelan.c
drivers/net/wireless/wavelan_cs.c

index dc6e474229b1fae95923ce733b5647d9ac4be771..e2ce41d3828ed47e90b31c7e09d7cb29649a1373 100644 (file)
@@ -640,10 +640,8 @@ static int init586(struct net_device *dev)
        cfg_cmd->time_low = 0x00;
        cfg_cmd->time_high = 0xf2;
        cfg_cmd->promisc = 0;
-       if (dev->flags & (IFF_ALLMULTI | IFF_PROMISC)) {
+       if (dev->flags & (IFF_ALLMULTI | IFF_PROMISC))
                cfg_cmd->promisc = 1;
-               dev->flags |= IFF_PROMISC;
-       }
        cfg_cmd->carr_coll = 0x00;
 
        p->scb->cbl_offset = make16(cfg_cmd);
index 6aca0c640f13949ae2033cac47df4e1ba3b4783d..abc84f765973e2c30ef55b8e5c34973799dad415 100644 (file)
@@ -1521,14 +1521,11 @@ static void do_mc32_set_multicast_list(struct net_device *dev, int retry)
        struct mc32_local *lp = netdev_priv(dev);
        u16 filt = (1<<2); /* Save Bad Packets, for stats purposes */
 
-       if (dev->flags&IFF_PROMISC)
+       if ((dev->flags&IFF_PROMISC) ||
+           (dev->flags&IFF_ALLMULTI) ||
+           dev->mc_count > 10)
                /* Enable promiscuous mode */
                filt |= 1;
-       else if((dev->flags&IFF_ALLMULTI) || dev->mc_count > 10)
-       {
-               dev->flags|=IFF_PROMISC;
-               filt |= 1;
-       }
        else if(dev->mc_count)
        {
                unsigned char block[62];
index 3d4433358a36ed50b846d2156494c58b6fa61374..c10cd8058e2303da73054ce892d52878123d225c 100644 (file)
@@ -854,14 +854,9 @@ static void set_rx_mode_8002(struct net_device *dev)
        struct net_local *lp = netdev_priv(dev);
        long ioaddr = dev->base_addr;
 
-       if ( dev->mc_count > 0 || (dev->flags & (IFF_ALLMULTI|IFF_PROMISC))) {
-               /* We must make the kernel realise we had to move
-                *      into promisc mode or we start all out war on
-                *      the cable. - AC
-                */
-               dev->flags|=IFF_PROMISC;
+       if (dev->mc_count > 0 || (dev->flags & (IFF_ALLMULTI|IFF_PROMISC)))
                lp->addr_mode = CMR2h_PROMISC;
-       else
+       else
                lp->addr_mode = CMR2h_Normal;
        write_reg_high(ioaddr, CMR2, lp->addr_mode);
 }
index 3f5190c654cf9285e4b9587fcdc53db53ddac952..d454e143483ee39ad64ba0724753af67053527c0 100644 (file)
@@ -488,13 +488,6 @@ static void de620_set_multicast_list(struct net_device *dev)
 {
        if (dev->mc_count || dev->flags&(IFF_ALLMULTI|IFF_PROMISC))
        { /* Enable promiscuous mode */
-               /*
-                *      We must make the kernel realise we had to move
-                *      into promisc mode or we start all out war on
-                *      the cable. - AC
-                */
-               dev->flags|=IFF_PROMISC;
-
                de620_set_register(dev, W_TCR, (TCR_DEF & ~RXPBM) | RXALL);
        }
        else
index 56f50491a453f444412f15ee25b6179b3fd17684..1f11350e16cf24b6a1a25d44ab9f8c41d4481a79 100644 (file)
@@ -1283,14 +1283,6 @@ set_multicast_list(struct net_device *dev)
 
        if (dev->flags&(IFF_ALLMULTI|IFF_PROMISC) || dev->mc_count > 63)
        {
-               /*
-                *      We must make the kernel realise we had to move
-                *      into promisc mode or we start all out war on
-                *      the cable. If it was a promisc request the
-                *      flag is already set. If not we assert it.
-                */
-               dev->flags|=IFF_PROMISC;
-
                eepro_sw2bank2(ioaddr); /* be CAREFUL, BANK 2 now */
                mode = inb(ioaddr + REG2);
                outb(mode | PRMSC_Mode, ioaddr + REG2);
index e3dd8b1369086369f10f30be29a6b716ff2ec552..bee8b3fbc56591c9d8f493ae2295dba5ba849793 100644 (file)
@@ -1356,7 +1356,6 @@ static void eth16i_multicast(struct net_device *dev)
 
        if(dev->mc_count || dev->flags&(IFF_ALLMULTI|IFF_PROMISC))
        {
-               dev->flags|=IFF_PROMISC;        /* Must do this */
                outb(3, ioaddr + RECEIVE_MODE_REG);
        } else {
                outb(2, ioaddr + RECEIVE_MODE_REG);
index 591a7e4220c75058d7f1361d36f60d61274e10af..83fa9d82a004830cecad296d2403cc1dce70c767 100644 (file)
@@ -1272,8 +1272,6 @@ static void set_multicast_list(struct net_device *dev) {
                        return;
                }
                if (dev->mc_count == 0 && !(dev->flags & (IFF_PROMISC | IFF_ALLMULTI))) {
-                       if (dev->flags & IFF_ALLMULTI)
-                               dev->flags |= IFF_PROMISC;
                        lp->i596_config[8] &= ~0x01;
                } else {
                        lp->i596_config[8] |= 0x01;
index a20005c09e0707c22f26e4a22fe1b323b681a010..8e0ca9f4e40479f3fa6ff43c429d45cb69da1b52 100644 (file)
@@ -648,7 +648,6 @@ static void ni5010_set_multicast_list(struct net_device *dev)
        PRINTK2((KERN_DEBUG "%s: entering set_multicast_list\n", dev->name));
 
        if (dev->flags&IFF_PROMISC || dev->flags&IFF_ALLMULTI || dev->mc_list) {
-               dev->flags |= IFF_PROMISC;
                outb(RMD_PROMISC, EDLC_RMODE); /* Enable promiscuous mode */
                PRINTK((KERN_DEBUG "%s: Entering promiscuous mode\n", dev->name));
        } else {
index a316dcc8a06d5e61576c1ce4b1ba9e8073cb0d76..b9a882d362da1f7bdbc34c76be0958815fc2c684 100644 (file)
@@ -621,7 +621,7 @@ static int init586(struct net_device *dev)
                if (num_addrs > len) {
                        printk(KERN_ERR "%s: switching to promisc. mode\n",
                                dev->name);
-                       dev->flags |= IFF_PROMISC;
+                       writeb(0x01, &cfg_cmd->promisc);
                }
        }
        if (dev->flags & IFF_PROMISC)
index 9b2a7f7bb25863f1c2e68e14865bc3f1f4ff85c7..e531302d95f5078680e1065bda74550346574055 100644 (file)
@@ -425,14 +425,11 @@ static int init586(struct net_device *dev)
                int len = ((char *) p->iscp - (char *) ptr - 8) / 6;
                if(num_addrs > len)     {
                        printk("%s: switching to promisc. mode\n",dev->name);
-                       dev->flags|=IFF_PROMISC;
+                       cfg_cmd->promisc = 1;
                }
        }
        if(dev->flags&IFF_PROMISC)
-       {
-                        cfg_cmd->promisc=1;
-                        dev->flags|=IFF_PROMISC;
-       }
+               cfg_cmd->promisc = 1;
        cfg_cmd->carr_coll      = 0x00;
 
        p->scb->cbl_offset      = make16(cfg_cmd);
index b047306bf38681da30132a061c44b82de4efb029..1ebcafe7ca5fd7aa90421385ee864c0459a8d17f 100644 (file)
@@ -1998,13 +1998,6 @@ __orinoco_set_multicast_list(struct net_device *dev)
                else
                        priv->mc_count = mc_count;
        }
-
-       /* Since we can set the promiscuous flag when it wasn't asked
-          for, make sure the net_device knows about it. */
-       if (priv->promiscuous)
-               dev->flags |= IFF_PROMISC;
-       else
-               dev->flags &= ~IFF_PROMISC;
 }
 
 /* This must be called from user context, without locks held - use
index 49ae970039524bea6dd6e47c173045f49c01f60c..136220b5ca81a389fee29bf0a28d622723c0d927 100644 (file)
@@ -1409,9 +1409,6 @@ static void wavelan_set_multicast_list(struct net_device * dev)
                        lp->mc_count = 0;
 
                        wv_82586_reconfig(dev);
-
-                       /* Tell the kernel that we are doing a really bad job. */
-                       dev->flags |= IFF_PROMISC;
                }
        } else
                /* Are there multicast addresses to send? */
index b584c0ecc62d1eeb191d6d5443eb34ec650b242d..00a3559e5aa4c362d62b0baae8a545bd853ac3c6 100644 (file)
@@ -1412,9 +1412,6 @@ wavelan_set_multicast_list(struct net_device *    dev)
          lp->mc_count = 0;
 
          wv_82593_reconfig(dev);
-
-         /* Tell the kernel that we are doing a really bad job... */
-         dev->flags |= IFF_PROMISC;
        }
     }
   else
@@ -1433,9 +1430,6 @@ wavelan_set_multicast_list(struct net_device *    dev)
            lp->mc_count = 0;
 
            wv_82593_reconfig(dev);
-
-           /* Tell the kernel that we are doing a really bad job... */
-           dev->flags |= IFF_ALLMULTI;
          }
       }
     else