diff options
author | Joe Stringer <joestringer@nicira.com> | 2015-10-06 14:00:01 -0400 |
---|---|---|
committer | David S. Miller <davem@davemloft.net> | 2015-10-07 08:03:06 -0400 |
commit | ab38a7b5a4493a3658d891a8e91f9ffcb3d2defb (patch) | |
tree | 60bffa8ee121a82fcd16a55387a68cec62657ec9 /net/openvswitch | |
parent | fbccce5965a58d56aaed9e9acd1bec75d8a66e87 (diff) |
openvswitch: Change CT_ATTR_FLAGS to CT_ATTR_COMMIT
Previously, the CT_ATTR_FLAGS attribute, when nested under the
OVS_ACTION_ATTR_CT, encoded a 32-bit bitmask of flags that modify the
semantics of the ct action. It's more extensible to just represent each
flag as a nested attribute, and this requires no additional error
checking to reject flags that aren't currently supported.
Suggested-by: Ben Pfaff <blp@nicira.com>
Signed-off-by: Joe Stringer <joestringer@nicira.com>
Acked-by: Pravin B Shelar <pshelar@nicira.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'net/openvswitch')
-rw-r--r-- | net/openvswitch/conntrack.c | 13 |
1 files changed, 6 insertions, 7 deletions
diff --git a/net/openvswitch/conntrack.c b/net/openvswitch/conntrack.c index 466d5576fe3f..80bf702715bb 100644 --- a/net/openvswitch/conntrack.c +++ b/net/openvswitch/conntrack.c | |||
@@ -47,7 +47,7 @@ struct ovs_conntrack_info { | |||
47 | struct nf_conntrack_helper *helper; | 47 | struct nf_conntrack_helper *helper; |
48 | struct nf_conntrack_zone zone; | 48 | struct nf_conntrack_zone zone; |
49 | struct nf_conn *ct; | 49 | struct nf_conn *ct; |
50 | u32 flags; | 50 | u8 commit : 1; |
51 | u16 family; | 51 | u16 family; |
52 | struct md_mark mark; | 52 | struct md_mark mark; |
53 | struct md_labels labels; | 53 | struct md_labels labels; |
@@ -493,7 +493,7 @@ int ovs_ct_execute(struct net *net, struct sk_buff *skb, | |||
493 | return err; | 493 | return err; |
494 | } | 494 | } |
495 | 495 | ||
496 | if (info->flags & OVS_CT_F_COMMIT) | 496 | if (info->commit) |
497 | err = ovs_ct_commit(net, key, info, skb); | 497 | err = ovs_ct_commit(net, key, info, skb); |
498 | else | 498 | else |
499 | err = ovs_ct_lookup(net, key, info, skb); | 499 | err = ovs_ct_lookup(net, key, info, skb); |
@@ -539,8 +539,7 @@ static int ovs_ct_add_helper(struct ovs_conntrack_info *info, const char *name, | |||
539 | } | 539 | } |
540 | 540 | ||
541 | static const struct ovs_ct_len_tbl ovs_ct_attr_lens[OVS_CT_ATTR_MAX + 1] = { | 541 | static const struct ovs_ct_len_tbl ovs_ct_attr_lens[OVS_CT_ATTR_MAX + 1] = { |
542 | [OVS_CT_ATTR_FLAGS] = { .minlen = sizeof(u32), | 542 | [OVS_CT_ATTR_COMMIT] = { .minlen = 0, .maxlen = 0 }, |
543 | .maxlen = sizeof(u32) }, | ||
544 | [OVS_CT_ATTR_ZONE] = { .minlen = sizeof(u16), | 543 | [OVS_CT_ATTR_ZONE] = { .minlen = sizeof(u16), |
545 | .maxlen = sizeof(u16) }, | 544 | .maxlen = sizeof(u16) }, |
546 | [OVS_CT_ATTR_MARK] = { .minlen = sizeof(struct md_mark), | 545 | [OVS_CT_ATTR_MARK] = { .minlen = sizeof(struct md_mark), |
@@ -576,8 +575,8 @@ static int parse_ct(const struct nlattr *attr, struct ovs_conntrack_info *info, | |||
576 | } | 575 | } |
577 | 576 | ||
578 | switch (type) { | 577 | switch (type) { |
579 | case OVS_CT_ATTR_FLAGS: | 578 | case OVS_CT_ATTR_COMMIT: |
580 | info->flags = nla_get_u32(a); | 579 | info->commit = true; |
581 | break; | 580 | break; |
582 | #ifdef CONFIG_NF_CONNTRACK_ZONES | 581 | #ifdef CONFIG_NF_CONNTRACK_ZONES |
583 | case OVS_CT_ATTR_ZONE: | 582 | case OVS_CT_ATTR_ZONE: |
@@ -701,7 +700,7 @@ int ovs_ct_action_to_attr(const struct ovs_conntrack_info *ct_info, | |||
701 | if (!start) | 700 | if (!start) |
702 | return -EMSGSIZE; | 701 | return -EMSGSIZE; |
703 | 702 | ||
704 | if (nla_put_u32(skb, OVS_CT_ATTR_FLAGS, ct_info->flags)) | 703 | if (ct_info->commit && nla_put_flag(skb, OVS_CT_ATTR_COMMIT)) |
705 | return -EMSGSIZE; | 704 | return -EMSGSIZE; |
706 | if (IS_ENABLED(CONFIG_NF_CONNTRACK_ZONES) && | 705 | if (IS_ENABLED(CONFIG_NF_CONNTRACK_ZONES) && |
707 | nla_put_u16(skb, OVS_CT_ATTR_ZONE, ct_info->zone.id)) | 706 | nla_put_u16(skb, OVS_CT_ATTR_ZONE, ct_info->zone.id)) |