Skip to content

Commit

Permalink
netlink: improved event handling
Browse files Browse the repository at this point in the history
  • Loading branch information
wwmm committed Sep 10, 2024
1 parent b3071e0 commit 04717a6
Showing 1 changed file with 7 additions and 4 deletions.
11 changes: 7 additions & 4 deletions src/netlink.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -80,12 +80,14 @@ void Netlink::subscribe() const {
}

void Netlink::handle_events() {
std::vector<char> buff(getpagesize());
// std::vector<char> buff(getpagesize());
char buff[4096];
sockaddr_nl addr{};
iovec iov[1];

iov[0].iov_base = buff.data();
iov[0].iov_len = sizeof(char) * buff.size();
iov[0].iov_base = buff;
// iov[0].iov_len = sizeof(char) * buff.size();
iov[0].iov_len = sizeof(buff);

msghdr msg_hdr{.msg_name = &addr,
.msg_namelen = sizeof(addr),
Expand All @@ -112,7 +114,8 @@ void Netlink::handle_events() {
continue;
}

auto* nlmsg_hdr = reinterpret_cast<nlmsghdr*>(buff.data());
// auto* nlmsg_hdr = reinterpret_cast<nlmsghdr*>(buff.data());
auto* nlmsg_hdr = reinterpret_cast<nlmsghdr*>(buff);

while (NLMSG_OK(nlmsg_hdr, len)) {
if (!std::filesystem::is_regular_file(input_file)) {
Expand Down

0 comments on commit 04717a6

Please sign in to comment.