From: Mark Andrews Date: Wed, 23 Jan 2008 22:49:54 +0000 (+0000) Subject: DHCP now builds under AIX X-Git-Tag: v4_1_0a1~12 X-Git-Url: http://git.ipfire.org/gitweb.cgi?a=commitdiff_plain;h=b8c0eda0e58fe679396a540004c34798412db499;p=thirdparty%2Fdhcp.git DHCP now builds under AIX --- diff --git a/common/discover.c b/common/discover.c index 8138d4243..fcffe31d3 100644 --- a/common/discover.c +++ b/common/discover.c @@ -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 diff --git a/configure.ac b/configure.ac index 09723db8f..c9c121eb9 100644 --- a/configure.ac +++ b/configure.ac @@ -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 diff --git a/includes/dhcpd.h b/includes/dhcpd.h index 62f8915c8..9b02f1054 100644 --- a/includes/dhcpd.h +++ b/includes/dhcpd.h @@ -57,6 +57,7 @@ #include #include +#undef FDDI #include #include #if HAVE_NET_IF_DL_H diff --git a/includes/netinet/if_ether.h b/includes/netinet/if_ether.h index e53b4c7f6..8de80235b 100644 --- a/includes/netinet/if_ether.h +++ b/includes/netinet/if_ether.h @@ -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 diff --git a/includes/osdep.h b/includes/osdep.h index 6e1db70e5..3cba94245 100644 --- a/includes/osdep.h +++ b/includes/osdep.h @@ -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) diff --git a/minires/res_send.c b/minires/res_send.c index 3b903c355..728309df0 100644 --- a/minires/res_send.c +++ b/minires/res_send.c @@ -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