2
0
mirror of https://gitlab.isc.org/isc-projects/dhcp synced 2025-09-01 06:45:27 +00:00

AIX and Digital Unix compatibility fixes.

This commit is contained in:
Ted Lemon
2000-02-01 03:19:56 +00:00
parent fb6297b12b
commit cfdfb9f126
16 changed files with 57 additions and 71 deletions

View File

@@ -73,7 +73,7 @@ MINORVERSION=MinorVersion
# removes the comment characters from the appropriate set of # removes the comment characters from the appropriate set of
# assignments, and writes the output to Makefile. # assignments, and writes the output to Makefile.
## AIX 4.1.5.0 ## AIX 4.3
##--aix-- ##--aix--
#CF = cf/aix.h #CF = cf/aix.h
#CC=cc -Daix #CC=cc -Daix

View File

@@ -22,7 +22,7 @@
#ifndef lint #ifndef lint
static char copyright[] = 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 */ #endif /* not lint */
#include "dhcpd.h" #include "dhcpd.h"
@@ -444,7 +444,8 @@ void dns_packet (protocol)
u_int16_t class; u_int16_t class;
TIME ttl; TIME ttl;
u_int16_t rdlength; u_int16_t rdlength;
int len, status; socklen_t len;
int status;
int i; int i;
struct dns_query *query; struct dns_query *query;

View File

@@ -23,7 +23,7 @@
#ifndef lint #ifndef lint
static char copyright[] = 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 */ #endif /* not lint */
#include "dhcpd.h" #include "dhcpd.h"
@@ -163,7 +163,8 @@ isc_result_t icmp_echoreply (h)
struct sockaddr_in from; struct sockaddr_in from;
unsigned char icbuf [1500]; unsigned char icbuf [1500];
int status; int status;
int len, hlen; socklen_t len;
int hlen;
struct iaddr ia; struct iaddr ia;
struct icmp_state *state; struct icmp_state *state;
@@ -179,7 +180,7 @@ isc_result_t icmp_echoreply (h)
/* Find the IP header length... */ /* Find the IP header length... */
ip = (struct ip *)icbuf; ip = (struct ip *)icbuf;
hlen = ip -> ip_hl << 2; hlen = IP_HL (ip) << 2;
/* Short packet? */ /* Short packet? */
if (status < hlen + (sizeof *icfrom)) { if (status < hlen + (sizeof *icfrom)) {

View File

@@ -22,7 +22,7 @@
#ifndef lint #ifndef lint
static char copyright[] = 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 */ #endif /* not lint */
#include "dhcpd.h" #include "dhcpd.h"
@@ -125,8 +125,8 @@ void assemble_udp_ip_header (interface, buf, bufix,
struct udphdr udp; struct udphdr udp;
/* Fill out the IP header */ /* Fill out the IP header */
ip.ip_v = 4; IP_V_SET (&ip, 4);
ip.ip_hl = 5; IP_HL_SET (&ip, 20);
ip.ip_tos = IPTOS_LOWDELAY; ip.ip_tos = IPTOS_LOWDELAY;
ip.ip_len = htons(sizeof(ip) + sizeof(udp) + len); ip.ip_len = htons(sizeof(ip) + sizeof(udp) + len);
ip.ip_id = 0; ip.ip_id = 0;

View File

@@ -22,7 +22,7 @@
#ifndef lint #ifndef lint
static char copyright[] = 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 */ #endif /* not lint */
#include "dhcpd.h" #include "dhcpd.h"
@@ -3352,11 +3352,7 @@ int parse_auth_key (key_id, cfile)
return key_id -> len ? 1 : 0; return key_id -> len ? 1 : 0;
} }
int parse_warn (ANSI_DECL (struct parse *)cfile, int parse_warn (struct parse *cfile, const char *fmt, ...)
ANSI_DECL (const char *) fmt, VA_DOTDOTDOT)
KandR (struct parse *cfile;)
KandR (char *fmt;)
va_dcl
{ {
va_list list; va_list list;
static char spaces [] = " "; static char spaces [] = " ";
@@ -3374,7 +3370,7 @@ int parse_warn (ANSI_DECL (struct parse *)cfile,
cfile -> tlname, cfile -> lexline, mbuf); cfile -> tlname, cfile -> lexline, mbuf);
#endif #endif
VA_start (list, fmt); va_start (list, fmt);
vsnprintf (mbuf, sizeof mbuf, fbuf, list); vsnprintf (mbuf, sizeof mbuf, fbuf, list);
va_end (list); va_end (list);

View File

@@ -30,7 +30,7 @@
#ifndef lint #ifndef lint
static char copyright[] = 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 */ #endif /* not lint */
#include "dhcpd.h" #include "dhcpd.h"
@@ -213,7 +213,7 @@ ssize_t receive_packet (interface, buf, len, from, hfrom)
struct sockaddr_in *from; struct sockaddr_in *from;
struct hardware *hfrom; struct hardware *hfrom;
{ {
int flen = sizeof *from; socklen_t flen = sizeof *from;
int result; int result;
#ifdef IGNORE_HOSTUNREACH #ifdef IGNORE_HOSTUNREACH
@@ -240,7 +240,7 @@ isc_result_t fallback_discard (object)
{ {
char buf [1540]; char buf [1540];
struct sockaddr_in from; struct sockaddr_in from;
int flen = sizeof from; socklen_t flen = sizeof from;
int status; int status;
struct interface_info *interface; struct interface_info *interface;

View File

@@ -68,7 +68,7 @@ depend:
makedepend $(INCLUDES) $(PREDEFINES) $(SRCS) makedepend $(INCLUDES) $(PREDEFINES) $(SRCS)
clean: clean:
-rm -f $(OBJ) test.o test -rm -f $(OBJ) test.o test cltest.o cltest
realclean: clean realclean: clean
-rm -f libdhcpctl.a *~ $(CATMANPAGES) $(SEDMANPAGES) -rm -f libdhcpctl.a *~ $(CATMANPAGES) $(SEDMANPAGES)

View File

@@ -67,9 +67,10 @@ extern int h_errno;
#define _PATH_DHCRELAY_PID "/etc/dhcrelay.pid" #define _PATH_DHCRELAY_PID "/etc/dhcrelay.pid"
#endif #endif
#include <varargs.h> #include <stdarg.h>
#define VA_DOTDOTDOT va_alist #define VA_DOTDOTDOT ...
#define VA_start(list, last) va_start (list) #define VA_start(list, last) va_start (list)
#define va_dcl
#define vsnprintf(buf, size, fmt, list) vsprintf (buf, fmt, list) #define vsnprintf(buf, size, fmt, list) vsprintf (buf, fmt, list)
#define NO_SNPRINTF #define NO_SNPRINTF

View File

@@ -21,6 +21,7 @@
*/ */
#ifndef __CYGWIN32__ #ifndef __CYGWIN32__
#define _POSIX_PII_SOCKET
#include <sys/types.h> #include <sys/types.h>
#include <netinet/in.h> #include <netinet/in.h>
#include <sys/socket.h> #include <sys/socket.h>
@@ -997,7 +998,7 @@ int parse_option_token PROTO ((struct expression **, struct parse *,
const char *, struct expression *, int, int)); const char *, struct expression *, int, int));
int parse_allow_deny PROTO ((struct option_cache **, struct parse *, int)); int parse_allow_deny PROTO ((struct option_cache **, struct parse *, int));
int parse_auth_key PROTO ((struct data_string *, struct parse *)); 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))); __attribute__((__format__(__printf__,2,3)));
/* tree.c */ /* tree.c */
@@ -1519,7 +1520,7 @@ int write_lease PROTO ((struct lease *));
int write_host PROTO ((struct host_decl *)); int write_host PROTO ((struct host_decl *));
int write_group PROTO ((struct group_object *)); int write_group PROTO ((struct group_object *));
int db_printable PROTO ((const char *)); 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 write_billing_class PROTO ((struct class *));
int commit_leases PROTO ((void)); int commit_leases PROTO ((void));
void db_startup PROTO ((int)); void db_startup PROTO ((int));

View File

@@ -49,14 +49,7 @@
* against negative integers quite easily, and fail in subtle ways. * against negative integers quite easily, and fail in subtle ways.
*/ */
struct ip { struct ip {
#if BYTE_ORDER == LITTLE_ENDIAN u_int8_t ip_fvhl; /* header length, version */
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_tos; /* type of service */ u_int8_t ip_tos; /* type of service */
int16_t ip_len; /* total length */ int16_t ip_len; /* total length */
u_int16_t ip_id; /* identification */ u_int16_t ip_id; /* identification */
@@ -70,6 +63,12 @@ struct ip {
struct in_addr ip_src, ip_dst; /* source and dest address */ 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 */ #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_code; /* IPOPT_TS */
u_int8_t ipt_len; /* size of structure (variable) */ u_int8_t ipt_len; /* size of structure (variable) */
u_int8_t ipt_ptr; /* index of current entry */ u_int8_t ipt_ptr; /* index of current entry */
#if BYTE_ORDER == LITTLE_ENDIAN u_int8_t ipt_flg_oflw; /* flags, see below, overflow counter */
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
union ipt_timestamp { union ipt_timestamp {
u_int32_t ipt_time[1]; u_int32_t ipt_time[1];
struct ipt_ta { struct ipt_ta {

View File

@@ -24,6 +24,7 @@
#define __OMAPIP_OMAPIP_P_H__ #define __OMAPIP_OMAPIP_P_H__
#ifndef __CYGWIN32__ #ifndef __CYGWIN32__
#define _POSIX_PII_SOCKET
#include <sys/types.h> #include <sys/types.h>
#include <netinet/in.h> #include <netinet/in.h>
#include <sys/socket.h> #include <sys/socket.h>

View File

@@ -32,6 +32,7 @@ isc_result_t omapi_connect (omapi_object_t *c,
isc_result_t status; isc_result_t status;
omapi_connection_object_t *obj; omapi_connection_object_t *obj;
int flag; int flag;
socklen_t sl;
obj = (omapi_connection_object_t *)dmalloc (sizeof *obj, MDL); obj = (omapi_connection_object_t *)dmalloc (sizeof *obj, MDL);
if (!obj) 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 /* I don't know why this would fail, so I'm tempted not to test
the return value. */ the return value. */
hix = sizeof (obj -> local_addr); sl = sizeof (obj -> local_addr);
if (getsockname (obj -> socket, if (getsockname (obj -> socket,
((struct sockaddr *) ((struct sockaddr *)
&obj -> local_addr), &hix) < 0) { &obj -> local_addr), &sl) < 0) {
} }
if (fcntl (obj -> socket, F_SETFL, O_NONBLOCK) < 0) { if (fcntl (obj -> socket, F_SETFL, O_NONBLOCK) < 0) {

View File

@@ -29,7 +29,7 @@
#ifndef lint #ifndef lint
static char copyright[] = 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 */ #endif /* not lint */
#include <omapip/omapip_p.h> #include <omapip/omapip_p.h>
@@ -48,15 +48,13 @@ static char fbuf [1024];
/* Log an error message, then exit... */ /* Log an error message, then exit... */
void log_fatal (ANSI_DECL(const char *) fmt, VA_DOTDOTDOT) void log_fatal (const char * fmt, ... )
KandR (char *fmt;)
va_dcl
{ {
va_list list; va_list list;
do_percentm (fbuf, fmt); do_percentm (fbuf, fmt);
VA_start (list, fmt); va_start (list, fmt);
vsnprintf (mbuf, sizeof mbuf, fbuf, list); vsnprintf (mbuf, sizeof mbuf, fbuf, list);
va_end (list); va_end (list);
@@ -82,15 +80,13 @@ void log_fatal (ANSI_DECL(const char *) fmt, VA_DOTDOTDOT)
/* Log an error message... */ /* Log an error message... */
int log_error (ANSI_DECL (const char *) fmt, VA_DOTDOTDOT) int log_error (const char * fmt, ...)
KandR (char *fmt;)
va_dcl
{ {
va_list list; va_list list;
do_percentm (fbuf, fmt); do_percentm (fbuf, fmt);
VA_start (list, fmt); va_start (list, fmt);
vsnprintf (mbuf, sizeof mbuf, fbuf, list); vsnprintf (mbuf, sizeof mbuf, fbuf, list);
va_end (list); va_end (list);
@@ -108,15 +104,13 @@ int log_error (ANSI_DECL (const char *) fmt, VA_DOTDOTDOT)
/* Log a note... */ /* Log a note... */
int log_info (ANSI_DECL (const char *) fmt, VA_DOTDOTDOT) int log_info (const char *fmt, ...)
KandR (char *fmt;)
va_dcl
{ {
va_list list; va_list list;
do_percentm (fbuf, fmt); do_percentm (fbuf, fmt);
VA_start (list, fmt); va_start (list, fmt);
vsnprintf (mbuf, sizeof mbuf, fbuf, list); vsnprintf (mbuf, sizeof mbuf, fbuf, list);
va_end (list); va_end (list);
@@ -134,15 +128,13 @@ int log_info (ANSI_DECL (const char *) fmt, VA_DOTDOTDOT)
/* Log a debug message... */ /* Log a debug message... */
int log_debug (ANSI_DECL (const char *) fmt, VA_DOTDOTDOT) int log_debug (const char *fmt, ...)
KandR (char *fmt;)
va_dcl
{ {
va_list list; va_list list;
do_percentm (fbuf, fmt); do_percentm (fbuf, fmt);
VA_start (list, fmt); va_start (list, fmt);
vsnprintf (mbuf, sizeof mbuf, fbuf, list); vsnprintf (mbuf, sizeof mbuf, fbuf, list);
va_end (list); va_end (list);

View 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 omapi_accept (omapi_object_t *h)
{ {
isc_result_t status; isc_result_t status;
int len; socklen_t len;
omapi_connection_object_t *obj; omapi_connection_object_t *obj;
omapi_listener_object_t *listener; omapi_listener_object_t *listener;

View File

@@ -22,7 +22,7 @@
#ifndef lint #ifndef lint
static char copyright[] = 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 */ #endif /* not lint */
#include "dhcpd.h" #include "dhcpd.h"
@@ -423,7 +423,6 @@ int parse_statement (cfile, group, type, host_decl, declaration)
"option space definitions %s", "option space definitions %s",
"may not be scoped."); "may not be scoped.");
skip_to_semi (cfile); skip_to_semi (cfile);
free_option (option, MDL);
break; break;
} }
parse_option_space_decl (cfile); parse_option_space_decl (cfile);
@@ -2208,14 +2207,16 @@ struct lease *parse_lease_declaration (cfile)
(&binding -> value.buffer, (&binding -> value.buffer,
binding -> value.len + 1, MDL))) binding -> value.len + 1, MDL)))
log_fatal ("No memory for binding."); log_fatal ("No memory for binding.");
strcpy (binding -> value.buffer -> data, val); strcpy ((char *)
binding -> value.buffer -> data, val);
binding -> value.data = binding -> value.data =
binding -> value.buffer -> data; binding -> value.buffer -> data;
binding -> value.terminated = 1; binding -> value.terminated = 1;
} else { } else {
s = (parse_numeric_aggregate s = ((char *)
(cfile, (unsigned char *)0, (parse_numeric_aggregate
&binding -> value.len, ':', 16, 8)); (cfile, (unsigned char *)0,
&binding -> value.len, ':', 16, 8)));
if (!s) if (!s)
return (struct lease *)0; return (struct lease *)0;
if (binding -> value.len) { if (binding -> value.len) {

View File

@@ -22,7 +22,7 @@
#ifndef lint #ifndef lint
static char copyright[] = 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 */ #endif /* not lint */
#include "dhcpd.h" #include "dhcpd.h"
@@ -134,7 +134,7 @@ int write_lease (lease)
} }
if (lease -> uid_len) { if (lease -> uid_len) {
int i; int i;
if (db_printable_len ((const char *)lease -> uid, if (db_printable_len (lease -> uid,
lease -> uid_len)) { lease -> uid_len)) {
fprintf (db_file, "\n uid \"%*s\";", fprintf (db_file, "\n uid \"%*s\";",
lease -> uid_len, lease -> uid); lease -> uid_len, lease -> uid);
@@ -290,8 +290,7 @@ int write_host (host)
if (host -> client_identifier.len) { if (host -> client_identifier.len) {
int i; int i;
errno = 0; errno = 0;
if (db_printable_len ((const char *) if (db_printable_len (host -> client_identifier.data,
host -> client_identifier.data,
host -> client_identifier.len)) { host -> client_identifier.len)) {
fprintf (db_file, "\n uid \"%*s\";", fprintf (db_file, "\n uid \"%*s\";",
host -> client_identifier.len, host -> client_identifier.len,
@@ -453,7 +452,7 @@ int db_printable (s)
} }
int db_printable_len (s, len) int db_printable_len (s, len)
const char *s; const unsigned char *s;
unsigned len; unsigned len;
{ {
int i; int i;