Commit 02650b07 authored by Pavel Emelyanov's avatar Pavel Emelyanov

net: Sanitize dump_links() function code

Signed-off-by: 's avatarPavel Emelyanov <xemul@parallels.com>
parent 9a6bc0fd
......@@ -180,7 +180,7 @@ static int dump_one_link(struct nlmsghdr *hdr, void *arg)
return ret;
}
static int do_dump_links(int (*cb)(struct nlmsghdr *h, void *), void *arg)
static int dump_links(struct cr_fdset *fds)
{
int sk, ret;
struct {
......@@ -188,6 +188,8 @@ static int do_dump_links(int (*cb)(struct nlmsghdr *h, void *), void *arg)
struct rtgenmsg g;
} req;
pr_info("Dumping netns links\n");
ret = sk = socket(PF_NETLINK, SOCK_RAW, NETLINK_ROUTE);
if (sk < 0) {
pr_perror("Can't open rtnl sock for net dump");
......@@ -202,19 +204,12 @@ static int do_dump_links(int (*cb)(struct nlmsghdr *h, void *), void *arg)
req.nlh.nlmsg_seq = CR_NLMSG_SEQ;
req.g.rtgen_family = AF_PACKET;
ret = do_rtnl_req(sk, &req, sizeof(req), cb, arg);
ret = do_rtnl_req(sk, &req, sizeof(req), dump_one_link, fds);
close(sk);
out:
return ret;
}
static int dump_links(struct cr_fdset *fds)
{
pr_info("Dumping netns links\n");
return do_dump_links(dump_one_link, fds);
}
static int restore_link_cb(struct nlmsghdr *hdr, void *arg)
{
pr_info("Got response on SETLINK =)\n");
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment