Skip to content

Commit

Permalink
cls_flower: Add extack support for flags key
Browse files Browse the repository at this point in the history
Pass extack down to fl_set_key_flags() and set message on error.

Signed-off-by: Guillaume Nault <gnault@redhat.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
  • Loading branch information
Guillaume Nault authored and David S. Miller committed Mar 27, 2020
1 parent bd7d4c1 commit e304e21
Showing 1 changed file with 7 additions and 4 deletions.
11 changes: 7 additions & 4 deletions net/sched/cls_flower.c
Original file line number Diff line number Diff line change
Expand Up @@ -856,14 +856,16 @@ static void fl_set_key_flag(u32 flower_key, u32 flower_mask,
}
}

static int fl_set_key_flags(struct nlattr **tb,
u32 *flags_key, u32 *flags_mask)
static int fl_set_key_flags(struct nlattr **tb, u32 *flags_key,
u32 *flags_mask, struct netlink_ext_ack *extack)
{
u32 key, mask;

/* mask is mandatory for flags */
if (!tb[TCA_FLOWER_KEY_FLAGS_MASK])
if (!tb[TCA_FLOWER_KEY_FLAGS_MASK]) {
NL_SET_ERR_MSG(extack, "Missing flags mask");
return -EINVAL;
}

key = be32_to_cpu(nla_get_u32(tb[TCA_FLOWER_KEY_FLAGS]));
mask = be32_to_cpu(nla_get_u32(tb[TCA_FLOWER_KEY_FLAGS_MASK]));
Expand Down Expand Up @@ -1474,7 +1476,8 @@ static int fl_set_key(struct net *net, struct nlattr **tb,
return ret;

if (tb[TCA_FLOWER_KEY_FLAGS])
ret = fl_set_key_flags(tb, &key->control.flags, &mask->control.flags);
ret = fl_set_key_flags(tb, &key->control.flags,
&mask->control.flags, extack);

return ret;
}
Expand Down

0 comments on commit e304e21

Please sign in to comment.