cls_flower: Support filtering on multiple MPLS Label Stack Entries
authorGuillaume Nault <gnault@redhat.com>
Tue, 26 May 2020 12:29:04 +0000 (14:29 +0200)
committerDavid S. Miller <davem@davemloft.net>
Tue, 26 May 2020 22:22:58 +0000 (15:22 -0700)
commit61aec25a6db5d0c2e8ab5da6d2d152269d0d9d69
treead9b6ab061d286f977a84cf728da2676f0895d6f
parent58cff782cc55eb755826c649976aea9f5f8b3086
cls_flower: Support filtering on multiple MPLS Label Stack Entries

With struct flow_dissector_key_mpls now recording the first
FLOW_DIS_MPLS_MAX labels, we can extend Flower to filter on any of
these LSEs independently.

In order to avoid creating new netlink attributes for every possible
depth, let's define a new TCA_FLOWER_KEY_MPLS_OPTS nested attribute
that contains the list of LSEs to match. Each LSE is represented by
another attribute, TCA_FLOWER_KEY_MPLS_OPTS_LSE, which then contains
the attributes representing the depth and the MPLS fields to match at
this depth (label, TTL, etc.).

For each MPLS field, the mask is always set to all-ones, as this is
what the original API did. We could allow user configurable masks in
the future if there is demand for more flexibility.

The new API also allows to only specify an LSE depth. In that case,
Flower only verifies that the MPLS label stack depth is greater or
equal to the provided depth (that is, an LSE exists at this depth).

Filters that only match on one (or more) fields of the first LSE are
dumped using the old netlink attributes, to avoid confusing user space
programs that don't understand the new API.

Signed-off-by: Guillaume Nault <gnault@redhat.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
include/uapi/linux/pkt_cls.h
net/sched/cls_flower.c