diff options
author | Coren[m] <Break@Ocean> | 2013-09-12 18:39:21 +0200 |
---|---|---|
committer | Coren[m] <Break@Ocean> | 2013-09-12 18:39:21 +0200 |
commit | 591d6c70c635406830486deb561343e4dc06af2a (patch) | |
tree | e427dc378ad3f2c0744249896d3e165063aae7be /toxcore/DHT.c | |
parent | 0cfbe004ef30e5a601f965e625ab42a490e13e15 (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/DHT.c')
-rw-r--r-- | toxcore/DHT.c | 27 |
1 files changed, 22 insertions, 5 deletions
diff --git a/toxcore/DHT.c b/toxcore/DHT.c index 3de7b6ae..a5f0c1ab 100644 --- a/toxcore/DHT.c +++ b/toxcore/DHT.c | |||
@@ -982,11 +982,28 @@ void DHT_bootstrap(DHT *dht, IP_Port ip_port, uint8_t *public_key) | |||
982 | int DHT_bootstrap_from_address(DHT *dht, const char *address, uint8_t ipv6enabled, | 982 | int DHT_bootstrap_from_address(DHT *dht, const char *address, uint8_t ipv6enabled, |
983 | uint16_t port, uint8_t *public_key) | 983 | uint16_t port, uint8_t *public_key) |
984 | { | 984 | { |
985 | IP_Port ip_port; | 985 | IP_Port ip_port_v64, ip_port_v4; |
986 | ip_init(&ip_port.ip, ipv6enabled); | 986 | IP *ip_extra = NULL; |
987 | if (addr_resolve_or_parse_ip(address, &ip_port.ip)) { | 987 | #ifdef TOX_ENABLE_IPV6 |
988 | ip_port.port = port; | 988 | ip_init(&ip_port_v64.ip, ipv6enabled); |
989 | DHT_bootstrap(dht, ip_port, public_key); | 989 | if (ipv6enabled) { |
990 | ip_port_v64.ip.family = AF_UNSPEC; | ||
991 | ip_reset(&ip_port_v4.ip); | ||
992 | ip_extra = &ip_port_v4.ip; | ||
993 | } | ||
994 | #else | ||
995 | ip_init(&ip_port_v64.ip, 0); | ||
996 | #endif | ||
997 | |||
998 | if (addr_resolve_or_parse_ip(address, &ip_port_v64.ip, ip_extra)) { | ||
999 | ip_port_v64.port = port; | ||
1000 | DHT_bootstrap(dht, ip_port_v64, public_key); | ||
1001 | #ifdef TOX_ENABLE_IPV6 | ||
1002 | if ((ip_extra != NULL) && ip_isset(ip_extra)) { | ||
1003 | ip_port_v4.port = port; | ||
1004 | DHT_bootstrap(dht, ip_port_v4, public_key); | ||
1005 | } | ||
1006 | #endif | ||
990 | return 1; | 1007 | return 1; |
991 | } | 1008 | } |
992 | else | 1009 | else |