]> git.ipfire.org Git - thirdparty/dhcp.git/commitdiff
AIX and Digital Unix compatibility fixes.
authorTed Lemon <source@isc.org>
Tue, 1 Feb 2000 03:19:56 +0000 (03:19 +0000)
committerTed Lemon <source@isc.org>
Tue, 1 Feb 2000 03:19:56 +0000 (03:19 +0000)
16 files changed:
Makefile.conf
common/dns.c
common/icmp.c
common/packet.c
common/parse.c
common/socket.c
dhcpctl/Makefile.dist
includes/cf/aix.h
includes/dhcpd.h
includes/netinet/ip.h
includes/omapip/omapip_p.h
omapip/connection.c
omapip/errwarn.c
omapip/listener.c
server/confpars.c
server/db.c

index 4cc480d65b4f844b7f0099b52f41b738066b238e..4f0663891e02381dffc0e4ad3aa9725a2405abf1 100644 (file)
@@ -73,7 +73,7 @@ MINORVERSION=MinorVersion
 # removes the comment characters from the appropriate set of
 # assignments, and writes the output to Makefile.
 
-## AIX 4.1.5.0
+## AIX 4.3
 ##--aix--
 #CF = cf/aix.h
 #CC=cc -Daix
index 22389baa641f9f7a6713edd3135e1904e51561e4..ddc917b56d49bc05b9fc2941d2e794ee8aac038e 100644 (file)
@@ -22,7 +22,7 @@
 
 #ifndef lint
 static char copyright[] =
-"$Id: dns.c,v 1.14 2000/01/26 14:55:34 mellon Exp $ Copyright (c) 1997 The Internet Software Consortium.  All rights reserved.\n";
+"$Id: dns.c,v 1.15 2000/02/01 03:19:38 mellon Exp $ Copyright (c) 1997 The Internet Software Consortium.  All rights reserved.\n";
 #endif /* not lint */
 
 #include "dhcpd.h"
@@ -444,7 +444,8 @@ void dns_packet (protocol)
        u_int16_t class;
        TIME ttl;
        u_int16_t rdlength;
-       int len, status;
+       socklen_t len;
+       int status;
        int i;
        struct dns_query *query;
 
index 77dd12655d3b7af8d8bdd8fe97eb13a29752a29a..c13dcf28dddd2d60d605c6bcd163811ea9af8f3d 100644 (file)
@@ -23,7 +23,7 @@
 
 #ifndef lint
 static char copyright[] =
-"$Id: icmp.c,v 1.17 2000/01/26 14:55:34 mellon Exp $ Copyright (c) 1997, 1998 The Internet Software Consortium.  All rights reserved.\n";
+"$Id: icmp.c,v 1.18 2000/02/01 03:19:38 mellon Exp $ Copyright (c) 1997, 1998 The Internet Software Consortium.  All rights reserved.\n";
 #endif /* not lint */
 
 #include "dhcpd.h"
@@ -163,7 +163,8 @@ isc_result_t icmp_echoreply (h)
        struct sockaddr_in from;
        unsigned char icbuf [1500];
        int status;
-       int len, hlen;
+       socklen_t len;
+       int hlen;
        struct iaddr ia;
        struct icmp_state *state;
 
@@ -179,7 +180,7 @@ isc_result_t icmp_echoreply (h)
 
        /* Find the IP header length... */
        ip = (struct ip *)icbuf;
