jardin | eb5d44e | 2003-12-23 08:09:43 +0000 | [diff] [blame] | 1 | /* |
| 2 | * IS-IS Rout(e)ing protocol - isis_main.c |
| 3 | * |
| 4 | * Copyright (C) 2001,2002 Sampo Saaristo |
| 5 | * Tampere University of Technology |
| 6 | * Institute of Communications Engineering |
| 7 | * |
| 8 | * This program is free software; you can redistribute it and/or modify it |
| 9 | * under the terms of the GNU General Public Licenseas published by the Free |
| 10 | * Software Foundation; either version 2 of the License, or (at your option) |
| 11 | * any later version. |
| 12 | * |
| 13 | * This program is distributed in the hope that it will be useful,but WITHOUT |
| 14 | * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or |
| 15 | * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for |
| 16 | * more details. |
| 17 | |
| 18 | * You should have received a copy of the GNU General Public License along |
| 19 | * with this program; if not, write to the Free Software Foundation, Inc., |
| 20 | * 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. |
| 21 | */ |
| 22 | |
jardin | eb5d44e | 2003-12-23 08:09:43 +0000 | [diff] [blame] | 23 | #include <zebra.h> |
jardin | eb5d44e | 2003-12-23 08:09:43 +0000 | [diff] [blame] | 24 | |
| 25 | #include "getopt.h" |
| 26 | #include "thread.h" |
| 27 | #include "log.h" |
gdt | 5e4fa16 | 2004-03-16 14:38:36 +0000 | [diff] [blame] | 28 | #include <lib/version.h> |
jardin | eb5d44e | 2003-12-23 08:09:43 +0000 | [diff] [blame] | 29 | #include "command.h" |
| 30 | #include "vty.h" |
| 31 | #include "memory.h" |
| 32 | #include "stream.h" |
| 33 | #include "if.h" |
jardin | 9e867fe | 2003-12-23 08:56:18 +0000 | [diff] [blame] | 34 | #include "privs.h" |
paul | 2d75d05 | 2004-01-19 21:31:15 +0000 | [diff] [blame] | 35 | #include "sigevent.h" |
hasso | c729c65 | 2004-10-13 08:36:47 +0000 | [diff] [blame] | 36 | #include "filter.h" |
Vyacheslav Trushkin | 48d8bea | 2011-11-25 18:51:48 +0400 | [diff] [blame] | 37 | #include "zclient.h" |
Feng Lu | 126215c | 2015-05-22 11:39:58 +0200 | [diff] [blame] | 38 | #include "vrf.h" |
jardin | eb5d44e | 2003-12-23 08:09:43 +0000 | [diff] [blame] | 39 | |
| 40 | #include "isisd/dict.h" |
| 41 | #include "include-netbsd/iso.h" |
| 42 | #include "isisd/isis_constants.h" |
| 43 | #include "isisd/isis_common.h" |
| 44 | #include "isisd/isis_flags.h" |
| 45 | #include "isisd/isis_circuit.h" |
| 46 | #include "isisd/isisd.h" |
| 47 | #include "isisd/isis_dynhn.h" |
Josh Bailey | 3f045a0 | 2012-03-24 08:35:20 -0700 | [diff] [blame] | 48 | #include "isisd/isis_spf.h" |
| 49 | #include "isisd/isis_route.h" |
| 50 | #include "isisd/isis_zebra.h" |
jardin | eb5d44e | 2003-12-23 08:09:43 +0000 | [diff] [blame] | 51 | |
| 52 | /* Default configuration file name */ |
| 53 | #define ISISD_DEFAULT_CONFIG "isisd.conf" |
| 54 | /* Default vty port */ |
jardin | fc58e87 | 2003-12-23 10:42:45 +0000 | [diff] [blame] | 55 | #define ISISD_VTY_PORT 2608 |
jardin | eb5d44e | 2003-12-23 08:09:43 +0000 | [diff] [blame] | 56 | |
jardin | 9e867fe | 2003-12-23 08:56:18 +0000 | [diff] [blame] | 57 | /* isisd privileges */ |
hasso | f390d2c | 2004-09-10 20:48:21 +0000 | [diff] [blame] | 58 | zebra_capabilities_t _caps_p[] = { |
paul | ceacedb | 2005-09-29 14:39:32 +0000 | [diff] [blame] | 59 | ZCAP_NET_RAW, |
jardin | 9e867fe | 2003-12-23 08:56:18 +0000 | [diff] [blame] | 60 | ZCAP_BIND |
| 61 | }; |
| 62 | |
hasso | f390d2c | 2004-09-10 20:48:21 +0000 | [diff] [blame] | 63 | struct zebra_privs_t isisd_privs = { |
jardin | 9e867fe | 2003-12-23 08:56:18 +0000 | [diff] [blame] | 64 | #if defined(QUAGGA_USER) |
| 65 | .user = QUAGGA_USER, |
| 66 | #endif |
| 67 | #if defined QUAGGA_GROUP |
| 68 | .group = QUAGGA_GROUP, |
| 69 | #endif |
| 70 | #ifdef VTY_GROUP |
| 71 | .vty_group = VTY_GROUP, |
| 72 | #endif |
| 73 | .caps_p = _caps_p, |
Josh Bailey | 3f045a0 | 2012-03-24 08:35:20 -0700 | [diff] [blame] | 74 | .cap_num_p = sizeof (_caps_p) / sizeof (*_caps_p), |
jardin | 9e867fe | 2003-12-23 08:56:18 +0000 | [diff] [blame] | 75 | .cap_num_i = 0 |
| 76 | }; |
| 77 | |
jardin | eb5d44e | 2003-12-23 08:09:43 +0000 | [diff] [blame] | 78 | /* isisd options */ |
hasso | f390d2c | 2004-09-10 20:48:21 +0000 | [diff] [blame] | 79 | struct option longopts[] = { |
Vyacheslav Trushkin | 1627b20 | 2011-11-25 17:56:21 +0400 | [diff] [blame] | 80 | {"daemon", no_argument, NULL, 'd'}, |
hasso | f390d2c | 2004-09-10 20:48:21 +0000 | [diff] [blame] | 81 | {"config_file", required_argument, NULL, 'f'}, |
Vyacheslav Trushkin | 1627b20 | 2011-11-25 17:56:21 +0400 | [diff] [blame] | 82 | {"pid_file", required_argument, NULL, 'i'}, |
Vyacheslav Trushkin | 48d8bea | 2011-11-25 18:51:48 +0400 | [diff] [blame] | 83 | {"socket", required_argument, NULL, 'z'}, |
Vyacheslav Trushkin | 1627b20 | 2011-11-25 17:56:21 +0400 | [diff] [blame] | 84 | {"vty_addr", required_argument, NULL, 'A'}, |
| 85 | {"vty_port", required_argument, NULL, 'P'}, |
| 86 | {"user", required_argument, NULL, 'u'}, |
| 87 | {"group", required_argument, NULL, 'g'}, |
| 88 | {"version", no_argument, NULL, 'v'}, |
| 89 | {"dryrun", no_argument, NULL, 'C'}, |
| 90 | {"help", no_argument, NULL, 'h'}, |
hasso | f390d2c | 2004-09-10 20:48:21 +0000 | [diff] [blame] | 91 | {0} |
jardin | eb5d44e | 2003-12-23 08:09:43 +0000 | [diff] [blame] | 92 | }; |
| 93 | |
| 94 | /* Configuration file and directory. */ |
jardin | eb5d44e | 2003-12-23 08:09:43 +0000 | [diff] [blame] | 95 | char config_default[] = SYSCONFDIR ISISD_DEFAULT_CONFIG; |
| 96 | char *config_file = NULL; |
| 97 | |
| 98 | /* isisd program name. */ |
| 99 | char *progname; |
| 100 | |
| 101 | int daemon_mode = 0; |
| 102 | |
| 103 | /* Master of threads. */ |
| 104 | struct thread_master *master; |
| 105 | |
hasso | c3aac6f | 2004-02-20 18:44:21 +0000 | [diff] [blame] | 106 | /* Process ID saved for use by init system */ |
hasso | 1cd8084 | 2004-10-07 20:07:40 +0000 | [diff] [blame] | 107 | const char *pid_file = PATH_ISISD_PID; |
jardin | eb5d44e | 2003-12-23 08:09:43 +0000 | [diff] [blame] | 108 | |
| 109 | /* for reload */ |
hasso | 37da8c0 | 2004-05-19 11:38:40 +0000 | [diff] [blame] | 110 | char _cwd[MAXPATHLEN]; |
| 111 | char _progpath[MAXPATHLEN]; |
jardin | eb5d44e | 2003-12-23 08:09:43 +0000 | [diff] [blame] | 112 | int _argc; |
| 113 | char **_argv; |
| 114 | char **_envp; |
| 115 | |
Paul Jakma | 41b36e9 | 2006-12-08 01:09:50 +0000 | [diff] [blame] | 116 | /* |
| 117 | * Prototypes. |
| 118 | */ |
| 119 | void reload(void); |
| 120 | void sighup(void); |
| 121 | void sigint(void); |
| 122 | void sigterm(void); |
| 123 | void sigusr1(void); |
| 124 | |
| 125 | |
jardin | eb5d44e | 2003-12-23 08:09:43 +0000 | [diff] [blame] | 126 | /* Help information display. */ |
| 127 | static void |
| 128 | usage (int status) |
| 129 | { |
| 130 | if (status != 0) |
| 131 | fprintf (stderr, "Try `%s --help' for more information.\n", progname); |
| 132 | else |
hasso | f390d2c | 2004-09-10 20:48:21 +0000 | [diff] [blame] | 133 | { |
jardin | eb5d44e | 2003-12-23 08:09:43 +0000 | [diff] [blame] | 134 | printf ("Usage : %s [OPTION...]\n\n\ |
| 135 | Daemon which manages IS-IS routing\n\n\ |
| 136 | -d, --daemon Runs in daemon mode\n\ |
| 137 | -f, --config_file Set configuration file name\n\ |
hasso | c3aac6f | 2004-02-20 18:44:21 +0000 | [diff] [blame] | 138 | -i, --pid_file Set process identifier file name\n\ |
Vyacheslav Trushkin | 48d8bea | 2011-11-25 18:51:48 +0400 | [diff] [blame] | 139 | -z, --socket Set path of zebra socket\n\ |
hasso | c3aac6f | 2004-02-20 18:44:21 +0000 | [diff] [blame] | 140 | -A, --vty_addr Set vty's bind address\n\ |
jardin | eb5d44e | 2003-12-23 08:09:43 +0000 | [diff] [blame] | 141 | -P, --vty_port Set vty's port number\n\ |
hasso | c065230 | 2004-11-25 19:33:48 +0000 | [diff] [blame] | 142 | -u, --user User to run as\n\ |
| 143 | -g, --group Group to run as\n\ |
jardin | eb5d44e | 2003-12-23 08:09:43 +0000 | [diff] [blame] | 144 | -v, --version Print program version\n\ |
Paul Jakma | 876b8be | 2006-10-15 23:35:57 +0000 | [diff] [blame] | 145 | -C, --dryrun Check configuration for validity and exit\n\ |
jardin | eb5d44e | 2003-12-23 08:09:43 +0000 | [diff] [blame] | 146 | -h, --help Display this help and exit\n\ |
| 147 | \n\ |
Christian Franke | 4ff3bca | 2013-03-20 10:50:07 +0000 | [diff] [blame] | 148 | Report bugs to %s\n", progname, ZEBRA_BUG_ADDRESS); |
jardin | eb5d44e | 2003-12-23 08:09:43 +0000 | [diff] [blame] | 149 | } |
| 150 | |
| 151 | exit (status); |
| 152 | } |
| 153 | |
| 154 | |
| 155 | void |
| 156 | reload () |
| 157 | { |
hasso | 529d65b | 2004-12-24 00:14:50 +0000 | [diff] [blame] | 158 | zlog_debug ("Reload"); |
jardin | eb5d44e | 2003-12-23 08:09:43 +0000 | [diff] [blame] | 159 | /* FIXME: Clean up func call here */ |
ajs | cdb6ee9 | 2005-02-23 15:48:32 +0000 | [diff] [blame] | 160 | vty_reset (); |
Josh Bailey | 3f045a0 | 2012-03-24 08:35:20 -0700 | [diff] [blame] | 161 | (void) isisd_privs.change (ZPRIVS_RAISE); |
jardin | eb5d44e | 2003-12-23 08:09:43 +0000 | [diff] [blame] | 162 | execve (_progpath, _argv, _envp); |
Josh Bailey | 3f045a0 | 2012-03-24 08:35:20 -0700 | [diff] [blame] | 163 | zlog_err ("Reload failed: cannot exec %s: %s", _progpath, |
| 164 | safe_strerror (errno)); |
jardin | eb5d44e | 2003-12-23 08:09:43 +0000 | [diff] [blame] | 165 | } |
| 166 | |
ajs | 887c44a | 2004-12-03 16:36:46 +0000 | [diff] [blame] | 167 | static void |
jardin | eb5d44e | 2003-12-23 08:09:43 +0000 | [diff] [blame] | 168 | terminate (int i) |
| 169 | { |
| 170 | exit (i); |
| 171 | } |
| 172 | |
| 173 | /* |
| 174 | * Signal handlers |
| 175 | */ |
paul | 2d75d05 | 2004-01-19 21:31:15 +0000 | [diff] [blame] | 176 | |
hasso | f390d2c | 2004-09-10 20:48:21 +0000 | [diff] [blame] | 177 | void |
paul | 2d75d05 | 2004-01-19 21:31:15 +0000 | [diff] [blame] | 178 | sighup (void) |
jardin | eb5d44e | 2003-12-23 08:09:43 +0000 | [diff] [blame] | 179 | { |
hasso | 529d65b | 2004-12-24 00:14:50 +0000 | [diff] [blame] | 180 | zlog_debug ("SIGHUP received"); |
jardin | eb5d44e | 2003-12-23 08:09:43 +0000 | [diff] [blame] | 181 | reload (); |
| 182 | |
| 183 | return; |
| 184 | } |
| 185 | |
| 186 | void |
paul | 2d75d05 | 2004-01-19 21:31:15 +0000 | [diff] [blame] | 187 | sigint (void) |
jardin | eb5d44e | 2003-12-23 08:09:43 +0000 | [diff] [blame] | 188 | { |
ajs | 887c44a | 2004-12-03 16:36:46 +0000 | [diff] [blame] | 189 | zlog_notice ("Terminating on signal SIGINT"); |
jardin | eb5d44e | 2003-12-23 08:09:43 +0000 | [diff] [blame] | 190 | terminate (0); |
jardin | eb5d44e | 2003-12-23 08:09:43 +0000 | [diff] [blame] | 191 | } |
| 192 | |
| 193 | void |
paul | 2d75d05 | 2004-01-19 21:31:15 +0000 | [diff] [blame] | 194 | sigterm (void) |
jardin | eb5d44e | 2003-12-23 08:09:43 +0000 | [diff] [blame] | 195 | { |
ajs | 887c44a | 2004-12-03 16:36:46 +0000 | [diff] [blame] | 196 | zlog_notice ("Terminating on signal SIGTERM"); |
jardin | eb5d44e | 2003-12-23 08:09:43 +0000 | [diff] [blame] | 197 | terminate (0); |
| 198 | } |
| 199 | |
| 200 | void |
paul | 2d75d05 | 2004-01-19 21:31:15 +0000 | [diff] [blame] | 201 | sigusr1 (void) |
jardin | eb5d44e | 2003-12-23 08:09:43 +0000 | [diff] [blame] | 202 | { |
hasso | 529d65b | 2004-12-24 00:14:50 +0000 | [diff] [blame] | 203 | zlog_debug ("SIGUSR1 received"); |
jardin | eb5d44e | 2003-12-23 08:09:43 +0000 | [diff] [blame] | 204 | zlog_rotate (NULL); |
| 205 | } |
| 206 | |
paul | 2d75d05 | 2004-01-19 21:31:15 +0000 | [diff] [blame] | 207 | struct quagga_signal_t isisd_signals[] = |
hasso | f390d2c | 2004-09-10 20:48:21 +0000 | [diff] [blame] | 208 | { |
paul | 2d75d05 | 2004-01-19 21:31:15 +0000 | [diff] [blame] | 209 | { |
hasso | f390d2c | 2004-09-10 20:48:21 +0000 | [diff] [blame] | 210 | .signal = SIGHUP, |
| 211 | .handler = &sighup, |
| 212 | }, |
paul | 2d75d05 | 2004-01-19 21:31:15 +0000 | [diff] [blame] | 213 | { |
hasso | f390d2c | 2004-09-10 20:48:21 +0000 | [diff] [blame] | 214 | .signal = SIGUSR1, |
| 215 | .handler = &sigusr1, |
| 216 | }, |
paul | 2d75d05 | 2004-01-19 21:31:15 +0000 | [diff] [blame] | 217 | { |
hasso | f390d2c | 2004-09-10 20:48:21 +0000 | [diff] [blame] | 218 | .signal = SIGINT, |
| 219 | .handler = &sigint, |
| 220 | }, |
| 221 | { |
| 222 | .signal = SIGTERM, |
| 223 | .handler = &sigterm, |
| 224 | }, |
paul | 2d75d05 | 2004-01-19 21:31:15 +0000 | [diff] [blame] | 225 | }; |
jardin | eb5d44e | 2003-12-23 08:09:43 +0000 | [diff] [blame] | 226 | |
| 227 | /* |
| 228 | * Main routine of isisd. Parse arguments and handle IS-IS state machine. |
| 229 | */ |
hasso | f390d2c | 2004-09-10 20:48:21 +0000 | [diff] [blame] | 230 | int |
jardin | eb5d44e | 2003-12-23 08:09:43 +0000 | [diff] [blame] | 231 | main (int argc, char **argv, char **envp) |
| 232 | { |
| 233 | char *p; |
| 234 | int opt, vty_port = ISISD_VTY_PORT; |
| 235 | struct thread thread; |
| 236 | char *config_file = NULL; |
| 237 | char *vty_addr = NULL; |
Paul Jakma | 876b8be | 2006-10-15 23:35:57 +0000 | [diff] [blame] | 238 | int dryrun = 0; |
jardin | eb5d44e | 2003-12-23 08:09:43 +0000 | [diff] [blame] | 239 | |
| 240 | /* Get the programname without the preceding path. */ |
| 241 | progname = ((p = strrchr (argv[0], '/')) ? ++p : argv[0]); |
| 242 | |
ajs | 274a4a4 | 2004-12-07 15:39:31 +0000 | [diff] [blame] | 243 | zlog_default = openzlog (progname, ZLOG_ISIS, |
hasso | f390d2c | 2004-09-10 20:48:21 +0000 | [diff] [blame] | 244 | LOG_CONS | LOG_NDELAY | LOG_PID, LOG_DAEMON); |
jardin | eb5d44e | 2003-12-23 08:09:43 +0000 | [diff] [blame] | 245 | |
jardin | eb5d44e | 2003-12-23 08:09:43 +0000 | [diff] [blame] | 246 | /* for reload */ |
| 247 | _argc = argc; |
| 248 | _argv = argv; |
| 249 | _envp = envp; |
| 250 | getcwd (_cwd, sizeof (_cwd)); |
| 251 | if (*argv[0] == '.') |
| 252 | snprintf (_progpath, sizeof (_progpath), "%s/%s", _cwd, _argv[0]); |
| 253 | else |
| 254 | snprintf (_progpath, sizeof (_progpath), "%s", argv[0]); |
hasso | f390d2c | 2004-09-10 20:48:21 +0000 | [diff] [blame] | 255 | |
jardin | eb5d44e | 2003-12-23 08:09:43 +0000 | [diff] [blame] | 256 | /* Command line argument treatment. */ |
hasso | f390d2c | 2004-09-10 20:48:21 +0000 | [diff] [blame] | 257 | while (1) |
jardin | eb5d44e | 2003-12-23 08:09:43 +0000 | [diff] [blame] | 258 | { |
Vyacheslav Trushkin | 48d8bea | 2011-11-25 18:51:48 +0400 | [diff] [blame] | 259 | opt = getopt_long (argc, argv, "df:i:z:hA:p:P:u:g:vC", longopts, 0); |
jardin | eb5d44e | 2003-12-23 08:09:43 +0000 | [diff] [blame] | 260 | |
hasso | f390d2c | 2004-09-10 20:48:21 +0000 | [diff] [blame] | 261 | if (opt == EOF) |
| 262 | break; |
| 263 | |
| 264 | switch (opt) |
| 265 | { |
| 266 | case 0: |
jardin | 9e867fe | 2003-12-23 08:56:18 +0000 | [diff] [blame] | 267 | break; |
hasso | f390d2c | 2004-09-10 20:48:21 +0000 | [diff] [blame] | 268 | case 'd': |
| 269 | daemon_mode = 1; |
| 270 | break; |
| 271 | case 'f': |
| 272 | config_file = optarg; |
| 273 | break; |
| 274 | case 'i': |
| 275 | pid_file = optarg; |
| 276 | break; |
Vyacheslav Trushkin | 48d8bea | 2011-11-25 18:51:48 +0400 | [diff] [blame] | 277 | case 'z': |
| 278 | zclient_serv_path_set (optarg); |
| 279 | break; |
hasso | f390d2c | 2004-09-10 20:48:21 +0000 | [diff] [blame] | 280 | case 'A': |
| 281 | vty_addr = optarg; |
| 282 | break; |
| 283 | case 'P': |
| 284 | /* Deal with atoi() returning 0 on failure, and isisd not |
| 285 | listening on isisd port... */ |
| 286 | if (strcmp (optarg, "0") == 0) |
| 287 | { |
| 288 | vty_port = 0; |
| 289 | break; |
| 290 | } |
| 291 | vty_port = atoi (optarg); |
| 292 | vty_port = (vty_port ? vty_port : ISISD_VTY_PORT); |
| 293 | break; |
| 294 | case 'u': |
hasso | c065230 | 2004-11-25 19:33:48 +0000 | [diff] [blame] | 295 | isisd_privs.user = optarg; |
hasso | f390d2c | 2004-09-10 20:48:21 +0000 | [diff] [blame] | 296 | break; |
hasso | c065230 | 2004-11-25 19:33:48 +0000 | [diff] [blame] | 297 | case 'g': |
| 298 | isisd_privs.group = optarg; |
hasso | f390d2c | 2004-09-10 20:48:21 +0000 | [diff] [blame] | 299 | break; |
| 300 | case 'v': |
| 301 | printf ("ISISd version %s\n", ISISD_VERSION); |
| 302 | printf ("Copyright (c) 2001-2002 Sampo Saaristo," |
| 303 | " Ofer Wald and Hannes Gredler\n"); |
| 304 | print_version ("Zebra"); |
| 305 | exit (0); |
| 306 | break; |
Paul Jakma | 876b8be | 2006-10-15 23:35:57 +0000 | [diff] [blame] | 307 | case 'C': |
| 308 | dryrun = 1; |
| 309 | break; |
hasso | f390d2c | 2004-09-10 20:48:21 +0000 | [diff] [blame] | 310 | case 'h': |
| 311 | usage (0); |
| 312 | break; |
| 313 | default: |
| 314 | usage (1); |
| 315 | break; |
| 316 | } |
jardin | eb5d44e | 2003-12-23 08:09:43 +0000 | [diff] [blame] | 317 | } |
hasso | f390d2c | 2004-09-10 20:48:21 +0000 | [diff] [blame] | 318 | |
jardin | eb5d44e | 2003-12-23 08:09:43 +0000 | [diff] [blame] | 319 | /* thread master */ |
| 320 | master = thread_master_create (); |
| 321 | |
| 322 | /* random seed from time */ |
Donald Sharp | f31bab4 | 2015-06-19 19:26:19 -0400 | [diff] [blame] | 323 | srandom (time (NULL)); |
jardin | eb5d44e | 2003-12-23 08:09:43 +0000 | [diff] [blame] | 324 | |
| 325 | /* |
| 326 | * initializations |
| 327 | */ |
jardin | 9e867fe | 2003-12-23 08:56:18 +0000 | [diff] [blame] | 328 | zprivs_init (&isisd_privs); |
Balaji.G | 837d16c | 2012-09-26 14:09:10 +0530 | [diff] [blame] | 329 | signal_init (master, array_size (isisd_signals), isisd_signals); |
jardin | eb5d44e | 2003-12-23 08:09:43 +0000 | [diff] [blame] | 330 | cmd_init (1); |
jardin | 9e867fe | 2003-12-23 08:56:18 +0000 | [diff] [blame] | 331 | vty_init (master); |
jardin | eb5d44e | 2003-12-23 08:09:43 +0000 | [diff] [blame] | 332 | memory_init (); |
hasso | c729c65 | 2004-10-13 08:36:47 +0000 | [diff] [blame] | 333 | access_list_init(); |
Feng Lu | 126215c | 2015-05-22 11:39:58 +0200 | [diff] [blame] | 334 | vrf_init (); |
jardin | eb5d44e | 2003-12-23 08:09:43 +0000 | [diff] [blame] | 335 | isis_init (); |
Josh Bailey | 3f045a0 | 2012-03-24 08:35:20 -0700 | [diff] [blame] | 336 | isis_circuit_init (); |
| 337 | isis_spf_cmds_init (); |
| 338 | |
| 339 | /* create the global 'isis' instance */ |
| 340 | isis_new (1); |
| 341 | |
| 342 | isis_zebra_init (); |
| 343 | |
hasso | f390d2c | 2004-09-10 20:48:21 +0000 | [diff] [blame] | 344 | /* parse config file */ |
jardin | eb5d44e | 2003-12-23 08:09:43 +0000 | [diff] [blame] | 345 | /* this is needed three times! because we have interfaces before the areas */ |
hasso | 320ec10 | 2004-06-20 19:54:37 +0000 | [diff] [blame] | 346 | vty_read_config (config_file, config_default); |
hasso | 00995cf | 2004-05-19 13:43:50 +0000 | [diff] [blame] | 347 | |
Paul Jakma | 876b8be | 2006-10-15 23:35:57 +0000 | [diff] [blame] | 348 | /* Start execution only if not in dry-run mode */ |
| 349 | if (dryrun) |
| 350 | return(0); |
| 351 | |
jardin | eb5d44e | 2003-12-23 08:09:43 +0000 | [diff] [blame] | 352 | /* demonize */ |
Josh Bailey | 3f045a0 | 2012-03-24 08:35:20 -0700 | [diff] [blame] | 353 | if (daemon_mode) |
| 354 | daemon (0, 0); |
jardin | eb5d44e | 2003-12-23 08:09:43 +0000 | [diff] [blame] | 355 | |
jardin | eb5d44e | 2003-12-23 08:09:43 +0000 | [diff] [blame] | 356 | /* Process ID file creation. */ |
Josh Bailey | 3f045a0 | 2012-03-24 08:35:20 -0700 | [diff] [blame] | 357 | if (pid_file[0] != '\0') |
| 358 | pid_output (pid_file); |
jardin | eb5d44e | 2003-12-23 08:09:43 +0000 | [diff] [blame] | 359 | |
| 360 | /* Make isis vty socket. */ |
jardin | 9e867fe | 2003-12-23 08:56:18 +0000 | [diff] [blame] | 361 | vty_serv_sock (vty_addr, vty_port, ISIS_VTYSH_PATH); |
hasso | f390d2c | 2004-09-10 20:48:21 +0000 | [diff] [blame] | 362 | |
jardin | eb5d44e | 2003-12-23 08:09:43 +0000 | [diff] [blame] | 363 | /* Print banner. */ |
ajs | 887c44a | 2004-12-03 16:36:46 +0000 | [diff] [blame] | 364 | zlog_notice ("Quagga-ISISd %s starting: vty@%d", QUAGGA_VERSION, vty_port); |
hasso | c89c05d | 2005-09-04 21:36:36 +0000 | [diff] [blame] | 365 | |
jardin | eb5d44e | 2003-12-23 08:09:43 +0000 | [diff] [blame] | 366 | /* Start finite state machine. */ |
| 367 | while (thread_fetch (master, &thread)) |
| 368 | thread_call (&thread); |
| 369 | |
| 370 | /* Not reached. */ |
| 371 | exit (0); |
| 372 | } |