2
0
mirror of https://gitlab.isc.org/isc-projects/dhcp synced 2025-08-30 05:47:45 +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. */
/*
* Copyright (c) 1995, 1996 The Internet Software Consortium.
* Copyright (c) 1995, 1996, 1998 The Internet Software Consortium.
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
@ -42,7 +42,7 @@
#ifndef lint
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 */
#define DHCP_OPTION_DATA
@ -71,13 +71,15 @@ void parse_options (packet)
if (packet -> options_valid
&& packet -> options [DHO_DHCP_OPTION_OVERLOAD].data) {
if (packet -> options [DHO_DHCP_OPTION_OVERLOAD].data [0] & 1)
parse_option_buffer (packet,
packet -> raw -> file,
sizeof packet -> raw -> file);
parse_option_buffer
(packet,
(unsigned char *)packet -> raw -> file,
sizeof packet -> raw -> file);
if (packet -> options [DHO_DHCP_OPTION_OVERLOAD].data [0] & 2)
parse_option_buffer (packet,
packet -> raw -> sname,
sizeof packet -> raw -> sname);
parse_option_buffer
(packet,
(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':
if (emit_quotes)
*op++ = '"';
strcpy (op, dp);
op += strlen (dp);
strcpy (op, (char *)dp);
op += strlen ((char *)dp);
if (emit_quotes)
*op++ = '"';
*op = 0;
@ -682,7 +684,7 @@ void do_packet (interface, packbuf, len, from_port, from, hfrom)
struct interface_info *interface;
unsigned char *packbuf;
int len;
unsigned short from_port;
unsigned int from_port;
struct iaddr from;
struct hardware *hfrom;
{

View File

@ -3,7 +3,7 @@
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.
*
* 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));
void do_packet PROTO ((struct interface_info *,
unsigned char *, int,
unsigned short, struct iaddr, struct hardware *));
unsigned int, struct iaddr, struct hardware *));
/* errwarn.c */
extern int warnings_occurred;
@ -624,7 +624,7 @@ void dhcprelease PROTO ((struct packet *));
void dhcpdecline PROTO ((struct packet *));
void dhcpinform PROTO ((struct packet *));
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 *));
struct lease *find_lease PROTO ((struct packet *,
struct shared_network *, int *));
@ -827,7 +827,7 @@ extern struct interface_info *interfaces, *dummy_interfaces;
extern struct protocol *protocols;
extern int quiet_interface_discovery;
extern void (*bootp_packet_handler) PROTO ((struct interface_info *,
unsigned char *, int, unsigned short,
unsigned char *, int, unsigned int,
struct iaddr, struct hardware *));
extern struct timeout *timeouts;
void discover_interfaces PROTO ((int));
@ -846,9 +846,10 @@ void remove_protocol PROTO ((struct protocol *));
/* hash.c */
struct hash_table *new_hash PROTO ((void));
void add_hash PROTO ((struct hash_table *, char *, int, unsigned char *));
void delete_hash_entry PROTO ((struct hash_table *, char *, int));
unsigned char *hash_lookup PROTO ((struct hash_table *, char *, int));
void add_hash PROTO ((struct hash_table *,
unsigned char *, int, unsigned char *));
void delete_hash_entry PROTO ((struct hash_table *, unsigned char *, int));
unsigned char *hash_lookup PROTO ((struct hash_table *, unsigned char *, int));
/* tables.c */
extern struct option dhcp_options [256];
@ -866,8 +867,8 @@ u_int16_t getUShort PROTO ((unsigned char *));
int16_t getShort PROTO ((unsigned char *));
void putULong PROTO ((unsigned char *, u_int32_t));
void putLong PROTO ((unsigned char *, int32_t));
void putUShort PROTO ((unsigned char *, u_int16_t));
void putShort PROTO ((unsigned char *, int16_t));
void putUShort PROTO ((unsigned char *, u_int32_t));
void putShort PROTO ((unsigned char *, int32_t));
/* inet.c */
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 *,
int *, struct hardware *));
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));
ssize_t decode_hw_header PROTO ((struct interface_info *, unsigned char *,
int, struct hardware *));
@ -1006,7 +1007,7 @@ void parse_reject_statement PROTO ((FILE *, struct client_config *));
/* dhcrelay.c */
void relay PROTO ((struct interface_info *, u_int8_t *, int,
unsigned short, struct iaddr, struct hardware *));
unsigned int, struct iaddr, struct hardware *));
/* icmp.c */
void icmp_startup PROTO ((int, void (*) PROTO ((struct iaddr,

View File

@ -42,14 +42,14 @@
#ifndef lint
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 */
#include "dhcpd.h"
int outstanding_pings;
static unsigned char dhcp_message [256];
static char dhcp_message [256];
void dhcp (packet)
struct packet *packet;
@ -418,12 +418,12 @@ void nak_lease (packet, cip)
/* Set DHCP_MESSAGE to whatever the message is */
options [DHO_DHCP_MESSAGE] = &dhcpmsg_tree;
options [DHO_DHCP_MESSAGE] -> value = dhcp_message;
options [DHO_DHCP_MESSAGE] -> len = strlen (dhcp_message);
options [DHO_DHCP_MESSAGE] -> buf_size = strlen (dhcp_message);
options [DHO_DHCP_MESSAGE] -> value = (unsigned char *)dhcp_message;
options [DHO_DHCP_MESSAGE] -> buf_size =
options [DHO_DHCP_MESSAGE] -> len = strlen (dhcp_message);
options [DHO_DHCP_MESSAGE] -> timeout = 0xFFFFFFFF;
options [DHO_DHCP_MESSAGE] -> tree = (struct tree *)0;
/* Do not use the client's requested parameter list. */
packet -> options [DHO_DHCP_PARAMETER_REQUEST_LIST].len = 0;
packet -> options [DHO_DHCP_PARAMETER_REQUEST_LIST].data =
@ -513,7 +513,7 @@ void nak_lease (packet, cip)
void ack_lease (packet, lease, offer, when)
struct packet *packet;
struct lease *lease;
unsigned char offer;
unsigned int offer;
TIME when;
{
struct lease lt;
@ -533,7 +533,7 @@ void ack_lease (packet, lease, offer, when)
if (packet -> options [DHO_DHCP_CLASS_IDENTIFIER].len) {
vendor_class =
find_class (0,
packet ->
(char *)packet ->
options [DHO_DHCP_CLASS_IDENTIFIER].data,
packet ->
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) {
user_class =
find_class (1,
packet ->
(char *)packet ->
options [DHO_DHCP_USER_CLASS_ID].data,
packet ->
options [DHO_DHCP_USER_CLASS_ID].len);