On 16-06-04 12:24 PM, Daniel Borkmann wrote:
Add a possibility where the user can just specify the parent and
all filters under that parent are then being purged. Currently,
for example for scripting, one needs to specify pref/prio to have
a well-defined number for 'tc filter del' command for addressing
the previously created instance or additionally filter handle in
case of priorities being the same. Improve usage by allowing the
option for tc to specify the parent and removing the whole chain
for that given parent.

Example usage after patch, no tc changes required:

   # tc qdisc replace dev foo clsact
   # tc filter add dev foo egress bpf da obj ./bpf.o
   # tc filter add dev foo egress bpf da obj ./bpf.o
   # tc filter show dev foo egress
   filter protocol all pref 49151 bpf
   filter protocol all pref 49151 bpf handle 0x1 bpf.o:[classifier] 
direct-action
   filter protocol all pref 49152 bpf
   filter protocol all pref 49152 bpf handle 0x1 bpf.o:[classifier] 
direct-action
   # tc filter del dev foo egress
   # tc filter show dev foo egress
   #

Previously, RTM_DELTFILTER requests with invalid prio of 0 were
rejected, so only netlink requests with RTM_NEWTFILTER and NLM_F_CREATE
flag were allowed where the kernel would auto-generate a pref/prio.
We can piggyback on that and use prio of 0 as a wildcard for
requests of RTM_DELTFILTER.

Signed-off-by: Daniel Borkmann <dan...@iogearbox.net>


Looks good to me.
Acked-by: Jamal Hadi Salim <j...@mojatatu.com>

cheers,
jamal

Reply via email to