We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
2 parents 8a2e54e + 37b2dda commit 66b8cf6Copy full SHA for 66b8cf6
src/util.c
@@ -174,11 +174,13 @@ get_iface_ip(const char *ifname)
174
u_int32_t ip;
175
176
/* Create a socket */
177
- if ((sockd = socket(AF_INET, SOCK_RAW, htons(0x8086))) < 0) {
+ if ((sockd = socket(AF_INET, SOCK_DGRAM, 0)) < 0) {
178
debug(LOG_ERR, "socket(): %s", strerror(errno));
179
return NULL;
180
}
181
182
+ /* I want to get an IPv4 IP address */
183
+ if_data.ifr_addr.sa_family = AF_INET;
184
/* Get IP of internal interface */
185
strncpy(if_data.ifr_name, ifname, 15);
186
if_data.ifr_name[15] = '\0';
0 commit comments