summaryrefslogtreecommitdiffstats
path: root/libexec/bootpd/tools
diff options
context:
space:
mode:
authorpst <pst@FreeBSD.org>1996-01-23 01:35:04 +0000
committerpst <pst@FreeBSD.org>1996-01-23 01:35:04 +0000
commitaccc2aa38fbbf04568a6d3941e897dc34aee7930 (patch)
tree9d4d2f644df6a63fbb148e0952fdf7f3ae9aebf5 /libexec/bootpd/tools
parent6b42e1664561f04b1d3f497ecd5ccad48fd8c3b4 (diff)
downloadFreeBSD-src-accc2aa38fbbf04568a6d3941e897dc34aee7930.zip
FreeBSD-src-accc2aa38fbbf04568a6d3941e897dc34aee7930.tar.gz
Import bootpd-2.4.3 from ftp.mc.com
Diffstat (limited to 'libexec/bootpd/tools')
-rw-r--r--libexec/bootpd/tools/bootpef/bootpef.c9
-rw-r--r--libexec/bootpd/tools/bootptest/bootptest.c28
-rw-r--r--libexec/bootpd/tools/bootptest/print-bootp.c15
3 files changed, 31 insertions, 21 deletions
diff --git a/libexec/bootpd/tools/bootpef/bootpef.c b/libexec/bootpd/tools/bootpef/bootpef.c
index eb18935..3ffe50b 100644
--- a/libexec/bootpd/tools/bootpef/bootpef.c
+++ b/libexec/bootpd/tools/bootpef/bootpef.c
@@ -20,11 +20,6 @@ ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS
SOFTWARE.
************************************************************************/
-#ifndef lint
-static char rcsid[] = "$Id: bootpef.c,v 1.1.1.1 1994/09/10 14:44:54 csgr Exp $";
-#endif
-
-
/*
* bootpef - BOOTP Extension File generator
* Makes an "Extension File" for each host entry that
@@ -97,7 +92,6 @@ static char rcsid[] = "$Id: bootpef.c,v 1.1.1.1 1994/09/10 14:44:54 csgr Exp $";
#define P(args) ()
#endif
-static void dovend_rfc1048 P((struct bootp *, struct host *, int32));
static void mktagfile P((struct host *));
static void usage P((void));
@@ -291,7 +285,6 @@ mktagfile(hp)
FILE *fp;
int bytesleft, len;
byte *vp;
- char *tmpstr;
if (!hp->flags.exten_file)
return;
@@ -332,7 +325,7 @@ mktagfile(hp)
}
fclose(fp);
-} /* dovend_rfc1048 */
+} /* mktagfile */
/*
* Local Variables:
diff --git a/libexec/bootpd/tools/bootptest/bootptest.c b/libexec/bootpd/tools/bootptest/bootptest.c
index bc235ac..c4e38d4 100644
--- a/libexec/bootpd/tools/bootptest/bootptest.c
+++ b/libexec/bootpd/tools/bootptest/bootptest.c
@@ -40,11 +40,16 @@ char *usage = "bootptest [-h] server-name [vendor-data-template-file]";
#include <sys/file.h>
#include <sys/time.h>
#include <sys/stat.h>
+#include <sys/utsname.h>
#include <net/if.h>
#include <netinet/in.h>
#include <arpa/inet.h> /* inet_ntoa */
+#ifndef NO_UNISTD
+#include <unistd.h>
+#endif
+
#include <stdlib.h>
#include <signal.h>
#include <stdio.h>
@@ -57,8 +62,12 @@ char *usage = "bootptest [-h] server-name [vendor-data-template-file]";
#include "bootp.h"
#include "bootptest.h"
#include "getif.h"
+#include "getether.h"
+
#include "patchlevel.h"
+static void send_request();
+
#define LOG_ERR 1
#define BUFLEN 1024
#define WAITSECS 1
@@ -94,10 +103,12 @@ u_char eaddr[16]; /* Ethernet address */
*/
int debug = 1; /* Debugging flag (level) */
-char hostname[64];
char *sndbuf; /* Send packet buffer */
char *rcvbuf; /* Receive packet buffer */
+struct utsname my_uname;
+char *hostname;
+
/*
* Vendor magic cookies for CMU and RFC1048
*/
@@ -114,6 +125,7 @@ extern void bootp_print();
* the receiver loop is started. Die when interrupted.
*/
+void
main(argc, argv)
int argc;
char **argv;
@@ -127,7 +139,7 @@ main(argc, argv)
char *bp_file = NULL;
int32 server_addr; /* inet addr, network order */
int s; /* Socket file descriptor */
- int n, tolen, fromlen, recvcnt;
+ int n, fromlen, recvcnt;
int use_hwa = 0;
int32 vend_magic;
int32 xid;
@@ -149,6 +161,12 @@ main(argc, argv)
*/
assert(sizeof(struct bootp) == BP_MINPKTSZ);
+ if (uname(&my_uname) < 0) {
+ fprintf(stderr, "%s: can't get hostname\n", argv[0]);
+ exit(1);
+ }
+ hostname = my_uname.nodename;
+
sndbuf = malloc(BUFLEN);
rcvbuf = malloc(BUFLEN);
if (!sndbuf || !rcvbuf) {
@@ -302,7 +320,7 @@ main(argc, argv)
printf("No interface for %s\n", servername);
exit(1);
}
- if (getether(ifr->ifr_name, eaddr)) {
+ if (getether(ifr->ifr_name, (char*)eaddr)) {
printf("Can not get ether addr for %s\n", ifr->ifr_name);
exit(1);
}
@@ -312,7 +330,6 @@ main(argc, argv)
bcopy(eaddr, bp->bp_chaddr, bp->bp_hlen);
} else {
/* Fill in the client IP address. */
- gethostname(hostname, sizeof(hostname));
hep = gethostbyname(hostname);
if (!hep) {
printf("Can not get my IP address\n");
@@ -422,6 +439,7 @@ main(argc, argv)
exit(1);
}
+static void
send_request(s)
int s;
{
@@ -451,7 +469,7 @@ printfn(s, ep)
register u_char c;
putchar('"');
- while (c = *s++) {
+ while ((c = *s++) != '\0') {
if (s > ep) {
putchar('"');
return (1);
diff --git a/libexec/bootpd/tools/bootptest/print-bootp.c b/libexec/bootpd/tools/bootptest/print-bootp.c
index f416998..ff31670 100644
--- a/libexec/bootpd/tools/bootptest/print-bootp.c
+++ b/libexec/bootpd/tools/bootptest/print-bootp.c
@@ -23,18 +23,19 @@
* This file was copied from tcpdump-2.1.1 and modified.
* There is an e-mail list for tcpdump: <tcpdump@ee.lbl.gov>
*/
-#ifndef lint
-static char rcsid[] = "$Id: print-bootp.c,v 1.1.1.1 1994/09/10 14:44:55 csgr Exp $";
-/* 93/10/10 <gwr@mc.com> New data-driven option print routine. */
-#endif
#include <stdio.h>
#include <sys/param.h>
#include <sys/types.h>
#include <sys/socket.h>
+
+#ifdef _AIX32
+#include <sys/time.h> /* for struct timeval in net/if.h */
+#endif
#include <net/if.h>
#include <netinet/in.h>
+
#include <string.h>
#include <ctype.h>
@@ -42,6 +43,7 @@ static char rcsid[] = "$Id: print-bootp.c,v 1.1.1.1 1994/09/10 14:44:55 csgr Exp
#include "bootptest.h"
/* These decode the vendor data. */
+extern int printfn();
static void rfc1048_print();
static void cmu_print();
static void other_print();
@@ -271,8 +273,6 @@ rfc1048_opts[] = {
};
#define KNOWN_OPTIONS (sizeof(rfc1048_opts) / sizeof(rfc1048_opts[0]))
-static void print_string();
-
static void
rfc1048_print(bp, length)
register u_char *bp;
@@ -280,7 +280,7 @@ rfc1048_print(bp, length)
{
u_char tag;
u_char *ep;
- register int len, j;
+ register int len;
u_int32 ul;
u_short us;
struct in_addr ia;
@@ -433,7 +433,6 @@ other_print(bp, length)
{
u_char *ep; /* end pointer */
u_char *zp; /* points one past last non-zero byte */
- register int i, j;
/* Setup end pointer */
ep = bp + length;
OpenPOWER on IntegriCloud