Thread (32 messages) 32 messages, 5 authors, 2011-09-26

Re: [net-next-2.6 PATCH 3/3 RFC] macvtap: Add support for TUNSETTXFILTER

flat view

From: Arnd Bergmann <arnd@arndb.de>
Date: 2011-09-08 22:54:47

On Wednesday 07 September 2011, Roopa Prabhu wrote:
From: Roopa Prabhu <redacted>

This patch adds support for TUNSETTXFILTER. Calls macvlan set filter function
with address list and flags received via TUNSETTXFILTER.

Signed-off-by: Roopa Prabhu <redacted>
Signed-off-by: Christian Benvenuti <redacted>
Signed-off-by: David Wang <redacted>
Looks ok to me in principle, but
quoted hunk ↗ jump to hunk
+               /* XXX: If broadcast address present, set IFF_BROADCAST */
+               /* XXX: If multicast address present, set IFF_MULTICAST */
+               flags |= (tf.flags & TUN_FLT_ALLMULTI ? IFF_ALLMULTI : 0) |
+                        (!tf.count ? IFF_PROMISC : 0);
+               ret = 0;
+               if (tf.count > 0) {
+                       alen = ETH_ALEN * tf.count;
+                       addrs = kmalloc(alen, GFP_KERNEL);
+                       if (!addrs) {
+                               dev_put(vlan->dev);
+                               return -ENOMEM;
+                       }
I think you need to check tf.count for a maximum value. In theory, a user
could pass a rather large number (65536) which is not good.

Also the TUNSETTXFILTER code looks sufficiently large that it would be
better to put it into a separate function. Use "goto" statements in
order to do the error handling in there, instead of repeating
lots of kfree and dev_put calls in each error case.

	Arnd
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help