X-Git-Url: http://git.onelab.eu/?p=distributedratelimiting.git;a=blobdiff_plain;f=drl%2Fulogd_DRL.c;h=f9d6d5642ea19ddef4773b289506d8cd24984c23;hp=83e5f137ec95369eba9d7d6ff3e8559291290a1c;hb=9f79e9f0c22d7d87c4369ca6441571d9c155bf95;hpb=17fba5cc2628df108d09ab4abbbd4b4a7437e7eb diff --git a/drl/ulogd_DRL.c b/drl/ulogd_DRL.c index 83e5f13..f9d6d56 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 partition = { +static config_entry_t enforce_on = { .next = NULL, + .key = "enforce_on", + .type = CONFIG_TYPE_INT, + .options = CONFIG_OPT_NONE, + .u = { .value = 1 }, +}; + +static config_entry_t partition = { + .next = &enforce_on, .key = "partition_set", .type = CONFIG_TYPE_INT, .options = CONFIG_OPT_NONE, @@ -1782,6 +1790,13 @@ static void _drl_reg_op(void) fprintf(stderr, "An error has occured starting ulogd_DRL. Refer to your logfile (%s) for additional information.\n", drl_logfile.u.string); exit(EXIT_FAILURE); } + + if (enforce_on.u.value) { + pthread_rwlock_wrlock(&limiter.limiter_lock); + do_enforcement = 1; + printlog(LOG_CRITICAL, "--Switching enforcement on.--\n"); + pthread_rwlock_unlock(&limiter.limiter_lock); + } } void _init(void)