aboutsummaryrefslogtreecommitdiff
path: root/src/usr
diff options
context:
space:
mode:
authorMichael Brown <mcb30@ipxe.org>2014-07-29 15:15:28 +0100
committerMichael Brown <mcb30@ipxe.org>2014-07-29 15:20:49 +0100
commit721a4920207634c688608007ef0d63c15a696c0d (patch)
tree0771171534dc6b41e6e46984fb709555b46a3f79 /src/usr
parentec30c856a80270578a90528ecffdaf4eaf148503 (diff)
downloadipxe-721a4920207634c688608007ef0d63c15a696c0d.zip
ipxe-721a4920207634c688608007ef0d63c15a696c0d.tar.gz
ipxe-721a4920207634c688608007ef0d63c15a696c0d.tar.bz2
[lotest] Discard packets arriving on the incorrect network device
Commit 24bbaf6 ("[lotest] Allow loopback testing on shared networks") introduced a regression in which loopback testing packets would be accepted from any network device. This produces unexpected results, such as VLAN loopback testing succeeding even when incorrectly using the underlying trunk device as either transmitter or receiver. Fix by discarding any loopback testing packets which arrive on a network device other than the current loopback testing receiver. Signed-off-by: Michael Brown <mcb30@ipxe.org>
Diffstat (limited to 'src/usr')
-rw-r--r--src/usr/lotest.c12
1 files changed, 6 insertions, 6 deletions
diff --git a/src/usr/lotest.c b/src/usr/lotest.c
index 9e2ac33..ad7a2fa 100644
--- a/src/usr/lotest.c
+++ b/src/usr/lotest.c
@@ -39,8 +39,8 @@ FILE_LICENCE ( GPL2_OR_LATER );
*
*/
-/** Loopback testing in progress flag */
-static int lotest_active;
+/** Current loopback test receiver */
+static struct net_device *lotest_receiver;
/** Loopback testing received packets */
static LIST_HEAD ( lotest_queue );
@@ -56,13 +56,13 @@ static LIST_HEAD ( lotest_queue );
* @ret rc Return status code
*/
static int lotest_rx ( struct io_buffer *iobuf,
- struct net_device *netdev __unused,
+ struct net_device *netdev,
const void *ll_dest __unused,
const void *ll_source __unused,
unsigned int flags __unused ) {
/* Add to received packet queue if currently performing a test */
- if ( lotest_active ) {
+ if ( netdev == lotest_receiver ) {
list_add_tail ( &iobuf->list, &lotest_queue );
} else {
free_iob ( iobuf );
@@ -223,7 +223,7 @@ int loopback_test ( struct net_device *sender, struct net_device *receiver,
/* Start loopback test */
lotest_flush();
- lotest_active = 1;
+ lotest_receiver = receiver;
/* Perform loopback test */
for ( successes = 0 ; ; successes++ ) {
@@ -261,7 +261,7 @@ int loopback_test ( struct net_device *sender, struct net_device *receiver,
printf ( "\n");
/* Stop loopback testing */
- lotest_active = 0;
+ lotest_receiver = NULL;
lotest_flush();
/* Dump final statistics */