]> git.proxmox.com Git - mirror_ubuntu-zesty-kernel.git/commit
net sched actions: Add support for user cookies
authorJamal Hadi Salim <jhs@mojatatu.com>
Tue, 24 Jan 2017 12:02:41 +0000 (07:02 -0500)
committerTim Gardner <tim.gardner@canonical.com>
Mon, 20 Mar 2017 11:53:33 +0000 (05:53 -0600)
commitfc0cef7a8ec1e63ee3405f642983dd86e04ab6cc
treec12728bfb2f635bef1e2e78c2ea2fc416a0f53df
parentb220bc83d8d01196373b1b14689013080c84af92
net sched actions: Add support for user cookies

BugLink: http://bugs.launchpad.net/bugs/1674087
Introduce optional 128-bit action cookie.
Like all other cookie schemes in the networking world (eg in protocols
like http or existing kernel fib protocol field, etc) the idea is to save
user state that when retrieved serves as a correlator. The kernel
_should not_ intepret it.  The user can store whatever they wish in the
128 bits.

Sample exercise(showing variable length use of cookie)

.. create an accept action with cookie a1b2c3d4
sudo $TC actions add action ok index 1 cookie a1b2c3d4

.. dump all gact actions..
sudo $TC -s actions ls action gact

    action order 0: gact action pass
     random type none pass val 0
     index 1 ref 1 bind 0 installed 5 sec used 5 sec
    Action statistics:
    Sent 0 bytes 0 pkt (dropped 0, overlimits 0 requeues 0)
    backlog 0b 0p requeues 0
    cookie a1b2c3d4

.. bind the accept action to a filter..
sudo $TC filter add dev lo parent ffff: protocol ip prio 1 \
u32 match ip dst 127.0.0.1/32 flowid 1:1 action gact index 1

... send some traffic..
$ ping 127.0.0.1 -c 3
PING 127.0.0.1 (127.0.0.1) 56(84) bytes of data.
64 bytes from 127.0.0.1: icmp_seq=1 ttl=64 time=0.020 ms
64 bytes from 127.0.0.1: icmp_seq=2 ttl=64 time=0.027 ms
64 bytes from 127.0.0.1: icmp_seq=3 ttl=64 time=0.038 ms

Signed-off-by: David S. Miller <davem@davemloft.net>
(back ported from commit 1045ba77a5962a22bce7777678ef46714107ea63)
Signed-off-by: Tim Gardner <tim.gardner@canonical.com>
Conflicts:
include/uapi/linux/pkt_cls.h
include/net/act_api.h
include/net/pkt_cls.h
include/uapi/linux/pkt_cls.h
net/sched/act_api.c