You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

67 lines
2.0 KiB

  1. --- a/cmake/checks.cmake
  2. +++ b/cmake/checks.cmake
  3. @@ -54,9 +54,13 @@ if(NOT DARWIN)
  4. endif(NOT DARWIN)
  5. +set(CMAKE_EXTRA_INCLUDE_FILES "linux/if_ether.h")
  6. +check_type_size("struct ethhdr" SIZEOF_ETHHDR)
  7. +string(COMPARE NOTEQUAL "${SIZEOF_ETHHDR}" "" HAVE_LINUX_ETHHDR)
  8. +
  9. set(CMAKE_EXTRA_INCLUDE_FILES "netinet/if_ether.h")
  10. check_type_size("struct ethhdr" SIZEOF_ETHHDR)
  11. -string(COMPARE NOTEQUAL "${SIZEOF_ETHHDR}" "" HAVE_ETHHDR)
  12. +string(COMPARE NOTEQUAL "${SIZEOF_ETHHDR}" "" HAVE_NETINET_ETHHDR)
  13. set(CMAKE_REQUIRED_INCLUDES "sys/types.h")
  14. --- a/src/compat.h
  15. +++ b/src/compat.h
  16. @@ -45,7 +45,12 @@
  17. #include <net/if.h>
  18. #include <net/if_arp.h>
  19. #include <netinet/in.h>
  20. +
  21. +#if defined(HAVE_LINUX_ETHHDR)
  22. +#include <linux/if_ether.h>
  23. +#elif defined(HAVE_NETINET_ETHHDR)
  24. #include <netinet/if_ether.h>
  25. +#endif
  26. #ifndef ETH_ALEN
  27. /** The length of a MAC address */
  28. @@ -55,9 +60,8 @@
  29. #ifndef ETH_HLEN
  30. /** The length of the standard ethernet header */
  31. #define ETH_HLEN 14
  32. -#endif
  33. -#ifndef HAVE_ETHHDR
  34. +#if !defined(HAVE_LINUX_ETHHDR) && !defined(HAVE_NETINET_ETHHDR)
  35. /** An ethernet header */
  36. struct ethhdr {
  37. uint8_t h_dest[ETH_ALEN]; /**< The destination MAC address field */
  38. @@ -65,6 +69,7 @@ struct ethhdr {
  39. uint16_t h_proto; /**< The EtherType/length field */
  40. } __attribute__((packed));
  41. #endif
  42. +#endif
  43. #if defined(USE_FREEBIND) && !defined(IP_FREEBIND)
  44. /** Compatiblity define for systems supporting, but not defining IP_FREEBIND */
  45. --- a/src/fastd_config.h.in
  46. +++ b/src/fastd_config.h.in
  47. @@ -35,8 +35,11 @@
  48. /** Defined if the platform supports the AI_ADDRCONFIG flag to getaddrinfo() */
  49. #cmakedefine HAVE_AI_ADDRCONFIG
  50. -/** Defined if the platform defines the \e ethhdr struct */
  51. -#cmakedefine HAVE_ETHHDR
  52. +/** Defined if the platform defines the \e ethhdr struct through linux/if_ether.h */
  53. +#cmakedefine HAVE_LINUX_ETHHDR
  54. +
  55. +/** Defined if the platform defines the \e ethhdr struct through netinet/if_ether.h */
  56. +#cmakedefine HAVE_NETINET_ETHHDR
  57. /** Defined if the platform defines get_current_dir_name() */
  58. #cmakedefine HAVE_GET_CURRENT_DIR_NAME