From db2d7c0ae7cc14bfa59203ca744428c791373b03 Mon Sep 17 00:00:00 2001 From: krw Date: Mon, 17 Apr 2017 18:31:08 +0000 Subject: [PATCH] Use better types for checksum() parameters and local var from dhclient. Eliminate extra prototypes for checksum() and wrapsum(). --- usr.sbin/dhcpd/dhcpd.h | 4 ++-- usr.sbin/dhcpd/packet.c | 9 +++------ 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) { -- 2.20.1