Bug 174533 - net/openbgpd doesn't reload after config error (previous reload still running)
Summary: net/openbgpd doesn't reload after config error (previous reload still running)
Status: Closed FIXED
Alias: None
Product: Ports & Packages
Classification: Unclassified
Component: Individual Port(s) (show other bugs)
Version: Latest
Hardware: Any Any
: Normal Affects Only Me
Assignee: Hiroki Sato
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2012-12-18 00:30 UTC by Renato Ornelas
Modified: 2018-01-16 06:00 UTC (History)
2 users (show)

See Also:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Renato Ornelas 2012-12-18 00:30:00 UTC
After upgrading to openbgp-5.2.20121014, bgpctl cant reload a config after the config file has any error.

Dec 17 18:22:51 bgp2 bgpd[37607]: /etc/bgpd/clientes.conf:855: syntax error
Dec 17 18:22:51 bgp2 bgpd[37607]: /etc/bgpd/clientes.conf:858: start prefixlen is bigger than end
Dec 17 18:22:51 bgp2 bgpd[37607]: config file /usr/local/etc/bgpd.conf has errors, not reloading

After you correct the error, bgpctl reload starts giving the following error:

bgp2# bgpctl re
reload request sent.
previous reload still running


You need to restart openbgpd to correct the error

Fix: 

--- src/usr.sbin/bgpd/bgpd.c	2012/09/18 10:45:51	1.169
+++ src/usr.sbin/bgpd/bgpd.c	2012/11/02 19:02:45	1.170
@@ -1,4 +1,4 @@
-/*	$OpenBSD: bgpd.c,v 1.169 2012/09/18 09:45:51 claudio Exp $ */
+/*	$OpenBSD: bgpd.c,v 1.170 2012/11/02 18:02:45 florian Exp $ */
 
 /*
  * Copyright (c) 2003, 2004 Henning Brauer <henning@openbsd.org>
@@ -436,6 +436,7 @@ reconfigure(char *conffile, struct bgpd_config *conf, 
 	    &rdom_l)) {
 		log_warnx("config file %s has errors, not reloading",
 		    conffile);
+		reconfpending = 0;
 		return (1);
 	}
How-To-Repeat: Put any invalid option on the config file, issue a bgpctl reload, correct the file and give another reload to bgpctl
Comment 1 Edwin Groothuis freebsd_committer freebsd_triage 2012-12-18 00:30:08 UTC
Responsible Changed
From-To: freebsd-ports-bugs->hrs

Over to maintainer (via the GNATS Auto Assign Tool)
Comment 2 Carlo Strub freebsd_committer freebsd_triage 2014-09-11 20:04:23 UTC
Is this PR still relevant?
Comment 3 Walter Schwarzenfeld freebsd_triage 2018-01-10 07:22:37 UTC
patch-bgpd_bgpd.c shows:
  267 @@ -452,27 +414,33 @@ send_filterset(struct imsgbuf *i, struct
    268  
    269  int
    270  reconfigure(char *conffile, struct bgpd_config *conf, struct mrt_head *mrt_l,
    271 -    struct peer **peer_l, struct filter_head *rules_l)
    272 +    struct peer **peer_l)
    273  {
    272 +    struct peer **peer_l)
    273  {
    274         struct network_head      net_l;
    275 -       struct network          *n;
    276 +       struct rdomain_head      rdom_l;
    277 +       struct filter_head       rules_l;
    278         struct peer             *p;
    279         struct filter_rule      *r;
    280         struct listen_addr      *la;
    281         struct rde_rib          *rr;
    282 +       struct rdomain          *rd;
    283  
    284 -       if (parse_config(conffile, conf, mrt_l, peer_l, &net_l, rules_l)) {
    285 +       if (reconfpending) {
    286 +               log_info("previous reload still running");
    287 +               return (2);
    288 +       }
    289 +       reconfpending = 2;      /* one per child */
    290 +
    291 +       log_info("rereading config");
    292 +       if (parse_config(conffile, conf, mrt_l, peer_l, &net_l, &rules_l,
    293 +           &rdom_l)) {
    294                 log_warnx("config file %s has errors, not reloading",
    295                     conffile);
    296 +               reconfpending = 0;
    297                 return (1);
    298         }
    299  


If I interpret this right, it is done and the PR could closed.