aboutsummaryrefslogtreecommitdiffstats
path: root/net/openvswitch/meter.c
diff options
context:
space:
mode:
authorJohannes Berg <johannes.berg@intel.com>2019-04-26 08:07:31 -0400
committerDavid S. Miller <davem@davemloft.net>2019-04-27 17:07:22 -0400
commitef6243acb4782df587a4d7d6c310fa5b5d82684b (patch)
tree81b4175fc03c61adbb8935f5f7b8ce02589c65dd /net/openvswitch/meter.c
parent56738f460841761abc70347c919d5c45f6f05a42 (diff)
genetlink: optionally validate strictly/dumps
Add options to strictly validate messages and dump messages, sometimes perhaps validating dump messages non-strictly may be required, so add an option for that as well. Since none of this can really be applied to existing commands, set the options everwhere using the following spatch: @@ identifier ops; expression X; @@ struct genl_ops ops[] = { ..., { .cmd = X, + .validate = GENL_DONT_VALIDATE_STRICT | GENL_DONT_VALIDATE_DUMP, ... }, ... }; For new commands one should just not copy the .validate 'opt-out' flags and thus get strict validation. Signed-off-by: Johannes Berg <johannes.berg@intel.com> Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'net/openvswitch/meter.c')
-rw-r--r--net/openvswitch/meter.c4
1 files changed, 4 insertions, 0 deletions
diff --git a/net/openvswitch/meter.c b/net/openvswitch/meter.c
index 9c89e8539a5a..bb67238f0340 100644
--- a/net/openvswitch/meter.c
+++ b/net/openvswitch/meter.c
@@ -526,20 +526,24 @@ bool ovs_meter_execute(struct datapath *dp, struct sk_buff *skb,
526 526
527static struct genl_ops dp_meter_genl_ops[] = { 527static struct genl_ops dp_meter_genl_ops[] = {
528 { .cmd = OVS_METER_CMD_FEATURES, 528 { .cmd = OVS_METER_CMD_FEATURES,
529 .validate = GENL_DONT_VALIDATE_STRICT | GENL_DONT_VALIDATE_DUMP,
529 .flags = 0, /* OK for unprivileged users. */ 530 .flags = 0, /* OK for unprivileged users. */
530 .doit = ovs_meter_cmd_features 531 .doit = ovs_meter_cmd_features
531 }, 532 },
532 { .cmd = OVS_METER_CMD_SET, 533 { .cmd = OVS_METER_CMD_SET,
534 .validate = GENL_DONT_VALIDATE_STRICT | GENL_DONT_VALIDATE_DUMP,
533 .flags = GENL_ADMIN_PERM, /* Requires CAP_NET_ADMIN 535 .flags = GENL_ADMIN_PERM, /* Requires CAP_NET_ADMIN
534 * privilege. 536 * privilege.
535 */ 537 */
536 .doit = ovs_meter_cmd_set, 538 .doit = ovs_meter_cmd_set,
537 }, 539 },
538 { .cmd = OVS_METER_CMD_GET, 540 { .cmd = OVS_METER_CMD_GET,
541 .validate = GENL_DONT_VALIDATE_STRICT | GENL_DONT_VALIDATE_DUMP,
539 .flags = 0, /* OK for unprivileged users. */ 542 .flags = 0, /* OK for unprivileged users. */
540 .doit = ovs_meter_cmd_get, 543 .doit = ovs_meter_cmd_get,
541 }, 544 },
542 { .cmd = OVS_METER_CMD_DEL, 545 { .cmd = OVS_METER_CMD_DEL,
546 .validate = GENL_DONT_VALIDATE_STRICT | GENL_DONT_VALIDATE_DUMP,
543 .flags = GENL_ADMIN_PERM, /* Requires CAP_NET_ADMIN 547 .flags = GENL_ADMIN_PERM, /* Requires CAP_NET_ADMIN
544 * privilege. 548 * privilege.
545 */ 549 */