From 700f63d361ca9d88f6273a26a1b9e4179cd44dcd Mon Sep 17 00:00:00 2001 From: Lou Berger Date: Sun, 2 Apr 2017 13:55:58 -0400 Subject: bgp: fix a couple of instances of bm being used before init'ed Signed-off-by: Lou Berger --- bgpd/bgp_main.c | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) (limited to 'bgpd') diff --git a/bgpd/bgp_main.c b/bgpd/bgp_main.c index 423c9453e..55bf41062 100644 --- a/bgpd/bgp_main.c +++ b/bgpd/bgp_main.c @@ -363,6 +363,7 @@ main (int argc, char **argv) int bgp_port = BGP_PORT_DEFAULT; char *bgp_address = NULL; + int no_fib_flag = 0; frr_preinit(&bgpd_di, argc, argv); frr_opt_add("p:l:rne:", longopts, @@ -389,7 +390,7 @@ main (int argc, char **argv) if (tmp_port <= 0 || tmp_port > 0xffff) bgp_port = BGP_PORT_DEFAULT; else - bm->port = tmp_port; + bgp_port = tmp_port; break; case 'e': multipath_num = atoi (optarg); @@ -406,7 +407,7 @@ main (int argc, char **argv) bgp_address = optarg; /* listenon implies -n */ case 'n': - bgp_option_set (BGP_OPT_NO_FIB); + no_fib_flag = 1; break; default: frr_help_exit (1); @@ -418,6 +419,8 @@ main (int argc, char **argv) bgp_master_init (frr_init ()); bm->port = bgp_port; bm->address = bgp_address; + if (no_fib_flag) + bgp_option_set (BGP_OPT_NO_FIB); /* Initializations. */ bgp_vrf_init (); -- cgit v1.2.3 From c0734576140d104d0f9b0c67bfc5a7260a2ab15c Mon Sep 17 00:00:00 2001 From: Lou Berger Date: Sun, 2 Apr 2017 15:34:55 -0400 Subject: bgpd: restore -S, --skip_runas options Signed-off-by: Lou Berger --- bgpd/bgp_main.c | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) (limited to 'bgpd') diff --git a/bgpd/bgp_main.c b/bgpd/bgp_main.c index 55bf41062..1773070fe 100644 --- a/bgpd/bgp_main.c +++ b/bgpd/bgp_main.c @@ -66,6 +66,7 @@ static const struct option longopts[] = { "listenon", required_argument, NULL, 'l'}, { "retain", no_argument, NULL, 'r'}, { "no_kernel", no_argument, NULL, 'n'}, + { "skip_runas", no_argument, NULL, 'S'}, { "ecmp", required_argument, NULL, 'e'}, { 0 } }; @@ -151,7 +152,8 @@ sigint (void) if (! retain_mode) { bgp_terminate (); - zprivs_terminate (&bgpd_privs); + if (bgpd_privs.user) /* NULL if skip_runas flag set */ + zprivs_terminate (&bgpd_privs); } bgp_exit (0); @@ -364,6 +366,7 @@ main (int argc, char **argv) int bgp_port = BGP_PORT_DEFAULT; char *bgp_address = NULL; int no_fib_flag = 0; + int skip_runas = 0; frr_preinit(&bgpd_di, argc, argv); frr_opt_add("p:l:rne:", longopts, @@ -371,6 +374,7 @@ main (int argc, char **argv) " -l, --listenon Listen on specified address (implies -n)\n" " -r, --retain When program terminates, retain added route by bgpd.\n" " -n, --no_kernel Do not install route to kernel.\n" + " -S, --skip_runas Skip capabilities checks, and changing user and group IDs.\n" " -e, --ecmp Specify ECMP to use.\n"); /* Command line argument treatment. */ @@ -409,11 +413,16 @@ main (int argc, char **argv) case 'n': no_fib_flag = 1; break; + case 'S': + skip_runas = 1; + break; default: frr_help_exit (1); break; } } + if (skip_runas) + memset (&bgpd_privs, 0, sizeof (bgpd_privs)); /* BGP master init. */ bgp_master_init (frr_init ()); -- cgit v1.2.3 From 14f0a0f9c51950611600d7ba675d2c7275724756 Mon Sep 17 00:00:00 2001 From: Lou Berger Date: Tue, 9 May 2017 14:38:55 -0400 Subject: bgp rfapi: rfapi shouldn't be called (yet) for BGP VRF instances. --- bgpd/bgpd.c | 9 ++++++--- bgpd/rfapi/bgp_rfapi_cfg.c | 2 ++ 2 files changed, 8 insertions(+), 3 deletions(-) (limited to 'bgpd') diff --git a/bgpd/bgpd.c b/bgpd/bgpd.c index 25bd75784..9af26f551 100644 --- a/bgpd/bgpd.c +++ b/bgpd/bgpd.c @@ -2951,9 +2951,12 @@ bgp_create (as_t *as, const char *name, enum bgp_instance_type inst_type) bgp->as = *as; #if ENABLE_BGP_VNC - bgp->rfapi = bgp_rfapi_new(bgp); - assert(bgp->rfapi); - assert(bgp->rfapi_cfg); + if (inst_type != BGP_INSTANCE_TYPE_VRF) + { + bgp->rfapi = bgp_rfapi_new(bgp); + assert(bgp->rfapi); + assert(bgp->rfapi_cfg); + } #endif /* ENABLE_BGP_VNC */ if (name) diff --git a/bgpd/rfapi/bgp_rfapi_cfg.c b/bgpd/rfapi/bgp_rfapi_cfg.c index 5ddccc906..4f4656590 100644 --- a/bgpd/rfapi/bgp_rfapi_cfg.c +++ b/bgpd/rfapi/bgp_rfapi_cfg.c @@ -4281,6 +4281,8 @@ bgp_rfapi_cfg_write (struct vty *vty, struct bgp *bgp) int write = 0; afi_t afi; int type; + if (bgp->rfapi == NULL || hc == NULL) + return write; vty_out (vty, "!%s", VTY_NEWLINE); for (ALL_LIST_ELEMENTS (hc->nve_groups_sequential, node, nnode, rfg)) -- cgit v1.2.3