]> git.proxmox.com Git - mirror_iproute2.git/commit
iproute2: fix MPLS label parsing
authorGuillaume Nault <gnault@redhat.com>
Wed, 11 Mar 2020 15:16:36 +0000 (16:16 +0100)
committerStephen Hemminger <stephen@networkplumber.org>
Sun, 15 Mar 2020 16:56:53 +0000 (09:56 -0700)
commit72cc0bafb9f8af217283f7757397242cb7ca8b2d
tree9948f76bfedf92e07cd1b89ef50ff8b2030c72b7
parentd9b868436a6fce8986560178c6d1a78072e21861
iproute2: fix MPLS label parsing

The initial value of "label" in parse_mpls() is 0xffffffff. Therefore
we should test for this value, and not 0, to detect if a label has been
provided. The "!label" test not only fails to detect a missing label
parameter, it also prevents the use of the IPv4 explicit NULL label,
which actually equals 0.

Reproducer:
  $ ip link add name dm0 type dummy
  $ tc qdisc add dev dm0 ingress

  $ tc filter add dev dm0 parent ffff: matchall action mpls push
  Error: act_mpls: Label is required for MPLS push.
  We have an error talking to the kernel
  --> Filter was pushed to the kernel, where it got rejected.

  $ tc filter add dev dm0 parent ffff: matchall action mpls push label 0
  Error: argument "label" is required
  --> Label 0 was rejected by iproute2.

Expected result:
  $ tc filter add dev dm0 parent ffff: matchall action mpls push
  Error: argument "label" is required
  --> Filter was directly rejected by iproute2.

  $ tc filter add dev dm0 parent ffff: matchall action mpls push label 0
  --> Filter is accepted.

Signed-off-by: Guillaume Nault <gnault@redhat.com>
Signed-off-by: Stephen Hemminger <stephen@networkplumber.org>
tc/m_mpls.c