Commit 1121ea30 authored by Juliusz Chroboczek's avatar Juliusz Chroboczek

Fall back to other interfaces when we fail to find a MAC address.

parent 338eb19b
...@@ -103,7 +103,7 @@ int ...@@ -103,7 +103,7 @@ int
main(int argc, char **argv) main(int argc, char **argv)
{ {
struct sockaddr_in6 sin6; struct sockaddr_in6 sin6;
int rc, fd, rfd; int rc, fd, rfd, i;
time_t expiry_time, source_expiry_time, kernel_dump_time; time_t expiry_time, source_expiry_time, kernel_dump_time;
char *config_file = NULL; char *config_file = NULL;
void *vrc; void *vrc;
...@@ -378,6 +378,22 @@ main(int argc, char **argv) ...@@ -378,6 +378,22 @@ main(int argc, char **argv)
} }
} }
/* We failed to get a global EUI64 from the interfaces we were given.
Let's hope we find an interface with a MAC address among the first
five. */
for(i = 0; i < 5; i++) {
char buf[IF_NAMESIZE], *ifname;
unsigned char eui[8];
ifname = if_indextoname(i, buf);
if(ifname == NULL)
continue;
rc = if_eui64(ifname, i, eui);
if(rc < 0)
continue;
memcpy(myid, eui, 8);
goto have_id;
}
fprintf(stderr, fprintf(stderr,
"Warning: couldn't find router id -- using random value.\n"); "Warning: couldn't find router id -- using random value.\n");
if(rfd >= 0) { if(rfd >= 0) {
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment