Skip to content

Commit

Permalink
net: sched: em_ipt: add support for addrtype matching
Browse files Browse the repository at this point in the history
Allow em_ipt to use addrtype for matching. Restrict the use only to
revision 1 which has IPv6 support. Since it's a NFPROTO_UNSPEC xt match
we use the user-specified nfproto for matching, in case it's unspecified
both v4/v6 will be matched by the rule.

v2: no changes, was patch 5 in v1

Signed-off-by: Nikolay Aleksandrov <nikolay@cumulusnetworks.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
  • Loading branch information
Nikolay Aleksandrov authored and David S. Miller committed Jun 29, 2019
1 parent ba3d24d commit 0c4231c
Showing 1 changed file with 14 additions and 0 deletions.
14 changes: 14 additions & 0 deletions net/sched/em_ipt.c
Original file line number Diff line number Diff line change
Expand Up @@ -72,11 +72,25 @@ static int policy_validate_match_data(struct nlattr **tb, u8 mrev)
return 0;
}

static int addrtype_validate_match_data(struct nlattr **tb, u8 mrev)
{
if (mrev != 1) {
pr_err("only addrtype match revision 1 supported");
return -EINVAL;
}

return 0;
}

static const struct em_ipt_xt_match em_ipt_xt_matches[] = {
{
.match_name = "policy",
.validate_match_data = policy_validate_match_data
},
{
.match_name = "addrtype",
.validate_match_data = addrtype_validate_match_data
},
{}
};

Expand Down

0 comments on commit 0c4231c

Please sign in to comment.