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
5d66f72c
Commit
5d66f72c
authored
Aug 23, 2013
by
Pavel Emelyanov
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
zdtm: Check tap's hwaddr doesn't change after c/r
Signed-off-by:
Pavel Emelyanov
<
xemul@parallels.com
>
parent
022cfc30
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
28 additions
and
0 deletions
+28
-0
tun.c
test/zdtm/live/static/tun.c
+28
-0
No files found.
test/zdtm/live/static/tun.c
View file @
5d66f72c
...
...
@@ -99,9 +99,23 @@ static void check_tun(int fd, char *name, unsigned flags)
}
}
static
int
dev_get_hwaddr
(
int
fd
,
char
*
a
)
{
struct
ifreq
ifr
;
if
(
ioctl
(
fd
,
SIOCGIFHWADDR
,
&
ifr
)
<
0
)
{
err
(
"Can't get hwaddr"
);
return
-
1
;
}
memcpy
(
a
,
ifr
.
ifr_hwaddr
.
sa_data
,
ETH_ALEN
);
return
0
;
}
int
main
(
int
argc
,
char
**
argv
)
{
int
fds
[
5
],
ret
;
char
addr
[
ETH_ALEN
],
a2
[
ETH_ALEN
];
test_init
(
argc
,
argv
);
...
...
@@ -155,6 +169,11 @@ int main(int argc, char **argv)
return
-
1
;
}
if
(
dev_get_hwaddr
(
fds
[
4
],
addr
)
<
0
)
{
err
(
"No hwaddr for tap?"
);
return
-
1
;
}
close
(
ret
);
test_daemon
();
...
...
@@ -200,6 +219,15 @@ int main(int argc, char **argv)
}
check_tun
(
fds
[
4
],
"tapx0"
,
IFF_TAP
);
if
(
dev_get_hwaddr
(
fds
[
4
],
a2
)
<
0
)
{
err
(
"No hwaddr for tap? (2)"
);
any_fail
=
1
;
}
else
if
(
memcmp
(
addr
,
a2
,
sizeof
(
addr
)))
{
fail
(
"Address mismatch on tap %x:%x -> %x:%x"
,
(
int
)
addr
[
0
],
(
int
)
addr
[
1
],
(
int
)
a2
[
0
],
(
int
)
a2
[
1
]);
any_fail
=
1
;
}
if
(
!
any_fail
)
pass
();
...
...
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