case "$OS" in
freebsd*|kfreebsd*)
+ # FreeBSD hide some newer POSIX APIs behind _GNU_SOURCE ...
echo "CPPFLAGS+= -D_GNU_SOURCE" >>$CONFIG_MK
+ case "$OS" in
+ kfreebsd*) echo "CPPFLAGS+= -DBSD" >>$CONFIG_MK;;
+ esac
echo "DHCPCD_SRCS+= if-bsd.c" >>$CONFIG_MK
+ # Whacky includes needed to buck the trend
+ echo "#include <net/if.h>" >>$CONFIG_H
+ echo "#include <net/if_var.h>" >>$CONFIG_H
;;
linux*)
echo "CPPFLAGS+= -D_GNU_SOURCE" >>$CONFIG_MK
const char dhcpcd_copyright[] = "Copyright (c) 2006-2015 Roy Marples";
-#define _WITH_DPRINTF /* Stop FreeBSD bitching */
-
#include <sys/file.h>
#include <sys/socket.h>
#include <sys/stat.h>
#include <sys/uio.h>
#include <sys/utsname.h>
+#include "config.h"
+
#include <arpa/inet.h>
#include <net/bpf.h>
#include <net/if.h>
#include <net/if_dl.h>
-#ifdef __FreeBSD__ /* Needed so that including netinet6/in6_var.h works */
-# include <net/if_var.h>
-#endif
#include <net/if_media.h>
#include <net/route.h>
#include <netinet/if_ether.h>
#undef IPV6CTL_ACCEPT_RTADV
#endif
-#include "config.h"
#include "common.h"
#include "dhcp.h"
#include "if.h"
* SUCH DAMAGE.
*/
-#define _WITH_GETLINE /* Stop FreeBSD bitching */
-
#include <sys/param.h>
#include <sys/stat.h>
#include <sys/types.h>
#include <sys/ioctl.h>
#include <sys/socket.h>
+#include "config.h"
+
#include <net/if.h>
#include <net/if_arp.h>
#include <netinet/in.h>
-#ifdef __FreeBSD__ /* Needed so that including netinet6/in6_var.h works */
-# include <net/if_var.h>
-#endif
#ifdef AF_LINK
# include <net/if_dl.h>
# include <net/if_types.h>
#include <unistd.h>
#include <fcntl.h>
-#include "config.h"
#include "common.h"
#include "dev.h"
#include "dhcp.h"
#define INTERFACE_H
#include <net/if.h>
-#ifdef __FreeBSD__
-#include <net/if_var.h>
-#endif
#include <net/route.h> /* for RTM_ADD et all */
#include <netinet/in.h>
#ifdef BSD
#include <netinet/in.h>
#include <netinet/if_ether.h>
+#include "config.h"
+
#ifdef BSD
/* Purely for the ND6_IFF_AUTO_LINKLOCAL #define which is solely used
* to generate our CAN_ADD_LLADDR #define. */
-# ifdef __FreeBSD__
-# include <net/if_var.h>
-# endif
# include <netinet6/in6_var.h>
# include <netinet6/nd6.h>
#endif
#include <sys/uio.h>
#include <netinet/in.h>
+#include "config.h"
+
#ifndef __linux__
# ifndef __QNX__
# include <sys/endian.h>
# endif
# include <net/if.h>
-# ifdef __FreeBSD__ /* Needed so that including netinet6/in6_var.h works */
-# include <net/if_var.h>
-# endif
# ifndef __sun
# include <netinet6/in6_var.h>
# endif
#endif
-#include "config.h"
-#include "dhcpcd.h"
-
#define ALLROUTERS "ff02::2"
#define ROUNDUP8(a) (1 + (((a) - 1) | 7))