From f74ef39e54bbaee847549c4fdc345351f7d2a1e0 Mon Sep 17 00:00:00 2001 From: Ollie Walsh Date: Wed, 18 Feb 2026 01:07:19 +0000 Subject: [PATCH] Fix IP introspection issues with multiple interfaces If an interface does not have an IP then continue to the next interface instead of bailing out. --- libxbot-service-interface/src/Socket.cpp | 3 +-- libxbot-service/src/portable/linux/socket.cpp | 3 +-- 2 files changed, 2 insertions(+), 4 deletions(-) diff --git a/libxbot-service-interface/src/Socket.cpp b/libxbot-service-interface/src/Socket.cpp index cdc74a9..53878a6 100644 --- a/libxbot-service-interface/src/Socket.cpp +++ b/libxbot-service-interface/src/Socket.cpp @@ -46,8 +46,7 @@ bool get_ip(std::string &ip) { // Get IP address if (ioctl(fd, SIOCGIFADDR, &ifr) < 0) { - perror("SIOCGIFADDR"); - break; + continue; // No IP on interface } const char *addrStr = inet_ntoa(reinterpret_cast(&ifr.ifr_addr)->sin_addr); diff --git a/libxbot-service/src/portable/linux/socket.cpp b/libxbot-service/src/portable/linux/socket.cpp index c84fa00..08d5da8 100644 --- a/libxbot-service/src/portable/linux/socket.cpp +++ b/libxbot-service/src/portable/linux/socket.cpp @@ -49,8 +49,7 @@ bool get_ip(char* ip, size_t ip_len) { // Get IP address if (ioctl(fd, SIOCGIFADDR, &ifr) < 0) { - perror("SIOCGIFADDR"); - break; + continue; // No IP on interface } const char* addrStr = inet_ntoa(reinterpret_cast(&ifr.ifr_addr)->sin_addr);