Backport:v0.8 Handle multiple URL and DNS selectors correctly #726
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Currently we have experimental support for URL and DNS actions, which could be used to trigger Thinkst canaries. This experimental support incorrectly handles multiple selectors – it simply collects all the URLs in the kprobe and all the FQDNs in the kprobe into lists, and when a URL or FQDN action fires on it, it triggers everything in the corresponding list. This is obviously wrong.
This commit fixes this as follows. Each kprobe stores a table of URLs and FQDNs that it references, each entry with its own index. These indices are provided in the config to the match actions in the selectors, and the BPF program reports the matching index. In user space, the URL or FQDN is retrieved from the table using this index.
Note that only one URL and/or FQDN action is permitted per selector. It will be possible to enable multiple if necessary, but it is deemed that a single trigger should be sufficient to trigger any further triggers.
[Upstream commit: 15d2eaa]