Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
L
lxc
Project
Overview
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
Chen Yisong
lxc
Commits
e360d52a
Unverified
Commit
e360d52a
authored
Jun 14, 2017
by
Christian Brauner
Committed by
Stéphane Graber
Jul 16, 2017
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
network: add lxc_log_configured_netdevs()
This logs the configured networks on the trace level to support debugging. Signed-off-by:
Christian Brauner
<
christian.brauner@ubuntu.com
>
parent
9c8ca2a5
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
62 additions
and
0 deletions
+62
-0
conf.c
src/lxc/conf.c
+3
-0
confile_utils.c
src/lxc/confile_utils.c
+58
-0
confile_utils.h
src/lxc/confile_utils.h
+1
-0
No files found.
src/lxc/conf.c
View file @
e360d52a
...
...
@@ -77,6 +77,7 @@
#include "caps.h"
/* for lxc_caps_last_cap() */
#include "cgroup.h"
#include "conf.h"
#include "confile_utils.h"
#include "error.h"
#include "log.h"
#include "lxcaufs.h"
...
...
@@ -2944,6 +2945,8 @@ int lxc_create_network(struct lxc_handler *handler)
if
(
!
am_root
)
return
0
;
lxc_log_configured_netdevs
(
handler
->
conf
);
lxc_list_for_each
(
iterator
,
network
)
{
netdev
=
iterator
->
elem
;
...
...
src/lxc/confile_utils.c
View file @
e360d52a
...
...
@@ -235,3 +235,61 @@ struct lxc_netdev *lxc_get_netdev_by_idx(struct lxc_conf *conf,
return
netdev
;
}
void
lxc_log_configured_netdevs
(
const
struct
lxc_conf
*
conf
)
{
struct
lxc_netdev
*
netdev
;
struct
lxc_list
*
it
=
(
struct
lxc_list
*
)
&
conf
->
network
;;
if
((
conf
->
loglevel
!=
LXC_LOG_LEVEL_TRACE
)
&&
(
lxc_log_get_level
()
!=
LXC_LOG_LEVEL_TRACE
))
return
;
if
(
lxc_list_empty
(
it
))
{
TRACE
(
"container has no networks configured"
);
return
;
}
lxc_list_for_each
(
it
,
&
conf
->
network
)
{
netdev
=
it
->
elem
;
TRACE
(
"index: %d"
,
netdev
->
idx
);
switch
(
netdev
->
type
)
{
case
LXC_NET_VETH
:
TRACE
(
"type: veth"
);
break
;
case
LXC_NET_MACVLAN
:
TRACE
(
"type: macvlan"
);
break
;
case
LXC_NET_VLAN
:
TRACE
(
"type: vlan"
);
break
;
case
LXC_NET_PHYS
:
TRACE
(
"type: phys"
);
break
;
case
LXC_NET_EMPTY
:
TRACE
(
"type: empty"
);
break
;
case
LXC_NET_NONE
:
TRACE
(
"type: none"
);
break
;
default:
ERROR
(
"invalid network type %d"
,
netdev
->
type
);
return
;
}
TRACE
(
"flags: %s"
,
netdev
->
flags
==
IFF_UP
?
"up"
:
"none"
);
if
(
netdev
->
link
)
TRACE
(
"link: %s"
,
netdev
->
link
);
if
(
netdev
->
name
)
TRACE
(
"name: %s"
,
netdev
->
name
);
if
(
netdev
->
hwaddr
)
TRACE
(
"hwaddr: %s"
,
netdev
->
hwaddr
);
if
(
netdev
->
mtu
)
TRACE
(
"mtu: %s"
,
netdev
->
mtu
);
if
(
netdev
->
upscript
)
TRACE
(
"upscript: %s"
,
netdev
->
upscript
);
if
(
netdev
->
downscript
)
TRACE
(
"downscript: %s"
,
netdev
->
downscript
);
}
}
src/lxc/confile_utils.h
View file @
e360d52a
...
...
@@ -32,5 +32,6 @@ extern struct lxc_netdev *lxc_find_netdev_by_idx(struct lxc_conf *conf,
unsigned
int
idx
);
extern
struct
lxc_netdev
*
lxc_get_netdev_by_idx
(
struct
lxc_conf
*
conf
,
unsigned
int
idx
);
extern
void
lxc_log_configured_netdevs
(
const
struct
lxc_conf
*
conf
);
#endif
/* __LXC_CONFILE_UTILS_H */
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