]> git.ipfire.org Git - thirdparty/nftables.git/commit
src: meta priority support using tc classid
authorPablo Neira Ayuso <pablo@netfilter.org>
Tue, 16 Aug 2016 21:30:18 +0000 (23:30 +0200)
committerPablo Neira Ayuso <pablo@netfilter.org>
Thu, 18 Aug 2016 01:14:58 +0000 (03:14 +0200)
commit6f2eb8548e0d18078989adec069b438b2f154767
tree6e2e838e8a6c20f24a8ce2d8fea65e0fa3966f26
parent860979abdbe3081c310a5acd9250abdfcb741ce4
src: meta priority support using tc classid

This patch adds the missing bits to scan and parse the meta priority
handle as expressed by tc classid major:minor syntax.

The :minor syntax is not support for two reason: major is always >= 1
and this clashes with port syntax in nat.

Here below, several example on how to match the packet priority field:

   nft add rule filter forward meta priority abcd:0
   nft add rule filter forward meta priority abcd:1234

and to set it, you have to:

   nft add rule filter forward meta priority set abcd:1234

The priority expression in flex looks ahead to restrict the pattern to
avoid problems with mappings:

{classid}/[ \t\n:\-},]

So the following doesn't break:

   ... vmap { 25:accept }
              ^^^^^

The lookahead expression requires a slight change to extend the input
string in one byte.

This patch is conservative as you always have to explicity indicate
major and minor numbers even if zero.

We could consider supporting this shortcut in the future:

abcd:

However, with regards to this:

:abcd

We don't need to support it since major number is assumed to be >= 1.
However, if we ever decide to support this, we'll have problems since
this clashes with our port representation in redirect and mangle.

So let's keep this simple and start with this approach.

Signed-off-by: Pablo Neira Ayuso <pablo@netfilter.org>
src/cli.c
src/erec.c
src/main.c
src/meta.c
src/scanner.l
src/statement.c
tests/py/any/meta.t
tests/py/any/meta.t.payload