]> git.proxmox.com Git - mirror_frr.git/blame - pimd/pim_main.c
pimd: Set c_oil->pim for static routes
[mirror_frr.git] / pimd / pim_main.c
CommitLineData
12e41d03 1/*
896014f4
DL
2 * PIM for Quagga
3 * Copyright (C) 2008 Everton da Silva Marques
4 *
5 * This program is free software; you can redistribute it and/or modify
6 * it under the terms of the GNU General Public License as published by
7 * the Free Software Foundation; either version 2 of the License, or
8 * (at your option) any later version.
9 *
10 * This program is distributed in the hope that it will be useful, but
11 * WITHOUT ANY WARRANTY; without even the implied warranty of
12 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
13 * General Public License for more details.
14 *
15 * You should have received a copy of the GNU General Public License along
16 * with this program; see the file COPYING; if not, write to the Free Software
17 * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
18 */
12e41d03
DL
19
20#include <zebra.h>
21
22#include "log.h"
d62a17ae 23#include "privs.h"
12e41d03
DL
24#include "version.h"
25#include <getopt.h>
26#include "command.h"
27#include "thread.h"
28#include <signal.h>
29
30#include "memory.h"
fc7948fa
DL
31#include "vrf.h"
32#include "memory_vty.h"
12e41d03
DL
33#include "filter.h"
34#include "vty.h"
35#include "sigevent.h"
36#include "version.h"
0e8ce7e6
DS
37#include "prefix.h"
38#include "plist.h"
48e8451b 39#include "vrf.h"
4f04a76b 40#include "libfrr.h"
12e41d03
DL
41
42#include "pimd.h"
43#include "pim_version.h"
44#include "pim_signals.h"
45#include "pim_zebra.h"
11128587 46#include "pim_msdp.h"
7176984f 47#include "pim_iface.h"
ba4eb1bc 48#include "pim_bfd.h"
12e41d03 49
12e41d03
DL
50extern struct host host;
51
d62a17ae 52struct option longopts[] = {{0}};
12e41d03
DL
53
54/* pimd privileges */
d62a17ae 55zebra_capabilities_t _caps_p[] = {
9d303b37 56 ZCAP_NET_ADMIN, ZCAP_SYS_ADMIN, ZCAP_NET_RAW, ZCAP_BIND,
12e41d03
DL
57};
58
59/* pimd privileges to run with */
d62a17ae 60struct zebra_privs_t pimd_privs = {
b2f36157 61#if defined(FRR_USER) && defined(FRR_GROUP)
d62a17ae 62 .user = FRR_USER,
63 .group = FRR_GROUP,
12e41d03
DL
64#endif
65#ifdef VTY_GROUP
d62a17ae 66 .vty_group = VTY_GROUP,
12e41d03 67#endif
d62a17ae 68 .caps_p = _caps_p,
69 .cap_num_p = sizeof(_caps_p) / sizeof(_caps_p[0]),
70 .cap_num_i = 0};
4f04a76b 71
d62a17ae 72FRR_DAEMON_INFO(pimd, PIM, .vty_port = PIMD_VTY_PORT,
12e41d03 73
d62a17ae 74 .proghelp = "Implementation of the PIM routing protocol.",
1bc98276 75
d62a17ae 76 .signals = pimd_signals,
77 .n_signals = 4 /* XXX array_size(pimd_signals) XXX*/,
4f04a76b 78
d62a17ae 79 .privs = &pimd_privs, )
4f04a76b 80
4f04a76b 81
d62a17ae 82int main(int argc, char **argv, char **envp)
83{
84 frr_preinit(&pimd_di, argc, argv);
85 frr_opt_add("", longopts, "");
86
87 /* this while just reads the options */
88 while (1) {
89 int opt;
90
91 opt = frr_getopt(argc, argv, NULL);
92
93 if (opt == EOF)
94 break;
95
96 switch (opt) {
97 case 0:
98 break;
99 default:
100 frr_help_exit(1);
101 break;
102 }
103 }
104
105 master = frr_init();
106
107 /*
108 * Initializations
109 */
110 pim_vrf_init();
111 access_list_init();
112 prefix_list_init();
113 prefix_list_add_hook(pim_prefix_list_update);
114 prefix_list_delete_hook(pim_prefix_list_update);
115
116 pim_route_map_init();
117 pim_init();
118 pim_msdp_init(master);
119
120 /*
121 * Initialize zclient "update" and "lookup" sockets
122 */
123 pim_zebra_init();
124 pim_bfd_init();
125
126 frr_config_fork();
12e41d03 127
12e41d03 128#ifdef PIM_DEBUG_BYDEFAULT
d62a17ae 129 zlog_notice("PIM_DEBUG_BYDEFAULT: Enabling all debug commands");
130 PIM_DO_DEBUG_PIM_EVENTS;
131 PIM_DO_DEBUG_PIM_PACKETS;
132 PIM_DO_DEBUG_PIM_TRACE;
133 PIM_DO_DEBUG_IGMP_EVENTS;
134 PIM_DO_DEBUG_IGMP_PACKETS;
135 PIM_DO_DEBUG_IGMP_TRACE;
136 PIM_DO_DEBUG_ZEBRA;
12e41d03
DL
137#endif
138
12e41d03 139#ifdef PIM_CHECK_RECV_IFINDEX_SANITY
d62a17ae 140 zlog_notice(
141 "PIM_CHECK_RECV_IFINDEX_SANITY: will match sock/recv ifindex");
12e41d03 142#ifdef PIM_REPORT_RECV_IFINDEX_MISMATCH
d62a17ae 143 zlog_notice(
144 "PIM_REPORT_RECV_IFINDEX_MISMATCH: will report sock/recv ifindex mismatch");
12e41d03
DL
145#endif
146#endif
147
148#ifdef PIM_UNEXPECTED_KERNEL_UPCALL
d62a17ae 149 zlog_notice(
150 "PIM_UNEXPECTED_KERNEL_UPCALL: report unexpected kernel upcall");
12e41d03
DL
151#endif
152
d62a17ae 153 frr_run(master);
12e41d03 154
d62a17ae 155 /* never reached */
156 return 0;
12e41d03 157}