GCC Code Coverage Report
Directory: ./ Exec Total Coverage
File: sbin/isakmpd/init.c Lines: 0 30 0.0 %
Date: 2016-12-06 Branches: 0 0 0.0 %

Line Branch Exec Source
1
/* $OpenBSD: init.c,v 1.41 2013/04/24 13:46:09 deraadt Exp $	 */
2
/* $EOM: init.c,v 1.25 2000/03/30 14:27:24 ho Exp $	 */
3
4
/*
5
 * Copyright (c) 1998, 1999, 2000 Niklas Hallqvist.  All rights reserved.
6
 * Copyright (c) 2000 Angelos D. Keromytis.  All rights reserved.
7
 * Copyright (c) 2003, 2004 Håkan Olsson.  All rights reserved.
8
 *
9
 * Redistribution and use in source and binary forms, with or without
10
 * modification, are permitted provided that the following conditions
11
 * are met:
12
 * 1. Redistributions of source code must retain the above copyright
13
 *    notice, this list of conditions and the following disclaimer.
14
 * 2. Redistributions in binary form must reproduce the above copyright
15
 *    notice, this list of conditions and the following disclaimer in the
16
 *    documentation and/or other materials provided with the distribution.
17
 *
18
 * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
19
 * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
20
 * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
21
 * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
22
 * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
23
 * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
24
 * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
25
 * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
26
 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
27
 * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
28
 */
29
30
/*
31
 * This code was written under funding by Ericsson Radio Systems.
32
 */
33
34
/* XXX This file could easily be built dynamically instead.  */
35
36
#include <stdlib.h>
37
38
#include "app.h"
39
#include "cert.h"
40
#include "conf.h"
41
#include "connection.h"
42
#include "doi.h"
43
#include "exchange.h"
44
#include "init.h"
45
#include "ipsec.h"
46
#include "isakmp_doi.h"
47
#include "libcrypto.h"
48
#include "log.h"
49
#include "dh.h"
50
#include "monitor.h"
51
#include "sa.h"
52
#include "timer.h"
53
#include "transport.h"
54
#include "virtual.h"
55
#include "udp.h"
56
#include "ui.h"
57
#include "util.h"
58
#include "vendor.h"
59
60
#include "policy.h"
61
62
#include "nat_traversal.h"
63
#include "udp_encap.h"
64
65
void
66
init(void)
67
{
68
	app_init();
69
	doi_init();
70
	exchange_init();
71
	group_init();
72
	ipsec_init();
73
	isakmp_doi_init();
74
	libcrypto_init();
75
76
	timer_init();
77
78
	/* The following group are depending on timer_init having run.  */
79
	conf_init();
80
	connection_init();
81
82
	/* This depends on conf_init, thus check as soon as possible. */
83
	log_reinit();
84
85
	/* policy_init depends on conf_init having run.  */
86
	policy_init();
87
88
	/* Depends on conf_init and policy_init having run */
89
	cert_init();
90
	crl_init();
91
92
	sa_init();
93
	transport_init();
94
	virtual_init();
95
	udp_init();
96
	nat_t_init();
97
	udp_encap_init();
98
	vendor_init();
99
}
100
101
/* Reinitialize, either after a SIGHUP reception or by FIFO UI cmd.  */
102
void
103
reinit(void)
104
{
105
	log_print("isakmpd: reinitializing daemon");
106
107
	/*
108
	 * XXX Remove all(/some?) pending exchange timers? - they may not be
109
	 *     possible to complete after we've re-read the config file.
110
	 *     User-initiated SIGHUP's maybe "authorizes" a wait until
111
	 *     next connection-check.
112
	 * XXX This means we discard exchange->last_msg, is this really ok?
113
         */
114
115
	/* Reread config file.  */
116
	conf_reinit();
117
118
	log_reinit();
119
120
	/* Reread the policies.  */
121
	policy_init();
122
123
	/* Reinitialize certificates */
124
	cert_init();
125
	crl_init();
126
127
	/* Reinitialize our connection list.  */
128
	connection_reinit();
129
130
	/*
131
	 * Rescan interfaces (call reinit() in all transports).
132
         */
133
	transport_reinit();
134
135
	/*
136
	 * XXX "These" (non-existent) reinitializations should not be done.
137
	 * cookie_reinit ();
138
	 * ui_reinit ();
139
         */
140
141
	sa_reinit();
142
}