Make the "/tftpboot/<client-ip-address>" requirement conditional on

-DREQUIRE_TFTPBOOT and disable it by default.
This commit is contained in:
thorpej 1995-09-01 21:55:44 +00:00
parent 29053c58b2
commit c78a02a75a
3 changed files with 28 additions and 14 deletions

View File

@ -1,9 +1,13 @@
# @(#) $Id: Makefile,v 1.2 1994/12/22 11:39:31 cgd Exp $
# @(#) $Id: Makefile,v 1.3 1995/09/01 21:55:44 thorpej Exp $
PROG= rarpd
SRCS= rarpd.c
CFLAGS+=-I${.CURDIR} -DTFTP_DIR=\"/tftpboot\"
CFLAGS+=-I${.CURDIR}
# Uncomment the following to require a boot file in TFTP_DIR
# to exist for a rarp reply to be sent.
# CFLAGS+=-DREQUIRE_TFTPBOOT -DTFTP_DIR=\"/tftpboot\"
MAN= rarpd.8

View File

@ -17,7 +17,7 @@
.\" THIS SOFTWARE IS PROVIDED ``AS IS'' AND WITHOUT ANY EXPRESS OR IMPLIED
.\" WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED WARRANTIES OF
.\" MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
.\" @(#) $Id: rarpd.8,v 1.2 1994/01/14 16:22:58 jtc Exp $
.\" @(#) $Id: rarpd.8,v 1.3 1995/09/01 21:55:45 thorpej Exp $
.\"
.Dd October 26, 1990
.Dt RARPD 8
@ -42,14 +42,14 @@ and
databases.
If a host does not exist in both databases, the translation cannot
proceed and a reply will not be sent.
.Pp
Additionally, a request is honored only if the server
(i.e., the host that rarpd is running on)
can "boot" the target; that is, if the directory
.Pa /tftpboot/ Ns Em ipaddr
exists, where
.Rm ipaddr
is the target IP address.
.\" .Pp
.\" Additionally, a request is honored only if the server
.\" (i.e., the host that rarpd is running on)
.\" can "boot" the target; that is, if the directory
.\" .Pa /tftpboot/ Ns Em ipaddr
.\" exists, where
.\" .Rm ipaddr
.\" is the target IP address.
.Pp
In normal operation,
.Nm rarpd
@ -75,7 +75,7 @@ Run in the foreground.
.Bl -tag -width Pa -compact
.It Pa /etc/ethers
.It Pa /etc/hosts
.It Pa /tftpboot
.\" .It Pa /tftpboot
.El
.Sh SEE ALSO
.Xr bpf 4 ,

View File

@ -26,7 +26,7 @@ char copyright[] =
#ifndef lint
static char rcsid[] =
"@(#) $Id: rarpd.c,v 1.7 1994/05/25 20:01:15 mycroft Exp $";
"@(#) $Id: rarpd.c,v 1.8 1995/09/01 21:55:47 thorpej Exp $";
#endif
@ -79,7 +79,6 @@ struct if_info {
struct if_info *iflist;
int rarp_open __P((char *));
int rarp_bootable __P((u_long));
void init_one __P((char *));
void init_all __P((void));
void rarp_loop __P((void));
@ -93,6 +92,10 @@ void err __P((int, const char *,...));
void debug __P((const char *,...));
u_long ipaddrtonetmask __P((u_long));
#ifdef REQUIRE_TFTPBOOT
int rarp_bootable __P((u_long));
#endif
int aflag = 0; /* listen on "all" interfaces */
int dflag = 0; /* print debugging messages */
int fflag = 0; /* don't fork */
@ -447,6 +450,9 @@ rarp_loop()
}
}
}
#ifdef REQUIRE_TFTPBOOT
#ifndef TFTP_DIR
#define TFTP_DIR "/tftpboot"
#endif
@ -486,6 +492,8 @@ rarp_bootable(addr)
return 1;
return 0;
}
#endif /* REQUIRE_TFTPBOOT */
/*
* Given a list of IP addresses, 'alist', return the first address that
* is on network 'net'; 'netmask' is a mask indicating the network portion
@ -538,7 +546,9 @@ rarp_process(ii, pkt)
ename, inet_ntoa(in));
return;
}
#ifdef REQUIRE_TFTPBOOT
if (rarp_bootable(htonl(target_ipaddr)))
#endif
rarp_reply(ii, ep, target_ipaddr);
}
/*