-       hlen = ip -> ip_hl << 2;
+       hlen = IP_HL (ip) << 2;
 
        /* Short packet? */
        if (status < hlen + (sizeof *icfrom)) {
index b7be88badf3f6b101f2afc4a1738a87a3faa2443..38e5962ac63c5c2f56c749b222907792152a5486 100644 (file)
@@ -22,7 +22,7 @@
 
 #ifndef lint
 static char copyright[] =
-"$Id: packet.c,v 1.30 2000/01/29 05:47:50 mellon Exp $ Copyright (c) 1996 The Internet Software Consortium.  All rights reserved.\n";
+"$Id: packet.c,v 1.31 2000/02/01 03:19:39 mellon Exp $ Copyright (c) 1996 The Internet Software Consortium.  All rights reserved.\n";
 #endif /* not lint */
 
 #include "dhcpd.h"
@@ -125,8 +125,8 @@ void assemble_udp_ip_header (interface, buf, bufix,
        struct udphdr udp;
 
        /* Fill out the IP header */
-       ip.ip_v = 4;
-       ip.ip_hl = 5;
+       IP_V_SET (&ip, 4);
+       IP_HL_SET (&ip, 20);
        ip.ip_tos = IPTOS_LOWDELAY;
        ip.ip_len = htons(sizeof(ip) + sizeof(udp) + len);
        ip.ip_id = 0;
index 6747ed2634b848e41c4141924e3156573e57ea81..38dea858f628aa384d1025a4d1e3338bf079fadf 100644 (file)
@@ -22,7 +22,7 @@
 
 #ifndef lint
 static char copyright[] =
-"$Id: parse.c,v 1.60 2000/01/26 14:55:34 mellon Exp $ Copyright (c) 1995, 1996, 1997, 1998, 1999 The Internet Software Consortium.  All rights reserved.\n";
+"$Id: parse.c,v 1.61 2000/02/01 03:19:39 mellon Exp $ Copyright (c) 1995, 1996, 1997, 1998, 1999 The Internet Software Consortium.  All rights reserved.\n";
 #endif /* not lint */
 
 #include "dhcpd.h"
@@ -3352,11 +3352,7 @@ int parse_auth_key (key_id, cfile)
        return key_id -> len ? 1 : 0;
 }
 
-int parse_warn (ANSI_DECL (struct parse *)cfile,
-               ANSI_DECL (const char *) fmt, VA_DOTDOTDOT)
-       KandR (struct parse *cfile;)
-       KandR (char *fmt;)
-       va_dcl
+int parse_warn (struct parse *cfile, const char *fmt, ...)
 {
        va_list list;
        static char spaces [] = "                                                                                ";
@@ -3374,7 +3370,7 @@ int parse_warn (ANSI_DECL (struct parse *)cfile,
                 cfile -> tlname, cfile -> lexline, mbuf);
 #endif
        
-       VA_start (list, fmt);
+       va_start (list, fmt);
        vsnprintf (mbuf, sizeof mbuf, fbuf, list);
        va_end (list);
 
index 46803c339f3c4c73d44ecd8070ceb2bdf41c404f..9a64677b614e665a07c094068998150f65da5028 100644 (file)
@@ -30,7 +30,7 @@
 
 #ifndef lint
 static char copyright[] =
-"$Id: socket.c,v 1.43 2000/01/02 22:21:23 mellon Exp $ Copyright (c) 1995, 1996, 1997, 1998, 1999 The Internet Software Consortium.  All rights reserved.\n";
+"$Id: socket.c,v 1.44 2000/02/01 03:19:39 mellon Exp $ Copyright (c) 1995, 1996, 1997, 1998, 1999 The Internet Software Consortium.  All rights reserved.\n";
 #endif /* not lint */
 
 #include "dhcpd.h"
@@ -213,7 +213,7 @@ ssize_t receive_packet (interface, buf, len, from, hfrom)
        struct sockaddr_in *from;
        struct hardware *hfrom;
 {
-       int flen = sizeof *from;
+       socklen_t flen = sizeof *from;
        int result;
 
 #ifdef IGNORE_HOSTUNREACH
@@ -240,7 +240,7 @@ isc_result_t fallback_discard (object)
 {
        char buf [1540];
        struct sockaddr_in from;
-       int flen = sizeof from;
+       socklen_t flen = sizeof from;
        int status;
        struct interface_info *interface;
 
index 92e557b823392b431080373cc946726865a932fb..1d27f1c958d923941c9695b7899c6c635d74e421 100644 (file)
@@ -68,7 +68,7 @@ depend:
        makedepend $(INCLUDES) $(PREDEFINES) $(SRCS)
 
 clean:
-       -rm -f $(OBJ) test.o test
+       -rm -f $(OBJ) test.o test cltest.o cltest
 
 realclean: clean
        -rm -f libdhcpctl.a *~ $(CATMANPAGES) $(SEDMANPAGES)
index 8a1b4d51ff31bda5513d3e1a5546ff28476b93aa..7ce5c07c7d905a25cb4935a42b17053747815ef2 100644 (file)
@@ -67,9 +67,10 @@ extern int h_errno;
 #define _PATH_DHCRELAY_PID "/etc/dhcrelay.pid"
 #endif
 
-#include <varargs.h>
-#define VA_DOTDOTDOT va_alist
+#include <stdarg.h>
+#define VA_DOTDOTDOT ...
 #define VA_start(list, last) va_start (list)
+#define va_dcl
 
 #define vsnprintf(buf, size, fmt, list) vsprintf (buf, fmt, list)
 #define NO_SNPRINTF
index ce10734c5fe2cbaf7189f4b39d18ac3867c56204..09fb6a0dea7592cc9b943c0e59020fe9da7cfd34 100644 (file)
@@ -21,6 +21,7 @@
  */
 
 #ifndef __CYGWIN32__
+#define _POSIX_PII_SOCKET
 #include <sys/types.h>
 #include <netinet/in.h>
 #include <sys/socket.h>
@@ -997,7 +998,7 @@ int parse_option_token PROTO ((struct expression **, struct parse *,
                               const char *, struct expression *, int, int));
 int parse_allow_deny PROTO ((struct option_cache **, struct parse *, int));
 int parse_auth_key PROTO ((struct data_string *, struct parse *));
-int parse_warn PROTO ((struct parse *, const char *, ...))
+int parse_warn (struct parse *, const char *, ...)
        __attribute__((__format__(__printf__,2,3)));
 
 /* tree.c */
@@ -1519,7 +1520,7 @@ int write_lease PROTO ((struct lease *));
 int write_host PROTO ((struct host_decl *));
 int write_group PROTO ((struct group_object *));
 int db_printable PROTO ((const char *));
-int db_printable_len PROTO ((const char *, unsigned));
+int db_printable_len PROTO ((const unsigned char *, unsigned));
 int write_billing_class PROTO ((struct class *));
 int commit_leases PROTO ((void));
 void db_startup PROTO ((int));
index 233abd6e69b5362350d42c957af94d0a4a5792b0..4afb80d73486a61d29c7606700d8d54aafa466b6 100644 (file)
  * against negative integers quite easily, and fail in subtle ways.
  */
 struct ip {
-#if BYTE_ORDER == LITTLE_ENDIAN
-       u_int8_t  ip_hl:4,              /* header length */
-                 ip_v:4;               /* version */
-#endif
-#if BYTE_ORDER == BIG_ENDIAN
-       u_int8_t  ip_v:4,               /* version */
-                 ip_hl:4;              /* header length */
-#endif
+       u_int8_t  ip_fvhl;              /* header length, version */
        u_int8_t  ip_tos;               /* type of service */
        int16_t   ip_len;               /* total length */
        u_int16_t ip_id;                /* identification */
@@ -70,6 +63,12 @@ struct ip {
        struct    in_addr ip_src, ip_dst; /* source and dest address */
 };
 
+#define IP_V(iph)      ((iph)->ip_fvhl >> 4)
+#define IP_HL(iph)     ((iph)->ip_fvhl & 0x0F)
+#define IP_V_SET(iph,x)        ((iph)->ip_fvhl = ((iph)->ip_fvhl & 0x0F) | ((x) << 4))
+#define IP_HL_SET(iph,x) ((iph)->ip_fvhl = \
+                         ((iph)->ip_fvhl & 0xF0) | ((x) >> 2))
+
 #define        IP_MAXPACKET    65535           /* maximum packet size */
 
 /*
@@ -129,14 +128,7 @@ struct     ip_timestamp {
        u_int8_t ipt_code;              /* IPOPT_TS */
        u_int8_t ipt_len;               /* size of structure (variable) */
        u_int8_t ipt_ptr;               /* index of current entry */
-#if BYTE_ORDER == LITTLE_ENDIAN
-       u_int8_t ipt_flg:4,             /* flags, see below */
-                ipt_oflw:4;            /* overflow counter */
-#endif
-#if BYTE_ORDER == BIG_ENDIAN
-       u_int8_t ipt_oflw:4,            /* overflow counter */
-                ipt_flg:4;             /* flags, see below */
-#endif
+       u_int8_t ipt_flg_oflw;          /* flags, see below, overflow counter */
        union ipt_timestamp {
                 u_int32_t ipt_time[1];
                 struct ipt_ta {
index 296ebfa2caf1af9a2705620d851837fc0a98e356..ae3b95e20e50303e7fba9146a47e91221205527b 100644 (file)
@@ -24,6 +24,7 @@
 #define __OMAPIP_OMAPIP_P_H__
 
 #ifndef __CYGWIN32__
+#define _POSIX_PII_SOCKET
 #include <sys/types.h>
 #include <netinet/in.h>
 #include <sys/socket.h>
index c92ff91de4de1817e83ad69454264643e5a01df7..71e0b1e3f5a223a1b38a233b021af21960a8fcff 100644 (file)
@@ -32,6 +32,7 @@ isc_result_t omapi_connect (omapi_object_t *c,
        isc_result_t status;
        omapi_connection_object_t *obj;
        int flag;
+       socklen_t sl;
 
        obj = (omapi_connection_object_t *)dmalloc (sizeof *obj, MDL);
        if (!obj)
@@ -131,10 +132,10 @@ isc_result_t omapi_connect (omapi_object_t *c,
 
        /* I don't know why this would fail, so I'm tempted not to test
           the return value. */
-       hix = sizeof (obj -> local_addr);
+       sl = sizeof (obj -> local_addr);
        if (getsockname (obj -> socket,
                         ((struct sockaddr *)
-                         &obj -> local_addr), &hix) < 0) {
+                         &obj -> local_addr), &sl) < 0) {
        }
 
        if (fcntl (obj -> socket, F_SETFL, O_NONBLOCK) < 0) {
index 018a6399c13c5d2265579144a765c8041d7015c6..298bbdd0bbead110a97a271cd63898cc93549046 100644 (file)
@@ -29,7 +29,7 @@
 
 #ifndef lint
 static char copyright[] =
-"$Id: errwarn.c,v 1.2 2000/01/26 14:56:05 mellon Exp $ Copyright (c) 1996 The Internet Software Consortium.  All rights reserved.\n";
+"$Id: errwarn.c,v 1.3 2000/02/01 03:19:52 mellon Exp $ Copyright (c) 1996 The Internet Software Consortium.  All rights reserved.\n";
 #endif /* not lint */
 
 #include <omapip/omapip_p.h>
@@ -48,15 +48,13 @@ static char fbuf [1024];
 
 /* Log an error message, then exit... */
 
-void log_fatal (ANSI_DECL(const char *) fmt, VA_DOTDOTDOT)
-     KandR (char *fmt;)
-     va_dcl
+void log_fatal (const char * fmt, ... )
 {
   va_list list;
 
   do_percentm (fbuf, fmt);
 
-  VA_start (list, fmt);
+  va_start (list, fmt);
   vsnprintf (mbuf, sizeof mbuf, fbuf, list);
   va_end (list);
 
@@ -82,15 +80,13 @@ void log_fatal (ANSI_DECL(const char *) fmt, VA_DOTDOTDOT)
 
 /* Log an error message... */
 
-int log_error (ANSI_DECL (const char *) fmt, VA_DOTDOTDOT)
-     KandR (char *fmt;)
-     va_dcl
+int log_error (const char * fmt, ...)
 {
   va_list list;
 
   do_percentm (fbuf, fmt);
 
-  VA_start (list, fmt);
+  va_start (list, fmt);
   vsnprintf (mbuf, sizeof mbuf, fbuf, list);
   va_end (list);
 
@@ -108,15 +104,13 @@ int log_error (ANSI_DECL (const char *) fmt, VA_DOTDOTDOT)
 
 /* Log a note... */
 
-int log_info (ANSI_DECL (const char *) fmt, VA_DOTDOTDOT)
-     KandR (char *fmt;)
-     va_dcl
+int log_info (const char *fmt, ...)
 {
   va_list list;
 
   do_percentm (fbuf, fmt);
 
-  VA_start (list, fmt);
+  va_start (list, fmt);
   vsnprintf (mbuf, sizeof mbuf, fbuf, list);
   va_end (list);
 
@@ -134,15 +128,13 @@ int log_info (ANSI_DECL (const char *) fmt, VA_DOTDOTDOT)
 
 /* Log a debug message... */
 
-int log_debug (ANSI_DECL (const char *) fmt, VA_DOTDOTDOT)
-     KandR (char *fmt;)
-     va_dcl
+int log_debug (const char *fmt, ...)
 {
   va_list list;
 
   do_percentm (fbuf, fmt);
 
-  VA_start (list, fmt);
+  va_start (list, fmt);
   vsnprintf (mbuf, sizeof mbuf, fbuf, list);
   va_end (list);
 
index 3f0d90163ee20bc5d712c135bb40c442acb8f6f3..9ba5d03f0683f1810e265d849734d0226f0aa6a4 100644 (file)
@@ -125,7 +125,7 @@ int omapi_listener_readfd (omapi_object_t *h)
 isc_result_t omapi_accept (omapi_object_t *h)
 {
        isc_result_t status;
-       int len;
+       socklen_t len;
        omapi_connection_object_t *obj;
        omapi_listener_object_t *listener;
 
index 2d01edd4bd05c0eceecbe11c2711a820f8baef42..0bd2effbbce2acec19baf96133db5daf6c3db307 100644 (file)
@@ -22,7 +22,7 @@
 
 #ifndef lint
 static char copyright[] =
-"$Id: confpars.c,v 1.99 2000/01/31 23:41:56 mellon Exp $ Copyright (c) 1995, 1996 The Internet Software Consortium.  All rights reserved.\n";
+"$Id: confpars.c,v 1.100 2000/02/01 03:19:56 mellon Exp $ Copyright (c) 1995, 1996 The Internet Software Consortium.  All rights reserved.\n";
 #endif /* not lint */
 
 #include "dhcpd.h"
@@ -423,7 +423,6 @@ int parse_statement (cfile, group, type, host_decl, declaration)
                                            "option space definitions %s",
                                            "may not be scoped.");
                                skip_to_semi (cfile);
-                               free_option (option, MDL);
                                break;
                        }
                        parse_option_space_decl (cfile);
@@ -2208,14 +2207,16 @@ struct lease *parse_lease_declaration (cfile)
                                      (&binding -> value.buffer,
                                       binding -> value.len + 1, MDL)))
                                        log_fatal ("No memory for binding.");
-                               strcpy (binding -> value.buffer -> data, val);
+                               strcpy ((char *)
+                                       binding -> value.buffer -> data, val);
                                binding -> value.data =
                                        binding -> value.buffer -> data;
                                binding -> value.terminated = 1;
                        } else {
-                               s = (parse_numeric_aggregate
-                                    (cfile, (unsigned char *)0,
-                                     &binding -> value.len, ':', 16, 8));
+                               s = ((char *)
+                                    (parse_numeric_aggregate
+                                     (cfile, (unsigned char *)0,
+                                      &binding -> value.len, ':', 16, 8)));
                                if (!s)
                                        return (struct lease *)0;
                                if (binding -> value.len) {
index 3481381d10ce37e30aee3bfc676a189f82d6bad4..13d398a04e017d8b8e93ff1f2ead9fd446f14371 100644 (file)
@@ -22,7 +22,7 @@
 
 #ifndef lint
 static char copyright[] =
-"$Id: db.c,v 1.42 2000/01/26 14:56:18 mellon Exp $ Copyright (c) 1995, 1996 The Internet Software Consortium.  All rights reserved.\n";
+"$Id: db.c,v 1.43 2000/02/01 03:19:56 mellon Exp $ Copyright (c) 1995, 1996 The Internet Software Consortium.  All rights reserved.\n";
 #endif /* not lint */
 
 #include "dhcpd.h"
@@ -134,7 +134,7 @@ int write_lease (lease)
        }
        if (lease -> uid_len) {
                int i;
-               if (db_printable_len ((const char *)lease -> uid,
+               if (db_printable_len (lease -> uid,
                                      lease -> uid_len)) {
                        fprintf (db_file, "\n  uid \"%*s\";",
                                 lease -> uid_len, lease -> uid);
@@ -290,8 +290,7 @@ int write_host (host)
                if (host -> client_identifier.len) {
                        int i;
                        errno = 0;
-                       if (db_printable_len ((const char *)
-                                             host -> client_identifier.data,
+                       if (db_printable_len (host -> client_identifier.data,
                                              host -> client_identifier.len)) {
                                fprintf (db_file, "\n  uid \"%*s\";",
                                         host -> client_identifier.len,
@@ -453,7 +452,7 @@ int db_printable (s)
 }
 
 int db_printable_len (s, len)
-       const char *s;
+       const unsigned char *s;
        unsigned len;
 {
        int i;