Skip to content

Commit

Permalink
Merge pull request #139 from jfriesse/fix-find_myself
Browse files Browse the repository at this point in the history
transport: Fix _find_myself for kernel 6.9
  • Loading branch information
jfriesse authored Apr 24, 2024
2 parents f3fe313 + 7d93365 commit 9c40174
Showing 1 changed file with 10 additions and 11 deletions.
21 changes: 10 additions & 11 deletions src/transport.c
Original file line number Diff line number Diff line change
Expand Up @@ -208,17 +208,16 @@ int _find_myself(int family, struct booth_site **mep, int fuzzy_allowed)
return 0;
}

h = (struct nlmsghdr *)rcvbuf;
if (h->nlmsg_type == NLMSG_DONE)
break;

if (h->nlmsg_type == NLMSG_ERROR) {
close(fd);
log_error("netlink socket recvmsg error");
return 0;
}
for (h = (struct nlmsghdr *)rcvbuf; NLMSG_OK(h, status); h = NLMSG_NEXT(h, status)) {
if (h->nlmsg_type == NLMSG_DONE)
goto out;

if (h->nlmsg_type == NLMSG_ERROR) {
close(fd);
log_error("netlink socket recvmsg error");
return 0;
}

while (NLMSG_OK(h, status)) {
if (h->nlmsg_type == RTM_NEWADDR) {
struct ifaddrmsg *ifa = NLMSG_DATA(h);
struct rtattr *tb[IFA_MAX+1];
Expand Down Expand Up @@ -271,10 +270,10 @@ int _find_myself(int family, struct booth_site **mep, int fuzzy_allowed)
}
}
}
h = NLMSG_NEXT(h, status);
}
}

out:
close(fd);

if (!me)
Expand Down

0 comments on commit 9c40174

Please sign in to comment.