mirror of
https://github.com/bitcoin/bitcoin.git
synced 2026-01-21 15:50:07 +01:00
net: skip non-route netlink responses
This shouldn't usually be hit, but is a good belt-and-braces.
This commit is contained in:
@@ -97,6 +97,10 @@ std::optional<CNetAddr> QueryDefaultGatewayImpl(sa_family_t family)
|
||||
rtmsg* r = (rtmsg*)NLMSG_DATA(hdr);
|
||||
int remaining_len = RTM_PAYLOAD(hdr);
|
||||
|
||||
if (hdr->nlmsg_type != RTM_NEWROUTE) {
|
||||
continue; // Skip non-route messages
|
||||
}
|
||||
|
||||
// Only consider default routes (destination prefix length of 0).
|
||||
if (r->rtm_dst_len != 0) {
|
||||
continue;
|
||||
|
||||
Reference in New Issue
Block a user