diff options
author | Eric W. Biederman <ebiederm@xmission.com> | 2009-05-19 14:27:17 -0400 |
---|---|---|
committer | David S. Miller <davem@davemloft.net> | 2009-05-21 18:13:39 -0400 |
commit | d95ed9275edcb8995bda31005bb3f55e087626d7 (patch) | |
tree | bbaefa252b6e8f7386073ed27fb9c9f3a64cb55f /net/packet/af_packet.c | |
parent | ca0f31125c5cf0d48f47c2e1a3785a08876a7e87 (diff) |
af_packet: Teach to listen for multiple unicast addresses.
The the PACKET_ADD_MEMBERSHIP and the PACKET_DROP_MEMBERSHIP setsockopt
calls for af_packet already has all of the infrastructure needed to subscribe
to multiple mac addresses. All that is missing is a flag to say that
the address we want to listen on is a unicast address.
So introduce PACKET_MR_UNICAST and wire it up to dev_unicast_add and
dev_unicast_delete.
Additionally I noticed that errors from dev_mc_add were not propagated
from packet_dev_mc so fix that.
Signed-off-by: Eric W. Biederman <ebiederm@aristanetworks.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'net/packet/af_packet.c')
-rw-r--r-- | net/packet/af_packet.c | 10 |
1 files changed, 8 insertions, 2 deletions
diff --git a/net/packet/af_packet.c b/net/packet/af_packet.c index 766e6b41f7ca..c7c5d524967e 100644 --- a/net/packet/af_packet.c +++ b/net/packet/af_packet.c | |||
@@ -1570,9 +1570,9 @@ static int packet_dev_mc(struct net_device *dev, struct packet_mclist *i, | |||
1570 | switch (i->type) { | 1570 | switch (i->type) { |
1571 | case PACKET_MR_MULTICAST: | 1571 | case PACKET_MR_MULTICAST: |
1572 | if (what > 0) | 1572 | if (what > 0) |
1573 | dev_mc_add(dev, i->addr, i->alen, 0); | 1573 | return dev_mc_add(dev, i->addr, i->alen, 0); |
1574 | else | 1574 | else |
1575 | dev_mc_delete(dev, i->addr, i->alen, 0); | 1575 | return dev_mc_delete(dev, i->addr, i->alen, 0); |
1576 | break; | 1576 | break; |
1577 | case PACKET_MR_PROMISC: | 1577 | case PACKET_MR_PROMISC: |
1578 | return dev_set_promiscuity(dev, what); | 1578 | return dev_set_promiscuity(dev, what); |
@@ -1580,6 +1580,12 @@ static int packet_dev_mc(struct net_device *dev, struct packet_mclist *i, | |||
1580 | case PACKET_MR_ALLMULTI: | 1580 | case PACKET_MR_ALLMULTI: |
1581 | return dev_set_allmulti(dev, what); | 1581 | return dev_set_allmulti(dev, what); |
1582 | break; | 1582 | break; |
1583 | case PACKET_MR_UNICAST: | ||
1584 | if (what > 0) | ||
1585 | return dev_unicast_add(dev, i->addr, i->alen); | ||
1586 | else | ||
1587 | return dev_unicast_delete(dev, i->addr, i->alen); | ||
1588 | break; | ||
1583 | default:; | 1589 | default:; |
1584 | } | 1590 | } |
1585 | return 0; | 1591 | return 0; |