lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-Id: <1231950031.7109.307.camel@lappy>
Date:	Wed, 14 Jan 2009 09:20:31 -0700
From:	Alex Williamson <alex.williamson@...com>
To:	Mark McLoughlin <markmc@...hat.com>
Cc:	Rusty Russell <rusty@...tcorp.com.au>, kvm <kvm@...r.kernel.org>,
	netdev <netdev@...r.kernel.org>
Subject: Re: [PATCH 4/4] virtio_net: Add a MAC filter table

On Wed, 2009-01-14 at 10:15 +0000, Mark McLoughlin wrote:
> On Tue, 2009-01-13 at 14:23 -0700, Alex Williamson wrote:
> > Number of entries configurable via module param.
> 
> Could do with some more details here, like explaining that it means the
> we no longer run the NIC in promiscuous mode and the guest only receives
> packets destined for it.

Yep, thanks.

> > +	else {
> > +		unsigned int entries;
> > +
> > +		entries = mac_entries = min(mac_entries,
> > +					(unsigned int)(PAGE_SIZE / ETH_ALEN));
> > +		if (virtnet_send_command(vi, VIRTIO_NET_CTRL_MAC_TABLE,
> > +					 VIRTIO_NET_CTRL_MAC_TABLE_ALLOC,
> > +					 &entries, sizeof(entries)))
> > +			mac_entries = 0;
> > +	}
> 
> Should have a warning here.

I agree.

> Also, no need for the extra variable or the case, is there?

Initially, that's what I thought too... but it doesn't work, I always
got 0 on the backend.  I assume it has something to do with the memory
segment mac_entries lives in as a static variable.

> >  	/* Initialize our empty receive and send queues. */
> >  	skb_queue_head_init(&vi->recv);
> > diff --git a/include/linux/virtio_net.h b/include/linux/virtio_net.h
> > index 80cd7d3..31235a0 100644
> > --- a/include/linux/virtio_net.h
> > +++ b/include/linux/virtio_net.h
> > @@ -60,4 +60,8 @@ struct virtio_net_hdr_mrg_rxbuf {
> >   #define VIRTIO_NET_CTRL_RX_MODE_PROMISC      0
> >   #define VIRTIO_NET_CTRL_RX_MODE_ALLMULTI     1
> >  
> > +#define VIRTIO_NET_CTRL_MAC_TABLE  1
> > + #define VIRTIO_NET_CTRL_MAC_TABLE_ALLOC      0
> > + #define VIRTIO_NET_CTRL_MAC_TABLE_SET        1
> 
> I'd prefer:
> 
> #define VIRTIO_NET_CMD_ALLOC_MAC_TABLE 1
> #define VIRTIO_NET_CMD_SET_MAC_TABLE   2

Hmm, I'm still leaning towards the class/cmd, which would allow the
backend to logically split class commands into sub-functions.  But i'd
be happy to rename these to VIRTIO_NET_CMD_...

> Also, could do with some comments here to note e.g.:
> 
>   - alloc before set
>   - subsequent allocs will fail
>   - table limited to PAGE_SIZE (hmm, who's PAGE_SIZE?)
>   - format of the table

Agree, thanks for the comments.

Alex

-- 
Alex Williamson                             HP Open Source & Linux Org.

--
To unsubscribe from this list: send the line "unsubscribe netdev" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