xref: /openbsd-src/usr.sbin/rbootd/conf.c (revision b9fc9a728fce9c4289b7e9a992665e28d5629a54)
1*b9fc9a72Sderaadt /*	$OpenBSD: conf.c,v 1.8 2015/01/16 06:40:19 deraadt Exp $	*/
2df930be7Sderaadt /*	$NetBSD: conf.c,v 1.5 1995/10/06 05:12:13 thorpej Exp $	*/
3df930be7Sderaadt 
4df930be7Sderaadt /*
5df930be7Sderaadt  * Copyright (c) 1988, 1992 The University of Utah and the Center
6df930be7Sderaadt  *	for Software Science (CSS).
7df930be7Sderaadt  * Copyright (c) 1992, 1993
8df930be7Sderaadt  *	The Regents of the University of California.  All rights reserved.
9df930be7Sderaadt  *
10df930be7Sderaadt  * This code is derived from software contributed to Berkeley by
11df930be7Sderaadt  * the Center for Software Science of the University of Utah Computer
12df930be7Sderaadt  * Science Department.  CSS requests users of this software to return
13df930be7Sderaadt  * to css-dist@cs.utah.edu any improvements that they make and grant
14df930be7Sderaadt  * CSS redistribution rights.
15df930be7Sderaadt  *
16df930be7Sderaadt  * Redistribution and use in source and binary forms, with or without
17df930be7Sderaadt  * modification, are permitted provided that the following conditions
18df930be7Sderaadt  * are met:
19df930be7Sderaadt  * 1. Redistributions of source code must retain the above copyright
20df930be7Sderaadt  *    notice, this list of conditions and the following disclaimer.
21df930be7Sderaadt  * 2. Redistributions in binary form must reproduce the above copyright
22df930be7Sderaadt  *    notice, this list of conditions and the following disclaimer in the
23df930be7Sderaadt  *    documentation and/or other materials provided with the distribution.
2429295d1cSmillert  * 3. Neither the name of the University nor the names of its contributors
25df930be7Sderaadt  *    may be used to endorse or promote products derived from this software
26df930be7Sderaadt  *    without specific prior written permission.
27df930be7Sderaadt  *
28df930be7Sderaadt  * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
29df930be7Sderaadt  * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
30df930be7Sderaadt  * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
31df930be7Sderaadt  * ARE DISCLAIMED.  IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
32df930be7Sderaadt  * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
33df930be7Sderaadt  * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
34df930be7Sderaadt  * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
35df930be7Sderaadt  * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
36df930be7Sderaadt  * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
37df930be7Sderaadt  * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
38df930be7Sderaadt  * SUCH DAMAGE.
39df930be7Sderaadt  *
40df930be7Sderaadt  *	from: @(#)conf.c	8.1 (Berkeley) 6/4/93
41df930be7Sderaadt  *
42df930be7Sderaadt  * From: Utah Hdr: conf.c 3.1 92/07/06
43df930be7Sderaadt  * Author: Jeff Forys, University of Utah CSS
44df930be7Sderaadt  */
45df930be7Sderaadt 
46df930be7Sderaadt #include <sys/time.h>
47df930be7Sderaadt 
48df930be7Sderaadt #include <stdio.h>
49*b9fc9a72Sderaadt #include <limits.h>
50df930be7Sderaadt #include "defs.h"
51df930be7Sderaadt #include "pathnames.h"
52df930be7Sderaadt 
53df930be7Sderaadt /*
54df930be7Sderaadt **  Define (and possibly initialize) global variables here.
55df930be7Sderaadt **
56df930be7Sderaadt **  Caveat:
57df930be7Sderaadt **	The maximum number of bootable files (`char *BootFiles[]') is
58df930be7Sderaadt **	limited to C_MAXFILE (i.e. the maximum number of files that
59df930be7Sderaadt **	can be spec'd in the configuration file).  This was done to
60df930be7Sderaadt **	simplify the boot file search code.
61df930be7Sderaadt */
62df930be7Sderaadt 
63*b9fc9a72Sderaadt char	MyHost[HOST_NAME_MAX+1];			/* host name */
64df930be7Sderaadt int	DebugFlg = 0;				/* set true if debugging */
65df930be7Sderaadt int	BootAny = 0;				/* set true if we boot anyone */
66df930be7Sderaadt 
67df930be7Sderaadt char	*ConfigFile = NULL;			/* configuration file */
68df930be7Sderaadt char	*DfltConfig = _PATH_RBOOTDCONF;		/* default configuration file */
6975a39e5eSderaadt char	*BootDir = _PATH_RBOOTDDIR;		/* directory w/boot files */
70df930be7Sderaadt char	*DbgFile = _PATH_RBOOTDDBG;		/* debug output file */
71df930be7Sderaadt 
72df930be7Sderaadt FILE	*DbgFp = NULL;				/* debug file pointer */
73df930be7Sderaadt char	*IntfName = NULL;			/* intf we are attached to */
74df930be7Sderaadt 
75df930be7Sderaadt u_int16_t SessionID = 0;			/* generated session ID */
76df930be7Sderaadt 
77df930be7Sderaadt char	*BootFiles[C_MAXFILE];			/* list of boot files */
78df930be7Sderaadt 
79df930be7Sderaadt CLIENT	*Clients = NULL;			/* list of addrs we'll accept */
80df930be7Sderaadt RMPCONN	*RmpConns = NULL;			/* list of active connections */
81df930be7Sderaadt 
82df930be7Sderaadt u_int8_t RmpMcastAddr[RMP_ADDRLEN] = RMP_ADDR;	/* RMP multicast address */
83