On 11 July 2014 11:29, Daniele Di Proietto <[email protected]> wrote:
> -static void sw_flow_mask_set(struct sw_flow_mask *mask,
> - struct sw_flow_key_range *range, u8 val)
> +/* We expect the nlattr stream to be already validated */
> +static int nlattr_set(struct nlattr *attr, u8 val, bool parent)
> {
> - u8 *m = (u8 *)&mask->key + range->start;
> + struct nlattr *nla;
> + int rem;
> +
> + nla_for_each_nested(nla, attr, rem) {
> + u16 type = nla_type(nla);
>
> - mask->range = *range;
> - memset(m, val, range_n_bytes(range));
> + /* If we are parsing the parent attribute, we may encounter
> + * nested attributes. To deal with them we call ourselves
> + */
> + if (parent && (type == OVS_KEY_ATTR_ENCAP ||
> + type == OVS_KEY_ATTR_TUNNEL)) {
> + nlattr_set(nla, val, false);
> + } else {
> + memset(nla_data(nla), val, nla_len(nla));
> + }
> + }
> +
> + return 0;
> +}
> +
> +static int mask_set_nlattr(struct nlattr *attr, u8 val)
> +{
> + return nlattr_set(attr, val, true);
> }
>
Is there a reason why these functions return an int? It doesn't look like
they can fail.
_______________________________________________
dev mailing list
[email protected]
http://openvswitch.org/mailman/listinfo/dev