]> git.baikalelectronics.ru Git - kernel.git/commit
macvlan: don't touch promisc without passthrough
authorMichael S. Tsirkin <mst@redhat.com>
Thu, 13 Jun 2013 07:07:29 +0000 (10:07 +0300)
committerDavid S. Miller <davem@davemloft.net>
Thu, 13 Jun 2013 08:20:33 +0000 (01:20 -0700)
commit8dac05c59bf79ec6f88ca07187677fa43d737642
treea2ee090e38c77ed35834cc1fbb646f8866b8b234
parent2e1031851d5b2a0243318bc4ccaac1c40cc80e4f
macvlan: don't touch promisc without passthrough

commit a3e17141dde26b498f4a33e8139dfe0fc2e874d2
"macvlan: add FDB bridge ops and macvlan flags"
added a way to control NOPROMISC macvlan flag through netlink.

However, with a non passthrough device we never set promisc on open,
even if NOPROMISC is off.  As a result:

If userspace clears NOPROMISC on open, then does not clear it on a
netlink command, promisc counter is not decremented on stop and there
will be no way to clear it once macvlan is detached.

If userspace does not clear NOPROMISC on open, then sets NOPROMISC on a
netlink command, promisc counter will be decremented from 0 and overflow
to fffffffff with no way to clear promisc.

To fix, simply ignore NOPROMISC flag in a netlink command for
non-passthrough devices, same as we do at open/close.

Since we touch this code anyway - check dev_set_promiscuity return code
and pass it to users (though an error here is unlikely).

Cc: "David S. Miller" <davem@davemloft.net>
Reviewed-by: John Fastabend <john.r.fastabend@intel.com>
Signed-off-by: Michael S. Tsirkin <mst@redhat.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
drivers/net/macvlan.c