summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorOndrej Zajicek <santiago@crfreenet.org>2012-08-06 02:42:24 +0200
committerOndrej Zajicek <santiago@crfreenet.org>2012-08-06 02:42:24 +0200
commit5400c0e7f982757418a0aeb892459b52fbbcffc3 (patch)
tree631b0cab2fec49a55c4813bb394aed202d21ef10
parentbbcfd5a0485a8df9568d8da0fc524e272e3e7601 (diff)
Fixes BGP subcode during global shutdown.
-rw-r--r--doc/bird.sgml2
-rw-r--r--nest/proto.c14
-rw-r--r--nest/protocol.h3
-rw-r--r--proto/bgp/bgp.c1
4 files changed, 12 insertions, 8 deletions
diff --git a/doc/bird.sgml b/doc/bird.sgml
index 86ae5b0d..24bc3026 100644
--- a/doc/bird.sgml
+++ b/doc/bird.sgml
@@ -477,7 +477,7 @@ to zero to disable it. An empty <cf><m/switch/</cf> is equivalent to <cf/on/
problems in details of its behavior -- the number of exported
routes can temporarily exceed the limit without triggering it
during protocol reload, exported routes counter ignores route
- blocking and block action also blocks route updates of alread
+ blocking and block action also blocks route updates of already
accepted routes -- and these details will probably change in
the future. Default: <cf/none/.
diff --git a/nest/proto.c b/nest/proto.c
index 887d3e5e..53d3f1a2 100644
--- a/nest/proto.c
+++ b/nest/proto.c
@@ -512,20 +512,22 @@ protos_commit(struct config *new, struct config *old, int force_reconfig, int ty
else if (!p->disabled && nc->disabled)
log(L_INFO "Disabling protocol %s", p->name);
- PD(p, "Restarting");
p->down_code = nc->disabled ? PDC_CF_DISABLE : PDC_CF_RESTART;
p->cf_new = nc;
}
- else
+ else if (!shutting_down)
{
- if (!shutting_down)
- log(L_INFO "Removing protocol %s", p->name);
- PD(p, "Unconfigured");
+ log(L_INFO "Removing protocol %s", p->name);
p->down_code = PDC_CF_REMOVE;
p->cf_new = NULL;
}
- p->reconfiguring = 1;
+ else /* global shutdown */
+ {
+ p->down_code = PDC_CMD_SHUTDOWN;
+ p->cf_new = NULL;
+ }
+ p->reconfiguring = 1;
config_add_obstacle(old);
proto_rethink_goal(p);
}
diff --git a/nest/protocol.h b/nest/protocol.h
index 8a632715..11fcb164 100644
--- a/nest/protocol.h
+++ b/nest/protocol.h
@@ -222,8 +222,9 @@ struct proto_spec {
#define PDC_CF_RESTART 0x03 /* Restart due to reconfiguration */
#define PDC_CMD_DISABLE 0x11 /* Result of disable command */
#define PDC_CMD_RESTART 0x12 /* Result of restart command */
+#define PDC_CMD_SHUTDOWN 0x13 /* Result of global shutdown */
#define PDC_IN_LIMIT_HIT 0x21 /* Route import limit reached */
-#define PDC_OUT_LIMIT_HIT 0x22 /* Route export limit reached - not implemented */
+#define PDC_OUT_LIMIT_HIT 0x22 /* Route export limit reached */
void *proto_new(struct proto_config *, unsigned size);
diff --git a/proto/bgp/bgp.c b/proto/bgp/bgp.c
index 0b52dedc..dbc59eea 100644
--- a/proto/bgp/bgp.c
+++ b/proto/bgp/bgp.c
@@ -870,6 +870,7 @@ bgp_shutdown(struct proto *P)
break;
case PDC_CMD_DISABLE:
+ case PDC_CMD_SHUTDOWN:
subcode = 2; // Errcode 6, 2 - administrative shutdown
break;