Commit b2416ee9 authored by Jialin Li's avatar Jialin Li
Browse files

tofino: ignore outgoing packets when reading from virtual interfaces

parent 0ccba642
......@@ -80,9 +80,12 @@ static void switch_to_dev(size_t port) {
static const int BUFFER_SIZE = 2048;
char buf[BUFFER_SIZE];
volatile union SimbricksProtoNetN2D *msg_to;
struct sockaddr_ll addr;
socklen_t addr_len;
ssize_t n = recv(tofino_fds.at(port), buf, BUFFER_SIZE, 0);
if (n <= 0) {
ssize_t n = recvfrom(tofino_fds.at(port), buf, BUFFER_SIZE, 0,
(struct sockaddr*)&addr, &addr_len);
if (n <= 0 || addr.sll_pkttype == PACKET_OUTGOING) {
return;
}
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment