summaryrefslogtreecommitdiff
path: root/toxcore/LAN_discovery.c
diff options
context:
space:
mode:
authorKostya <kostyarjcnz@gmail.com>2013-08-30 03:28:50 -0400
committerKostya <kostyarjcnz@gmail.com>2013-08-30 03:28:50 -0400
commit25563ac07005448706d294dccdabf14fbe01d100 (patch)
tree2166609dfed18c1e4625c05ac0478220dd842d87 /toxcore/LAN_discovery.c
parent790867d984841ba0e28c4100615590870895e7d4 (diff)
Fixed build errors.
Diffstat (limited to 'toxcore/LAN_discovery.c')
-rw-r--r--toxcore/LAN_discovery.c17
1 files changed, 8 insertions, 9 deletions
diff --git a/toxcore/LAN_discovery.c b/toxcore/LAN_discovery.c
index 736959c5..cb27c024 100644
--- a/toxcore/LAN_discovery.c
+++ b/toxcore/LAN_discovery.c
@@ -89,11 +89,10 @@ static IP broadcast_ip(void)
89{ 89{
90 IP ip; 90 IP ip;
91#ifdef __linux 91#ifdef __linux
92 ip.i = get_broadcast(); 92 ip.uint32 = get_broadcast();
93 93
94 if (ip.i == 0) 94 if (ip.uint32 == 0)
95 /* Error occured, but try anyway? */ 95 ip.uint32 = ~0; /* Error occured, but try anyway? */
96 ip.i = ~0;
97 96
98#else 97#else
99 ip.i = ~0; 98 ip.i = ~0;
@@ -106,19 +105,19 @@ static IP broadcast_ip(void)
106 */ 105 */
107static int LAN_ip(IP ip) 106static int LAN_ip(IP ip)
108{ 107{
109 if (ip.c[0] == 127) /* Loopback. */ 108 if (ip.uint8[0] == 127) /* Loopback. */
110 return 0; 109 return 0;
111 110
112 if (ip.c[0] == 10) /* 10.0.0.0 to 10.255.255.255 range. */ 111 if (ip.uint8[0] == 10) /* 10.0.0.0 to 10.255.255.255 range. */
113 return 0; 112 return 0;
114 113
115 if (ip.c[0] == 172 && ip.c[1] >= 16 && ip.c[1] <= 31) /* 172.16.0.0 to 172.31.255.255 range. */ 114 if (ip.uint8[0] == 172 && ip.uint8[1] >= 16 && ip.uint8[1] <= 31) /* 172.16.0.0 to 172.31.255.255 range. */
116 return 0; 115 return 0;
117 116
118 if (ip.c[0] == 192 && ip.c[1] == 168) /* 192.168.0.0 to 192.168.255.255 range. */ 117 if (ip.uint8[0] == 192 && ip.uint8[1] == 168) /* 192.168.0.0 to 192.168.255.255 range. */
119 return 0; 118 return 0;
120 119
121 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. */ 120 if (ip.uint8[0] == 169 && ip.uint8[1] == 254 && ip.uint8[2] != 0 && ip.uint8[2] != 255)/* 169.254.1.0 to 169.254.254.255 range. */
122 return 0; 121 return 0;
123 122
124 return -1; 123 return -1;