+ char runfile[STRING_SIZE];
+ snprintf(runfile, STRING_SIZE - 1, "/var/run/openvpn/%s-n2n", conn->name);
+ rc = recursive_remove(runfile);
+ if (rc)
+ perror(runfile);
+
+ return 0;
+}
+
+int deleterrd(char *name) {
+ char rrd_dir[STRING_SIZE];
+
+ connection *conn = getConnections();
+ while(conn) {
+ if (strcmp(conn->name, name) != 0) {
+ conn = conn->next;
+ continue;
+ }
+
+ // Handle RW connections
+ if (strcmp(conn->type, "host") == 0) {
+ snprintf(rrd_dir, STRING_SIZE - 1, "/var/log/rrd/collectd/localhost/openvpn-%s/", name);
+
+ // Handle N2N connections
+ } else if (strcmp(conn->type, "net") == 0) {
+ snprintf(rrd_dir, STRING_SIZE - 1, "/var/log/rrd/collectd/localhost/openvpn-%s-n2n/", name);
+
+ // Unhandled connection type
+ } else {
+ conn = conn->next;
+ continue;
+ }
+
+ return recursive_remove(rrd_dir);
+ }
+
+ return 1;