mirror of
https://github.com/irungentoo/toxcore.git
synced 2024-03-22 13:30:51 +08:00
Remove unnecessary braces
This commit is contained in:
parent
e65bedc096
commit
5bfb3957c4
|
@ -21,38 +21,24 @@ IP broadcast_ip()
|
||||||
int LAN_ip(IP ip)
|
int LAN_ip(IP ip)
|
||||||
{
|
{
|
||||||
if(ip.c[0] == 127)/* Loopback */
|
if(ip.c[0] == 127)/* Loopback */
|
||||||
{
|
|
||||||
return 0;
|
return 0;
|
||||||
}
|
|
||||||
if(ip.c[0] == 10)/* 10.0.0.0 to 10.255.255.255 range */
|
if(ip.c[0] == 10)/* 10.0.0.0 to 10.255.255.255 range */
|
||||||
{
|
|
||||||
return 0;
|
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 */
|
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;
|
return 0;
|
||||||
}
|
|
||||||
if(ip.c[0] == 192 && ip.c[1] == 168) /* 192.168.0.0 to 192.168.255.255 range */
|
if(ip.c[0] == 192 && ip.c[1] == 168) /* 192.168.0.0 to 192.168.255.255 range */
|
||||||
{
|
|
||||||
return 0;
|
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 */
|
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 0;
|
||||||
}
|
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
|
|
||||||
int handle_LANdiscovery(uint8_t * packet, uint32_t length, IP_Port source)
|
int handle_LANdiscovery(uint8_t * packet, uint32_t length, IP_Port source)
|
||||||
{
|
{
|
||||||
if(LAN_ip(source.ip) == -1)
|
if(LAN_ip(source.ip) == -1)
|
||||||
{
|
|
||||||
return 1;
|
return 1;
|
||||||
}
|
|
||||||
if(length != crypto_box_PUBLICKEYBYTES + 1)
|
if(length != crypto_box_PUBLICKEYBYTES + 1)
|
||||||
{
|
|
||||||
return 1;
|
return 1;
|
||||||
}
|
|
||||||
DHT_bootstrap(source, packet + 1);
|
DHT_bootstrap(source, packet + 1);
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
@ -71,8 +57,6 @@ int send_LANdiscovery(uint16_t port)
|
||||||
int LANdiscovery_handlepacket(uint8_t * packet, uint32_t length, IP_Port source)
|
int LANdiscovery_handlepacket(uint8_t * packet, uint32_t length, IP_Port source)
|
||||||
{
|
{
|
||||||
if(packet[0] == 32)
|
if(packet[0] == 32)
|
||||||
{
|
|
||||||
return handle_LANdiscovery(packet, length, source);
|
return handle_LANdiscovery(packet, length, source);
|
||||||
}
|
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue
Block a user