Skip site navigation (1)Skip section navigation (2)
Date:      Sun, 26 Mar 2017 14:37:12 +0000 (UTC)
From:      Robert Watson <rwatson@FreeBSD.org>
To:        src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org
Subject:   svn commit: r315987 - in head/libexec/bootpd: . tools/bootptest
Message-ID:  <201703261437.v2QEbCp9017599@repo.freebsd.org>

next in thread | raw e-mail | index | archive | help
Author: rwatson
Date: Sun Mar 26 14:37:12 2017
New Revision: 315987
URL: https://svnweb.freebsd.org/changeset/base/315987

Log:
  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

Modified:
  head/libexec/bootpd/getif.c
  head/libexec/bootpd/tools/bootptest/bootptest.c
  head/libexec/bootpd/tools/bootptest/bootptest.h
  head/libexec/bootpd/tools/bootptest/print-bootp.c

Modified: head/libexec/bootpd/getif.c
==============================================================================
--- head/libexec/bootpd/getif.c	Sun Mar 26 14:31:29 2017	(r315986)
+++ head/libexec/bootpd/getif.c	Sun Mar 26 14:37:12 2017	(r315987)
@@ -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 *

Modified: head/libexec/bootpd/tools/bootptest/bootptest.c
==============================================================================
--- head/libexec/bootpd/tools/bootptest/bootptest.c	Sun Mar 26 14:31:29 2017	(r315986)
+++ head/libexec/bootpd/tools/bootptest/bootptest.c	Sun Mar 26 14:37:12 2017	(r315987)
@@ -71,7 +71,7 @@ char *usage = "bootptest [-h] server-nam
 
 #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. */

Modified: head/libexec/bootpd/tools/bootptest/bootptest.h
==============================================================================
--- head/libexec/bootpd/tools/bootptest/bootptest.h	Sun Mar 26 14:31:29 2017	(r315986)
+++ head/libexec/bootpd/tools/bootptest/bootptest.h	Sun Mar 26 14:37:12 2017	(r315987)
@@ -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);

Modified: head/libexec/bootpd/tools/bootptest/print-bootp.c
==============================================================================
--- head/libexec/bootpd/tools/bootptest/print-bootp.c	Sun Mar 26 14:31:29 2017	(r315986)
+++ head/libexec/bootpd/tools/bootptest/print-bootp.c	Sun Mar 26 14:37:12 2017	(r315987)
@@ -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



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?201703261437.v2QEbCp9017599>