]> git.proxmox.com Git - mirror_iproute2.git/commit
tc actions: store and dump correct length of user cookies
authorSimon Horman <simon.horman@netronome.com>
Tue, 5 Sep 2017 11:06:24 +0000 (13:06 +0200)
committerStephen Hemminger <stephen@networkplumber.org>
Tue, 5 Sep 2017 16:25:46 +0000 (09:25 -0700)
commitb75e0f6f4b6b29e7bc2f103cbcfa99bef73527a0
tree5f69d78f791265738bd634776ad2fd4d87741bc4
parent7c87c7fed18d1162e045c8331cb68fa440bc5728
tc actions: store and dump correct length of user cookies

Correct two errors which cancel each other out:
* Do not send twice the length of the actual provided by the user to the kernel
* Do not dump half the length of the cookie provided by the kernel

As the cookie is now stored in the kernel at its correct length rather
than double the that length cookies of up to the maximum size of 16 bytes
may now be stored rather than a maximum of half that length.

Output of dump is the same before and after this change,
but the data stored in the kernel is now exactly the cookie
rather than the cookie + as many trailing zeros.

Before:
 # tc filter add dev eth0 protocol ip parent ffff: \
       flower ip_proto udp action drop \
       cookie 0123456789abcdef0123456789abcdef
 RTNETLINK answers: Invalid argument

After:
 # tc filter add dev eth0 protocol ip parent ffff: \
       flower ip_proto udp action drop \
       cookie 0123456789abcdef0123456789abcdef
 # tc filter show dev eth0 ingress
   eth_type ipv4
   ip_proto udp
   not_in_hw
 action order 1: gact action drop
  random type none pass val 0
  index 1 ref 1 bind 1 installed 1 sec used 1 sec
 Action statistics:
 Sent 0 bytes 0 pkt (dropped 0, overlimits 0 requeues 0)
 backlog 0b 0p requeues 0
 cookie len 16 0123456789abcdef0123456789abcdef

Fixes: fd8b3d2c1b9b ("actions: Add support for user cookies")
Cc: Jamal Hadi Salim <jhs@mojatatu.com>
Signed-off-by: Simon Horman <simon.horman@netronome.com>
tc/m_action.c