]> git.ipfire.org Git - thirdparty/bird.git/commitdiff
Fixed possible race condition in hostcache trie matching code not triggering HCU
authorMaria Matejka <mq@ucw.cz>
Fri, 23 Sep 2022 07:57:40 +0000 (09:57 +0200)
committerMaria Matejka <mq@ucw.cz>
Fri, 23 Sep 2022 07:57:40 +0000 (09:57 +0200)
nest/rt-table.c

index 051bc949a0cfd6fb6dabce25f7e8ef6dbdbe4fb2..5db5755fb642b18d322d7d81bef35f816f35fc3a 100644 (file)
@@ -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);