Skip site navigation (1)Skip section navigation (2)
Date:      Wed, 15 May 2002 19:12:02 -0400 (EDT)
From:      Josh Elsasser <jre@vineyard.net>
To:        FreeBSD-gnats-submit@FreeBSD.org
Subject:   bin/38126: [PATCH] add option to rarpd for alternate tftp directory
Message-ID:  <20020515231202.731C41478C3@joshe.dyndns.org>

next in thread | raw e-mail | index | archive | help

>Number:         38126
>Category:       bin
>Synopsis:       [PATCH] add option to rarpd for alternate tftp directory
>Confidential:   no
>Severity:       non-critical
>Priority:       low
>Responsible:    freebsd-bugs
>State:          open
>Quarter:        
>Keywords:       
>Date-Required:
>Class:          change-request
>Submitter-Id:   current-users
>Arrival-Date:   Wed May 15 16:20:01 PDT 2002
>Closed-Date:
>Last-Modified:
>Originator:     Josh Elsasser
>Release:        FreeBSD 4.6-PRERELEASE i386
>Organization:
>Environment:
System: FreeBSD jade 4.6-PRERELEASE FreeBSD 4.6-PRERELEASE #1: Sat May 4 18:42:54 EDT 2002 joshe@jade:/usr/obj/usr/src/sys/JADE i386

>Description:
	Rarpd uses files in /tftpboot to determine if it can boot the
client.  Tftpd can be told via command-line options to use a directory
other than /tftpboot, however rarpd will still look in /tftpboot.  It
is possible to have rarpd use an alternate directory, but only at
compile-time.
>How-To-Repeat:
	Try to a directory other than /tftboot as your tftp directory.
>Fix:

	Add a command-line option to specify a non-default tftpN*directory to use.  Update manpage as well.

--- rarpd.c.orig	Sat Jul 21 14:58:09 2001
+++ rarpd.c	Wed May 15 14:29:46 2002
@@ -33,8 +33,8 @@
 /*
  * rarpd - Reverse ARP Daemon
  *
- * Usage:	rarpd -a [ -dfsv ] [ hostname ]
- *		rarpd [ -dfsv ] interface [ hostname ]
+ * Usage:	rarpd -a [ -dfsv ] [ -t directory ] [ hostname ]
+ *		rarpd [ -dfsv ] [ -t directory ] interface [ hostname ]
  *
  * 'hostname' is optional solely for backwards compatibility with Sun's rarpd.
  * Currently, the argument is ignored.
@@ -129,7 +129,7 @@
 
 int verbose;			/* verbose messages */
 int s;				/* inet datagram socket */
-const char *tftp_dir = TFTP_DIR;	/* tftp directory */
+char *tftp_dir = TFTP_DIR;	/* tftp directory */
 
 int dflag;			/* messages to stdout/stderr, not syslog(3) */
 int sflag;			/* ignore /tftpboot */
@@ -164,6 +164,8 @@
 	int aflag = 0;		/* listen on "all" interfaces  */
 	int fflag = 0;		/* don't fork */
 
+	extern char *optarg;
+
 	if ((name = strrchr(argv[0], '/')) != NULL)
 		++name;
 	else
@@ -177,7 +179,7 @@
 	openlog(name, LOG_PID | LOG_CONS, LOG_DAEMON);
 
 	opterr = 0;
-	while ((op = getopt(argc, argv, "adfsv")) != -1) {
+	while ((op = getopt(argc, argv, "adfst:v")) != -1) {
 		switch (op) {
 		case 'a':
 			++aflag;
@@ -195,6 +197,11 @@
 			++sflag;
 			break;
 
+		case 't':
+			if(optarg)
+				tftp_dir = optarg;
+			break;
+
 		case 'v':
 			++verbose;
 			break;
@@ -395,7 +402,7 @@
 void
 usage(void)
 {
-	(void)fprintf(stderr, "usage: rarpd [-adfsv] [interface]\n");
+	(void)fprintf(stderr, "usage: rarpd [-adfsv] [-t directory] [interface]\n");
 	exit(1);
 }
 
--- usr.sbin/rarpd/rarpd.8.orig	Sat Jul 21 14:58:08 2001
+++ usr.sbin/rarpd/rarpd.8	Wed May 15 13:36:50 2002
@@ -28,6 +28,7 @@
 .Sh SYNOPSIS
 .Nm
 .Op Fl adfsv
+.Op Fl t Ar directory
 .Op Ar interface
 .Sh DESCRIPTION
 .Nm
@@ -93,6 +94,11 @@
 Supply a response to any RARP request for which an ethernet to IP address
 mapping exists; do not depend on the existence of
 .Pa /tftpboot/\fIipaddr\fP* .
+.It Fl t Ar directory
+Use
+.Pa directory
+instead of
+.Pa /tftpboot .
 .It Fl v
 Enable verbose sysloging.
 .El
>Release-Note:
>Audit-Trail:
>Unformatted:

To Unsubscribe: send mail to majordomo@FreeBSD.org
with "unsubscribe freebsd-bugs" in the body of the message




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