Merge pull request #105 from nfkd/patch-1

Remove unnecessary braces
This commit is contained in:
irungentoo 2013-07-26 10:20:59 -07:00
commit 9d860fac79

View File

@ -21,38 +21,24 @@ IP broadcast_ip()
int LAN_ip(IP ip)
{
if(ip.c[0] == 127)/* Loopback */
{
return 0;
}
if(ip.c[0] == 10)/* 10.0.0.0 to 10.255.255.255 range */
{
return 0;
}
if(ip.c[0] == 172 && ip.c[1] >= 16 && ip.c[1] <= 31)/* 172.16.0.0 to 172.31.255.255 range */
{
return 0;
}
if(ip.c[0] == 192 && ip.c[1] == 168) /* 192.168.0.0 to 192.168.255.255 range */
{
return 0;
}
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 */
{
return 0;
}
return -1;
}
int handle_LANdiscovery(uint8_t * packet, uint32_t length, IP_Port source)
{
if(LAN_ip(source.ip) == -1)
{
return 1;
}
if(length != crypto_box_PUBLICKEYBYTES + 1)
{
return 1;
}
DHT_bootstrap(source, packet + 1);
return 0;
}
@ -71,8 +57,6 @@ int send_LANdiscovery(uint16_t port)
int LANdiscovery_handlepacket(uint8_t * packet, uint32_t length, IP_Port source)
{
if(packet[0] == 32)
{
return handle_LANdiscovery(packet, length, source);
}
return 1;
}