Skip to content

Commit

Permalink
debug netlink data pending
Browse files Browse the repository at this point in the history
  • Loading branch information
Tycho Andersen committed Oct 9, 2014
1 parent ffe3d5c commit ae9a540
Show file tree
Hide file tree
Showing 3 changed files with 44 additions and 2 deletions.
2 changes: 1 addition & 1 deletion Makefile
Expand Up @@ -250,7 +250,7 @@ criu-$(CRTOOLSVERSION).tar.bz2:
v$(CRTOOLSVERSION) | bzip2 > $@
.PHONY: dist tar

install: $(PROGRAM) $(CRIU-LIB) install-man
install: $(PROGRAM) $(CRIU-LIB)
$(E) " INSTALL " $(PROGRAM)
$(Q) mkdir -p $(DESTDIR)$(SBINDIR)
$(Q) install -m 755 $(PROGRAM) $(DESTDIR)$(SBINDIR)
Expand Down
2 changes: 2 additions & 0 deletions files.c
Expand Up @@ -222,6 +222,8 @@ static int fill_fd_params(struct parasite_ctl *ctl, int fd, int lfd,
if (parse_fdinfo(lfd, FD_TYPES__UND, NULL, &fdinfo))
return -1;

pr_info("TYCHO: real pid %d virt %d fd %d\n", ctl->pid.real, ctl->pid.virt, fd);

p->fs_type = fsbuf.f_type;
p->ctl = ctl;
p->fd = fd;
Expand Down
42 changes: 41 additions & 1 deletion sk-netlink.c
Expand Up @@ -88,8 +88,48 @@ static int dump_one_netlink_fd(int lfd, u32 id, const struct fd_parms *p)
ne.id = id;
ne.ino = p->stat.st_ino;

if (!can_dump_netlink_sk(lfd))
if (!can_dump_netlink_sk(lfd)) {
int len;
char buf[4096];
struct iovec iov = { buf, sizeof(buf) };
struct sockaddr_nl sa;
struct msghdr msg;
struct nlmsghdr *nh;

nh = (struct nlmsghdr *) buf;
memset(buf, 0, sizeof(buf));

pr_err("failed dumping lfd: %d, id %u\n", lfd, id);

msg.msg_name = &sa;
msg.msg_namelen = sizeof(sa),
msg.msg_iov = &iov,
msg.msg_iovlen = 1,
msg.msg_control = NULL,
msg.msg_controllen = 0,
msg.msg_flags = 0;

len = recvmsg(lfd, &msg, 0);
pr_err("received message of length %d, %d\n", len, NLMSG_OK (nh, len));
pr_err("nlmsg_len: %d, nlmsg_type: %d, nlmsg_seq %d, nlmsg_pid %d\n", nh->nlmsg_len, nh->nlmsg_type, nh->nlmsg_seq, nh->nlmsg_pid);

for (nh = (struct nlmsghdr *) buf; NLMSG_OK (nh, len); nh = NLMSG_NEXT (nh, len)) {
/* The end of multipart message. */
if (nh->nlmsg_type == NLMSG_DONE) {
pr_err("NLMSG_DONE\n");
break;
}

if (nh->nlmsg_type == NLMSG_ERROR) {
pr_err("NLMSG_ERROR\n");
break;
}

pr_err("nl message of type: %d\n", nh->nlmsg_type);
}

goto err;
}

if (sk) {
BUG_ON(sk->sd.already_dumped);
Expand Down

0 comments on commit ae9a540

Please sign in to comment.