summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authoriphydf <iphydf@users.noreply.github.com>2018-01-15 00:48:35 +0000
committeriphydf <iphydf@users.noreply.github.com>2018-01-16 14:17:05 +0000
commit0b13936ce8498735e245531c222c035f41fd5e0f (patch)
treebafaef43863e822bbcb0c05192da0a973b3381a1
parentb3ec05543acdc0019b545de170720dc32d8f28d3 (diff)
Use apidsl to generate LAN_discovery.h.
-rw-r--r--CMakeLists.txt1
-rw-r--r--other/DHT_bootstrap.c4
-rw-r--r--other/bootstrap_daemon/src/tox-bootstrapd.c4
-rw-r--r--toxcore/DHT.c12
-rw-r--r--toxcore/LAN_discovery.api.h73
-rw-r--r--toxcore/LAN_discovery.c18
-rw-r--r--toxcore/LAN_discovery.h48
-rw-r--r--toxcore/friend_connection.c10
-rw-r--r--toxcore/net_crypto.c4
-rw-r--r--toxcore/network.h7
-rw-r--r--toxcore/onion_announce.c2
-rw-r--r--toxcore/onion_client.c4
12 files changed, 141 insertions, 46 deletions
diff --git a/CMakeLists.txt b/CMakeLists.txt
index cca2f79e..2dd63713 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -232,6 +232,7 @@ endif()
232 232
233# LAYER 3: Distributed Hash Table 233# LAYER 3: Distributed Hash Table
234# ------------------------------- 234# -------------------------------
235apidsl(toxcore/LAN_discovery.api.h)
235apidsl(toxcore/ping.api.h) 236apidsl(toxcore/ping.api.h)
236apidsl(toxcore/ping_array.api.h) 237apidsl(toxcore/ping_array.api.h)
237add_submodule(toxcore toxdht 238add_submodule(toxcore toxdht
diff --git a/other/DHT_bootstrap.c b/other/DHT_bootstrap.c
index 0e95805d..5eae46b9 100644
--- a/other/DHT_bootstrap.c
+++ b/other/DHT_bootstrap.c
@@ -181,7 +181,7 @@ int main(int argc, char *argv[])
181 int is_waiting_for_dht_connection = 1; 181 int is_waiting_for_dht_connection = 1;
182 182
183 uint64_t last_LANdiscovery = 0; 183 uint64_t last_LANdiscovery = 0;
184 LANdiscovery_init(dht); 184 lan_discovery_init(dht);
185 185
186 while (1) { 186 while (1) {
187 if (is_waiting_for_dht_connection && DHT_isconnected(dht)) { 187 if (is_waiting_for_dht_connection && DHT_isconnected(dht)) {
@@ -192,7 +192,7 @@ int main(int argc, char *argv[])
192 do_DHT(dht); 192 do_DHT(dht);
193 193
194 if (is_timeout(last_LANdiscovery, is_waiting_for_dht_connection ? 5 : LAN_DISCOVERY_INTERVAL)) { 194 if (is_timeout(last_LANdiscovery, is_waiting_for_dht_connection ? 5 : LAN_DISCOVERY_INTERVAL)) {
195 send_LANdiscovery(net_htons(PORT), dht); 195 lan_discovery_send(net_htons(PORT), dht);
196 last_LANdiscovery = unix_time(); 196 last_LANdiscovery = unix_time();
197 } 197 }
198 198
diff --git a/other/bootstrap_daemon/src/tox-bootstrapd.c b/other/bootstrap_daemon/src/tox-bootstrapd.c
index c3af4a10..c6780fa3 100644
--- a/other/bootstrap_daemon/src/tox-bootstrapd.c
+++ b/other/bootstrap_daemon/src/tox-bootstrapd.c
@@ -316,7 +316,7 @@ int main(int argc, char *argv[])
316 int waiting_for_dht_connection = 1; 316 int waiting_for_dht_connection = 1;
317 317
318 if (enable_lan_discovery) { 318 if (enable_lan_discovery) {
319 LANdiscovery_init(dht); 319 lan_discovery_init(dht);
320 log_write(LOG_LEVEL_INFO, "Initialized LAN discovery successfully.\n"); 320 log_write(LOG_LEVEL_INFO, "Initialized LAN discovery successfully.\n");
321 } 321 }
322 322
@@ -324,7 +324,7 @@ int main(int argc, char *argv[])
324 do_DHT(dht); 324 do_DHT(dht);
325 325
326 if (enable_lan_discovery && is_timeout(last_LANdiscovery, LAN_DISCOVERY_INTERVAL)) { 326 if (enable_lan_discovery && is_timeout(last_LANdiscovery, LAN_DISCOVERY_INTERVAL)) {
327 send_LANdiscovery(net_htons_port, dht); 327 lan_discovery_send(net_htons_port, dht);
328 last_LANdiscovery = unix_time(); 328 last_LANdiscovery = unix_time();
329 } 329 }
330 330
diff --git a/toxcore/DHT.c b/toxcore/DHT.c
index 41c24ac0..a4251518 100644
--- a/toxcore/DHT.c
+++ b/toxcore/DHT.c
@@ -565,7 +565,7 @@ static void update_client(Logger *log, int index, Client_data *client, IP_Port i
565 net_ntohs(ip_port.port)); 565 net_ntohs(ip_port.port));
566 } 566 }
567 567
568 if (LAN_ip(assoc->ip_port.ip) != 0 && LAN_ip(ip_port.ip) == 0) { 568 if (ip_is_lan(assoc->ip_port.ip) != 0 && ip_is_lan(ip_port.ip) == 0) {
569 return; 569 return;
570 } 570 }
571 571
@@ -702,11 +702,11 @@ static void get_close_nodes_inner(const uint8_t *public_key, Node_format *nodes_
702 } 702 }
703 703
704 /* don't send LAN ips to non LAN peers */ 704 /* don't send LAN ips to non LAN peers */
705 if (LAN_ip(ipptp->ip_port.ip) == 0 && !is_LAN) { 705 if (ip_is_lan(ipptp->ip_port.ip) == 0 && !is_LAN) {
706 continue; 706 continue;
707 } 707 }
708 708
709 if (LAN_ip(ipptp->ip_port.ip) != 0 && want_good && hardening_correct(&ipptp->hardening) != HARDENING_ALL_OK 709 if (ip_is_lan(ipptp->ip_port.ip) != 0 && want_good && hardening_correct(&ipptp->hardening) != HARDENING_ALL_OK
710 && !id_equal(public_key, client->public_key)) { 710 && !id_equal(public_key, client->public_key)) {
711 continue; 711 continue;
712 } 712 }
@@ -1223,7 +1223,7 @@ static int sendnodes_ipv6(const DHT *dht, IP_Port ip_port, const uint8_t *public
1223 size_t Node_format_size = sizeof(Node_format); 1223 size_t Node_format_size = sizeof(Node_format);
1224 1224
1225 Node_format nodes_list[MAX_SENT_NODES]; 1225 Node_format nodes_list[MAX_SENT_NODES];
1226 uint32_t num_nodes = get_close_nodes(dht, client_id, nodes_list, 0, LAN_ip(ip_port.ip) == 0, 1); 1226 uint32_t num_nodes = get_close_nodes(dht, client_id, nodes_list, 0, ip_is_lan(ip_port.ip) == 0, 1);
1227 1227
1228 VLA(uint8_t, plain, 1 + Node_format_size * MAX_SENT_NODES + length); 1228 VLA(uint8_t, plain, 1 + Node_format_size * MAX_SENT_NODES + length);
1229 1229
@@ -2840,11 +2840,11 @@ int DHT_non_lan_connected(const DHT *dht)
2840 for (uint32_t i = 0; i < LCLIENT_LIST; ++i) { 2840 for (uint32_t i = 0; i < LCLIENT_LIST; ++i) {
2841 const Client_data *client = &dht->close_clientlist[i]; 2841 const Client_data *client = &dht->close_clientlist[i];
2842 2842
2843 if (!is_timeout(client->assoc4.timestamp, BAD_NODE_TIMEOUT) && LAN_ip(client->assoc4.ip_port.ip) == -1) { 2843 if (!is_timeout(client->assoc4.timestamp, BAD_NODE_TIMEOUT) && ip_is_lan(client->assoc4.ip_port.ip) == -1) {
2844 return 1; 2844 return 1;
2845 } 2845 }
2846 2846
2847 if (!is_timeout(client->assoc6.timestamp, BAD_NODE_TIMEOUT) && LAN_ip(client->assoc6.ip_port.ip) == -1) { 2847 if (!is_timeout(client->assoc6.timestamp, BAD_NODE_TIMEOUT) && ip_is_lan(client->assoc6.ip_port.ip) == -1) {
2848 return 1; 2848 return 1;
2849 } 2849 }
2850 } 2850 }
diff --git a/toxcore/LAN_discovery.api.h b/toxcore/LAN_discovery.api.h
new file mode 100644
index 00000000..9e6c6481
--- /dev/null
+++ b/toxcore/LAN_discovery.api.h
@@ -0,0 +1,73 @@
1%{
2/*
3 * LAN discovery implementation.
4 */
5
6/*
7 * Copyright © 2016-2017 The TokTok team.
8 * Copyright © 2013 Tox project.
9 *
10 * This file is part of Tox, the free peer to peer instant messenger.
11 *
12 * Tox is free software: you can redistribute it and/or modify
13 * it under the terms of the GNU General Public License as published by
14 * the Free Software Foundation, either version 3 of the License, or
15 * (at your option) any later version.
16 *
17 * Tox is distributed in the hope that it will be useful,
18 * but WITHOUT ANY WARRANTY; without even the implied warranty of
19 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
20 * GNU General Public License for more details.
21 *
22 * You should have received a copy of the GNU General Public License
23 * along with Tox. If not, see <http://www.gnu.org/licenses/>.
24 */
25#ifndef LAN_DISCOVERY_H
26#define LAN_DISCOVERY_H
27
28#include "DHT.h"
29%}
30
31class dHT { struct this; }
32class iP { struct this; }
33
34namespace lan_discovery {
35
36/**
37 * Interval in seconds between LAN discovery packet sending.
38 */
39const INTERVAL = 10;
40
41/**
42 * Send a LAN discovery pcaket to the broadcast address with port port.
43 */
44static int32_t send(uint16_t port, dHT::this *dht);
45
46/**
47 * Sets up packet handlers.
48 */
49static void init(dHT::this *dht);
50
51/**
52 * Clear packet handlers.
53 */
54static void kill(dHT::this *dht);
55
56}
57
58/**
59 * Is IP a local ip or not.
60 */
61static bool ip_is_local(iP::this ip);
62
63/**
64 * checks if a given IP isn't routable
65 *
66 * return 0 if ip is a LAN ip.
67 * return -1 if it is not.
68 */
69static int32_t ip_is_lan(iP::this ip);
70
71%{
72#endif
73%}
diff --git a/toxcore/LAN_discovery.c b/toxcore/LAN_discovery.c
index eeba96bd..b5cf2c52 100644
--- a/toxcore/LAN_discovery.c
+++ b/toxcore/LAN_discovery.c
@@ -256,7 +256,7 @@ static IP broadcast_ip(Family family_socket, Family family_broadcast)
256} 256}
257 257
258/* Is IP a local ip or not. */ 258/* Is IP a local ip or not. */
259bool Local_ip(IP ip) 259bool ip_is_local(IP ip)
260{ 260{
261 if (ip.family == TOX_AF_INET) { 261 if (ip.family == TOX_AF_INET) {
262 IP4 ip4 = ip.ip4; 262 IP4 ip4 = ip.ip4;
@@ -271,7 +271,7 @@ bool Local_ip(IP ip)
271 IP ip4; 271 IP ip4;
272 ip4.family = TOX_AF_INET; 272 ip4.family = TOX_AF_INET;
273 ip4.ip4.uint32 = ip.ip6.uint32[3]; 273 ip4.ip4.uint32 = ip.ip6.uint32[3];
274 return Local_ip(ip4); 274 return ip_is_local(ip4);
275 } 275 }
276 276
277 /* localhost in IPv6 (::1) */ 277 /* localhost in IPv6 (::1) */
@@ -286,9 +286,9 @@ bool Local_ip(IP ip)
286/* return 0 if ip is a LAN ip. 286/* return 0 if ip is a LAN ip.
287 * return -1 if it is not. 287 * return -1 if it is not.
288 */ 288 */
289int LAN_ip(IP ip) 289int ip_is_lan(IP ip)
290{ 290{
291 if (Local_ip(ip)) { 291 if (ip_is_local(ip)) {
292 return 0; 292 return 0;
293 } 293 }
294 294
@@ -335,7 +335,7 @@ int LAN_ip(IP ip)
335 IP ip4; 335 IP ip4;
336 ip4.family = TOX_AF_INET; 336 ip4.family = TOX_AF_INET;
337 ip4.ip4.uint32 = ip.ip6.uint32[3]; 337 ip4.ip4.uint32 = ip.ip6.uint32[3];
338 return LAN_ip(ip4); 338 return ip_is_lan(ip4);
339 } 339 }
340 } 340 }
341 341
@@ -346,7 +346,7 @@ static int handle_LANdiscovery(void *object, IP_Port source, const uint8_t *pack
346{ 346{
347 DHT *dht = (DHT *)object; 347 DHT *dht = (DHT *)object;
348 348
349 if (LAN_ip(source.ip) == -1) { 349 if (ip_is_lan(source.ip) == -1) {
350 return 1; 350 return 1;
351 } 351 }
352 352
@@ -363,7 +363,7 @@ static int handle_LANdiscovery(void *object, IP_Port source, const uint8_t *pack
363} 363}
364 364
365 365
366int send_LANdiscovery(uint16_t port, DHT *dht) 366int lan_discovery_send(uint16_t port, DHT *dht)
367{ 367{
368 uint8_t data[CRYPTO_PUBLIC_KEY_SIZE + 1]; 368 uint8_t data[CRYPTO_PUBLIC_KEY_SIZE + 1];
369 data[0] = NET_PACKET_LAN_DISCOVERY; 369 data[0] = NET_PACKET_LAN_DISCOVERY;
@@ -399,12 +399,12 @@ int send_LANdiscovery(uint16_t port, DHT *dht)
399} 399}
400 400
401 401
402void LANdiscovery_init(DHT *dht) 402void lan_discovery_init(DHT *dht)
403{ 403{
404 networking_registerhandler(dht->net, NET_PACKET_LAN_DISCOVERY, &handle_LANdiscovery, dht); 404 networking_registerhandler(dht->net, NET_PACKET_LAN_DISCOVERY, &handle_LANdiscovery, dht);
405} 405}
406 406
407void LANdiscovery_kill(DHT *dht) 407void lan_discovery_kill(DHT *dht)
408{ 408{
409 networking_registerhandler(dht->net, NET_PACKET_LAN_DISCOVERY, NULL, NULL); 409 networking_registerhandler(dht->net, NET_PACKET_LAN_DISCOVERY, NULL, NULL);
410} 410}
diff --git a/toxcore/LAN_discovery.h b/toxcore/LAN_discovery.h
index 753de524..6d9d17b6 100644
--- a/toxcore/LAN_discovery.h
+++ b/toxcore/LAN_discovery.h
@@ -26,27 +26,49 @@
26 26
27#include "DHT.h" 27#include "DHT.h"
28 28
29/* Interval in seconds between LAN discovery packet sending. */ 29#ifndef DHT_DEFINED
30#define LAN_DISCOVERY_INTERVAL 10 30#define DHT_DEFINED
31typedef struct DHT DHT;
32#endif /* DHT_DEFINED */
31 33
32/* Send a LAN discovery pcaket to the broadcast address with port port. */ 34#ifndef IP_DEFINED
33int send_LANdiscovery(uint16_t port, DHT *dht); 35#define IP_DEFINED
36typedef struct IP IP;
37#endif /* IP_DEFINED */
34 38
35/* Sets up packet handlers. */ 39/**
36void LANdiscovery_init(DHT *dht); 40 * Interval in seconds between LAN discovery packet sending.
41 */
42#define LAN_DISCOVERY_INTERVAL 10
37 43
38/* Clear packet handlers. */ 44uint32_t lan_discovery_interval(void);
39void LANdiscovery_kill(DHT *dht);
40 45
41/* Is IP a local ip or not. */ 46/**
42bool Local_ip(IP ip); 47 * Send a LAN discovery pcaket to the broadcast address with port port.
48 */
49int32_t lan_discovery_send(uint16_t port, DHT *dht);
43 50
44/* checks if a given IP isn't routable 51/**
52 * Sets up packet handlers.
53 */
54void lan_discovery_init(DHT *dht);
55
56/**
57 * Clear packet handlers.
58 */
59void lan_discovery_kill(DHT *dht);
60
61/**
62 * Is IP a local ip or not.
63 */
64bool ip_is_local(IP ip);
65
66/**
67 * checks if a given IP isn't routable
45 * 68 *
46 * return 0 if ip is a LAN ip. 69 * return 0 if ip is a LAN ip.
47 * return -1 if it is not. 70 * return -1 if it is not.
48 */ 71 */
49int LAN_ip(IP ip); 72int32_t ip_is_lan(IP ip);
50
51 73
52#endif 74#endif
diff --git a/toxcore/friend_connection.c b/toxcore/friend_connection.c
index 41fef426..2ebc0d9b 100644
--- a/toxcore/friend_connection.c
+++ b/toxcore/friend_connection.c
@@ -229,7 +229,7 @@ int friend_add_tcp_relay(Friend_Connections *fr_c, int friendcon_id, IP_Port ip_
229 } 229 }
230 230
231 /* Local ip and same pk means that they are hosting a TCP relay. */ 231 /* Local ip and same pk means that they are hosting a TCP relay. */
232 if (Local_ip(ip_port.ip) && public_key_cmp(friend_con->dht_temp_pk, public_key) == 0) { 232 if (ip_is_local(ip_port.ip) && public_key_cmp(friend_con->dht_temp_pk, public_key) == 0) {
233 if (friend_con->dht_ip_port.ip.family != 0) { 233 if (friend_con->dht_ip_port.ip.family != 0) {
234 ip_port.ip = friend_con->dht_ip_port.ip; 234 ip_port.ip = friend_con->dht_ip_port.ip;
235 } else { 235 } else {
@@ -892,7 +892,7 @@ Friend_Connections *new_friend_connections(Onion_Client *onion_c, bool local_dis
892 new_connection_handler(temp->net_crypto, &handle_new_connections, temp); 892 new_connection_handler(temp->net_crypto, &handle_new_connections, temp);
893 893
894 if (temp->local_discovery_enabled) { 894 if (temp->local_discovery_enabled) {
895 LANdiscovery_init(temp->dht); 895 lan_discovery_init(temp->dht);
896 } 896 }
897 897
898 return temp; 898 return temp;
@@ -907,11 +907,11 @@ static void LANdiscovery(Friend_Connections *fr_c)
907 last = last > TOX_PORTRANGE_TO ? TOX_PORTRANGE_TO : last; 907 last = last > TOX_PORTRANGE_TO ? TOX_PORTRANGE_TO : last;
908 908
909 // Always send to default port 909 // Always send to default port
910 send_LANdiscovery(net_htons(TOX_PORT_DEFAULT), fr_c->dht); 910 lan_discovery_send(net_htons(TOX_PORT_DEFAULT), fr_c->dht);
911 911
912 // And check some extra ports 912 // And check some extra ports
913 for (uint16_t port = first; port < last; port++) { 913 for (uint16_t port = first; port < last; port++) {
914 send_LANdiscovery(net_htons(port), fr_c->dht); 914 lan_discovery_send(net_htons(port), fr_c->dht);
915 } 915 }
916 916
917 // Don't include default port in port range 917 // Don't include default port in port range
@@ -987,7 +987,7 @@ void kill_friend_connections(Friend_Connections *fr_c)
987 } 987 }
988 988
989 if (fr_c->local_discovery_enabled) { 989 if (fr_c->local_discovery_enabled) {
990 LANdiscovery_kill(fr_c->dht); 990 lan_discovery_kill(fr_c->dht);
991 } 991 }
992 992
993 free(fr_c); 993 free(fr_c);
diff --git a/toxcore/net_crypto.c b/toxcore/net_crypto.c
index b3cf2cbf..3150392e 100644
--- a/toxcore/net_crypto.c
+++ b/toxcore/net_crypto.c
@@ -432,7 +432,7 @@ static int add_ip_port_connection(Net_Crypto *c, int crypt_connection_id, IP_Por
432 } 432 }
433 433
434 if (ip_port.ip.family == TOX_AF_INET) { 434 if (ip_port.ip.family == TOX_AF_INET) {
435 if (!ipport_equal(&ip_port, &conn->ip_portv4) && LAN_ip(conn->ip_portv4.ip) != 0) { 435 if (!ipport_equal(&ip_port, &conn->ip_portv4) && ip_is_lan(conn->ip_portv4.ip) != 0) {
436 if (!bs_list_add(&c->ip_port_list, (uint8_t *)&ip_port, crypt_connection_id)) { 436 if (!bs_list_add(&c->ip_port_list, (uint8_t *)&ip_port, crypt_connection_id)) {
437 return -1; 437 return -1;
438 } 438 }
@@ -482,7 +482,7 @@ static IP_Port return_ip_port_connection(Net_Crypto *c, int crypt_connection_id)
482 v6 = 1; 482 v6 = 1;
483 } 483 }
484 484
485 if (v4 && LAN_ip(conn->ip_portv4.ip) == 0) { 485 if (v4 && ip_is_lan(conn->ip_portv4.ip) == 0) {
486 return conn->ip_portv4; 486 return conn->ip_portv4;
487 } 487 }
488 488
diff --git a/toxcore/network.h b/toxcore/network.h
index c8671f57..d3b80218 100644
--- a/toxcore/network.h
+++ b/toxcore/network.h
@@ -140,20 +140,19 @@ typedef union {
140 uint16_t uint16[8]; 140 uint16_t uint16[8];
141 uint32_t uint32[4]; 141 uint32_t uint32[4];
142 uint64_t uint64[2]; 142 uint64_t uint64[2];
143} 143} IP6;
144IP6;
145 144
146IP6 get_ip6_loopback(void); 145IP6 get_ip6_loopback(void);
147extern const IP6 IP6_BROADCAST; 146extern const IP6 IP6_BROADCAST;
148 147
148#define IP_DEFINED
149typedef struct { 149typedef struct {
150 uint8_t family; 150 uint8_t family;
151 GNU_EXTENSION union { 151 GNU_EXTENSION union {
152 IP4 ip4; 152 IP4 ip4;
153 IP6 ip6; 153 IP6 ip6;
154 }; 154 };
155} 155} IP;
156IP;
157 156
158#define IP_PORT_DEFINED 157#define IP_PORT_DEFINED
159typedef struct IP_Port { 158typedef struct IP_Port {
diff --git a/toxcore/onion_announce.c b/toxcore/onion_announce.c
index d60c09c9..ab96a546 100644
--- a/toxcore/onion_announce.c
+++ b/toxcore/onion_announce.c
@@ -405,7 +405,7 @@ static int handle_announce_request(void *object, IP_Port source, const uint8_t *
405 /*Respond with a announce response packet*/ 405 /*Respond with a announce response packet*/
406 Node_format nodes_list[MAX_SENT_NODES]; 406 Node_format nodes_list[MAX_SENT_NODES];
407 unsigned int num_nodes = get_close_nodes(onion_a->dht, plain + ONION_PING_ID_SIZE, nodes_list, 0, 407 unsigned int num_nodes = get_close_nodes(onion_a->dht, plain + ONION_PING_ID_SIZE, nodes_list, 0,
408 LAN_ip(source.ip) == 0, 1); 408 ip_is_lan(source.ip) == 0, 1);
409 uint8_t nonce[CRYPTO_NONCE_SIZE]; 409 uint8_t nonce[CRYPTO_NONCE_SIZE];
410 random_nonce(nonce); 410 random_nonce(nonce);
411 411
diff --git a/toxcore/onion_client.c b/toxcore/onion_client.c
index 8a4dd40d..50373330 100644
--- a/toxcore/onion_client.c
+++ b/toxcore/onion_client.c
@@ -793,12 +793,12 @@ static int client_ping_nodes(Onion_Client *onion_c, uint32_t num, const Node_for
793 } 793 }
794 794
795 unsigned int i, j; 795 unsigned int i, j;
796 int lan_ips_accepted = (LAN_ip(source.ip) == 0); 796 int lan_ips_accepted = (ip_is_lan(source.ip) == 0);
797 797
798 for (i = 0; i < num_nodes; ++i) { 798 for (i = 0; i < num_nodes; ++i) {
799 799
800 if (!lan_ips_accepted) { 800 if (!lan_ips_accepted) {
801 if (LAN_ip(nodes[i].ip_port.ip) == 0) { 801 if (ip_is_lan(nodes[i].ip_port.ip) == 0) {
802 continue; 802 continue;
803 } 803 }
804 } 804 }