mirror of
https://github.com/zerotier/ZeroTierOne.git
synced 2025-06-05 03:53:44 +02:00
Don't bind to temporary IPv6 addresses (linux)
This commit is contained in:
parent
b8b65da51c
commit
ab87b8f881
1 changed files with 9 additions and 0 deletions
|
@ -36,6 +36,7 @@
|
||||||
#ifdef __LINUX__
|
#ifdef __LINUX__
|
||||||
#include <net/if.h>
|
#include <net/if.h>
|
||||||
#include <sys/ioctl.h>
|
#include <sys/ioctl.h>
|
||||||
|
#include <linux/if_addr.h>
|
||||||
#endif
|
#endif
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
@ -211,17 +212,25 @@ class Binder {
|
||||||
unsigned char ipbits[16];
|
unsigned char ipbits[16];
|
||||||
memset(ipbits, 0, sizeof(ipbits));
|
memset(ipbits, 0, sizeof(ipbits));
|
||||||
char* devname = (char*)0;
|
char* devname = (char*)0;
|
||||||
|
int flags = 0;
|
||||||
int n = 0;
|
int n = 0;
|
||||||
for (char* f = Utils::stok(tmp, " \t\r\n", &saveptr); (f); f = Utils::stok((char*)0, " \t\r\n", &saveptr)) {
|
for (char* f = Utils::stok(tmp, " \t\r\n", &saveptr); (f); f = Utils::stok((char*)0, " \t\r\n", &saveptr)) {
|
||||||
switch (n++) {
|
switch (n++) {
|
||||||
case 0: // IP in hex
|
case 0: // IP in hex
|
||||||
Utils::unhex(f, 32, ipbits, 16);
|
Utils::unhex(f, 32, ipbits, 16);
|
||||||
break;
|
break;
|
||||||
|
case 4:
|
||||||
|
flags = atoi(f);
|
||||||
|
break;
|
||||||
case 5: // device name
|
case 5: // device name
|
||||||
devname = f;
|
devname = f;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if ( (flags & IFA_F_TEMPORARY) != 0) {
|
||||||
|
continue;
|
||||||
|
}
|
||||||
if (devname) {
|
if (devname) {
|
||||||
ifnames.insert(devname);
|
ifnames.insert(devname);
|
||||||
InetAddress ip(ipbits, 16, 0);
|
InetAddress ip(ipbits, 16, 0);
|
||||||
|
|
Loading…
Add table
Reference in a new issue