|
@@ -224,9 +224,6 @@ static int ovs_ct_set_labels(struct sk_buff *skb, struct sw_flow_key *key,
|
|
struct nf_conn *ct;
|
|
struct nf_conn *ct;
|
|
int err;
|
|
int err;
|
|
|
|
|
|
- if (!IS_ENABLED(CONFIG_NF_CONNTRACK_LABELS))
|
|
|
|
- return -ENOTSUPP;
|
|
|
|
-
|
|
|
|
/* The connection could be invalid, in which case set_label is no-op.*/
|
|
/* The connection could be invalid, in which case set_label is no-op.*/
|
|
ct = nf_ct_get(skb, &ctinfo);
|
|
ct = nf_ct_get(skb, &ctinfo);
|
|
if (!ct)
|
|
if (!ct)
|
|
@@ -587,6 +584,10 @@ static int parse_ct(const struct nlattr *attr, struct ovs_conntrack_info *info,
|
|
case OVS_CT_ATTR_MARK: {
|
|
case OVS_CT_ATTR_MARK: {
|
|
struct md_mark *mark = nla_data(a);
|
|
struct md_mark *mark = nla_data(a);
|
|
|
|
|
|
|
|
+ if (!mark->mask) {
|
|
|
|
+ OVS_NLERR(log, "ct_mark mask cannot be 0");
|
|
|
|
+ return -EINVAL;
|
|
|
|
+ }
|
|
info->mark = *mark;
|
|
info->mark = *mark;
|
|
break;
|
|
break;
|
|
}
|
|
}
|
|
@@ -595,6 +596,10 @@ static int parse_ct(const struct nlattr *attr, struct ovs_conntrack_info *info,
|
|
case OVS_CT_ATTR_LABELS: {
|
|
case OVS_CT_ATTR_LABELS: {
|
|
struct md_labels *labels = nla_data(a);
|
|
struct md_labels *labels = nla_data(a);
|
|
|
|
|
|
|
|
+ if (!labels_nonzero(&labels->mask)) {
|
|
|
|
+ OVS_NLERR(log, "ct_labels mask cannot be 0");
|
|
|
|
+ return -EINVAL;
|
|
|
|
+ }
|
|
info->labels = *labels;
|
|
info->labels = *labels;
|
|
break;
|
|
break;
|
|
}
|
|
}
|
|
@@ -705,11 +710,12 @@ int ovs_ct_action_to_attr(const struct ovs_conntrack_info *ct_info,
|
|
if (IS_ENABLED(CONFIG_NF_CONNTRACK_ZONES) &&
|
|
if (IS_ENABLED(CONFIG_NF_CONNTRACK_ZONES) &&
|
|
nla_put_u16(skb, OVS_CT_ATTR_ZONE, ct_info->zone.id))
|
|
nla_put_u16(skb, OVS_CT_ATTR_ZONE, ct_info->zone.id))
|
|
return -EMSGSIZE;
|
|
return -EMSGSIZE;
|
|
- if (IS_ENABLED(CONFIG_NF_CONNTRACK_MARK) &&
|
|
|
|
|
|
+ if (IS_ENABLED(CONFIG_NF_CONNTRACK_MARK) && ct_info->mark.mask &&
|
|
nla_put(skb, OVS_CT_ATTR_MARK, sizeof(ct_info->mark),
|
|
nla_put(skb, OVS_CT_ATTR_MARK, sizeof(ct_info->mark),
|
|
&ct_info->mark))
|
|
&ct_info->mark))
|
|
return -EMSGSIZE;
|
|
return -EMSGSIZE;
|
|
if (IS_ENABLED(CONFIG_NF_CONNTRACK_LABELS) &&
|
|
if (IS_ENABLED(CONFIG_NF_CONNTRACK_LABELS) &&
|
|
|
|
+ labels_nonzero(&ct_info->labels.mask) &&
|
|
nla_put(skb, OVS_CT_ATTR_LABELS, sizeof(ct_info->labels),
|
|
nla_put(skb, OVS_CT_ATTR_LABELS, sizeof(ct_info->labels),
|
|
&ct_info->labels))
|
|
&ct_info->labels))
|
|
return -EMSGSIZE;
|
|
return -EMSGSIZE;
|