Search code examples
linuxlinux-kerneltrafficshaping

tc filter drop matched packets


I'm looking to add a set of filters that would drop packets that match parameters. It seems tc filters do not support drop action based on match, but based on qos parameters. Has anyone been able to place tc drop filters?

The most common method i've found thus far is to to mark it using tc and then us iptables to drop the marked packet, but that is not as efficient in my opinion.


Solution

  • tc filter supports drop action based on match. This is actually more straight forward than i anticipated

    An example below would drop all IP GRE traffic on interface eth3

    # add an ingress qdisc
    tc qdisc add dev eth3 ingress
    # filter on ip GRE traffic (protocol 47)
    tc filter add dev eth3 parent ffff: protocol ip prio 6 u32 match ip protocol 47 0x47 flowid 1:16 action drop