xref: /freebsd/libexec/rbootd/conf.c (revision 9e9a43bdec3ff0ad37e4799b209e0d9513150a6f)
10559b331SSteve Price /*
20559b331SSteve Price  * Copyright (c) 1988, 1992 The University of Utah and the Center
30559b331SSteve Price  *	for Software Science (CSS).
40559b331SSteve Price  * Copyright (c) 1992, 1993
50559b331SSteve Price  *	The Regents of the University of California.  All rights reserved.
60559b331SSteve Price  *
70559b331SSteve Price  * This code is derived from software contributed to Berkeley by
80559b331SSteve Price  * the Center for Software Science of the University of Utah Computer
90559b331SSteve Price  * Science Department.  CSS requests users of this software to return
100559b331SSteve Price  * to css-dist@cs.utah.edu any improvements that they make and grant
110559b331SSteve Price  * CSS redistribution rights.
120559b331SSteve Price  *
130559b331SSteve Price  * Redistribution and use in source and binary forms, with or without
140559b331SSteve Price  * modification, are permitted provided that the following conditions
150559b331SSteve Price  * are met:
160559b331SSteve Price  * 1. Redistributions of source code must retain the above copyright
170559b331SSteve Price  *    notice, this list of conditions and the following disclaimer.
180559b331SSteve Price  * 2. Redistributions in binary form must reproduce the above copyright
190559b331SSteve Price  *    notice, this list of conditions and the following disclaimer in the
200559b331SSteve Price  *    documentation and/or other materials provided with the distribution.
210559b331SSteve Price  * 3. All advertising materials mentioning features or use of this software
220559b331SSteve Price  *    must display the following acknowledgement:
230559b331SSteve Price  *	This product includes software developed by the University of
240559b331SSteve Price  *	California, Berkeley and its contributors.
250559b331SSteve Price  * 4. Neither the name of the University nor the names of its contributors
260559b331SSteve Price  *    may be used to endorse or promote products derived from this software
270559b331SSteve Price  *    without specific prior written permission.
280559b331SSteve Price  *
290559b331SSteve Price  * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
300559b331SSteve Price  * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
310559b331SSteve Price  * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
320559b331SSteve Price  * ARE DISCLAIMED.  IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
330559b331SSteve Price  * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
340559b331SSteve Price  * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
350559b331SSteve Price  * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
360559b331SSteve Price  * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
370559b331SSteve Price  * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
380559b331SSteve Price  * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
390559b331SSteve Price  * SUCH DAMAGE.
400559b331SSteve Price  *
410559b331SSteve Price  *	from: @(#)conf.c	8.1 (Berkeley) 6/4/93
420559b331SSteve Price  *
430559b331SSteve Price  * From: Utah Hdr: conf.c 3.1 92/07/06
440559b331SSteve Price  * Author: Jeff Forys, University of Utah CSS
450559b331SSteve Price  */
460559b331SSteve Price 
470559b331SSteve Price #ifndef lint
48eb0b8290SPhilippe Charnier #if 0
495c8709fdSSteve Price static const char sccsid[] = "@(#)conf.c	8.1 (Berkeley) 6/4/93";
50eb0b8290SPhilippe Charnier #endif
51eb0b8290SPhilippe Charnier static const char rcsid[] =
529e9a43bdSBrian Somers 	"$Id: conf.c,v 1.3 1997/11/24 07:33:40 charnier Exp $";
530559b331SSteve Price #endif /* not lint */
540559b331SSteve Price 
550559b331SSteve Price #include <sys/param.h>
560559b331SSteve Price #include <sys/time.h>
570559b331SSteve Price 
580559b331SSteve Price #include <stdio.h>
590559b331SSteve Price #include "defs.h"
600559b331SSteve Price #include "pathnames.h"
610559b331SSteve Price 
620559b331SSteve Price /*
630559b331SSteve Price **  Define (and possibly initialize) global variables here.
640559b331SSteve Price **
650559b331SSteve Price **  Caveat:
660559b331SSteve Price **	The maximum number of bootable files (`char *BootFiles[]') is
670559b331SSteve Price **	limited to C_MAXFILE (i.e. the maximum number of files that
680559b331SSteve Price **	can be spec'd in the configuration file).  This was done to
690559b331SSteve Price **	simplify the boot file search code.
700559b331SSteve Price */
710559b331SSteve Price 
729e9a43bdSBrian Somers char	MyHost[MAXHOSTNAMELEN];			/* host name */
730559b331SSteve Price pid_t	MyPid;					/* process id */
740559b331SSteve Price int	DebugFlg = 0;				/* set true if debugging */
750559b331SSteve Price int	BootAny = 0;				/* set true if we boot anyone */
760559b331SSteve Price 
770559b331SSteve Price char	*ConfigFile = NULL;			/* configuration file */
780559b331SSteve Price char	*DfltConfig = _PATH_RBOOTDCONF;		/* default configuration file */
790559b331SSteve Price char	*PidFile = _PATH_RBOOTDPID;		/* file w/pid of server */
800559b331SSteve Price char	*BootDir = _PATH_RBOOTDLIB;		/* directory w/boot files */
810559b331SSteve Price char	*DbgFile = _PATH_RBOOTDDBG;		/* debug output file */
820559b331SSteve Price 
830559b331SSteve Price FILE	*DbgFp = NULL;				/* debug file pointer */
840559b331SSteve Price char	*IntfName = NULL;			/* intf we are attached to */
850559b331SSteve Price 
860559b331SSteve Price u_int16_t SessionID = 0;			/* generated session ID */
870559b331SSteve Price 
880559b331SSteve Price char	*BootFiles[C_MAXFILE];			/* list of boot files */
890559b331SSteve Price 
900559b331SSteve Price CLIENT	*Clients = NULL;			/* list of addrs we'll accept */
910559b331SSteve Price RMPCONN	*RmpConns = NULL;			/* list of active connections */
920559b331SSteve Price 
930559b331SSteve Price u_int8_t RmpMcastAddr[RMP_ADDRLEN] = RMP_ADDR;	/* RMP multicast address */
94