Browse code

core: common check for ifa->ifa_addr in add_intefaces

- if no ip address associated with the network interface, it is not
useful anyhow

Daniel-Constantin Mierla authored on 06/04/2016 17:22:58
Showing 1 changed files
... ...
@@ -1205,9 +1205,12 @@ 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
+		/* skip if no IP addr associated with the interface */
1209
+		if (ifa->ifa_addr==0)
1210
+			continue;
1208 1211
 #ifdef AF_PACKET
1209 1212
 		/* skip AF_PACKET addr family since it is of no use later on */
1210
-		if (ifa->ifa_addr && ifa->ifa_addr->sa_family == AF_PACKET)
1213
+		if (ifa->ifa_addr->sa_family == AF_PACKET)
1211 1214
 			continue;
1212 1215
 #endif
1213 1216
 		if (if_name && strcmp(if_name, ifa->ifa_name))