Skip to content

Commit

Permalink
wip: use inet_pton
Browse files Browse the repository at this point in the history
Signed-off-by: Federico Di Pierro <[email protected]>
  • Loading branch information
FedeDP committed Feb 10, 2025
1 parent 0b78bdc commit c38fd4b
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions userspace/libsinsp/ifinfo.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -220,7 +220,7 @@ bool sinsp_network_interfaces::is_ipv4addr_in_local_machine(uint32_t addr,
auto ip = tinfo->get_container_ip();
if(!ip.empty()) {
struct in_addr in;
if(inet_aton(ip.c_str(), &in)) {
if(inet_pton(AF_INET, ip.c_str(), &in)) {
if(addr == in.s_addr) {
return true;
}
Expand All @@ -238,7 +238,7 @@ bool sinsp_network_interfaces::is_ipv4addr_in_local_machine(uint32_t addr,
e.read_field(fld, ip);
if(!ip.empty()) {
struct in_addr in;
if(inet_aton(ip.c_str(), &in)) {
if(inet_pton(AF_INET, ip.c_str(), &in)) {
if(addr == in.s_addr) {
found = true;
return false; // break-out loop
Expand Down

0 comments on commit c38fd4b

Please sign in to comment.