summaryrefslogtreecommitdiff
path: root/toxcore/LAN_discovery.c
diff options
context:
space:
mode:
authorCoren[m] <Break@Ocean>2013-09-12 18:39:21 +0200
committerCoren[m] <Break@Ocean>2013-09-12 18:39:21 +0200
commit591d6c70c635406830486deb561343e4dc06af2a (patch)
treee427dc378ad3f2c0744249896d3e165063aae7be /toxcore/LAN_discovery.c
parent0cfbe004ef30e5a601f965e625ab42a490e13e15 (diff)
network.*:
- addr_resolv(_or_parse_ip)(): added an optional parameter to return both an IPv6 and an IPv4 address if requested address family was AF_UNSPEC - logging of unhandled packets DHT.c: - bootstrap_from_address(): use the additional return from addr_resolv_or_parse_ip() to bootstrap in both network types at once Lossless_UDP_testclient.c: - main(): adapt to signature change of addr_resolve() Messenger.c. LAN_discovery.h: - lost a htons(), readded - moved LAN_DISCOVERY_INTERVAL #define into LAN_discovery.h LAN_discovery.c: - added IPv4-in-IPv6 local address test
Diffstat (limited to 'toxcore/LAN_discovery.c')
-rw-r--r--toxcore/LAN_discovery.c8
1 files changed, 8 insertions, 0 deletions
diff --git a/toxcore/LAN_discovery.c b/toxcore/LAN_discovery.c
index b429ea6e..c50fe65d 100644
--- a/toxcore/LAN_discovery.c
+++ b/toxcore/LAN_discovery.c
@@ -159,6 +159,14 @@ static int LAN_ip(IP ip)
159 if (((ip.ip6.s6_addr[0] == 0xFF) && (ip.ip6.s6_addr[1] < 3) && (ip.ip6.s6_addr[15] == 1)) || 159 if (((ip.ip6.s6_addr[0] == 0xFF) && (ip.ip6.s6_addr[1] < 3) && (ip.ip6.s6_addr[15] == 1)) ||
160 ((ip.ip6.s6_addr[0] == 0xFE) && ((ip.ip6.s6_addr[1] & 0xC0) == 0x80))) 160 ((ip.ip6.s6_addr[0] == 0xFE) && ((ip.ip6.s6_addr[1] & 0xC0) == 0x80)))
161 return 0; 161 return 0;
162
163 /* embedded IPv4-in-IPv6 */
164 if (!ip.ip6.s6_addr32[0] && !ip.ip6.s6_addr32[1] && ip.ip6.s6_addr32[2] == htonl(0xFFFF)) {
165 IP ip4;
166 ip4.family = AF_INET;
167 ip4.ip4.uint32 = ip.ip6.s6_addr32[3];
168 return LAN_ip(ip4);
169 }
162 } 170 }
163#endif 171#endif
164 172