then :
printf "%s\n" "#define HAVE_MALLOC_H 1" >>confdefs.h
+fi
+ac_fn_c_check_header_compile "$LINENO" "net/if_dl.h" "ac_cv_header_net_if_dl_h" "$ac_includes_default"
+if test "x$ac_cv_header_net_if_dl_h" = xyes
+then :
+ printf "%s\n" "#define HAVE_NET_IF_DL_H 1" >>confdefs.h
+
fi
ac_fn_c_check_header_compile "$LINENO" "netdb.h" "ac_cv_header_netdb_h" "$ac_includes_default"
if test "x$ac_cv_header_netdb_h" = xyes
then :
printf "%s\n" "#define HAVE_NETINET_IN_H 1" >>confdefs.h
+fi
+ac_fn_c_check_header_compile "$LINENO" "netpacket/packet.h" "ac_cv_header_netpacket_packet_h" "$ac_includes_default"
+if test "x$ac_cv_header_netpacket_packet_h" = xyes
+then :
+ printf "%s\n" "#define HAVE_NETPACKET_PACKET_H 1" >>confdefs.h
+
fi
ac_fn_c_check_header_compile "$LINENO" "prot.h" "ac_cv_header_prot_h" "$ac_includes_default"
if test "x$ac_cv_header_prot_h" = xyes
limits.h \
linux/if_packet.h \
malloc.h \
+ net/if_dl.h \
netdb.h \
netinet/in.h \
+ netpacket/packet.h \
prot.h \
pwd.h \
resource.h \
/* Define to 1 if you have the <netinet/in.h> header file. */
#undef HAVE_NETINET_IN_H
+/* Define to 1 if you have the <netpacket/packet.h> header file. */
+#undef HAVE_NETPACKET_PACKET_H
+
+/* Define to 1 if you have the <net/if_dl.h> header file. */
+#undef HAVE_NET_IF_DL_H
+
/* Define to 1 if you have the <net/if.h> header file. */
#undef HAVE_NET_IF_H
#include <stdlib.h>
#include <ifaddrs.h>
+#include <net/if_arp.h>
-#ifdef HAVE_LINUX_IF_PACKET_H
+/*
+ * Linux
+ */
+#if defined(HAVE_LINUX_IF_PACKET_H)
# include <linux/if_packet.h>
# include <linux/if_ether.h>
-#endif
-
-#include <net/if_arp.h>
-
/*
* Apple, *BSD
*/
-#ifndef __linux__
-#include <net/if_dl.h>
+#elif defined(HAVE_NET_IF_DL_H)
+# include <net/if_dl.h> /* Needed for struct sockaddr_ll def */
+/*
+ * emscripten/musl
+ */
+#elif defined(HAVE_NETPACKET_PACKET_H)
+# include <netpacket/packet.h> /* Needed for struct sockaddr_ll def */
#endif
bool fr_reverse_lookups = false; //!< IP -> hostname lookups?
#ifdef HAVE_STRUCT_SOCKADDR_IN6
} else if (ipaddr->af == AF_INET6) {
- if (IN6_IS_ADDR_UNSPECIFIED(&(ipaddr->addr.v6))) {
+ /* Unconst for emscripten/musl */
+ if (IN6_IS_ADDR_UNSPECIFIED(UNCONST(struct in6_addr *, &(ipaddr->addr.v6)))) {
return 1;
}
#endif
if ((ipaddr->addr.v4.s_addr >= 3758096384) && (ipaddr->addr.v4.s_addr <= 4026531839)) return 1;
#ifdef HAVE_STRUCT_SOCKADDR_IN6
} else if (ipaddr->af == AF_INET6) {
- if (IN6_IS_ADDR_MULTICAST(&(ipaddr->addr.v6))) {
+ /* Unconst for emscripten/musl */
+ if (IN6_IS_ADDR_MULTICAST(UNCONST(struct in6_addr *, &(ipaddr->addr.v6)))) {
return 1;
}
#endif
if (!i->ifa_addr || !i->ifa_name || (i->ifa_addr->sa_family != AF_LINK)) continue;
if (strcmp(i->ifa_name, interface) != 0) continue;
-#ifdef __linux__
+#if defined(__linux__) || defined(__EMSCRIPTEN__)
struct sockaddr_ll *ll;
ll = (struct sockaddr_ll *) i->ifa_addr;
#ifndef SIOCGIFHWADDR
# include <ifaddrs.h>
-# include <net/if_dl.h>
+# ifdef HAVE_NET_IF_DL_H
+# include <net/if_dl.h>
+# endif
#else
# include <net/if.h>
#endif
*/
if (ipaddr->af == AF_INET6) {
# ifdef IPV6_V6ONLY
- if (IN6_IS_ADDR_UNSPECIFIED(&ipaddr->addr.v6)) {
+ /* unconst for emscripten/musl */
+ if (IN6_IS_ADDR_UNSPECIFIED(UNCONST(struct in6_addr *, &ipaddr->addr.v6))) {
int on = 1;
if (setsockopt(sockfd, IPPROTO_IPV6, IPV6_V6ONLY,
uint64_t value;
num_bits = offset + child->flags.length;
- if ((end - p) < fr_bytes_from_bits(num_bits)) {
+ if ((size_t)(end - p) < fr_bytes_from_bits(num_bits)) {
FR_PROTO_TRACE("not enough data for bit decoder?");
goto unknown;
}