conf.c revision 50476
1133565Sharti/*
2133565Sharti * Copyright (c) 1988, 1992 The University of Utah and the Center
3133565Sharti *	for Software Science (CSS).
4133565Sharti * Copyright (c) 1992, 1993
5133565Sharti *	The Regents of the University of California.  All rights reserved.
6133565Sharti *
7133565Sharti * This code is derived from software contributed to Berkeley by
8133565Sharti * the Center for Software Science of the University of Utah Computer
9133565Sharti * Science Department.  CSS requests users of this software to return
10133565Sharti * to css-dist@cs.utah.edu any improvements that they make and grant
11133565Sharti * CSS redistribution rights.
12133565Sharti *
13133565Sharti * Redistribution and use in source and binary forms, with or without
14133565Sharti * modification, are permitted provided that the following conditions
15133565Sharti * are met:
16133565Sharti * 1. Redistributions of source code must retain the above copyright
17133565Sharti *    notice, this list of conditions and the following disclaimer.
18133565Sharti * 2. Redistributions in binary form must reproduce the above copyright
19133565Sharti *    notice, this list of conditions and the following disclaimer in the
20133565Sharti *    documentation and/or other materials provided with the distribution.
21133565Sharti * 3. All advertising materials mentioning features or use of this software
22133565Sharti *    must display the following acknowledgement:
23133565Sharti *	This product includes software developed by the University of
24133565Sharti *	California, Berkeley and its contributors.
25133565Sharti * 4. Neither the name of the University nor the names of its contributors
26133565Sharti *    may be used to endorse or promote products derived from this software
27133565Sharti *    without specific prior written permission.
28133565Sharti *
29133565Sharti * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
30133565Sharti * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
31133565Sharti * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
32133565Sharti * ARE DISCLAIMED.  IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
33133565Sharti * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
34133565Sharti * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
35133565Sharti * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
36133565Sharti * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
37133565Sharti * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
38133565Sharti * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
39133565Sharti * SUCH DAMAGE.
40133565Sharti *
41133565Sharti *	from: @(#)conf.c	8.1 (Berkeley) 6/4/93
42133565Sharti *
43133565Sharti * From: Utah Hdr: conf.c 3.1 92/07/06
44133565Sharti * Author: Jeff Forys, University of Utah CSS
45133565Sharti */
46133565Sharti
47133565Sharti#ifndef lint
48133565Sharti#if 0
49133565Shartistatic const char sccsid[] = "@(#)conf.c	8.1 (Berkeley) 6/4/93";
50133565Sharti#endif
51133565Shartistatic const char rcsid[] =
52133565Sharti  "$FreeBSD: head/libexec/rbootd/conf.c 50476 1999-08-28 00:22:10Z peter $";
53133565Sharti#endif /* not lint */
54133565Sharti
55133565Sharti#include <sys/param.h>
56133565Sharti#include <sys/time.h>
57133565Sharti
58133565Sharti#include <stdio.h>
59133565Sharti#include "defs.h"
60133565Sharti#include "pathnames.h"
61133565Sharti
62133565Sharti/*
63133565Sharti**  Define (and possibly initialize) global variables here.
64133565Sharti**
65133565Sharti**  Caveat:
66133565Sharti**	The maximum number of bootable files (`char *BootFiles[]') is
67133565Sharti**	limited to C_MAXFILE (i.e. the maximum number of files that
68133565Sharti**	can be spec'd in the configuration file).  This was done to
69133565Sharti**	simplify the boot file search code.
70133565Sharti*/
71133565Sharti
72133565Shartichar	MyHost[MAXHOSTNAMELEN];			/* host name */
73133565Shartipid_t	MyPid;					/* process id */
74133565Shartiint	DebugFlg = 0;				/* set true if debugging */
75133565Shartiint	BootAny = 0;				/* set true if we boot anyone */
76
77char	*ConfigFile = NULL;			/* configuration file */
78char	*DfltConfig = _PATH_RBOOTDCONF;		/* default configuration file */
79char	*PidFile = _PATH_RBOOTDPID;		/* file w/pid of server */
80char	*BootDir = _PATH_RBOOTDLIB;		/* directory w/boot files */
81char	*DbgFile = _PATH_RBOOTDDBG;		/* debug output file */
82
83FILE	*DbgFp = NULL;				/* debug file pointer */
84char	*IntfName = NULL;			/* intf we are attached to */
85
86u_int16_t SessionID = 0;			/* generated session ID */
87
88char	*BootFiles[C_MAXFILE];			/* list of boot files */
89
90CLIENT	*Clients = NULL;			/* list of addrs we'll accept */
91RMPCONN	*RmpConns = NULL;			/* list of active connections */
92
93u_int8_t RmpMcastAddr[RMP_ADDRLEN] = RMP_ADDR;	/* RMP multicast address */
94