[sr-dev] git:4.4:e6dd2c17: core: test if AF_PACKET is defined at compile time

Daniel-Constantin Mierla miconda at gmail.com
Fri Apr 1 11:23:49 CEST 2016


Module: kamailio
Branch: 4.4
Commit: e6dd2c172be3712e8c468cbe7e55ba94d81a7b62
URL: https://github.com/kamailio/kamailio/commit/e6dd2c172be3712e8c468cbe7e55ba94d81a7b62

Author: Daniel-Constantin Mierla <miconda at gmail.com>
Committer: Daniel-Constantin Mierla <miconda at gmail.com>
Date: 2016-04-01T11:23:19+02:00

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)

---

Modified: socket_info.c

---

Diff:  https://github.com/kamailio/kamailio/commit/e6dd2c172be3712e8c468cbe7e55ba94d81a7b62.diff
Patch: https://github.com/kamailio/kamailio/commit/e6dd2c172be3712e8c468cbe7e55ba94d81a7b62.patch

---

diff --git a/socket_info.c b/socket_info.c
index 1d28977..cecfef9 100644
--- a/socket_info.c
+++ b/socket_info.c
@@ -1205,16 +1205,18 @@ int add_interfaces(char* if_name, int family, unsigned short port,
 
 	for (ifa = ifap; ifa; ifa = ifa->ifa_next)
 	{
+#ifdef AF_PACKET
 		/* skip AF_PACKET addr family since it is of no use later on */
 		if (ifa->ifa_addr->sa_family == AF_PACKET)
 			continue;
+#endif
 		if (if_name && strcmp(if_name, ifa->ifa_name))
 			continue;
 		if (family && family != ifa->ifa_addr->sa_family)
 			continue;
 		sockaddr2ip_addr(&addr, (struct sockaddr*)ifa->ifa_addr);
 		tmp=ip_addr2a(&addr);
-		if (ifa->ifa_flags & IFF_LOOPBACK) 
+		if (ifa->ifa_flags & IFF_LOOPBACK)
 			flags = SI_IS_LO;
 		else
 			flags = SI_NONE;




More information about the sr-dev mailing list