diff options
Diffstat (limited to 'plugins-root/t')
0 files changed, 0 insertions, 0 deletions
diff --git a/plugins-root/check_icmp.c b/plugins-root/check_icmp.c index 700fe8b..c0b29f2 100644 --- a/plugins-root/check_icmp.c +++ b/plugins-root/check_icmp.c | |||
@@ -1139,12 +1139,14 @@ get_ip_address(const char *ifname) | |||
1139 | { | 1139 | { |
1140 | #if defined(SIOCGIFADDR) | 1140 | #if defined(SIOCGIFADDR) |
1141 | struct ifreq ifr; | 1141 | struct ifreq ifr; |
1142 | struct sockaddr_in ip; | ||
1142 | 1143 | ||
1143 | strncpy(ifr.ifr_name, ifname, sizeof(ifr.ifr_name) - 1); | 1144 | strncpy(ifr.ifr_name, ifname, sizeof(ifr.ifr_name) - 1); |
1144 | ifr.ifr_name[sizeof(ifr.ifr_name) - 1] = '\0'; | 1145 | ifr.ifr_name[sizeof(ifr.ifr_name) - 1] = '\0'; |
1145 | if(ioctl(icmp_sock, SIOCGIFADDR, &ifr) == -1) | 1146 | if(ioctl(icmp_sock, SIOCGIFADDR, &ifr) == -1) |
1146 | crash("Cannot determine IP address of interface %s", ifname); | 1147 | crash("Cannot determine IP address of interface %s", ifname); |
1147 | return ((struct sockaddr_in *)&ifr.ifr_addr)->sin_addr.s_addr; | 1148 | memcpy(&ip, &ifr.ifr_addr, sizeof(ip)); |
1149 | return ip.sin_addr.s_addr; | ||
1148 | #else | 1150 | #else |
1149 | errno = 0; | 1151 | errno = 0; |
1150 | crash("Cannot get interface IP address on this platform."); | 1152 | crash("Cannot get interface IP address on this platform."); |