mirror of
https://github.com/servalproject/serval-dna.git
synced 2025-01-18 02:39:44 +00:00
impoved debugging and operation of interface detection
(since it has suddenly decided to fail)
This commit is contained in:
parent
26ef52cf99
commit
82ca3dde5d
3
lsif.c
3
lsif.c
@ -74,6 +74,7 @@ int lsif(void)
|
||||
/* Get a socket handle. */
|
||||
sck = socket(PF_INET, SOCK_DGRAM, 0);
|
||||
if(sck < 0) {
|
||||
WHY("Failed to gt socket handle to list addresses");
|
||||
return 1;
|
||||
}
|
||||
|
||||
@ -81,12 +82,14 @@ int lsif(void)
|
||||
ifc.ifc_len = sizeof(buf);
|
||||
ifc.ifc_buf = buf;
|
||||
if(ioctl(sck, SIOCGIFCONF, &ifc) < 0) {
|
||||
WHY("Failed to read interface list");
|
||||
return 1;
|
||||
}
|
||||
|
||||
/* Iterate through the list of interfaces. */
|
||||
ifr = ifc.ifc_req;
|
||||
nInterfaces = ifc.ifc_len / sizeof(struct ifreq);
|
||||
WHYF("Examining %d interfaces",nInterfaces);
|
||||
for(i = 0; i < nInterfaces; i++) {
|
||||
item = &ifr[i];
|
||||
|
||||
|
@ -606,11 +606,13 @@ int overlay_interface_discover()
|
||||
}
|
||||
}
|
||||
freeifaddrs(ifaddr);
|
||||
#else
|
||||
#endif
|
||||
#ifdef ANDROID
|
||||
/* Use alternative linux-only method to find and register interfaces. */
|
||||
lsif();
|
||||
#else
|
||||
#ifdef HAVE_IFADDRS_H
|
||||
#else
|
||||
#error Don't know how to get interface list on this platform
|
||||
#endif
|
||||
#endif
|
||||
|
Loading…
Reference in New Issue
Block a user