Skip to content

eBPF-based security platform

bpm: let tree sync catch up over a generation it missed

Daniel Borkmannc36c5b8c0fd6
diff --git a/builtin-bpm.c b/builtin-bpm.c
index dfdc6421..b2654bed 100644
--- a/builtin-bpm.c
+++ b/builtin-bpm.c
@@ -1577,7 +1577,13 @@ static int cmd_bpm_tree_sync(int argc, const char **argv)
TREE_SYNC_RETURN(-EINVAL);
if (have_state && !same_manifest && pub.generation <= state.generation)
TREE_SYNC_RETURN(-ERANGE);
- if (have_state && !same_manifest && pub.parent_manifest_digest[0] &&
+ /*
+ * Only a direct successor names the manifest this target recorded
+ * as its parent; one that missed a generation never saw the parent.
+ */
+ if (have_state && !same_manifest &&
+ pub.generation == state.generation + 1 &&
+ pub.parent_manifest_digest[0] &&
strcmp(pub.parent_manifest_digest, state.manifest_digest))
TREE_SYNC_RETURN(-ERANGE);
if (have_state && pub.head_seq < state.last_seq)