xref: /freebsd/libexec/rbootd/conf.c (revision a6fe717c2a876105123214c05176cd74106fb94b)
1*8a16b7a1SPedro F. Giffuni /*-
2*8a16b7a1SPedro F. Giffuni  * SPDX-License-Identifier: BSD-3-Clause
3*8a16b7a1SPedro F. Giffuni  *
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.
235efaea4cSChristian Brueffer  * 3. Neither the name of the University nor the names of its contributors
240559b331SSteve Price  *    may be used to endorse or promote products derived from this software
250559b331SSteve Price  *    without specific prior written permission.
260559b331SSteve Price  *
270559b331SSteve Price  * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
280559b331SSteve Price  * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
290559b331SSteve Price  * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
300559b331SSteve Price  * ARE DISCLAIMED.  IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
310559b331SSteve Price  * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
320559b331SSteve Price  * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
330559b331SSteve Price  * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
340559b331SSteve Price  * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
350559b331SSteve Price  * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
360559b331SSteve Price  * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
370559b331SSteve Price  * SUCH DAMAGE.
380559b331SSteve Price  *
390559b331SSteve Price  * From: Utah Hdr: conf.c 3.1 92/07/06
400559b331SSteve Price  * Author: Jeff Forys, University of Utah CSS
410559b331SSteve Price  */
420559b331SSteve Price 
430559b331SSteve Price #include <sys/param.h>
440559b331SSteve Price #include <sys/time.h>
450559b331SSteve Price 
460559b331SSteve Price #include <stdio.h>
470559b331SSteve Price #include "defs.h"
480559b331SSteve Price #include "pathnames.h"
490559b331SSteve Price 
500559b331SSteve Price /*
510559b331SSteve Price **  Define (and possibly initialize) global variables here.
520559b331SSteve Price **
530559b331SSteve Price **  Caveat:
540559b331SSteve Price **	The maximum number of bootable files (`char *BootFiles[]') is
550559b331SSteve Price **	limited to C_MAXFILE (i.e. the maximum number of files that
560559b331SSteve Price **	can be spec'd in the configuration file).  This was done to
570559b331SSteve Price **	simplify the boot file search code.
580559b331SSteve Price */
590559b331SSteve Price 
609e9a43bdSBrian Somers char	MyHost[MAXHOSTNAMELEN];			/* host name */
610559b331SSteve Price pid_t	MyPid;					/* process id */
620559b331SSteve Price int	DebugFlg = 0;				/* set true if debugging */
630559b331SSteve Price int	BootAny = 0;				/* set true if we boot anyone */
640559b331SSteve Price 
650559b331SSteve Price char	*ConfigFile = NULL;			/* configuration file */
660559b331SSteve Price char	*DfltConfig = _PATH_RBOOTDCONF;		/* default configuration file */
670559b331SSteve Price char	*PidFile = _PATH_RBOOTDPID;		/* file w/pid of server */
680559b331SSteve Price char	*BootDir = _PATH_RBOOTDLIB;		/* directory w/boot files */
690559b331SSteve Price char	*DbgFile = _PATH_RBOOTDDBG;		/* debug output file */
700559b331SSteve Price 
710559b331SSteve Price FILE	*DbgFp = NULL;				/* debug file pointer */
720559b331SSteve Price char	*IntfName = NULL;			/* intf we are attached to */
730559b331SSteve Price 
740559b331SSteve Price u_int16_t SessionID = 0;			/* generated session ID */
750559b331SSteve Price 
760559b331SSteve Price char	*BootFiles[C_MAXFILE];			/* list of boot files */
770559b331SSteve Price 
780559b331SSteve Price CLIENT	*Clients = NULL;			/* list of addrs we'll accept */
790559b331SSteve Price RMPCONN	*RmpConns = NULL;			/* list of active connections */
800559b331SSteve Price 
810559b331SSteve Price u_int8_t RmpMcastAddr[RMP_ADDRLEN] = RMP_ADDR;	/* RMP multicast address */
82