3 * Copyright (C) 2021 David Lamparter for NetDEF, Inc.
4 * Copyright (C) 2008 Everton da Silva Marques (pim_main.c)
6 * This program is free software; you can redistribute it and/or modify it
7 * under the terms of the GNU General Public License as published by the Free
8 * Software Foundation; either version 2 of the License, or (at your option)
11 * This program is distributed in the hope that it will be useful, but WITHOUT
12 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
13 * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
16 * You should have received a copy of the GNU General Public License along
17 * with this program; see the file COPYING; if not, write to the Free Software
18 * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
24 #include "lib/filter.h"
25 #include "lib/plist.h"
26 #include "lib/routemap.h"
27 #include "lib/routing_nb.h"
29 #include "lib/privs.h"
30 #include "lib/sigevent.h"
31 #include "lib/libfrr.h"
32 #include "lib/version.h"
35 #include "pim_instance.h"
36 #include "pim_errors.h"
37 #include "pim_iface.h"
38 #include "pim_zebra.h"
43 zebra_capabilities_t _caps_p
[] = {
50 /* pimd privileges to run with */
51 struct zebra_privs_t pimd_privs
= {
52 #if defined(FRR_USER) && defined(FRR_GROUP)
57 .vty_group
= VTY_GROUP
,
60 .cap_num_p
= array_size(_caps_p
),
64 static void pim6_terminate(void);
66 static void pim6_sighup(void)
68 zlog_info("SIGHUP received, ignoring");
71 static void pim6_sigint(void)
73 zlog_notice("Terminating on signal SIGINT");
78 static void pim6_sigterm(void)
80 zlog_notice("Terminating on signal SIGTERM");
85 static void pim6_sigusr1(void)
90 struct frr_signal_t pim6d_signals
[] = {
93 .handler
= &pim6_sighup
,
97 .handler
= &pim6_sigusr1
,
101 .handler
= &pim6_sigint
,
105 .handler
= &pim6_sigterm
,
109 static const struct frr_yang_module_info
*const pim6d_yang_modules
[] = {
120 /* clang-format off */
121 FRR_DAEMON_INFO(pim6d
, PIM6
,
123 .flags
= FRR_NO_SPLIT_CONFIG
,
125 .proghelp
= "Protocol Independent Multicast (RFC7761) for IPv6",
127 .signals
= pim6d_signals
,
128 .n_signals
= array_size(pim6d_signals
),
130 .privs
= &pimd_privs
,
132 .yang_modules
= pim6d_yang_modules
,
133 .n_yang_modules
= array_size(pim6d_yang_modules
),
135 /* clang-format on */
137 int main(int argc
, char **argv
, char **envp
)
139 static struct option longopts
[] = {
143 frr_preinit(&pim6d_di
, argc
, argv
);
144 frr_opt_add("", longopts
, "");
146 /* this while just reads the options */
150 opt
= frr_getopt(argc
, argv
, NULL
);
174 prefix_list_add_hook(pim_prefix_list_update
);
175 prefix_list_delete_hook(pim_prefix_list_update
);
177 pim_route_map_init();
181 * Initialize zclient "update" and "lookup" sockets
193 hook_register(routing_conf_event
,
194 routing_control_plane_protocols_name_validate
);
196 routing_control_plane_protocols_register_vrf_dependency();
199 frr_run(router
->master
);
205 static void pim6_terminate(void)
208 pim_router_terminate();