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
b57fb6da
Commit
b57fb6da
authored
Aug 10, 2012
by
Pavel Emelyanov
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
net: Move ifla parsing higher the call-stack
Signed-off-by:
Pavel Emelyanov
<
xemul@parallels.com
>
parent
7f1c9af0
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
13 additions
and
12 deletions
+13
-12
net.c
net.c
+13
-12
No files found.
net.c
View file @
b57fb6da
...
...
@@ -18,19 +18,11 @@ void show_netdevices(int fd, struct cr_options *opt)
pb_show_plain
(
fd
,
PB_NETDEV
);
}
static
int
dump_one_netdev
(
int
type
,
struct
nlmsghdr
*
h
,
struct
ifinfomsg
*
ifi
,
struct
cr_fdset
*
fds
)
static
int
dump_one_netdev
(
int
type
,
struct
ifinfomsg
*
ifi
,
struct
rtattr
**
tb
,
struct
cr_fdset
*
fds
)
{
int
len
=
h
->
nlmsg_len
-
NLMSG_LENGTH
(
sizeof
(
*
ifi
));
struct
rtattr
*
tb
[
IFLA_MAX
+
1
];
NetDeviceEntry
netdev
=
NET_DEVICE_ENTRY__INIT
;
if
(
len
<
0
)
{
pr_err
(
"No iflas for link %d
\n
"
,
ifi
->
ifi_index
);
return
-
1
;
}
parse_rtattr
(
tb
,
IFLA_MAX
,
IFLA_RTA
(
ifi
),
len
);
if
(
!
tb
[
IFLA_IFNAME
])
{
pr_err
(
"No name for link %d
\n
"
,
ifi
->
ifi_index
);
return
-
1
;
...
...
@@ -49,14 +41,23 @@ static int dump_one_link(struct nlmsghdr *hdr, void *arg)
{
struct
cr_fdset
*
fds
=
arg
;
struct
ifinfomsg
*
ifi
;
int
ret
=
0
;
int
ret
=
0
,
len
=
hdr
->
nlmsg_len
-
NLMSG_LENGTH
(
sizeof
(
*
ifi
));
struct
rtattr
*
tb
[
IFLA_MAX
+
1
];
ifi
=
NLMSG_DATA
(
hdr
);
if
(
len
<
0
)
{
pr_err
(
"No iflas for link %d
\n
"
,
ifi
->
ifi_index
);
return
-
1
;
}
parse_rtattr
(
tb
,
IFLA_MAX
,
IFLA_RTA
(
ifi
),
len
);
pr_info
(
"
\t
LD: Got link %d, type %d
\n
"
,
ifi
->
ifi_index
,
ifi
->
ifi_type
);
switch
(
ifi
->
ifi_type
)
{
case
ARPHRD_LOOPBACK
:
ret
=
dump_one_netdev
(
ND_TYPE__LOOPBACK
,
hdr
,
ifi
,
fds
);
ret
=
dump_one_netdev
(
ND_TYPE__LOOPBACK
,
ifi
,
tb
,
fds
);
break
;
default:
pr_err
(
"Unsupported link type %d
\n
"
,
ifi
->
ifi_type
);
...
...
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