2
0
mirror of https://github.com/openvswitch/ovs synced 2025-10-15 14:17:18 +00:00

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>
This commit is contained in:
Murphy McCauley
2013-06-13 14:41:21 -07:00
committed by Ben Pfaff
parent ddd3c9755d
commit 32383c3bd0
3 changed files with 25 additions and 4 deletions

View File

@@ -1,5 +1,5 @@
/*
* Copyright (c) 2011, 2012 Nicira, Inc.
* Copyright (c) 2011, 2012, 2013 Nicira, Inc.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -106,7 +106,8 @@ enum {
SO_SNDLOWAT,
SO_SNDTIMEO,
SO_TYPE,
SO_RCVBUFFORCE
SO_RCVBUFFORCE,
SO_ATTACH_FILTER
};
enum {