]> git.ipfire.org Git - thirdparty/dhcp.git/commitdiff
DHCP now builds under AIX
authorMark Andrews <marka@isc.org>
Wed, 23 Jan 2008 22:49:54 +0000 (22:49 +0000)
committerMark Andrews <marka@isc.org>
Wed, 23 Jan 2008 22:49:54 +0000 (22:49 +0000)
common/discover.c
configure.ac
includes/dhcpd.h
includes/netinet/if_ether.h
includes/osdep.h
minires/res_send.c

index 8138d424375ab0d0e4710f0c8eb9d565e5596cf4..fcffe31d38fe865adf3c1bc1b92de148ac65d4a7 100644 (file)
@@ -190,7 +190,23 @@ isc_result_t interface_initialize (omapi_object_t *ipo,
 #  define IF_NAMESIZE  16
 # endif
 #endif
+#elif !defined(__linux) && !defined(HAVE_IFADDRS_H)
+# define SIOCGLIFCONF SIOCGIFCONF
+# define SIOCGLIFFLAGS SIOCGIFFLAGS
+# define LIFREQ ifreq
+# define LIFCONF ifconf
+# define lifr_name ifr_name
+# define lifr_addr ifr_addr
+# define lifr_flags ifr_flags
+# define lifc_len ifc_len
+# define lifc_buf ifc_buf
+# define lifc_req ifc_req
+#ifdef _AIX
+# define ss_family __ss_family
+#endif
+#endif
 
+#if defined(SIOCGLIFCONF) && defined(SIOCGLIFFLAGS)
 /* 
  * Solaris support
  * ---------------
@@ -243,6 +259,7 @@ begin_iface_scan(struct iface_conf_list *ifaces) {
 #ifdef ISC_PLATFORM_HAVELIFNUM
        lifnum.lifn_family = AF_UNSPEC;
 #endif
+#ifdef SIOCGLIFNUM
        if (ioctl(ifaces->sock, SIOCGLIFNUM, &lifnum) < 0) {
                log_error("Error finding total number of interfaces; %m");
                close(ifaces->sock);
@@ -255,6 +272,9 @@ begin_iface_scan(struct iface_conf_list *ifaces) {
 #else
        ifaces->num = lifnum;
 #endif
+#else
+       ifaces->num = 64;
+#endif /* SIOCGLIFNUM */
 
        memset(&ifaces->conf, 0, sizeof(ifaces->conf));
 #ifdef ISC_HAVE_LIFC_FAMILY
@@ -309,7 +329,8 @@ next_iface(struct iface_info *info, int *err, struct iface_conf_list *ifaces) {
                        return 0;
                }
                strcpy(info->name, p->lifr_name);
-               info->addr = p->lifr_addr;
+               memset(&info->addr, 0, sizeof(info->addr));
+               memcpy(&info->addr, &p->lifr_addr, sizeof(p->lifr_addr));
 
 #if defined(sun) || defined(__linux)
                /* interface aliases look like "eth0:1" or "wlan1:3" */
@@ -719,7 +740,7 @@ end_iface_scan(struct iface_conf_list *ifaces) {
        ifaces->fp6 = NULL;
 #endif
 }
-#else /* !HAVE_SIOCGLIFCONF, !__linux */
+#else
 
 /* 
  * BSD support
index 09723db8fcba894dcda4781d07f58717b3588fd9..c9c121eb9e8d848477014ee62ef669b09252c87d 100644 (file)
@@ -140,6 +140,9 @@ AC_ARG_WITH(relay-pid-file,
        AC_DEFINE_UNQUOTED([_PATH_DHCRELAY_PID], ["$withval"],
                           [File for dhcrelay process information.]))
 
+# see if ifaddrs.h is available
+AC_CHECK_HEADERS(ifaddrs.h)
+
 # figure out what IPv4 interface code to use
 AC_CHECK_HEADERS(linux/types.h)  # needed for linux/filter.h on old systems
 
index 62f8915c85b0ba08393d2ac85ddf16c579a0664d..9b02f10543a615b3339fb566bb7f082fdcb9ef9f 100644 (file)
@@ -57,6 +57,7 @@
 #include <time.h>
 
 #include <net/if.h>
+#undef FDDI
 #include <net/route.h>
 #include <net/if_arp.h>
 #if HAVE_NET_IF_DL_H
index e53b4c7f66bcf281374549de42d651ecac61af0c..8de80235beccbe2235ee9436199eff311db9b860 100644 (file)
@@ -35,6 +35,9 @@
  *     @(#)if_ether.h  8.1 (Berkeley) 6/10/93
  */
 
+#ifndef netinet_if_ether_h
+#define netinet_if_ether_h
+
 /*
  * Ethernet address - 6 octets
  * this is only used by the ethers(3) functions.
@@ -59,3 +62,5 @@ struct        isc_ether_header {
 #define       ETHERTYPE_ARP           0x0806  /* address resolution protocol */
 
 #define ETHER_HEADER_SIZE (ETHER_ADDR_LEN * 2 + sizeof (u_int16_t))
+
+#endif
index 6e1db70e586fc4ba43dd175a964e433829efc7be..3cba94245001197917ded584583a3d7f60b11b50 100644 (file)
@@ -278,6 +278,9 @@ typedef uint32_t u_int32_t;
 
 #if !defined (SOCKLEN_T)
 # define SOCKLEN_T socklen_t
+#elif defined(_AIX)
+#undef SOCKLEN_T
+#define SOCKLEN_T socklen_t
 #endif
 
 #if !defined (STDERR_FILENO)
index 3b903c3554838d502fc343f0fd0452ca55c1fcc2..728309df0f2ef0c0cbb177c77aa5e0238ba0b8af 100644 (file)
@@ -76,7 +76,7 @@
 
 #if defined(LIBC_SCCS) && !defined(lint)
 static const char sccsid[] = "@(#)res_send.c   8.1 (Berkeley) 6/4/93";
-static const char rcsid[] = "$Id: res_send.c,v 1.10 2008/01/21 22:49:46 dhankins Exp $";
+static const char rcsid[] = "$Id: res_send.c,v 1.11 2008/01/23 22:49:54 marka Exp $";
 #endif /* LIBC_SCCS and not lint */
 
 /*
@@ -118,14 +118,23 @@ time_t trace_mr_time(time_t *);
 int trace_mr_select(int, fd_set *, fd_set *, fd_set *, struct timeval *);
 unsigned int trace_mr_res_randomid(unsigned int);
 
+#undef send
 #define send            trace_mr_send
+#undef recvfrom
 #define recvfrom        trace_mr_recvfrom
+#undef read
 #define read            trace_mr_read
+#undef connect
 #define connect         trace_mr_connect
+#undef socket
 #define socket          trace_mr_socket
+#undef bind
 #define bind            trace_mr_bind
+#undef close
 #define close           trace_mr_close
+#undef select
 #define select          trace_mr_select
+#undef time
 #define time            trace_mr_time
 
 #define        CHECK_SRVR_ADDR