lib/netdev-linux.c: Prevent receiving of sent packets
authorMurphy McCauley <murphy.mccauley@gmail.com>
Thu, 13 Jun 2013 21:41:21 +0000 (14:41 -0700)
committerBen Pfaff <blp@nicira.com>
Thu, 13 Jun 2013 21:43:29 +0000 (14:43 -0700)
commit32383c3bd064fb87ec2b366569ba1185698c2e6d
tree096612d99d7de97b5e0e6a0a784286691e37df0f
parentddd3c9755d5fb1606445a72fb5f25e615518a162
lib/netdev-linux.c: Prevent receiving of sent packets

Commit 796223f5 (netdev: Add new "struct netdev_rx" for capturing packets
from a netdev) refactored send and receive into separate netdevs.  As a
result, send and receive now use different socket descriptors (except for tap
interfaces which are treated specially).  An unintended side effect was that
all sent packets are looped back and received, which had previously been
avoided as the kernel specifically prevents this from happening on a single
socket descriptor.

To resolve the situation, a socket filter is added to the receive socket
so that it only accepts inbound packets.

Simon Horman co-discovered and initially reported this issue.

Signed-off-by: Murphy McCauley <murphy.mccauley@gmail.com>
Signed-off-by: Ben Pfaff <blp@nicira.com>
Tested-by: Simon Horman <horms@verge.net.au>
Reviewed-by: Simon Horman <horms@verge.net.au>
AUTHORS
include/sparse/sys/socket.h
lib/netdev-linux.c