Skip to content
Snippets Groups Projects
Commit 05737427 authored by Neal Cardwell's avatar Neal Cardwell
Browse files

net-test: packetdrill: fix bug in remote mode packet sniffing direction

Fix wire_server_netdev_receive() to reflect the fact that in remote
mode the server is sniffing packets that are inbound (whereas in local
mode we are sniffing *outbound* packets).

This was a bug introduced in "net-test: packetdrill encap
support: refactor packet receive loops into one loop".

Remote mode has been broken since the addition of encapsulation
support, partly due to this issue.

Change-Id: Ia92f70f48ae90cb2e089ee51d728473a12c63595
parent 5580e026
No related branches found
No related tags found
No related merge requests found
......@@ -371,11 +371,12 @@ static int local_netdev_receive(struct netdev *a_netdev,
DEBUGP("local_netdev_receive\n");
return netdev_receive_loop(netdev->psock, PACKET_LAYER_3_IP,
packet, error);
DIRECTION_OUTBOUND, packet, error);
}
int netdev_receive_loop(struct packet_socket *psock,
enum packet_layer_t layer,
enum direction_t direction,
struct packet **packet,
char **error)
{
......@@ -388,8 +389,7 @@ int netdev_receive_loop(struct packet_socket *psock,
*packet = packet_new(PACKET_READ_BYTES);
/* Sniff the next outbound packet from the kernel under test. */
if (packet_socket_receive(psock, DIRECTION_OUTBOUND,
*packet, &in_bytes))
if (packet_socket_receive(psock, direction, *packet, &in_bytes))
continue;
result = parse_packet(*packet, in_bytes, layer, error);
......
......@@ -88,6 +88,7 @@ static inline int netdev_receive(struct netdev *netdev,
*/
extern int netdev_receive_loop(struct packet_socket *psock,
enum packet_layer_t layer,
enum direction_t direction,
struct packet **packet,
char **error);
......
......@@ -192,7 +192,7 @@ static int wire_server_netdev_receive(struct netdev *a_netdev,
DEBUGP("wire_server_netdev_receive\n");
return netdev_receive_loop(netdev->psock, PACKET_LAYER_2_ETHERNET,
packet, error);
DIRECTION_INBOUND, packet, error);
}
struct netdev_ops wire_server_netdev_ops = {
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment