2
0
mirror of https://gitlab.isc.org/isc-projects/dhcp synced 2025-08-31 14:25:41 +00:00

Declare arguments that can be promoted so that the compiler's behaviour doesn't change depending on whether or not it follows ANSI. Fix signed vs. unsigned char discrepencies.

This commit is contained in:
Ted Lemon
1998-03-16 06:19:46 +00:00
parent 19d6cdc7d2
commit a7822eac77
3 changed files with 34 additions and 31 deletions

View File

@@ -3,7 +3,7 @@
DHCP options parsing and reassembly. */ DHCP options parsing and reassembly. */
/* /*
* Copyright (c) 1995, 1996 The Internet Software Consortium. * Copyright (c) 1995, 1996, 1998 The Internet Software Consortium.
* All rights reserved. * All rights reserved.
* *
* Redistribution and use in source and binary forms, with or without * Redistribution and use in source and binary forms, with or without
@@ -42,7 +42,7 @@
#ifndef lint #ifndef lint
static char copyright[] = static char copyright[] =
"$Id: options.c,v 1.27 1998/02/06 01:18:33 mellon Exp $ Copyright (c) 1995, 1996 The Internet Software Consortium. All rights reserved.\n"; "$Id: options.c,v 1.28 1998/03/16 06:19:46 mellon Exp $ Copyright (c) 1995, 1996 The Internet Software Consortium. All rights reserved.\n";
#endif /* not lint */ #endif /* not lint */
#define DHCP_OPTION_DATA #define DHCP_OPTION_DATA
@@ -71,13 +71,15 @@ void parse_options (packet)
if (packet -> options_valid if (packet -> options_valid
&& packet -> options [DHO_DHCP_OPTION_OVERLOAD].data) { && packet -> options [DHO_DHCP_OPTION_OVERLOAD].data) {
if (packet -> options [DHO_DHCP_OPTION_OVERLOAD].data [0] & 1) if (packet -> options [DHO_DHCP_OPTION_OVERLOAD].data [0] & 1)
parse_option_buffer (packet, parse_option_buffer
packet -> raw -> file, (packet,
sizeof packet -> raw -> file); (unsigned char *)packet -> raw -> file,
sizeof packet -> raw -> file);
if (packet -> options [DHO_DHCP_OPTION_OVERLOAD].data [0] & 2) if (packet -> options [DHO_DHCP_OPTION_OVERLOAD].data [0] & 2)
parse_option_buffer (packet, parse_option_buffer
packet -> raw -> sname, (packet,
sizeof packet -> raw -> sname); (unsigned char *)packet -> raw -> sname,
sizeof packet -> raw -> sname);
} }
} }
@@ -623,8 +625,8 @@ char *pretty_print_option (code, data, len, emit_commas, emit_quotes)
case 't': case 't':
if (emit_quotes) if (emit_quotes)
*op++ = '"'; *op++ = '"';
strcpy (op, dp); strcpy (op, (char *)dp);
op += strlen (dp); op += strlen ((char *)dp);
if (emit_quotes) if (emit_quotes)
*op++ = '"'; *op++ = '"';
*op = 0; *op = 0;
@@ -682,7 +684,7 @@ void do_packet (interface, packbuf, len, from_port, from, hfrom)
struct interface_info *interface; struct interface_info *interface;
unsigned char *packbuf; unsigned char *packbuf;
int len; int len;
unsigned short from_port; unsigned int from_port;
struct iaddr from; struct iaddr from;
struct hardware *hfrom; struct hardware *hfrom;
{ {

View File

@@ -3,7 +3,7 @@
Definitions for dhcpd... */ Definitions for dhcpd... */
/* /*
* Copyright (c) 1995, 1996, 1997 The Internet Software Consortium. * Copyright (c) 1995, 1996, 1997, 1998 The Internet Software Consortium.
* All rights reserved. * All rights reserved.
* *
* Redistribution and use in source and binary forms, with or without * Redistribution and use in source and binary forms, with or without
@@ -529,7 +529,7 @@ char *pretty_print_option PROTO ((unsigned int,
unsigned char *, int, int, int)); unsigned char *, int, int, int));
void do_packet PROTO ((struct interface_info *, void do_packet PROTO ((struct interface_info *,
unsigned char *, int, unsigned char *, int,
unsigned short, struct iaddr, struct hardware *)); unsigned int, struct iaddr, struct hardware *));
/* errwarn.c */ /* errwarn.c */
extern int warnings_occurred; extern int warnings_occurred;
@@ -624,7 +624,7 @@ void dhcprelease PROTO ((struct packet *));
void dhcpdecline PROTO ((struct packet *)); void dhcpdecline PROTO ((struct packet *));
void dhcpinform PROTO ((struct packet *)); void dhcpinform PROTO ((struct packet *));
void nak_lease PROTO ((struct packet *, struct iaddr *cip)); void nak_lease PROTO ((struct packet *, struct iaddr *cip));
void ack_lease PROTO ((struct packet *, struct lease *, unsigned char, TIME)); void ack_lease PROTO ((struct packet *, struct lease *, unsigned int, TIME));
void dhcp_reply PROTO ((struct lease *)); void dhcp_reply PROTO ((struct lease *));
struct lease *find_lease PROTO ((struct packet *, struct lease *find_lease PROTO ((struct packet *,
struct shared_network *, int *)); struct shared_network *, int *));
@@ -827,7 +827,7 @@ extern struct interface_info *interfaces, *dummy_interfaces;
extern struct protocol *protocols; extern struct protocol *protocols;
extern int quiet_interface_discovery; extern int quiet_interface_discovery;
extern void (*bootp_packet_handler) PROTO ((struct interface_info *, extern void (*bootp_packet_handler) PROTO ((struct interface_info *,
unsigned char *, int, unsigned short, unsigned char *, int, unsigned int,
struct iaddr, struct hardware *)); struct iaddr, struct hardware *));
extern struct timeout *timeouts; extern struct timeout *timeouts;
void discover_interfaces PROTO ((int)); void discover_interfaces PROTO ((int));
@@ -846,9 +846,10 @@ void remove_protocol PROTO ((struct protocol *));
/* hash.c */ /* hash.c */
struct hash_table *new_hash PROTO ((void)); struct hash_table *new_hash PROTO ((void));
void add_hash PROTO ((struct hash_table *, char *, int, unsigned char *)); void add_hash PROTO ((struct hash_table *,
void delete_hash_entry PROTO ((struct hash_table *, char *, int)); unsigned char *, int, unsigned char *));
unsigned char *hash_lookup PROTO ((struct hash_table *, char *, int)); void delete_hash_entry PROTO ((struct hash_table *, unsigned char *, int));
unsigned char *hash_lookup PROTO ((struct hash_table *, unsigned char *, int));
/* tables.c */ /* tables.c */
extern struct option dhcp_options [256]; extern struct option dhcp_options [256];
@@ -866,8 +867,8 @@ u_int16_t getUShort PROTO ((unsigned char *));
int16_t getShort PROTO ((unsigned char *)); int16_t getShort PROTO ((unsigned char *));
void putULong PROTO ((unsigned char *, u_int32_t)); void putULong PROTO ((unsigned char *, u_int32_t));
void putLong PROTO ((unsigned char *, int32_t)); void putLong PROTO ((unsigned char *, int32_t));
void putUShort PROTO ((unsigned char *, u_int16_t)); void putUShort PROTO ((unsigned char *, u_int32_t));
void putShort PROTO ((unsigned char *, int16_t)); void putShort PROTO ((unsigned char *, int32_t));
/* inet.c */ /* inet.c */
struct iaddr subnet_number PROTO ((struct iaddr, struct iaddr)); struct iaddr subnet_number PROTO ((struct iaddr, struct iaddr));
@@ -938,7 +939,7 @@ u_int32_t wrapsum PROTO ((u_int32_t));
void assemble_hw_header PROTO ((struct interface_info *, unsigned char *, void assemble_hw_header PROTO ((struct interface_info *, unsigned char *,
int *, struct hardware *)); int *, struct hardware *));
void assemble_udp_ip_header PROTO ((struct interface_info *, unsigned char *, void assemble_udp_ip_header PROTO ((struct interface_info *, unsigned char *,
int *, u_int32_t, u_int32_t, u_int16_t, int *, u_int32_t, u_int32_t, u_int32_t,
unsigned char *, int)); unsigned char *, int));
ssize_t decode_hw_header PROTO ((struct interface_info *, unsigned char *, ssize_t decode_hw_header PROTO ((struct interface_info *, unsigned char *,
int, struct hardware *)); int, struct hardware *));
@@ -1006,7 +1007,7 @@ void parse_reject_statement PROTO ((FILE *, struct client_config *));
/* dhcrelay.c */ /* dhcrelay.c */
void relay PROTO ((struct interface_info *, u_int8_t *, int, void relay PROTO ((struct interface_info *, u_int8_t *, int,
unsigned short, struct iaddr, struct hardware *)); unsigned int, struct iaddr, struct hardware *));
/* icmp.c */ /* icmp.c */
void icmp_startup PROTO ((int, void (*) PROTO ((struct iaddr, void icmp_startup PROTO ((int, void (*) PROTO ((struct iaddr,

View File

@@ -42,14 +42,14 @@
#ifndef lint #ifndef lint
static char copyright[] = static char copyright[] =
"$Id: dhcp.c,v 1.58 1998/02/06 01:08:38 mellon Exp $ Copyright (c) 1995, 1996 The Internet Software Consortium. All rights reserved.\n"; "$Id: dhcp.c,v 1.59 1998/03/16 06:18:03 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"
int outstanding_pings; int outstanding_pings;
static unsigned char dhcp_message [256]; static char dhcp_message [256];
void dhcp (packet) void dhcp (packet)
struct packet *packet; struct packet *packet;
@@ -418,9 +418,9 @@ void nak_lease (packet, cip)
/* Set DHCP_MESSAGE to whatever the message is */ /* Set DHCP_MESSAGE to whatever the message is */
options [DHO_DHCP_MESSAGE] = &dhcpmsg_tree; options [DHO_DHCP_MESSAGE] = &dhcpmsg_tree;
options [DHO_DHCP_MESSAGE] -> value = dhcp_message; options [DHO_DHCP_MESSAGE] -> value = (unsigned char *)dhcp_message;
options [DHO_DHCP_MESSAGE] -> len = strlen (dhcp_message); options [DHO_DHCP_MESSAGE] -> buf_size =
options [DHO_DHCP_MESSAGE] -> buf_size = strlen (dhcp_message); options [DHO_DHCP_MESSAGE] -> len = strlen (dhcp_message);
options [DHO_DHCP_MESSAGE] -> timeout = 0xFFFFFFFF; options [DHO_DHCP_MESSAGE] -> timeout = 0xFFFFFFFF;
options [DHO_DHCP_MESSAGE] -> tree = (struct tree *)0; options [DHO_DHCP_MESSAGE] -> tree = (struct tree *)0;
@@ -513,7 +513,7 @@ void nak_lease (packet, cip)
void ack_lease (packet, lease, offer, when) void ack_lease (packet, lease, offer, when)
struct packet *packet; struct packet *packet;
struct lease *lease; struct lease *lease;
unsigned char offer; unsigned int offer;
TIME when; TIME when;
{ {
struct lease lt; struct lease lt;
@@ -533,7 +533,7 @@ void ack_lease (packet, lease, offer, when)
if (packet -> options [DHO_DHCP_CLASS_IDENTIFIER].len) { if (packet -> options [DHO_DHCP_CLASS_IDENTIFIER].len) {
vendor_class = vendor_class =
find_class (0, find_class (0,
packet -> (char *)packet ->
options [DHO_DHCP_CLASS_IDENTIFIER].data, options [DHO_DHCP_CLASS_IDENTIFIER].data,
packet -> packet ->
options [DHO_DHCP_CLASS_IDENTIFIER].len); options [DHO_DHCP_CLASS_IDENTIFIER].len);
@@ -544,7 +544,7 @@ void ack_lease (packet, lease, offer, when)
if (packet -> options [DHO_DHCP_USER_CLASS_ID].len) { if (packet -> options [DHO_DHCP_USER_CLASS_ID].len) {
user_class = user_class =
find_class (1, find_class (1,
packet -> (char *)packet ->
options [DHO_DHCP_USER_CLASS_ID].data, options [DHO_DHCP_USER_CLASS_ID].data,
packet -> packet ->
options [DHO_DHCP_USER_CLASS_ID].len); options [DHO_DHCP_USER_CLASS_ID].len);