Skip to content
Projects
Groups
Snippets
Help
Loading...
Sign in
Toggle navigation
C
criu
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
zhul
criu
Commits
398bec28
Commit
398bec28
authored
Aug 16, 2012
by
Pavel Emelyanov
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
zdtm: Test for packet fanout
Signed-off-by:
Pavel Emelyanov
<
xemul@parallels.com
>
parent
4ee3345b
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
33 additions
and
0 deletions
+33
-0
packet_sock.c
test/zdtm/live/static/packet_sock.c
+33
-0
No files found.
test/zdtm/live/static/packet_sock.c
View file @
398bec28
...
...
@@ -24,6 +24,11 @@ const char *test_author = "Pavel Emelyanov <xemul@parallels.com>";
#include <net/ethernet.h>
#define SK_RESERVE 8
#define DEF_FANOUT 13
#ifndef PACKET_FANOUT
#define PACKET_FANOUT 18
#endif
static
int
test_sockaddr
(
int
n
,
struct
sockaddr_ll
*
have
,
struct
sockaddr_ll
*
want
)
{
...
...
@@ -128,6 +133,12 @@ int main(int argc, char **argv)
return
1
;
}
yes
=
DEF_FANOUT
;
if
(
setsockopt
(
sk2
,
SOL_PACKET
,
PACKET_FANOUT
,
&
yes
,
sizeof
(
yes
))
<
0
)
{
err
(
"Can't configure fanout %m"
);
return
1
;
}
memset
(
&
mreq
,
0
,
sizeof
(
mreq
));
mreq
.
mr_ifindex
=
1
;
mreq
.
mr_type
=
PACKET_MR_PROMISC
;
...
...
@@ -187,6 +198,17 @@ int main(int argc, char **argv)
return
1
;
}
alen
=
sizeof
(
yes
);
if
(
getsockopt
(
sk1
,
SOL_PACKET
,
PACKET_FANOUT
,
&
yes
,
&
alen
)
<
0
)
{
fail
(
"Can't read fanout back %m"
);
return
1
;
}
if
(
yes
!=
0
)
{
fail
(
"Fanout screwed up to %x"
,
yes
);
return
1
;
}
alen
=
sizeof
(
addr
);
if
(
getsockname
(
sk2
,
(
struct
sockaddr
*
)
&
addr
,
&
alen
)
<
0
)
{
fail
(
"Can't get sockname 2 rst"
);
...
...
@@ -227,6 +249,17 @@ int main(int argc, char **argv)
return
1
;
}
alen
=
sizeof
(
yes
);
if
(
getsockopt
(
sk2
,
SOL_PACKET
,
PACKET_FANOUT
,
&
yes
,
&
alen
)
<
0
)
{
fail
(
"Can't read fanout2 back %m"
);
return
1
;
}
if
(
yes
!=
DEF_FANOUT
)
{
fail
(
"Fanout2 screwed up to %x"
,
yes
);
return
1
;
}
pass
();
return
0
;
}
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