Closed arg0d closed 3 years ago
Hey guys. Could you take a look at this PR? I would rather merge the changes here, instead of managing my own fork.
Some more context: I want to be notified of routing table change events, using NetLink. https://stackoverflow.com/questions/27008067/how-to-get-notified-about-network-interface-changes-with-netlist-and-rtmgrp-link
Its possible to keep continuously polling the socket, but the code is cleaner if I just block and wait for next message.
@polachok @bkchr
Allow receiving route events:
let group = MulticastGroup::RTMGRP_LINK | MulticastGroup::RTMGRP_IPV4_IFADDR | MulticastGroup::RTMGRP_IPV6_IFADDR;
let nonblocking = false; let mut socket = NetlinkSocket::bind_with_args(NetlinkProtocol::Route, group.bits(), nonblocking)?;