diff options
Diffstat (limited to 'src/libsystemd-bus')
-rw-r--r-- | src/libsystemd-bus/bus-bloom.c | 2 | ||||
-rw-r--r-- | src/libsystemd-bus/bus-control.c | 6 | ||||
-rw-r--r-- | src/libsystemd-bus/bus-kernel.c | 1 | ||||
-rw-r--r-- | src/libsystemd-bus/test-bus-kernel-bloom.c | 13 |
4 files changed, 20 insertions, 2 deletions
diff --git a/src/libsystemd-bus/bus-bloom.c b/src/libsystemd-bus/bus-bloom.c index cb65e47b4c..04bee8581e 100644 --- a/src/libsystemd-bus/bus-bloom.c +++ b/src/libsystemd-bus/bus-bloom.c @@ -49,6 +49,8 @@ void bloom_add_data(uint64_t filter[BLOOM_SIZE/8], const void *data, size_t n) { for (k = 0; k < ELEMENTSOF(hash); k++) set_bit(filter, hash[k] & 511); + + /* log_debug("bloom: adding <%.*s>", (int) n, (char*) data); */ } void bloom_add_pair(uint64_t filter[BLOOM_SIZE/8], const char *a, const char *b) { diff --git a/src/libsystemd-bus/bus-control.c b/src/libsystemd-bus/bus-control.c index 66f713082c..cb8618e5c5 100644 --- a/src/libsystemd-bus/bus-control.c +++ b/src/libsystemd-bus/bus-control.c @@ -406,8 +406,10 @@ int bus_add_match_internal( break; case BUS_MATCH_PATH_NAMESPACE: - bloom_add_pair(bloom, "path-slash-prefix", c->value_str); - using_bloom = true; + if (!streq(c->value_str, "/")) { + bloom_add_pair(bloom, "path-slash-prefix", c->value_str); + using_bloom = true; + } break; case BUS_MATCH_ARG...BUS_MATCH_ARG_LAST: { diff --git a/src/libsystemd-bus/bus-kernel.c b/src/libsystemd-bus/bus-kernel.c index 33c25a4fd9..19d274b662 100644 --- a/src/libsystemd-bus/bus-kernel.c +++ b/src/libsystemd-bus/bus-kernel.c @@ -141,6 +141,7 @@ static int bus_message_setup_bloom(sd_bus_message *m, void *bloom) { bloom_add_pair(bloom, "member", m->member); if (m->path) { bloom_add_pair(bloom, "path", m->path); + bloom_add_pair(bloom, "path-slash-prefix", m->path); bloom_add_prefixes(bloom, "path-slash-prefix", m->path, '/'); } diff --git a/src/libsystemd-bus/test-bus-kernel-bloom.c b/src/libsystemd-bus/test-bus-kernel-bloom.c index 02d9a98be9..5445d3488f 100644 --- a/src/libsystemd-bus/test-bus-kernel-bloom.c +++ b/src/libsystemd-bus/test-bus-kernel-bloom.c @@ -68,9 +68,11 @@ static void test_one( r = sd_bus_start(b); assert_se(r >= 0); + log_debug("match"); r = sd_bus_add_match(b, match, NULL, NULL); assert_se(r >= 0); + log_debug("signal"); r = sd_bus_emit_signal(a, path, interface, member, "s", arg0); assert_se(r >= 0); @@ -95,5 +97,16 @@ int main(int argc, char *argv[]) { test_one("/foo/bar/waldo", "waldo.com", "Piep", "foobar", "path='/foo/bar/waldo',interface='waldo.com',member='Piep',arg0='foobar'", true); test_one("/foo/bar/waldo", "waldo.com", "Piep", "foobar", "path='/foo/bar/waldo',interface='waldo.com',member='Piep',arg0='foobar2'", false); + test_one("/foo/bar/waldo", "waldo.com", "Piep", "foobar", "path='/foo/bar/waldo'", true); + test_one("/foo/bar/waldo", "waldo.com", "Piep", "foobar", "path='/foo/bar'", false); + test_one("/foo/bar/waldo", "waldo.com", "Piep", "foobar", "path='/foo'", false); + test_one("/foo/bar/waldo", "waldo.com", "Piep", "foobar", "path='/'", false); + test_one("/foo/bar/waldo", "waldo.com", "Piep", "foobar", "path='/foo/bar/waldo/quux'", false); + test_one("/foo/bar/waldo", "waldo.com", "Piep", "foobar", "path_namespace='/foo/bar/waldo'", true); + test_one("/foo/bar/waldo", "waldo.com", "Piep", "foobar", "path_namespace='/foo/bar'", true); + test_one("/foo/bar/waldo", "waldo.com", "Piep", "foobar", "path_namespace='/foo'", true); + test_one("/foo/bar/waldo", "waldo.com", "Piep", "foobar", "path_namespace='/'", true); + test_one("/foo/bar/waldo", "waldo.com", "Piep", "foobar", "path_namespace='/quux'", false); + return 0; } |