+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;
+}
+