changeset 5270:be03c967ee2a draft

Check AF_PACKET is defined
author Roy Marples <roy@marples.name>
date Wed, 27 May 2020 15:49:40 +0000
parents 13d407c45d58
children 8fb09d31d388
files src/if.c src/sa.c
diffstat 2 files changed, 5 insertions(+), 5 deletions(-) [+]
line wrap: on
line diff
--- a/src/if.c	Sun May 24 14:57:18 2020 +0000
+++ b/src/if.c	Wed May 27 15:49:40 2020 +0000
@@ -381,7 +381,7 @@
 	struct if_laddrreq iflr = { .flags = IFLR_PREFIX };
 	int link_fd;
 #endif
-#elif AF_PACKET
+#elif defined(AF_PACKET)
 	const struct sockaddr_ll *sll;
 #endif
 #if defined(SIOCGIFPRIORITY)
@@ -423,7 +423,7 @@
 #ifdef AF_LINK
 			if (ifa->ifa_addr->sa_family != AF_LINK)
 				continue;
-#elif AF_PACKET
+#elif defined(AF_PACKET)
 			if (ifa->ifa_addr->sa_family != AF_PACKET)
 				continue;
 #endif
@@ -578,7 +578,7 @@
 			}
 			ifp->hwlen = sdl->sdl_alen;
 			memcpy(ifp->hwaddr, CLLADDR(sdl), ifp->hwlen);
-#elif AF_PACKET
+#elif defined(AF_PACKET)
 			sll = (const void *)ifa->ifa_addr;
 			ifp->index = (unsigned int)sll->sll_ifindex;
 			ifp->hwtype = sll->sll_hatype;
--- a/src/sa.c	Sun May 24 14:57:18 2020 +0000
+++ b/src/sa.c	Wed May 27 15:49:40 2020 +0000
@@ -32,7 +32,7 @@
 #include <arpa/inet.h>
 #ifdef AF_LINK
 #include <net/if_dl.h>
-#elif AF_PACKET
+#elif defined(AF_PACKET)
 #include <linux/if_packet.h>
 #endif
 
@@ -385,7 +385,7 @@
 		}
 		return hwaddr_ntoa(CLLADDR(sdl), sdl->sdl_alen, buf, len);
 	}
-#elif AF_PACKET
+#elif defined(AF_PACKET)
 	if (sa->sa_family == AF_PACKET) {
 		const struct sockaddr_ll *sll;