Skip to content
GitLab
Menu
Projects
Groups
Snippets
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Menu
Open sidebar
ycai
simbricks
Commits
b2416ee9
Commit
b2416ee9
authored
Aug 24, 2021
by
Jialin Li
Browse files
tofino: ignore outgoing packets when reading from virtual interfaces
parent
0ccba642
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
5 additions
and
2 deletions
+5
-2
sims/tofino/tofino.cc
sims/tofino/tofino.cc
+5
-2
No files found.
sims/tofino/tofino.cc
View file @
b2416ee9
...
@@ -80,9 +80,12 @@ static void switch_to_dev(size_t port) {
...
@@ -80,9 +80,12 @@ static void switch_to_dev(size_t port) {
static
const
int
BUFFER_SIZE
=
2048
;
static
const
int
BUFFER_SIZE
=
2048
;
char
buf
[
BUFFER_SIZE
];
char
buf
[
BUFFER_SIZE
];
volatile
union
SimbricksProtoNetN2D
*
msg_to
;
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
);
ssize_t
n
=
recvfrom
(
tofino_fds
.
at
(
port
),
buf
,
BUFFER_SIZE
,
0
,
if
(
n
<=
0
)
{
(
struct
sockaddr
*
)
&
addr
,
&
addr_len
);
if
(
n
<=
0
||
addr
.
sll_pkttype
==
PACKET_OUTGOING
)
{
return
;
return
;
}
}
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment