diff options
author | Justin Pettit <jpettit@ovn.org> | 2018-07-03 22:05:40 -0700 |
---|---|---|
committer | Justin Pettit <jpettit@ovn.org> | 2018-07-30 17:57:13 -0700 |
commit | 23749245d2a4579564a747b9c8ed5f63efa2737f (patch) | |
tree | 8f955b9801d0dcf9e7dc9e66780fff038af690ae /ovn/utilities/ovn-nbctl.c | |
parent | 206ddb9adbac045fa00fd1727f273a0552fb9c28 (diff) | |
download | openvswitch-23749245d2a4579564a747b9c8ed5f63efa2737f.tar.gz |
ovn: Add rate-limiting for ACL logs.
Signed-off-by: Justin Pettit <jpettit@ovn.org>
Acked-by: Ben Pfaff <blp@ovn.org>
Diffstat (limited to 'ovn/utilities/ovn-nbctl.c')
-rw-r--r-- | ovn/utilities/ovn-nbctl.c | 13 |
1 files changed, 10 insertions, 3 deletions
diff --git a/ovn/utilities/ovn-nbctl.c b/ovn/utilities/ovn-nbctl.c index d891e766f..6b5ed4226 100644 --- a/ovn/utilities/ovn-nbctl.c +++ b/ovn/utilities/ovn-nbctl.c @@ -1822,7 +1822,10 @@ nbctl_acl_list(struct ctl_context *ctx) ds_put_format(&ctx->output, "name=%s,", acl->name); } if (acl->severity) { - ds_put_format(&ctx->output, "severity=%s", acl->severity); + ds_put_format(&ctx->output, "severity=%s,", acl->severity); + } + if (acl->meter) { + ds_put_format(&ctx->output, "meter=\"%s\",", acl->meter); } ds_chomp(&ctx->output, ','); ds_put_cstr(&ctx->output, ")"); @@ -1927,7 +1930,8 @@ nbctl_acl_add(struct ctl_context *ctx) bool log = shash_find(&ctx->options, "--log") != NULL; const char *severity = shash_find_data(&ctx->options, "--severity"); const char *name = shash_find_data(&ctx->options, "--name"); - if (log || severity || name) { + const char *meter = shash_find_data(&ctx->options, "--meter"); + if (log || severity || name || meter) { nbrec_acl_set_log(acl, true); } if (severity) { @@ -1940,6 +1944,9 @@ nbctl_acl_add(struct ctl_context *ctx) if (name) { nbrec_acl_set_name(acl, name); } + if (meter) { + nbrec_acl_set_meter(acl, meter); + } /* Check if same acl already exists for the ls/portgroup */ size_t n_acls = pg ? pg->n_acls : ls->n_acls; @@ -4801,7 +4808,7 @@ static const struct ctl_command_syntax nbctl_commands[] = { /* acl commands. */ { "acl-add", 5, 6, "{SWITCH | PORTGROUP} DIRECTION PRIORITY MATCH ACTION", NULL, nbctl_acl_add, NULL, - "--log,--may-exist,--type=,--name=,--severity=", RW }, + "--log,--may-exist,--type=,--name=,--severity=,--meter=", RW }, { "acl-del", 1, 4, "{SWITCH | PORTGROUP} [DIRECTION [PRIORITY MATCH]]", NULL, nbctl_acl_del, NULL, "--type=", RW }, { "acl-list", 1, 1, "{SWITCH | PORTGROUP}", |