Browse code

core: test if AF_PACKET is defined at compile time

- mac os x (and perhaps *BSDs) doesn't have it

(cherry picked from commit 8543993e1f702aef80887c0e72b9bf67c62c1617)

Daniel-Constantin Mierla authored on 01/04/2016 09:10:46
Showing 1 changed files
... ...
@@ -1205,16 +1205,18 @@ int add_interfaces(char* if_name, int family, unsigned short port,
1205 1205
 
1206 1206
 	for (ifa = ifap; ifa; ifa = ifa->ifa_next)
1207 1207
 	{
1208
+#ifdef AF_PACKET
1208 1209
 		/* skip AF_PACKET addr family since it is of no use later on */
1209 1210
 		if (ifa->ifa_addr->sa_family == AF_PACKET)
1210 1211
 			continue;
1212
+#endif
1211 1213
 		if (if_name && strcmp(if_name, ifa->ifa_name))
1212 1214
 			continue;
1213 1215
 		if (family && family != ifa->ifa_addr->sa_family)
1214 1216
 			continue;
1215 1217
 		sockaddr2ip_addr(&addr, (struct sockaddr*)ifa->ifa_addr);
1216 1218
 		tmp=ip_addr2a(&addr);
1217
-		if (ifa->ifa_flags & IFF_LOOPBACK) 
1219
+		if (ifa->ifa_flags & IFF_LOOPBACK)
1218 1220
 			flags = SI_IS_LO;
1219 1221
 		else
1220 1222
 			flags = SI_NONE;