summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorderaadt <deraadt@openbsd.org>2004-09-16 18:35:42 +0000
committerderaadt <deraadt@openbsd.org>2004-09-16 18:35:42 +0000
commit0795b38919d5e1a9797bb5628fbd00cbe8824b7d (patch)
treef73c46995a06a83b0a5501f0a8a7c9b62bdb339d
parentftruncate() with ftello() instead of ftell(); ok millert (diff)
downloadwireguard-openbsd-0795b38919d5e1a9797bb5628fbd00cbe8824b7d.tar.xz
wireguard-openbsd-0795b38919d5e1a9797bb5628fbd00cbe8824b7d.zip
avoid aliasing with libc functions; ok henning
-rw-r--r--usr.sbin/dhcpd/alloc.c6
-rw-r--r--usr.sbin/dhcpd/bootp.c8
-rw-r--r--usr.sbin/dhcpd/bpf.c4
-rw-r--r--usr.sbin/dhcpd/conflex.c5
-rw-r--r--usr.sbin/dhcpd/confpars.c40
-rw-r--r--usr.sbin/dhcpd/db.c11
-rw-r--r--usr.sbin/dhcpd/dhcp.c24
-rw-r--r--usr.sbin/dhcpd/dhcpd.c8
-rw-r--r--usr.sbin/dhcpd/dhcpd.h4
-rw-r--r--usr.sbin/dhcpd/dispatch.c16
-rw-r--r--usr.sbin/dhcpd/errwarn.c4
-rw-r--r--usr.sbin/dhcpd/hash.c4
-rw-r--r--usr.sbin/dhcpd/icmp.c6
-rw-r--r--usr.sbin/dhcpd/memory.c10
-rw-r--r--usr.sbin/dhcpd/options.c16
-rw-r--r--usr.sbin/dhcpd/parse.c16
-rw-r--r--usr.sbin/dhcpd/tree.c4
-rw-r--r--usr.sbin/dhcpd/tree.h4
18 files changed, 92 insertions, 98 deletions
diff --git a/usr.sbin/dhcpd/alloc.c b/usr.sbin/dhcpd/alloc.c
index e02aa69278b..19ffe2db116 100644
--- a/usr.sbin/dhcpd/alloc.c
+++ b/usr.sbin/dhcpd/alloc.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: alloc.c,v 1.3 2004/05/04 20:28:40 deraadt Exp $ */
+/* $OpenBSD: alloc.c,v 1.4 2004/09/16 18:35:42 deraadt Exp $ */
/* Memory allocation... */
@@ -50,7 +50,7 @@ dmalloc(int size, char *name)
void *foo = calloc(size, sizeof(char));
if (!foo)
- warn("No memory for %s.", name);
+ warning("No memory for %s.", name);
return (foo);
}
@@ -58,7 +58,7 @@ void
dfree(void *ptr, char *name)
{
if (!ptr) {
- warn("dfree %s: free on null pointer.", name);
+ warning("dfree %s: free on null pointer.", name);
return;
}
free(ptr);
diff --git a/usr.sbin/dhcpd/bootp.c b/usr.sbin/dhcpd/bootp.c
index 03e970b1b0b..2021976dc91 100644
--- a/usr.sbin/dhcpd/bootp.c
+++ b/usr.sbin/dhcpd/bootp.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: bootp.c,v 1.10 2004/09/16 09:35:24 claudio Exp $ */
+/* $OpenBSD: bootp.c,v 1.11 2004/09/16 18:35:42 deraadt Exp $ */
/*
* BOOTP Protocol support.
@@ -57,7 +57,7 @@ bootp(struct packet *packet)
struct subnet *subnet = NULL;
struct lease *lease;
struct iaddr ip_address;
- int result, i;
+ int i;
if (packet->raw->op != BOOTREQUEST)
return;
@@ -332,7 +332,7 @@ lose:
to.sin_addr = raw.giaddr;
to.sin_port = server_port;
- result = send_packet(packet->interface, &raw,
+ (void) send_packet(packet->interface, &raw,
outgoing.packet_length, from, &to, packet->haddr);
return;
}
@@ -352,6 +352,6 @@ lose:
}
errno = 0;
- result = send_packet(packet->interface, &raw,
+ (void) send_packet(packet->interface, &raw,
outgoing.packet_length, from, &to, &hto);
}
diff --git a/usr.sbin/dhcpd/bpf.c b/usr.sbin/dhcpd/bpf.c
index 0d13b116e81..ca0088f235c 100644
--- a/usr.sbin/dhcpd/bpf.c
+++ b/usr.sbin/dhcpd/bpf.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: bpf.c,v 1.4 2004/05/04 20:28:40 deraadt Exp $ */
+/* $OpenBSD: bpf.c,v 1.5 2004/09/16 18:35:42 deraadt Exp $ */
/* BPF socket interface code, originally contributed by Archie Cobbs. */
@@ -247,7 +247,7 @@ send_packet(struct interface_info *interface, struct dhcp_packet *raw,
result = writev(interface->wfdesc, iov, 2);
if (result < 0)
- warn("send_packet: %m");
+ warning("send_packet: %m");
return (result);
}
diff --git a/usr.sbin/dhcpd/conflex.c b/usr.sbin/dhcpd/conflex.c
index 2ea3289529e..798badf9d60 100644
--- a/usr.sbin/dhcpd/conflex.c
+++ b/usr.sbin/dhcpd/conflex.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: conflex.c,v 1.3 2004/04/14 00:56:02 henning Exp $ */
+/* $OpenBSD: conflex.c,v 1.4 2004/09/16 18:35:42 deraadt Exp $ */
/* Lexical scanner for dhcpd config file... */
@@ -117,12 +117,11 @@ get_token(FILE *cfile)
{
int c, ttok;
static char tb[2];
- int l, p, u;
+ int l, p;
do {
l = line;
p = lpos;
- u = ugflag;
c = get_char(cfile);
diff --git a/usr.sbin/dhcpd/confpars.c b/usr.sbin/dhcpd/confpars.c
index cb4489ff96a..f66dda6c72b 100644
--- a/usr.sbin/dhcpd/confpars.c
+++ b/usr.sbin/dhcpd/confpars.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: confpars.c,v 1.11 2004/09/15 18:15:50 henning Exp $ */
+/* $OpenBSD: confpars.c,v 1.12 2004/09/16 18:35:42 deraadt Exp $ */
/*
* Copyright (c) 1995, 1996, 1997 The Internet Software Consortium.
@@ -41,8 +41,6 @@
#include "dhcpd.h"
#include "dhctoken.h"
-static time_t parsed_time;
-
/* conf-file :== parameters declarations EOF
parameters :== <nil> | parameter | parameters parameter
declarations :== <nil> | declaration | declarations declaration */
@@ -111,10 +109,10 @@ read_leases(void)
thinking that no leases have been assigned to anybody, which
could create severe network chaos. */
if ((cfile = fopen(path_dhcpd_db, "r")) == NULL) {
- warn("Can't open lease database %s: %m -- %s",
+ warning("Can't open lease database %s: %m -- %s",
path_dhcpd_db,
"check for failed database rewrite attempt!");
- warn("Please read the dhcpd.leases manual page if you.");
+ warning("Please read the dhcpd.leases manual page if you.");
error("don't know what to do about this.");
}
@@ -123,7 +121,7 @@ read_leases(void)
if (token == EOF)
break;
if (token != LEASE) {
- warn("Corrupt lease file - possible data loss!");
+ warning("Corrupt lease file - possible data loss!");
skip_to_semi(cfile);
} else {
struct lease *lease;
@@ -203,7 +201,6 @@ int parse_statement(cfile, group, type, host_decl, declaration)
return 1;
case TIMESTAMP:
- parsed_time = parse_timestamp(cfile);
break;
case SHARED_NETWORK:
@@ -354,7 +351,7 @@ int parse_statement(cfile, group, type, host_decl, declaration)
error("next-server is not known");
group->next_server.len = 4;
memcpy(group->next_server.iabuf,
- cache->value, group->next_server.len);
+ cache->value, group->next_server.len);
parse_semi(cfile);
break;
@@ -471,19 +468,16 @@ void parse_allow_deny(cfile, group, flag)
/* boolean :== ON SEMI | OFF SEMI | TRUE SEMI | FALSE SEMI */
-int parse_boolean(cfile)
- FILE *cfile;
+int
+parse_boolean(FILE *cfile)
{
- int token;
char *val;
int rv;
- token = next_token(&val, cfile);
- if (!strcasecmp (val, "true")
- || !strcasecmp (val, "on"))
+ next_token(&val, cfile);
+ if (!strcasecmp (val, "true") || !strcasecmp (val, "on"))
rv = 1;
- else if (!strcasecmp (val, "false")
- || !strcasecmp (val, "off"))
+ else if (!strcasecmp (val, "false") || !strcasecmp (val, "off"))
rv = 0;
else {
parse_warn("boolean value (true/false/on/off) expected");
@@ -1096,7 +1090,7 @@ void parse_option_param(cfile, group)
tree = tree_concat(tree, tree_const(buf, 1));
break;
default:
- warn("Bad format %c in parse_option_param.",
+ warning("Bad format %c in parse_option_param.",
*fmt);
skip_to_semi(cfile);
return;
@@ -1127,8 +1121,8 @@ void parse_option_param(cfile, group)
but rather in the database file and the journal file. (Okay, actually
they're not even used there yet). */
-time_t parse_timestamp(cfile)
- FILE *cfile;
+time_t
+parse_timestamp(FILE *cfile)
{
time_t rv;
@@ -1152,8 +1146,8 @@ time_t parse_timestamp(cfile)
| CLASS identifier SEMI
| DYNAMIC_BOOTP SEMI */
-struct lease *parse_lease_declaration(cfile)
- FILE *cfile;
+struct lease *
+parse_lease_declaration(FILE *cfile)
{
char *val;
int token;
@@ -1223,7 +1217,7 @@ struct lease *parse_lease_declaration(cfile)
lease.uid = (unsigned char *)
malloc(lease.uid_len);
if (!lease.uid) {
- warn("no space for uid");
+ warning("no space for uid");
return NULL;
}
memcpy(lease.uid, val, lease.uid_len);
@@ -1234,7 +1228,7 @@ struct lease *parse_lease_declaration(cfile)
parse_numeric_aggregate(cfile,
NULL, &lease.uid_len, ':', 16, 8);
if (!lease.uid) {
- warn("no space for uid");
+ warning("no space for uid");
return NULL;
}
if (lease.uid_len == 0) {
diff --git a/usr.sbin/dhcpd/db.c b/usr.sbin/dhcpd/db.c
index 3afa66b8e0b..8df804ceaa4 100644
--- a/usr.sbin/dhcpd/db.c
+++ b/usr.sbin/dhcpd/db.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: db.c,v 1.9 2004/07/29 11:58:41 henning Exp $ */
+/* $OpenBSD: db.c,v 1.10 2004/09/16 18:35:42 deraadt Exp $ */
/*
* Persistent database management routines for DHCPD.
@@ -100,15 +100,16 @@ write_lease(struct lease *lease)
}
if (lease->uid_len) {
- int i;
+ int j;
+
errno = 0;
fprintf(db_file, "\n\tuid %2.2x", lease->uid[0]);
if (errno)
++errors;
- for (i = 1; i < lease->uid_len; i++) {
+ for (j = 1; j < lease->uid_len; j++) {
errno = 0;
- fprintf(db_file, ":%2.2x", lease->uid[i]);
+ fprintf(db_file, ":%2.2x", lease->uid[j]);
if (errno)
++errors;
}
@@ -239,7 +240,7 @@ new_lease_file(void)
write_leases();
fflush(db_file);
- ftruncate(fileno(db_file), ftell(db_file));
+ ftruncate(fileno(db_file), ftello(db_file));
fsync(fileno(db_file));
counting = 1;
diff --git a/usr.sbin/dhcpd/dhcp.c b/usr.sbin/dhcpd/dhcp.c
index 98c0d3adff6..4c2b14ed211 100644
--- a/usr.sbin/dhcpd/dhcp.c
+++ b/usr.sbin/dhcpd/dhcp.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: dhcp.c,v 1.13 2004/09/16 09:35:24 claudio Exp $ */
+/* $OpenBSD: dhcp.c,v 1.14 2004/09/16 18:35:42 deraadt Exp $ */
/*
* Copyright (c) 1995, 1996, 1997, 1998, 1999
@@ -132,7 +132,7 @@ dhcpdiscover(struct packet *packet)
* reclaim the abandoned lease.
*/
if ((lease->flags & ABANDONED_LEASE)) {
- warn("Reclaiming abandoned IP address %s.",
+ warning("Reclaiming abandoned IP address %s.",
piaddr(lease->ip_addr));
lease->flags &= ~ABANDONED_LEASE;
}
@@ -563,7 +563,7 @@ nak_lease(struct packet *packet, struct iaddr *cip)
result = send_packet(packet->interface, &raw,
outgoing.packet_length, from, &to, packet->haddr);
if (result == -1)
- warn("send_fallback: %m");
+ warning("send_fallback: %m");
return;
} else {
to.sin_addr.s_addr = htonl(INADDR_BROADCAST);
@@ -882,7 +882,7 @@ ack_lease(struct packet *packet, struct lease *lease, unsigned int offer,
if (packet->options[i].data) {
state->prl = dmalloc(packet->options[i].len, "ack_lease: prl");
if (!state->prl)
- warn("no memory for parameter request list");
+ warning("no memory for parameter request list");
else {
memcpy(state->prl, packet->options[i].data,
packet->options[i].len);
@@ -1093,7 +1093,7 @@ ack_lease(struct packet *packet, struct lease *lease, unsigned int offer,
void
dhcp_reply(struct lease *lease)
{
- int bufs = 0, packet_length, result, i;
+ int bufs = 0, packet_length, i;
struct dhcp_packet raw;
struct sockaddr_in to;
struct in_addr from;
@@ -1215,7 +1215,7 @@ dhcp_reply(struct lease *lease)
to.sin_addr = raw.giaddr;
to.sin_port = server_port;
- result = send_packet(state->ip, &raw,
+ (void) send_packet(state->ip, &raw,
packet_length, raw.siaddr, &to, &state->haddr);
free_lease_state(state, "dhcp_reply gateway");
@@ -1258,7 +1258,7 @@ dhcp_reply(struct lease *lease)
memcpy(&from, state->from.iabuf, sizeof from);
- result = send_packet(state->ip, &raw, packet_length,
+ (void) send_packet(state->ip, &raw, packet_length,
from, &to, &hto);
free_lease_state(state, "dhcp_reply");
@@ -1405,7 +1405,7 @@ find_lease(struct packet *packet, struct shared_network *share,
ip_lease->hardware_addr.hlen))) {
if (uid_lease) {
if (uid_lease->ends > cur_time) {
- warn("client %s has duplicate leases on %s",
+ warning("client %s has duplicate leases on %s",
print_hw_addr(packet->raw->htype,
packet->raw->hlen, packet->raw->chaddr),
ip_lease->shared_network->name);
@@ -1427,13 +1427,13 @@ find_lease(struct packet *packet, struct shared_network *share,
if (packet->packet_type == DHCPREQUEST && fixed_lease) {
fixed_lease = NULL;
db_conflict:
- warn("Both dynamic and static leases present for %s.",
+ warning("Both dynamic and static leases present for %s.",
piaddr(cip));
- warn("Either remove host declaration %s or remove %s",
+ warning("Either remove host declaration %s or remove %s",
(fixed_lease && fixed_lease->host ?
(fixed_lease->host->name ? fixed_lease->host->name :
piaddr(cip)) : piaddr(cip)), piaddr(cip));
- warn("from the dynamic address pool for %s",
+ warning("from the dynamic address pool for %s",
share->name);
if (fixed_lease)
ip_lease = NULL;
@@ -1554,7 +1554,7 @@ db_conflict:
the administrator will eventually investigate. */
if (lease && (lease->flags & ABANDONED_LEASE)) {
if (packet->packet_type == DHCPREQUEST) {
- warn("Reclaiming REQUESTed abandoned IP address %s.",
+ warning("Reclaiming REQUESTed abandoned IP address %s.",
piaddr(lease->ip_addr));
lease->flags &= ~ABANDONED_LEASE;
} else
diff --git a/usr.sbin/dhcpd/dhcpd.c b/usr.sbin/dhcpd/dhcpd.c
index cea9db57771..548b17c9a4a 100644
--- a/usr.sbin/dhcpd/dhcpd.c
+++ b/usr.sbin/dhcpd/dhcpd.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: dhcpd.c,v 1.20 2004/09/09 20:51:57 millert Exp $ */
+/* $OpenBSD: dhcpd.c,v 1.21 2004/09/16 18:35:43 deraadt Exp $ */
/*
* Copyright (c) 2004 Henning Brauer <henning@cvs.openbsd.org>
@@ -186,7 +186,7 @@ lease_pinged(struct iaddr from, u_int8_t *packet, int length)
}
if (!lp->state && !lp->releasing) {
- warn("ICMP Echo Reply for %s arrived late or is spurious.",
+ warning("ICMP Echo Reply for %s arrived late or is spurious.",
piaddr(from));
return;
}
@@ -200,9 +200,9 @@ lease_pinged(struct iaddr from, u_int8_t *packet, int length)
* and something answered, so we don't release it.
*/
if (lp->releasing) {
- warn("IP address %s answers a ping after sending a release",
+ warning("IP address %s answers a ping after sending a release",
piaddr(lp->ip_addr));
- warn("Possible release spoof - Not releasing address %s",
+ warning("Possible release spoof - Not releasing address %s",
piaddr(lp->ip_addr));
lp->releasing = 0;
} else {
diff --git a/usr.sbin/dhcpd/dhcpd.h b/usr.sbin/dhcpd/dhcpd.h
index c2f1c732236..214ca4c8bcc 100644
--- a/usr.sbin/dhcpd/dhcpd.h
+++ b/usr.sbin/dhcpd/dhcpd.h
@@ -1,4 +1,4 @@
-/* $OpenBSD: dhcpd.h,v 1.14 2004/09/16 09:35:24 claudio Exp $ */
+/* $OpenBSD: dhcpd.h,v 1.15 2004/09/16 18:35:43 deraadt Exp $ */
/*
* Copyright (c) 1995, 1996, 1997, 1998, 1999
@@ -545,7 +545,7 @@ void do_packet(struct interface_info *, struct dhcp_packet *, int,
/* errwarn.c */
extern int warnings_occurred;
void error(char *, ...) __attribute__ ((__format__ (__printf__, 1, 2)));
-int warn(char *, ...) __attribute__ ((__format__ (__printf__, 1, 2)));
+int warning(char *, ...) __attribute__ ((__format__ (__printf__, 1, 2)));
int note(char *, ...) __attribute__ ((__format__ (__printf__, 1, 2)));
int debug(char *, ...) __attribute__ ((__format__ (__printf__, 1, 2)));
int parse_warn(char *, ...) __attribute__ ((__format__ (__printf__, 1, 2)));
diff --git a/usr.sbin/dhcpd/dispatch.c b/usr.sbin/dhcpd/dispatch.c
index ef0a0107c8e..6374ab95b61 100644
--- a/usr.sbin/dhcpd/dispatch.c
+++ b/usr.sbin/dhcpd/dispatch.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: dispatch.c,v 1.12 2004/09/16 09:35:24 claudio Exp $ */
+/* $OpenBSD: dispatch.c,v 1.13 2004/09/16 18:35:43 deraadt Exp $ */
/*
* Copyright (c) 1995, 1996, 1997, 1998, 1999
@@ -176,7 +176,7 @@ discover_interfaces(int state)
subnet->interface = tmp;
subnet->interface_address = addr;
} else if (subnet->interface != tmp) {
- warn("Multiple %s %s: %s %s",
+ warning("Multiple %s %s: %s %s",
"interfaces match the",
"same subnet",
subnet->interface->name,
@@ -185,7 +185,7 @@ discover_interfaces(int state)
share = subnet->shared_network;
if (tmp->shared_network &&
tmp->shared_network != share) {
- warn("Interface %s matches %s",
+ warning("Interface %s matches %s",
tmp->name,
"multiple shared networks");
} else {
@@ -195,7 +195,7 @@ discover_interfaces(int state)
if (!share->interface) {
share->interface = tmp;
} else if (share->interface != tmp) {
- warn("Multiple %s %s: %s %s",
+ warning("Multiple %s %s: %s %s",
"interfaces match the",
"same shared network",
share->interface->name,
@@ -237,9 +237,9 @@ discover_interfaces(int state)
/* We must have a subnet declaration for each interface. */
if (!tmp->shared_network && (state == DISCOVER_SERVER)) {
- warn("No subnet declaration for %s (%s).",
+ warning("No subnet declaration for %s (%s).",
tmp->name, inet_ntoa(foo.sin_addr));
- warn("Please write a subnet declaration in your %s",
+ warning("Please write a subnet declaration in your %s",
"dhcpd.conf file for the");
error("network segment to which interface %s %s",
tmp->name, "is attached.");
@@ -390,13 +390,13 @@ got_one(struct protocol *l)
if ((result = receive_packet (ip, u.packbuf, sizeof u,
&from, &hfrom)) == -1) {
- warn("receive_packet failed on %s: %s", ip->name,
+ warning("receive_packet failed on %s: %s", ip->name,
strerror(errno));
ip->errors++;
if ((!interface_status(ip)) ||
(ip->noifmedia && ip->errors > 20)) {
/* our interface has gone away. */
- warn("Interface %s no longer appears valid.",
+ warning("Interface %s no longer appears valid.",
ip->name);
ip->dead = 1;
interfaces_invalidated = 1;
diff --git a/usr.sbin/dhcpd/errwarn.c b/usr.sbin/dhcpd/errwarn.c
index 65fe1ca05e2..ad409e7fa57 100644
--- a/usr.sbin/dhcpd/errwarn.c
+++ b/usr.sbin/dhcpd/errwarn.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: errwarn.c,v 1.1 2004/04/13 23:41:48 henning Exp $ */
+/* $OpenBSD: errwarn.c,v 1.2 2004/09/16 18:35:43 deraadt Exp $ */
/* Errors and warnings... */
@@ -87,7 +87,7 @@ error(char *fmt, ...)
* Log a warning message...
*/
int
-warn(char *fmt, ...)
+warning(char *fmt, ...)
{
va_list list;
diff --git a/usr.sbin/dhcpd/hash.c b/usr.sbin/dhcpd/hash.c
index 5e974120d6a..ea2cdac3a9b 100644
--- a/usr.sbin/dhcpd/hash.c
+++ b/usr.sbin/dhcpd/hash.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: hash.c,v 1.2 2004/04/14 00:56:02 henning Exp $ */
+/* $OpenBSD: hash.c,v 1.3 2004/09/16 18:35:43 deraadt Exp $ */
/* Routines for manipulating hash tables... */
@@ -87,7 +87,7 @@ void add_hash(struct hash_table *table, unsigned char *name, int len,
bp = new_hash_bucket("add_hash");
if (!bp) {
- warn("Can't add %s to hash table.", name);
+ warning("Can't add %s to hash table.", name);
return;
}
bp->name = name;
diff --git a/usr.sbin/dhcpd/icmp.c b/usr.sbin/dhcpd/icmp.c
index ba39edc5bea..6df90da95f4 100644
--- a/usr.sbin/dhcpd/icmp.c
+++ b/usr.sbin/dhcpd/icmp.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: icmp.c,v 1.8 2004/04/22 15:22:48 henning Exp $ */
+/* $OpenBSD: icmp.c,v 1.9 2004/09/16 18:35:43 deraadt Exp $ */
/*
* Copyright (c) 1997, 1998 The Internet Software Consortium.
@@ -104,7 +104,7 @@ icmp_echorequest(struct iaddr *addr)
status = sendto(icmp_protocol_fd, &icmp, sizeof(icmp), 0,
(struct sockaddr *)&to, sizeof(to));
if (status < 0)
- warn("icmp_echorequest %s: %m", inet_ntoa(to.sin_addr));
+ warning("icmp_echorequest %s: %m", inet_ntoa(to.sin_addr));
if (status != sizeof icmp)
return 0;
@@ -126,7 +126,7 @@ icmp_echoreply(struct protocol *protocol)
status = recvfrom(protocol->fd, icbuf, sizeof(icbuf), 0,
(struct sockaddr *)&from, &salen);
if (status < 0) {
- warn("icmp_echoreply: %m");
+ warning("icmp_echoreply: %m");
return;
}
diff --git a/usr.sbin/dhcpd/memory.c b/usr.sbin/dhcpd/memory.c
index 962c01b9060..6b0cb86601a 100644
--- a/usr.sbin/dhcpd/memory.c
+++ b/usr.sbin/dhcpd/memory.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: memory.c,v 1.8 2004/05/11 04:08:35 deraadt Exp $ */
+/* $OpenBSD: memory.c,v 1.9 2004/09/16 18:35:43 deraadt Exp $ */
/*
* Copyright (c) 1995, 1996, 1997, 1998 The Internet Software Consortium.
@@ -252,7 +252,7 @@ new_address_range(struct iaddr low, struct iaddr high, struct subnet *subnet,
if (subnet->group->get_lease_hostnames) {
h = gethostbyaddr((char *)&ia, sizeof ia, AF_INET);
if (!h)
- warn("No hostname for %s", inet_ntoa(ia));
+ warning("No hostname for %s", inet_ntoa(ia));
else {
int len = strlen(h->h_name) + 1;
@@ -347,7 +347,7 @@ subnet_inner_than(struct subnet *subnet, struct subnet *scan, int warnp)
break;
strlcpy(n1buf, piaddr(subnet->net), sizeof(n1buf));
if (warnp)
- warn("%ssubnet %s/%d conflicts with subnet %s/%d",
+ warning("%ssubnet %s/%d conflicts with subnet %s/%d",
"Warning: ", n1buf, 32 - i,
piaddr(scan->net), 32 - j);
if (i < j)
@@ -463,7 +463,7 @@ supersede_lease(struct lease *comp, struct lease *lease, int commit)
lease->hardware_addr.hlen) ||
memcmp(comp->hardware_addr.haddr, lease->hardware_addr.haddr,
comp->hardware_addr.hlen))))) {
- warn("Lease conflict at %s", piaddr(comp->ip_addr));
+ warning("Lease conflict at %s", piaddr(comp->ip_addr));
return 0;
} else {
/* If there's a Unique ID, dissociate it from the hash
@@ -632,7 +632,7 @@ abandon_lease(struct lease *lease, char *message)
lease->flags |= ABANDONED_LEASE;
lt = *lease;
lt.ends = cur_time + abtime;
- warn("Abandoning IP address %s for %d seconds: %s",
+ warning("Abandoning IP address %s for %d seconds: %s",
piaddr(lease->ip_addr), abtime, message);
lt.hardware_addr.htype = 0;
lt.hardware_addr.hlen = 0;
diff --git a/usr.sbin/dhcpd/options.c b/usr.sbin/dhcpd/options.c
index eb19bb0e60e..da64057e180 100644
--- a/usr.sbin/dhcpd/options.c
+++ b/usr.sbin/dhcpd/options.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: options.c,v 1.4 2004/05/04 21:25:27 deraadt Exp $ */
+/* $OpenBSD: options.c,v 1.5 2004/09/16 18:35:43 deraadt Exp $ */
/* DHCP options parsing and reassembly. */
@@ -137,17 +137,17 @@ parse_option_buffer(struct packet *packet,
if (s + len + 2 > end) {
bogus:
bad_options++;
- warn("option %s (%d) %s.",
+ warning("option %s (%d) %s.",
dhcp_options[code].name, len,
"larger than buffer");
if (bad_options == bad_options_max) {
packet->options_valid = 1;
bad_options = 0;
- warn("Many bogus options seen in offers.");
- warn("Taking this offer in spite of bogus");
- warn("options - hope for the best!");
+ warning("Many bogus options seen in offers.");
+ warning("Taking this offer in spite of bogus");
+ warning("options - hope for the best!");
} else {
- warn("rejecting bogus offer.");
+ warning("rejecting bogus offer.");
packet->options_valid = 0;
}
return;
@@ -321,7 +321,7 @@ cons_options(struct packet *inpacket, struct dhcp_packet *outpacket,
&buffer[bufix], option_size - bufix);
mainbufix = option_size - bufix;
if (mainbufix < DHCP_FILE_LEN)
- outpacket->file[mainbufix++] = DHO_END;
+ outpacket->file[mainbufix++] = (char)DHO_END;
while (mainbufix < DHCP_FILE_LEN)
outpacket->file[mainbufix++] = DHO_PAD;
} else {
@@ -336,7 +336,7 @@ cons_options(struct packet *inpacket, struct dhcp_packet *outpacket,
mainbufix = option_size - bufix;
if (mainbufix < DHCP_SNAME_LEN)
- outpacket->file[mainbufix++] = DHO_END;
+ outpacket->file[mainbufix++] = (char)DHO_END;
while (mainbufix < DHCP_SNAME_LEN)
outpacket->file[mainbufix++] = DHO_PAD;
}
diff --git a/usr.sbin/dhcpd/parse.c b/usr.sbin/dhcpd/parse.c
index d02f1f1fb08..3dc693835e8 100644
--- a/usr.sbin/dhcpd/parse.c
+++ b/usr.sbin/dhcpd/parse.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: parse.c,v 1.6 2004/05/04 20:28:40 deraadt Exp $ */
+/* $OpenBSD: parse.c,v 1.7 2004/09/16 18:35:43 deraadt Exp $ */
/* Common parser code for dhcpd and dhclient. */
@@ -393,11 +393,11 @@ convert_num(unsigned char *buf, char *str, int base, int size)
else if (tval >= '0')
tval -= '0';
else {
- warn("Bogus number: %s.", str);
+ warning("Bogus number: %s.", str);
break;
}
if (tval >= base) {
- warn("Bogus number: %s: digit %d not in base %d",
+ warning("Bogus number: %s: digit %d not in base %d",
str, tval, base);
break;
}
@@ -411,15 +411,15 @@ convert_num(unsigned char *buf, char *str, int base, int size)
if (val > max) {
switch (base) {
case 8:
- warn("value %s%o exceeds max (%d) for precision.",
+ warning("value %s%o exceeds max (%d) for precision.",
negative ? "-" : "", val, max);
break;
case 16:
- warn("value %s%x exceeds max (%d) for precision.",
+ warning("value %s%x exceeds max (%d) for precision.",
negative ? "-" : "", val, max);
break;
default:
- warn("value %s%u exceeds max (%d) for precision.",
+ warning("value %s%u exceeds max (%d) for precision.",
negative ? "-" : "", val, max);
break;
}
@@ -436,7 +436,7 @@ convert_num(unsigned char *buf, char *str, int base, int size)
putLong(buf, -(unsigned long)val);
break;
default:
- warn("Unexpected integer size: %d", size);
+ warning("Unexpected integer size: %d", size);
break;
}
} else {
@@ -451,7 +451,7 @@ convert_num(unsigned char *buf, char *str, int base, int size)
putULong(buf, val);
break;
default:
- warn("Unexpected integer size: %d", size);
+ warning("Unexpected integer size: %d", size);
break;
}
}
diff --git a/usr.sbin/dhcpd/tree.c b/usr.sbin/dhcpd/tree.c
index 11db0200549..138f767062a 100644
--- a/usr.sbin/dhcpd/tree.c
+++ b/usr.sbin/dhcpd/tree.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: tree.c,v 1.9 2004/05/08 06:12:50 henning Exp $ */
+/* $OpenBSD: tree.c,v 1.10 2004/09/16 18:35:43 deraadt Exp $ */
/* Routines for manipulating parse trees... */
@@ -267,7 +267,7 @@ tree_evaluate_recurse(int *bufix, unsigned char **bufp,
return t1;
default:
- warn("Bad node id in tree: %d.", tree->op);
+ warning("Bad node id in tree: %d.", tree->op);
t1 = MAX_TIME;
return t1;
}
diff --git a/usr.sbin/dhcpd/tree.h b/usr.sbin/dhcpd/tree.h
index bdee4bf137b..fa9023b920d 100644
--- a/usr.sbin/dhcpd/tree.h
+++ b/usr.sbin/dhcpd/tree.h
@@ -1,4 +1,4 @@
-/* $OpenBSD: tree.h,v 1.4 2004/04/15 21:47:13 hshoexer Exp $ */
+/* $OpenBSD: tree.h,v 1.5 2004/09/16 18:35:43 deraadt Exp $ */
/* Definitions for address trees... */
@@ -85,7 +85,7 @@ struct dns_host_entry {
struct tree_cache {
unsigned char *value;
int len;
- int buf_size;
+ unsigned int buf_size;
time_t timeout;
struct tree *tree;
int flags;