summaryrefslogtreecommitdiff
path: root/proto
diff options
context:
space:
mode:
Diffstat (limited to 'proto')
-rw-r--r--proto/bgp/bgp.c14
-rw-r--r--proto/bgp/bgp.h1
-rw-r--r--proto/pipe/config.Y1
-rw-r--r--proto/pipe/pipe.c14
-rw-r--r--proto/pipe/pipe.h1
5 files changed, 18 insertions, 13 deletions
diff --git a/proto/bgp/bgp.c b/proto/bgp/bgp.c
index cf743dff..3b9f7cc5 100644
--- a/proto/bgp/bgp.c
+++ b/proto/bgp/bgp.c
@@ -848,6 +848,8 @@ bgp_start(struct proto *P)
return PS_START;
}
+extern int proto_restart;
+
static int
bgp_shutdown(struct proto *P)
{
@@ -877,10 +879,16 @@ bgp_shutdown(struct proto *P)
case PDC_IN_LIMIT_HIT:
subcode = 1; // Errcode 6, 1 - max number of prefixes reached
+ /* log message for compatibility */
log(L_WARN "%s: Route limit exceeded, shutting down", p->p.name);
+ goto limit;
+
+ case PDC_OUT_LIMIT_HIT:
+ subcode = proto_restart ? 4 : 2; // Administrative reset or shutdown
+ limit:
bgp_store_error(p, NULL, BE_AUTO_DOWN, BEA_ROUTE_LIMIT_EXCEEDED);
- if (P->cf->in_limit->action == PLA_RESTART)
+ if (proto_restart)
bgp_update_startup_delay(p);
else
p->startup_delay = 0;
@@ -1165,9 +1173,9 @@ bgp_show_proto_info(struct proto *P)
p->rs_client ? " route-server" : "",
p->as4_session ? " AS4" : "");
cli_msg(-1006, " Source address: %I", p->source_addr);
- if (p->cf->route_limit)
+ if (P->cf->in_limit)
cli_msg(-1006, " Route limit: %d/%d",
- p->p.stats.imp_routes, p->cf->route_limit);
+ p->p.stats.imp_routes, P->cf->in_limit->limit);
cli_msg(-1006, " Hold timer: %d/%d",
tm_remains(c->hold_timer), c->hold_time);
cli_msg(-1006, " Keepalive timer: %d/%d",
diff --git a/proto/bgp/bgp.h b/proto/bgp/bgp.h
index aa2db4b0..1c16f485 100644
--- a/proto/bgp/bgp.h
+++ b/proto/bgp/bgp.h
@@ -40,7 +40,6 @@ struct bgp_config {
int rr_client; /* Whether neighbor is RR client of me */
int rs_client; /* Whether neighbor is RS client of me */
int advertise_ipv4; /* Whether we should add IPv4 capability advertisement to OPEN message */
- u32 route_limit; /* Number of routes that may be imported, 0 means disable limit */
int passive; /* Do not initiate outgoing connection */
int interpret_communities; /* Hardwired handling of well-known communities */
unsigned connect_retry_time;
diff --git a/proto/pipe/config.Y b/proto/pipe/config.Y
index 4fb2b499..40637558 100644
--- a/proto/pipe/config.Y
+++ b/proto/pipe/config.Y
@@ -36,7 +36,6 @@ pipe_proto:
cf_error("Routing table name expected");
PIPE_CFG->peer = $4->def;
}
- | pipe_proto EXPORT LIMIT limit_spec ';' { PIPE_CFG->out_limit = $4; }
| pipe_proto MODE OPAQUE ';' { PIPE_CFG->mode = PIPE_OPAQUE; }
| pipe_proto MODE TRANSPARENT ';' { PIPE_CFG->mode = PIPE_TRANSPARENT; }
;
diff --git a/proto/pipe/pipe.c b/proto/pipe/pipe.c
index a5fcc6f6..6099d284 100644
--- a/proto/pipe/pipe.c
+++ b/proto/pipe/pipe.c
@@ -127,10 +127,8 @@ pipe_reload_routes(struct proto *P)
*/
proto_request_feeding(P);
- if (P->main_ahook->in_limit)
- P->main_ahook->in_limit->active = 0;
- if (p->peer_ahook->in_limit)
- p->peer_ahook->in_limit->active = 0;
+ proto_reset_limit(P->main_ahook->in_limit);
+ proto_reset_limit(p->peer_ahook->in_limit);
return 1;
}
@@ -168,10 +166,12 @@ pipe_start(struct proto *P)
P->main_ahook = proto_add_announce_hook(P, P->table, &P->stats);
P->main_ahook->out_filter = cf->c.out_filter;
P->main_ahook->in_limit = cf->c.in_limit;
+ proto_reset_limit(P->main_ahook->in_limit);
p->peer_ahook = proto_add_announce_hook(P, p->peer_table, &p->peer_stats);
p->peer_ahook->out_filter = cf->c.in_filter;
- p->peer_ahook->in_limit = cf->out_limit;
+ p->peer_ahook->in_limit = cf->c.out_limit;
+ proto_reset_limit(p->peer_ahook->in_limit);
return PS_UP;
}
@@ -225,7 +225,7 @@ pipe_reconfigure(struct proto *P, struct proto_config *new)
if (p->peer_ahook)
{
p->peer_ahook->out_filter = new->in_filter;
- p->peer_ahook->in_limit = nc->out_limit;
+ p->peer_ahook->in_limit = new->out_limit;
}
if ((P->proto_state != PS_UP) || (proto_reconfig_type == RECONFIG_SOFT))
@@ -311,7 +311,7 @@ pipe_show_proto_info(struct proto *P)
cli_msg(-1006, " Output filter: %s", filter_name(cf->c.out_filter));
proto_show_limit(cf->c.in_limit, "Import limit:");
- proto_show_limit(cf->out_limit, "Export limit:");
+ proto_show_limit(cf->c.out_limit, "Export limit:");
if (P->proto_state != PS_DOWN)
pipe_show_stats(p);
diff --git a/proto/pipe/pipe.h b/proto/pipe/pipe.h
index e777fb41..50b31698 100644
--- a/proto/pipe/pipe.h
+++ b/proto/pipe/pipe.h
@@ -15,7 +15,6 @@
struct pipe_config {
struct proto_config c;
struct rtable_config *peer; /* Table we're connected to */
- struct proto_limit *out_limit; /* Export route limit */
int mode; /* PIPE_OPAQUE or PIPE_TRANSPARENT */
};