Use a normal DGRAM (UDP) socket to determine local IPv4 IP (fixes #9)

This commit is contained in:
Arnout Engelen
2015-12-20 15:06:26 +01:00
parent 69eedd0faf
commit ee8b7ea8a4

View File

@@ -60,7 +60,7 @@ void getLocal (const char *device, bool tracemode)
struct ifreq iFreq;
struct sockaddr_in *saddr;
if((sock=socket(AF_INET, SOCK_RAW, htons(0x0806)))<0)
if((sock=socket(AF_INET, SOCK_DGRAM, 0))<0)
forceExit(false, "creating socket failed while establishing local IP - are you root?");
strcpy(iFreq.ifr_name, device);