#include "nhrpd.h"
#include "netlink.h"
+#include "nhrp_errors.h"
DEFINE_MGROUP(NHRPD, "NHRP")
struct timeval current_time;
/* nhrpd options. */
-struct option longopts[] = {
- { 0 }
-};
+struct option longopts[] = {{0}};
/* nhrpd privileges */
-static zebra_capabilities_t _caps_p [] = {
- ZCAP_NET_RAW,
- ZCAP_NET_ADMIN,
- ZCAP_DAC_OVERRIDE, /* for now needed to write to /proc/sys/net/ipv4/<if>/send_redirect */
+static zebra_capabilities_t _caps_p[] = {
+ ZCAP_NET_RAW, ZCAP_NET_ADMIN,
+ ZCAP_DAC_OVERRIDE, /* for now needed to write to
+ /proc/sys/net/ipv4/<if>/send_redirect */
};
-static struct zebra_privs_t nhrpd_privs = {
+struct zebra_privs_t nhrpd_privs = {
#if defined(FRR_USER) && defined(FRR_GROUP)
.user = FRR_USER,
.group = FRR_GROUP,
while (1) {
opt = frr_getopt(argc, argv, 0);
- if(opt < 0) break;
+ if (opt < 0)
+ break;
switch (opt) {
case 0:
static void nhrp_request_stop(void)
{
debugf(NHRP_DEBUG_COMMON, "Exiting...");
+ frr_early_fini();
nhrp_shortcut_terminate();
nhrp_nhs_terminate();
evmgr_terminate();
nhrp_vc_terminate();
vrf_terminate();
- /* memory_terminate(); */
- /* vty_terminate(); */
- cmd_terminate();
- /* signal_terminate(); */
- zprivs_terminate(&nhrpd_privs);
debugf(NHRP_DEBUG_COMMON, "Done.");
-
- closezlog();
+ frr_fini();
exit(0);
}
static struct quagga_signal_t sighandlers[] = {
- { .signal = SIGUSR1, .handler = &nhrp_sigusr1, },
- { .signal = SIGINT, .handler = &nhrp_request_stop, },
- { .signal = SIGTERM, .handler = &nhrp_request_stop, },
+ {
+ .signal = SIGUSR1,
+ .handler = &nhrp_sigusr1,
+ },
+ {
+ .signal = SIGINT,
+ .handler = &nhrp_request_stop,
+ },
+ {
+ .signal = SIGTERM,
+ .handler = &nhrp_request_stop,
+ },
};
-FRR_DAEMON_INFO(nhrpd, NHRP,
- .vty_port = NHRP_VTY_PORT,
+FRR_DAEMON_INFO(nhrpd, NHRP, .vty_port = NHRP_VTY_PORT,
- .proghelp = "Implementation of the NHRP routing protocol.",
+ .proghelp = "Implementation of the NHRP routing protocol.",
- .signals = sighandlers,
- .n_signals = array_size(sighandlers),
+ .signals = sighandlers, .n_signals = array_size(sighandlers),
- .privs = &nhrpd_privs,
-)
+ .privs = &nhrpd_privs, )
int main(int argc, char **argv)
{
/* Library inits. */
master = frr_init();
+ nhrp_error_init();
+ vrf_init(NULL, NULL, NULL, NULL);
nhrp_interface_init();
- vrf_init();
resolver_init();
/* Run with elevated capabilities, as for all netlink activity