Code

libcollectdclient: Write only metrics with the requested security level.
authorFlorian Forster <octo@collectd.org>
Tue, 2 May 2017 09:21:48 +0000 (11:21 +0200)
committerFlorian Forster <octo@collectd.org>
Tue, 2 May 2017 09:21:48 +0000 (11:21 +0200)
src/libcollectdclient/network_parse.c

index 83a05d4f37d0da8b1e907de91bdd00a14dede122..3a428892e9b5e5edeba10f6cc7d3940a89249203 100644 (file)
@@ -529,9 +529,11 @@ static int network_parse(void *data, size_t data_size, lcc_security_level_t sl,
         return EINVAL;
       }
 
-      /* TODO(octo): skip if current_security_level < required_security_level */
+      int status = 0;
 
-      int status = opts->writer(&vl);
+      /* Write metrics if they have the required security level. */
+      if (sl >= opts->security_level)
+        status = opts->writer(&vl);
 
       free(vl.values);
       free(vl.values_types);