X-Git-Url: http://git.onelab.eu/?p=distributedratelimiting.git;a=blobdiff_plain;f=drl%2Fulogd_DRL.c;h=97f24bc7fb97334df7e969d802da649cf09d0e53;hp=e24b41cc1b3d43f3c2bd9c3bed5685a131442981;hb=4beac2bba3083d8ee73c49b9ad51e6af1e2c9af4;hpb=c9d6255f0c06ee41eb2c06a5f74a957ec7be3223 diff --git a/drl/ulogd_DRL.c b/drl/ulogd_DRL.c index e24b41c..97f24bc 100644 --- a/drl/ulogd_DRL.c +++ b/drl/ulogd_DRL.c @@ -124,8 +124,16 @@ * Add the config options for DRL. */ -static config_entry_t enforce_on = { +static config_entry_t create_htb = { .next = NULL, + .key = "create_htb", + .type = CONFIG_TYPE_INT, + .options = CONFIG_OPT_NONE, + .u = { .value = 1 }, +}; + +static config_entry_t enforce_on = { + .next = &create_htb, .key = "enforce_on", .type = CONFIG_TYPE_INT, .options = CONFIG_OPT_NONE, @@ -697,6 +705,11 @@ static identity_t *new_identity(ident_config *config) { ident->comm.remote_nodes = comm_nodes; + if (!create_htb.u.value) { + ident->htb_node = config->htb_node; + ident->htb_parent = config->htb_parent; + } + return ident; } @@ -736,6 +749,17 @@ static int validate_config(ident_config *config) { return 1; } + if (!create_htb.u.value) { + if (config->htb_node < 0 || config->htb_parent < 0) { + 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; + } + } 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"); + } + } + /* Note: Parsing stage requires that each ident has at least one peer. */ return 0; } @@ -1080,6 +1104,14 @@ static int assign_htb_hierarchy(drl_instance_t *instance) { int i, j; int next_node = 0x100; + /* If we're not going to create our own htb hierarchy (for instance, + * if we're going to let PL's node manager do it for us), then we don't + * want this function to do anything. */ + if (!create_htb.u.value) { + printlog(LOG_DEBUG, "Skipping assign_htb_hierarchy becase ulogd.conf's create_htb set to 0.\n"); + return 0; + } + /* Chain machine nodes under 1:10. */ for (i = 0; i < instance->machine_count; ++i) { if (instance->machines[i]->parent == NULL) { @@ -1171,6 +1203,14 @@ static int create_htb_hierarchy(drl_instance_t *instance) { int i, j, k; uint64_t gigabit = 1024 * 1024 * 1024; + /* If we're not going to create our own htb hierarchy (for instance, + * if we're going to let PL's node manager do it for us), then we don't + * want this function to do anything. */ + if (!create_htb.u.value) { + printlog(LOG_DEBUG, "Skipping create_htb_hierarchy becase ulogd.conf's create_htb set to 0.\n"); + return 0; + } + /* Nuke the hierarchy. */ sprintf(cmd, "tc qdisc del dev eth0 root handle 1: htb"); execute_cmd(cmd);