diff options
author | Maria Matejka <mq@jmq.cz> | 2021-11-23 12:06:27 +0000 |
---|---|---|
committer | Maria Matejka <mq@jmq.cz> | 2021-11-23 12:06:27 +0000 |
commit | 5395880908fdb264b5b78ccc455dced49eb29915 (patch) | |
tree | 5cfece0f526f859f49c409eaa14c653b4860c7c5 | |
parent | 821344c781a99a4f559949a7497617b64c061c82 (diff) |
Fixed pipe reload/refeed
-rw-r--r-- | nest/proto.c | 5 | ||||
-rw-r--r-- | nest/rt-table.c | 3 | ||||
-rw-r--r-- | proto/pipe/pipe.c | 19 |
3 files changed, 27 insertions, 0 deletions
diff --git a/nest/proto.c b/nest/proto.c index 7a09ed64..2d30e640 100644 --- a/nest/proto.c +++ b/nest/proto.c @@ -589,6 +589,10 @@ channel_export_stopped(struct rt_export_request *req) { c->refeeding = 1; c->refeed_pending = 0; + + bmap_reset(&c->export_map, 1024); + bmap_reset(&c->export_reject_map, 1024); + rt_request_export(c->table, req); return; } @@ -621,6 +625,7 @@ channel_feed_end(struct channel *c) (l->count <= l->max)) { log(L_INFO "Protocol %s resets route export limit (%u)", c->proto->name, l->max); + channel_reset_limit(c, &c->out_limit, PLD_OUT); c->refeed_pending = 1; rt_stop_export(req, channel_export_stopped); diff --git a/nest/rt-table.c b/nest/rt-table.c index c53fd195..e4c85fd4 100644 --- a/nest/rt-table.c +++ b/nest/rt-table.c @@ -618,6 +618,9 @@ rt_notify_basic(struct channel *c, const net_addr *net, rte *new, rte *old) if (old && !bmap_test(&c->export_map, old->id)) old = NULL; + if (old && (old->sender == c->in_req.hook)) + bug("bad-behaved pipe"); + if (!new && !old) return; diff --git a/proto/pipe/pipe.c b/proto/pipe/pipe.c index a30da0e2..270f7b92 100644 --- a/proto/pipe/pipe.c +++ b/proto/pipe/pipe.c @@ -108,6 +108,23 @@ pipe_reload_routes(struct channel *C) channel_request_feeding((C == p->pri) ? p->sec : p->pri); } +static void +pipe_feed_begin(struct channel *C, int refeeding UNUSED) +{ + struct pipe_proto *p = (void *) C->proto; + struct channel *dst = (C == p->pri) ? p->sec : p->pri; + + channel_refresh_begin(dst); +} + +static void +pipe_feed_end(struct channel *C) +{ + struct pipe_proto *p = (void *) C->proto; + struct channel *dst = (C == p->pri) ? p->sec : p->pri; + + channel_refresh_end(dst); +} static void pipe_postconfig(struct proto_config *CF) @@ -178,6 +195,8 @@ pipe_init(struct proto_config *CF) P->rt_notify = pipe_rt_notify; P->preexport = pipe_preexport; P->reload_routes = pipe_reload_routes; + P->feed_begin = pipe_feed_begin; + P->feed_end = pipe_feed_end; p->rl_gen = (struct tbf) TBF_DEFAULT_LOG_LIMITS; |