]> git.ipfire.org Git - thirdparty/dhcpcd.git/commitdiff
Check AF_PACKET is defined
authorRoy Marples <roy@marples.name>
Wed, 27 May 2020 15:49:40 +0000 (15:49 +0000)
committerRoy Marples <roy@marples.name>
Wed, 27 May 2020 15:49:40 +0000 (15:49 +0000)
src/if.c
src/sa.c

index 667819d2dd35e0c9482ab4026910332cd552d157..dd9fdc059009f239421d1c95e4b32bd287235320 100644 (file)
--- a/src/if.c
+++ b/src/if.c
@@ -381,7 +381,7 @@ if_discover(struct dhcpcd_ctx *ctx, struct ifaddrs **ifaddrs,
        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 @@ if_discover(struct dhcpcd_ctx *ctx, struct ifaddrs **ifaddrs,
 #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 @@ if_discover(struct dhcpcd_ctx *ctx, struct ifaddrs **ifaddrs,
                        }
                        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;
index d7ecc76f24753a403612e5edd8fd9d2041687125..97e5e874d8f30e485578f856900e32478b55d95f 100644 (file)
--- a/src/sa.c
+++ b/src/sa.c
@@ -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 @@ sa_addrtop(const struct sockaddr *sa, char *buf, socklen_t len)
                }
                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;