return ident;
}
+static int validate_htb_exists(int node, int parent) {
+ FILE *pipe = popen("/sbin/tc class show dev eth0", "r");
+ char line[200];
+
+ while (fgets(line, 200, pipe) != NULL) {
+ int n, p;
+ char ignore[200];
+
+ sscanf(line, "class htb 1:%x parent 1:%x prio %s", &n, &p, ignore);
+ if (n == node && p == parent) {
+ pclose(pipe);
+ return 0;
+ }
+ }
+
+ pclose(pipe);
+ return 1;
+}
+
/* Determines the validity of the parameters of one ident_config.
*
* 0 valid
printlog(LOG_CRITICAL, "When create_htb is disabled in ulogd.conf, an identity must specify the htb_node and htb_parent propertities in its configuration.\n");
return 1;
}
+
+ if (validate_htb_exists(config->htb_node, config->htb_parent)) {
+ printlog(LOG_CRITICAL, "Identity specified htb node %x with parent %x. No such node/parent combo seems to exist!\n", config->htb_node, config->htb_parent);
+ return 1;
+ }
} else {
if (config->htb_node > -1 || config->htb_parent > -1) {
printlog(LOG_WARN, "htb_node or htb_parent are configured but ignored because we're configured to create our own htb hierarchy.\n");