diff options
author | irungentoo <irungentoo@gmail.com> | 2013-09-14 19:15:26 -0400 |
---|---|---|
committer | irungentoo <irungentoo@gmail.com> | 2013-09-14 19:15:26 -0400 |
commit | 20a8fb8a231d158368b8f2db2aab01e443f81b98 (patch) | |
tree | 4e50483f2ef505bd328d4b1ee91c573724f1c427 /toxcore/LAN_discovery.c | |
parent | 04e7b0eb6c31f6650bcef83b4915af259b087227 (diff) |
Fixed warnings.
Diffstat (limited to 'toxcore/LAN_discovery.c')
-rw-r--r-- | toxcore/LAN_discovery.c | 9 |
1 files changed, 7 insertions, 2 deletions
diff --git a/toxcore/LAN_discovery.c b/toxcore/LAN_discovery.c index ed8dd229..c7afb991 100644 --- a/toxcore/LAN_discovery.c +++ b/toxcore/LAN_discovery.c | |||
@@ -30,10 +30,13 @@ | |||
30 | #define MAX_INTERFACES 16 | 30 | #define MAX_INTERFACES 16 |
31 | 31 | ||
32 | #ifdef __linux | 32 | #ifdef __linux |
33 | #ifndef TOX_ENABLE_IPV6 | ||
33 | /* Send packet to all broadcast addresses | 34 | /* Send packet to all broadcast addresses |
34 | * | 35 | * |
35 | * return higher than 0 on success. | 36 | * return higher than 0 on success. |
36 | * return 0 on error. | 37 | * return 0 on error. |
38 | * | ||
39 | * TODO: Make this work with IPv6 and remove the #ifndef TOX_ENABLE_IPV6. | ||
37 | */ | 40 | */ |
38 | static uint32_t send_broadcasts(Networking_Core *net, uint16_t port, uint8_t *data, uint16_t length) | 41 | static uint32_t send_broadcasts(Networking_Core *net, uint16_t port, uint8_t *data, uint16_t length) |
39 | { | 42 | { |
@@ -80,6 +83,7 @@ static uint32_t send_broadcasts(Networking_Core *net, uint16_t port, uint8_t *da | |||
80 | return 0; | 83 | return 0; |
81 | } | 84 | } |
82 | #endif | 85 | #endif |
86 | #endif | ||
83 | 87 | ||
84 | /* Return the broadcast ip. */ | 88 | /* Return the broadcast ip. */ |
85 | static IP broadcast_ip(sa_family_t family_socket, sa_family_t family_broadcast) | 89 | static IP broadcast_ip(sa_family_t family_socket, sa_family_t family_broadcast) |
@@ -161,7 +165,7 @@ static int LAN_ip(IP ip) | |||
161 | } else if (ip.family == AF_INET6) | 165 | } else if (ip.family == AF_INET6) |
162 | { | 166 | { |
163 | /* autogenerated for each interface: FE80::* (up to FEBF::*) | 167 | /* autogenerated for each interface: FE80::* (up to FEBF::*) |
164 | /* FF02::1 is - according to RFC 4291 - multicast all-nodes link-local */ | 168 | FF02::1 is - according to RFC 4291 - multicast all-nodes link-local */ |
165 | if (((ip.ip6.s6_addr[0] == 0xFF) && (ip.ip6.s6_addr[1] < 3) && (ip.ip6.s6_addr[15] == 1)) || | 169 | if (((ip.ip6.s6_addr[0] == 0xFF) && (ip.ip6.s6_addr[1] < 3) && (ip.ip6.s6_addr[15] == 1)) || |
166 | ((ip.ip6.s6_addr[0] == 0xFE) && ((ip.ip6.s6_addr[1] & 0xC0) == 0x80))) | 170 | ((ip.ip6.s6_addr[0] == 0xFE) && ((ip.ip6.s6_addr[1] & 0xC0) == 0x80))) |
167 | return 0; | 171 | return 0; |
@@ -202,9 +206,10 @@ int send_LANdiscovery(uint16_t port, Net_Crypto *c) | |||
202 | memcpy(data + 1, c->self_public_key, crypto_box_PUBLICKEYBYTES); | 206 | memcpy(data + 1, c->self_public_key, crypto_box_PUBLICKEYBYTES); |
203 | 207 | ||
204 | #ifdef __linux | 208 | #ifdef __linux |
209 | #ifndef TOX_ENABLE_IPV6 | ||
205 | send_broadcasts(c->lossless_udp->net, port, data, 1 + crypto_box_PUBLICKEYBYTES); | 210 | send_broadcasts(c->lossless_udp->net, port, data, 1 + crypto_box_PUBLICKEYBYTES); |
206 | #endif | 211 | #endif |
207 | 212 | #endif | |
208 | int res = -1; | 213 | int res = -1; |
209 | IP_Port ip_port; | 214 | IP_Port ip_port; |
210 | ip_port.port = port; | 215 | ip_port.port = port; |