Commit f1fb3c74 authored by Pavel Emelyanov's avatar Pavel Emelyanov

net: Split dump_links into part

We'll need to dump links for another purpose, so prepare the
generic rtnl talker for that.
Signed-off-by: 's avatarPavel Emelyanov <xemul@parallels.com>
parent 2f3e52d8
......@@ -109,7 +109,7 @@ static int dump_one_link(struct nlmsghdr *hdr, void *arg)
return ret;
}
static int dump_links(struct cr_fdset *fds)
static int do_dump_links(int (*cb)(struct nlmsghdr *h, void *), void *arg)
{
int sk, ret;
struct {
......@@ -117,8 +117,6 @@ static int dump_links(struct cr_fdset *fds)
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");
......@@ -133,12 +131,19 @@ static int dump_links(struct cr_fdset *fds)
req.nlh.nlmsg_seq = CR_NLMSG_SEQ;
req.g.rtgen_family = AF_PACKET;
ret = do_rtnl_req(sk, &req, sizeof(req), dump_one_link, fds);
ret = do_rtnl_req(sk, &req, sizeof(req), cb, arg);
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 responce 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