summaryrefslogtreecommitdiff
path: root/core/LAN_discovery.c
diff options
context:
space:
mode:
authornfkd <nfkd@koszmial.pl>2013-07-26 13:25:51 -0300
committernfkd <nfkd@koszmial.pl>2013-07-26 13:25:51 -0300
commit5bfb3957c4f3707d6309e474687d363ea462f91b (patch)
treecac8950fbe41ae9bc3664557a44b31ce0d4464c9 /core/LAN_discovery.c
parente65bedc09657969e04ad02ffd790c3e84125a3bb (diff)
Remove unnecessary braces
Diffstat (limited to 'core/LAN_discovery.c')
-rw-r--r--core/LAN_discovery.c16
1 files changed, 0 insertions, 16 deletions
diff --git a/core/LAN_discovery.c b/core/LAN_discovery.c
index 7b6e0bd9..4ff2fcbf 100644
--- a/core/LAN_discovery.c
+++ b/core/LAN_discovery.c
@@ -21,38 +21,24 @@ IP broadcast_ip()
21int LAN_ip(IP ip) 21int LAN_ip(IP ip)
22{ 22{
23 if(ip.c[0] == 127)/* Loopback */ 23 if(ip.c[0] == 127)/* Loopback */
24 {
25 return 0; 24 return 0;
26 }
27 if(ip.c[0] == 10)/* 10.0.0.0 to 10.255.255.255 range */ 25 if(ip.c[0] == 10)/* 10.0.0.0 to 10.255.255.255 range */
28 {
29 return 0; 26 return 0;
30 }
31 if(ip.c[0] == 172 && ip.c[1] >= 16 && ip.c[1] <= 31)/* 172.16.0.0 to 172.31.255.255 range */ 27 if(ip.c[0] == 172 && ip.c[1] >= 16 && ip.c[1] <= 31)/* 172.16.0.0 to 172.31.255.255 range */
32 {
33 return 0; 28 return 0;
34 }
35 if(ip.c[0] == 192 && ip.c[1] == 168) /* 192.168.0.0 to 192.168.255.255 range */ 29 if(ip.c[0] == 192 && ip.c[1] == 168) /* 192.168.0.0 to 192.168.255.255 range */
36 {
37 return 0; 30 return 0;
38 }
39 if(ip.c[0] == 169 && ip.c[1] == 254 && ip.c[2] != 0 && ip.c[2] != 255)/* 169.254.1.0 to 169.254.254.255 range */ 31 if(ip.c[0] == 169 && ip.c[1] == 254 && ip.c[2] != 0 && ip.c[2] != 255)/* 169.254.1.0 to 169.254.254.255 range */
40 {
41 return 0; 32 return 0;
42 }
43 return -1; 33 return -1;
44} 34}
45 35
46int handle_LANdiscovery(uint8_t * packet, uint32_t length, IP_Port source) 36int handle_LANdiscovery(uint8_t * packet, uint32_t length, IP_Port source)
47{ 37{
48 if(LAN_ip(source.ip) == -1) 38 if(LAN_ip(source.ip) == -1)
49 {
50 return 1; 39 return 1;
51 }
52 if(length != crypto_box_PUBLICKEYBYTES + 1) 40 if(length != crypto_box_PUBLICKEYBYTES + 1)
53 {
54 return 1; 41 return 1;
55 }
56 DHT_bootstrap(source, packet + 1); 42 DHT_bootstrap(source, packet + 1);
57 return 0; 43 return 0;
58} 44}
@@ -71,8 +57,6 @@ int send_LANdiscovery(uint16_t port)
71int LANdiscovery_handlepacket(uint8_t * packet, uint32_t length, IP_Port source) 57int LANdiscovery_handlepacket(uint8_t * packet, uint32_t length, IP_Port source)
72{ 58{
73 if(packet[0] == 32) 59 if(packet[0] == 32)
74 {
75 return handle_LANdiscovery(packet, length, source); 60 return handle_LANdiscovery(packet, length, source);
76 }
77 return 1; 61 return 1;
78} 62}