summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMaria Matejka <mq@ucw.cz>2022-09-23 09:57:40 +0200
committerMaria Matejka <mq@ucw.cz>2022-09-23 09:57:40 +0200
commit5338a779c975c12074e9dd7ba10ba49fb7ed4bda (patch)
tree24fe3cb38a9f18b0ab789a6b813553ec9ae0ae8c
parentb1ade5efa1164e42ff62cb0f242774cc9b47886d (diff)
Fixed possible race condition in hostcache trie matching code not triggering HCU
-rw-r--r--nest/rt-table.c13
1 files changed, 9 insertions, 4 deletions
diff --git a/nest/rt-table.c b/nest/rt-table.c
index 051bc949..5db5755f 100644
--- a/nest/rt-table.c
+++ b/nest/rt-table.c
@@ -4445,11 +4445,16 @@ hc_notify_export_one(struct rt_export_request *req, const net_addr *net, struct
struct hostcache *hc = SKIP_BACK(struct hostcache, req, req);
/* No interest in this update, mark seen only */
- if (ev_active(&hc->update) || !trie_match_net(hc->trie, net))
- {
- rpe_mark_seen_all(req->hook, first, NULL);
+ int interested = 1;
+ RT_LOCKED((rtable *) hc->update.data, tab)
+ if (ev_active(&hc->update) || !trie_match_net(hc->trie, net))
+ {
+ rpe_mark_seen_all(req->hook, first, NULL);
+ interested = 0;
+ }
+
+ if (!interested)
return;
- }
/* This net may affect some hostentries, check the actual change */
rte *o = RTE_VALID_OR_NULL(first->old_best);