summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorKenneth R Westerback <krw@cvs.openbsd.org>2017-04-17 18:31:09 +0000
committerKenneth R Westerback <krw@cvs.openbsd.org>2017-04-17 18:31:09 +0000
commit4f2b4552387f6cc79aa67ba6e8e9ea120ede017f (patch)
treef967860c66b4ca9b5b1ae2bd6ff989f35c2719cc
parentfab95c90e9143f20d4c5a2fd0433a82223cf24aa (diff)
Use better types for checksum() parameters and local var from
dhclient. Eliminate extra prototypes for checksum() and wrapsum().
-rw-r--r--usr.sbin/dhcpd/dhcpd.h4
-rw-r--r--usr.sbin/dhcpd/packet.c9
2 files changed, 5 insertions, 8 deletions
diff --git a/usr.sbin/dhcpd/dhcpd.h b/usr.sbin/dhcpd/dhcpd.h
index de10928ba1b..2fedfa6140e 100644
--- a/usr.sbin/dhcpd/dhcpd.h
+++ b/usr.sbin/dhcpd/dhcpd.h
@@ -1,4 +1,4 @@
-/* $OpenBSD: dhcpd.h,v 1.61 2017/04/13 14:59:40 krw Exp $ */
+/* $OpenBSD: dhcpd.h,v 1.62 2017/04/17 18:31:08 krw Exp $ */
/*
* Copyright (c) 1995, 1996, 1997, 1998, 1999
@@ -548,7 +548,7 @@ ssize_t decode_hw_header(struct interface_info *, unsigned char *,
int, struct hardware *);
ssize_t decode_udp_ip_header(struct interface_info *, unsigned char *,
int, struct sockaddr_in *, int);
-u_int32_t checksum(unsigned char *, unsigned, u_int32_t);
+u_int32_t checksum(unsigned char *, u_int32_t, u_int32_t);
u_int32_t wrapsum(u_int32_t);
/* icmp.c */
diff --git a/usr.sbin/dhcpd/packet.c b/usr.sbin/dhcpd/packet.c
index 2514c73404a..1151ebf8066 100644
--- a/usr.sbin/dhcpd/packet.c
+++ b/usr.sbin/dhcpd/packet.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: packet.c,v 1.12 2017/02/13 19:13:14 krw Exp $ */
+/* $OpenBSD: packet.c,v 1.13 2017/04/17 18:31:08 krw Exp $ */
/* Packet assembly code, originally contributed by Archie Cobbs. */
@@ -58,13 +58,10 @@
#include "dhcpd.h"
#include "log.h"
-u_int32_t checksum(unsigned char *, unsigned, u_int32_t);
-u_int32_t wrapsum(u_int32_t);
-
u_int32_t
-checksum(unsigned char *buf, unsigned nbytes, u_int32_t sum)
+checksum(unsigned char *buf, u_int32_t nbytes, u_int32_t sum)
{
- int i;
+ unsigned int i;
/* Checksum all the pairs of bytes first... */
for (i = 0; i < (nbytes & ~1U); i += 2) {