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