Use a normal DGRAM (UDP) socket to determine local IPv4 IP (fixes #9)
This commit is contained in:
@@ -60,7 +60,7 @@ void getLocal (const char *device, bool tracemode)
|
|||||||
struct ifreq iFreq;
|
struct ifreq iFreq;
|
||||||
struct sockaddr_in *saddr;
|
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?");
|
forceExit(false, "creating socket failed while establishing local IP - are you root?");
|
||||||
|
|
||||||
strcpy(iFreq.ifr_name, device);
|
strcpy(iFreq.ifr_name, device);
|
||||||
|
|||||||
Reference in New Issue
Block a user