From mboxrd@z Thu Jan 1 00:00:00 1970 From: Andy Furniss Date: Fri, 11 Sep 2015 10:52:51 +0000 Subject: Re: fw mark based tc class selection not working Message-Id: <55F2B283.1020702@gmail.com> List-Id: References: In-Reply-To: MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit To: lartc@vger.kernel.org Akshat Kakkar wrote: > Recently I came to know that, Without any options fw classifier maps > fwmark to classid. > > tc filter add dev parent protocol ip prio 1 fw > > i.e. if my packet has mark(0x10001) and class id is not set, then > above tc filter, will set class id = 0x10001 i.e. 1:1 > > But when I am trying it out, its not working! I am having class 1:1 > defined but its not at all hit. > > Am I missing something out here? Seems to be broken, below is a paste from a mail I sent to this list 2 years ago showing it working. The same test now (apart from I am using eth2 instead of eth0) doesn't work. tc qdisc add dev eth0 root handle 1: htb tc class add dev eth0 parent 1: classid 1:a htb rate 1mbit tc class add dev eth0 parent 1: classid 1:b htb rate 1mbit tc class add dev eth0 parent 1: classid 1:c htb rate 1mbit tc filter add dev eth0 parent 1:0 protocol ip fw iptables -t mangle -I OUTPUT -o eth0 -p tcp -j MARK --set-mark 0x1000a iptables -t mangle -I OUTPUT -o eth0 -p icmp -j MARK --set-mark 0x1000b iptables -t mangle -I OUTPUT -o eth0 -p udp -j MARK --set-mark 0x1000c ph4[/home/andy]# iptables -L OUTPUT -vnt mangle Chain OUTPUT (policy ACCEPT 84 packets, 14747 bytes) pkts bytes target prot opt in out source destination 3 196 MARK udp -- * eth0 0.0.0.0/0 0.0.0.0/0 MARK set 0x1000c 7 588 MARK icmp -- * eth0 0.0.0.0/0 0.0.0.0/0 MARK set 0x1000b 74 13963 MARK tcp -- * eth0 0.0.0.0/0 0.0.0.0/0 MARK set 0x1000a ph4[/home/andy]# tc -s class ls dev eth0 class htb 1:c root prio 0 rate 1000Kbit ceil 1000Kbit burst 2850b cburst 2850b Sent 238 bytes 3 pkt (dropped 0, overlimits 0 requeues 0) rate 0bit 0pps backlog 0b 0p requeues 0 lended: 3 borrowed: 0 giants: 0 tokens: 346750 ctokens: 346750 class htb 1:a root prio 0 rate 1000Kbit ceil 1000Kbit burst 2850b cburst 2850b Sent 14999 bytes 74 pkt (dropped 0, overlimits 0 requeues 0) rate 32bit 0pps backlog 0b 0p requeues 0 lended: 74 borrowed: 0 giants: 0 tokens: 348000 ctokens: 348000 class htb 1:b root prio 0 rate 1000Kbit ceil 1000Kbit burst 2850b cburst 2850b Sent 686 bytes 7 pkt (dropped 0, overlimits 0 requeues 0) rate 0bit 0pps backlog 0b 0p requeues 0 lended: 7 borrowed: 0 giants: 0 tokens: 344000 ctokens: 344000