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
d16bda44
Unverified
Commit
d16bda44
authored
Mar 19, 2020
by
Christian Brauner
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
network: use cleanup attributes
Signed-off-by:
Christian Brauner
<
christian.brauner@ubuntu.com
>
parent
9c66dc4f
Expand all
Hide whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
10 additions
and
12 deletions
+10
-12
network.c
src/lxc/network.c
+0
-0
nl.c
src/lxc/nl.c
+2
-4
nl.h
src/lxc/nl.h
+5
-3
rtnl.c
src/lxc/rtnl.c
+2
-2
rtnl.h
src/lxc/rtnl.h
+1
-3
No files found.
src/lxc/network.c
View file @
d16bda44
This diff is collapsed.
Click to expand it.
src/lxc/nl.c
View file @
d16bda44
...
@@ -319,11 +319,9 @@ errclose:
...
@@ -319,11 +319,9 @@ errclose:
return
err
;
return
err
;
}
}
extern
int
netlink_close
(
struct
nl_handler
*
handler
)
extern
void
netlink_close
(
struct
nl_handler
*
handler
)
{
{
close
(
handler
->
fd
);
close_prot_errno_disarm
(
handler
->
fd
);
handler
->
fd
=
-
1
;
return
0
;
}
}
int
addattr
(
struct
nlmsghdr
*
n
,
size_t
maxlen
,
int
type
,
const
void
*
data
,
int
addattr
(
struct
nlmsghdr
*
n
,
size_t
maxlen
,
int
type
,
const
void
*
data
,
...
...
src/lxc/nl.h
View file @
d16bda44
...
@@ -5,6 +5,8 @@
...
@@ -5,6 +5,8 @@
#include <stdio.h>
#include <stdio.h>
#include "memory_utils.h"
/*
/*
* Use this as a good size to allocate generic netlink messages
* Use this as a good size to allocate generic netlink messages
*/
*/
...
@@ -64,10 +66,9 @@ int netlink_open(struct nl_handler *handler, int protocol);
...
@@ -64,10 +66,9 @@ int netlink_open(struct nl_handler *handler, int protocol);
* the handler is no longer valid
* the handler is no longer valid
*
*
* @handler: a handler to the netlink socket
* @handler: a handler to the netlink socket
*
* Returns 0 on success, < 0 otherwise
*/
*/
int
netlink_close
(
struct
nl_handler
*
handler
);
void
netlink_close
(
struct
nl_handler
*
handler
);
define_cleanup_function
(
struct
nl_handler
*
,
netlink_close
);
/*
/*
* netlink_rcv : receive a netlink message from the kernel.
* netlink_rcv : receive a netlink message from the kernel.
...
@@ -231,6 +232,7 @@ void *nlmsg_reserve(struct nlmsg *nlmsg, size_t len);
...
@@ -231,6 +232,7 @@ void *nlmsg_reserve(struct nlmsg *nlmsg, size_t len);
* @nlmsg: the netlink message to be freed
* @nlmsg: the netlink message to be freed
*/
*/
void
nlmsg_free
(
struct
nlmsg
*
nlmsg
);
void
nlmsg_free
(
struct
nlmsg
*
nlmsg
);
define_cleanup_function
(
struct
nlmsg
*
,
nlmsg_free
);
/*
/*
* nlmsg_data : returns a pointer to the data contained in the netlink message
* nlmsg_data : returns a pointer to the data contained in the netlink message
...
...
src/lxc/rtnl.c
View file @
d16bda44
...
@@ -21,9 +21,9 @@ extern int rtnetlink_open(struct rtnl_handler *handler)
...
@@ -21,9 +21,9 @@ extern int rtnetlink_open(struct rtnl_handler *handler)
return
netlink_open
(
&
handler
->
nlh
,
NETLINK_ROUTE
);
return
netlink_open
(
&
handler
->
nlh
,
NETLINK_ROUTE
);
}
}
extern
int
rtnetlink_close
(
struct
rtnl_handler
*
handler
)
extern
void
rtnetlink_close
(
struct
rtnl_handler
*
handler
)
{
{
return
netlink_close
(
&
handler
->
nlh
);
netlink_close
(
&
handler
->
nlh
);
}
}
#pragma GCC diagnostic push
#pragma GCC diagnostic push
...
...
src/lxc/rtnl.h
View file @
d16bda44
...
@@ -44,10 +44,8 @@ extern int rtnetlink_open(struct rtnl_handler *handler);
...
@@ -44,10 +44,8 @@ extern int rtnetlink_open(struct rtnl_handler *handler);
* genetlink_close : close a route netlink socket
* genetlink_close : close a route netlink socket
*
*
* @handler: the handler of the socket to be closed
* @handler: the handler of the socket to be closed
*
* Returns 0 on success, < 0 otherwise
*/
*/
extern
int
rtnetlink_close
(
struct
rtnl_handler
*
handler
);
extern
void
rtnetlink_close
(
struct
rtnl_handler
*
handler
);
/*
/*
* rtnetlink_rcv : receive a route netlink socket, it is up
* rtnetlink_rcv : receive a route netlink socket, it is up
...
...
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