* Add the config options for DRL.
*/
-static config_entry_t bind_addr = {
+static config_entry_t leaves = {
.next = NULL,
+ .key = "leaves",
+ .type = CONFIG_TYPE_STRING,
+ .options = CONFIG_OPT_NONE,
+ .u = { .string = "PLANETLAB" },
+};
+
+static config_entry_t bind_addr = {
+ .next = &leaves,
.key = "bind_addr",
.type = CONFIG_TYPE_STRING,
.options = CONFIG_OPT_NONE,
.key = "policy",
.type = CONFIG_TYPE_STRING,
.options = CONFIG_OPT_MANDATORY,
- .u = { .string = "GRD" },
+ .u = { .string = "FPS" },
};
/** The estimate interval, in milliseconds. */
.key = "estintms",
.type = CONFIG_TYPE_INT,
.options = CONFIG_OPT_MANDATORY,
- .u = { .value = 100 },
+ .u = { .value = 500 },
};
#define config_entries (&estintms)
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];
+ if (parent != 0) {
+ 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;
+ sscanf(line, "class htb 1:%x parent 1:%x prio %s", &n, &p, ignore);
+ if (n == node && p == parent) {
+ pclose(pipe);
+ return 0;
+ }
+ }
+ } else {
+ while (fgets(line, 200, pipe) != NULL) {
+ int n, p;
+ char ignore[200];
+
+ sscanf(line, "class htb 1:%x root prio %d %s", &n, &p, ignore);
+ if (n == node && strstr(line, "root") != NULL) {
+ pclose(pipe);
+ return 0;
+ }
}
+
}
pclose(pipe);
return false;
}
- if (get_eligible_leaves(&limiter.stable_instance)) {
- printlog(LOG_CRITICAL, "Failed to read eligigle leaves.\n");
- return false;
+ /* If no leaves are specified, assume we're on planetlab and read them out
+ * of /proc/virtual. Otherwise, read the specified line. */
+ if (!strncmp(leaves.u.string, "PLANETLAB", 9)) {
+ if (get_eligible_leaves(&limiter.stable_instance)) {
+ printlog(LOG_CRITICAL, "Failed to read eligigle leaves.\n");
+ return false;
+ }
+ } else {
+ if (parse_leaves(&limiter.stable_instance, leaves.u.string)) {
+ printlog(LOG_CRITICAL, "Failed to parse leaf string.\n");
+ return false;
+ }
}
if (parse_drl_config(drl_configfile.u.string, &configs)) {
return;
}
- if (get_eligible_leaves(&limiter.new_instance)) {
- free_failed_config(configs, &limiter.new_instance);
- printlog(LOG_CRITICAL, "Failed to read leaves during reconfig().\n");
- return;
+ if (!strncmp(leaves.u.string, "PLANETLAB", 9)) {
+ if (get_eligible_leaves(&limiter.new_instance)) {
+ free_failed_config(configs, &limiter.new_instance);
+ printlog(LOG_CRITICAL, "Failed to read eligigle leaves.\n");
+ return false;
+ }
+ } else {
+ if (parse_leaves(&limiter.new_instance, leaves.u.string)) {
+ free_failed_config(configs, &limiter.new_instance);
+ printlog(LOG_CRITICAL, "Failed to parse leaf string.\n");
+ return false;
+ }
}
if (parse_drl_config(drl_configfile.u.string, &configs)) {