3 * Copyright (C) 2018 Cumulus Networks, Inc.
6 * FRR 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
8 * Free Software Foundation; either version 2, or (at your option) any
11 * FRR is distributed in the hope that it will be useful, but
12 * WITHOUT ANY WARRANTY; without even the implied warranty of
13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
14 * General Public License for more details.
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
22 #include <lib/version.h>
40 #include "distribute.h"
44 #include "nexthop_group.h"
48 #include "pbr_zebra.h"
50 #include "pbr_debug.h"
53 zebra_capabilities_t _caps_p
[] = {
54 ZCAP_NET_RAW
, ZCAP_BIND
, ZCAP_NET_ADMIN
,
57 struct zebra_privs_t pbr_privs
= {
58 #if defined(FRR_USER) && defined(FRR_GROUP)
62 #if defined(VTY_GROUP)
63 .vty_group
= VTY_GROUP
,
66 .cap_num_p
= array_size(_caps_p
),
69 struct option longopts
[] = { { 0 } };
71 /* Master of threads. */
72 struct thread_master
*master
;
75 static void sighup(void)
77 zlog_info("SIGHUP received");
80 /* SIGINT / SIGTERM handler. */
81 static void sigint(void)
83 zlog_notice("Terminating on signal");
88 /* SIGUSR1 handler. */
89 static void sigusr1(void)
94 struct quagga_signal_t pbr_signals
[] = {
113 #define PBR_VTY_PORT 2615
115 static const struct frr_yang_module_info
*const pbrd_yang_modules
[] = {
119 FRR_DAEMON_INFO(pbrd
, PBR
, .vty_port
= PBR_VTY_PORT
,
121 .proghelp
= "Implementation of PBR.",
123 .signals
= pbr_signals
,
124 .n_signals
= array_size(pbr_signals
),
128 .yang_modules
= pbrd_yang_modules
,
129 .n_yang_modules
= array_size(pbrd_yang_modules
), )
131 int main(int argc
, char **argv
, char **envp
)
133 frr_preinit(&pbrd_di
, argc
, argv
);
134 frr_opt_add("", longopts
, "");
139 opt
= frr_getopt(argc
, argv
, NULL
);
157 nexthop_group_init(pbr_nhgroup_add_cb
,
158 pbr_nhgroup_add_nexthop_cb
,
159 pbr_nhgroup_del_nexthop_cb
,
160 pbr_nhgroup_delete_cb
);
163 * So we safely ignore these commands since
164 * we are getting them at this point in time
169 if_zapi_callbacks(pbr_ifp_create
, pbr_ifp_up
,
170 pbr_ifp_down
, pbr_ifp_destroy
);