Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit c16d1185 authored by Wang Chen's avatar Wang Chen Committed by Jeff Garzik
Browse files

[netdrvr] Drivers should not set IFF_* flag themselves



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: default avatarWang Chen <wangchen@cn.fujitsu.com>
Signed-off-by: default avatarJeff Garzik <jgarzik@redhat.com>
parent fe414248
Loading
Loading
Loading
Loading
+1 −3
Original line number Diff line number Diff line
@@ -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);
+3 −6
Original line number Diff line number Diff line
@@ -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];
+2 −7
Original line number Diff line number Diff line
@@ -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);
}
+0 −7
Original line number Diff line number Diff line
@@ -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
+0 −8
Original line number Diff line number Diff line
@@ -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);
Loading