From 45c0d45bb536a6fbf93e9029e350f1ec16d91ac9 Mon Sep 17 00:00:00 2001 From: Robert Watson Date: Sun, 26 Mar 2017 14:37:12 +0000 Subject: Emply contemporary function prototypes in bootpd, rather than relying on locally defined K&R prototypes in .c files; use appropriate casts for pointer types now that types for arguments are available at compile time. This ensures that compilers with multiple incompatible calling conventions can select the correct calling convention for external functions. Sponsored by: DARPA, AFRL MFC after: 1 week --- libexec/bootpd/getif.c | 2 +- libexec/bootpd/tools/bootptest/bootptest.c | 9 +++------ libexec/bootpd/tools/bootptest/bootptest.h | 5 ++++- libexec/bootpd/tools/bootptest/print-bootp.c | 9 ++++----- 4 files changed, 12 insertions(+), 13 deletions(-) (limited to 'libexec/bootpd') diff --git a/libexec/bootpd/getif.c b/libexec/bootpd/getif.c index 64e5edadb679..225647ea439b 100644 --- a/libexec/bootpd/getif.c +++ b/libexec/bootpd/getif.c @@ -36,7 +36,7 @@ static struct ifreq ifreq[10]; /* Holds interface configuration */ static struct ifconf ifconf; /* points to ifreq */ -static int nmatch(); +static int nmatch(u_char *ca, u_char *cb); /* Return a pointer to the interface struct for the passed address. */ struct ifreq * diff --git a/libexec/bootpd/tools/bootptest/bootptest.c b/libexec/bootpd/tools/bootptest/bootptest.c index e25c1f0f4665..b99ac49a735e 100644 --- a/libexec/bootpd/tools/bootptest/bootptest.c +++ b/libexec/bootpd/tools/bootptest/bootptest.c @@ -71,7 +71,7 @@ char *usage = "bootptest [-h] server-name [vendor-data-template-file]"; #include "patchlevel.h" -static void send_request(); +static void send_request(int s); #define LOG_ERR 1 #define BUFLEN 1024 @@ -122,9 +122,6 @@ unsigned char vm_cmu[4] = VM_CMU; unsigned char vm_rfc1048[4] = VM_RFC1048; short secs; /* How long client has waited */ -char *get_errmsg(); -extern void bootp_print(); - /* * Initialization such as command-line processing is done, then * the receiver loop is started. Die when interrupted. @@ -429,7 +426,7 @@ main(argc, argv) /* set globals needed by bootp_print() */ snaplen = n; snapend = (unsigned char *) rcvbuf + snaplen; - bootp_print(rcvbuf, n, sin_from.sin_port, 0); + bootp_print((struct bootp *)rcvbuf, n, sin_from.sin_port, 0); putchar('\n'); /* * This no longer exits immediately after receiving @@ -447,7 +444,7 @@ send_request(s) { /* Print the request packet. */ printf("Sending to %s", inet_ntoa(sin_server.sin_addr)); - bootp_print(sndbuf, snaplen, sin_from.sin_port, 0); + bootp_print((struct bootp *)sndbuf, snaplen, sin_from.sin_port, 0); putchar('\n'); /* Send the request packet. */ diff --git a/libexec/bootpd/tools/bootptest/bootptest.h b/libexec/bootpd/tools/bootptest/bootptest.h index a1891fe52556..2df35dea7ffc 100644 --- a/libexec/bootpd/tools/bootptest/bootptest.h +++ b/libexec/bootpd/tools/bootptest/bootptest.h @@ -20,4 +20,7 @@ extern int vflag; /* verbose flag */ extern unsigned char *packetp; extern unsigned char *snapend; -extern char *ipaddr_string(struct in_addr *); +void bootp_print(struct bootp *bp, int length, u_short sport, + u_short dport); +char *ipaddr_string(struct in_addr *); +int printfn(u_char *s, u_char *ep); diff --git a/libexec/bootpd/tools/bootptest/print-bootp.c b/libexec/bootpd/tools/bootptest/print-bootp.c index fddc4fb6b4c4..650798e5d0c0 100644 --- a/libexec/bootpd/tools/bootptest/print-bootp.c +++ b/libexec/bootpd/tools/bootptest/print-bootp.c @@ -42,11 +42,10 @@ #include "bootptest.h" /* These decode the vendor data. */ -extern int printfn(); -static void rfc1048_print(); -static void cmu_print(); -static void other_print(); -static void dump_hex(); +static void rfc1048_print(u_char *bp, int length); +static void cmu_print(u_char *bp, int length); +static void other_print(u_char *bp, int length); +static void dump_hex(u_char *bp, int len); /* * Print bootp requests -- cgit v1.2.3