From: =?iso-8859-1?Q?Christian_R=F6=DFner?= Date: Fri, 11 Apr 2014 06:28:36 +0000 Subject: Re: tc nexthdr Message-Id: <4778774A-3394-401A-AC9F-2F557B88EF9D@sys4.de> MIME-Version: 1 Content-Type: multipart/mixed; boundary="Apple-Mail=_521BB0BA-590F-40CA-BBE3-1FAEE91354DB" List-Id: References: <8B7BC216-6397-41E8-B39C-66178AD6C805@sys4.de> In-Reply-To: <8B7BC216-6397-41E8-B39C-66178AD6C805@sys4.de> To: lartc@vger.kernel.org --Apple-Mail=_521BB0BA-590F-40CA-BBE3-1FAEE91354DB Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset=windows-1252 Hi Anton, > You are trying to use the offset. It's valid only after linking. >=20 > See http://ace-host.stuart.id.au/russell/files/tc/doc/cls_u32.txt for > details and examples. thank you for your reply :) And thanks for the link Remy got nDPI kernel module compiled and I have included all this on our = router. Seems to work so far. Even nDPI is great, RDP detection needs some tweaks, as it covers all = RDP codecs including video, which I did not want to match. I actually = limit the length as well from minimum 20 up to 200 bytes. I also could do the length test in u32, as I have this information in = UDP. But some codecs have a dynamic PT, so I can not stay with u32 and = need nDPI ;-) Thanks for all your help Christian > 2014-04-10 12:57 GMT+04:00 Christian R=F6=DFner : >> Hi, >>=20 >> this is my first post to this list. >>=20 >> I try to match several RTPv2 codecs with tc u32 and I ended up with = the following: >>=20 >> tc filter add dev mydevice protocol ip parent 1:0 pref 3 u32 \ >> match ip protocol 0x11 0xFF \ >> match u16 0x8008 0xC07F at 28 \ >> flowid 1:110 >>=20 >> So far this works. It means (at least I hope so): >>=20 >> - match UDP, >> - match the first two bytes in the UDP payload, which are part of the = RTP header >> - first two bits say =84version 2=93 RTP >> - last 7 bits encode the codec. In this example G.711 PCMA >>=20 >> So now this code is just working for IPv4. And I would like to have a = more generic one using nexthdr. So I tried: >>=20 >> tc filter add dev mydevice protocol ip parent 1:0 pref 3 u32 \ >> match ip protocol 0x11 0xFF \ >> match u16 0x8008 0xC07F at nexthdr+4 \ >> flowid 1:110 >>=20 >> Problem with this is that it matches packets, but when doing a test = call with VoIP I can see that it does not match RTP traffic but some = wrong traffic. So I guess my =84nexthdr+4=93 is wrong. I thought that = the nexthdr depends on the selector u16 and therefor needs to be 4. = 4*16=3D64, which should be 8 bytes offset to UDP, which is the beginning = of the payload, isn=92t it? >>=20 >> Can someone help me fixing this rule? Thanks in advance -Christian R=F6=DFner -- [*] sys4 AG http://sys4.de, +49 (89) 30 90 46 64 Franziskanerstra=DFe 15, 81669 M=FCnchen Sitz der Gesellschaft: M=FCnchen, Amtsgericht M=FCnchen: HRB 199263 Vorstand: Patrick Ben Koetter, Marc Schiffbauer Aufsichtsratsvorsitzender: Florian Kirstein --Apple-Mail=_521BB0BA-590F-40CA-BBE3-1FAEE91354DB Content-Transfer-Encoding: 7bit Content-Disposition: attachment; filename=signature.asc Content-Type: application/pgp-signature; name=signature.asc Content-Description: Message signed with OpenPGP using GPGMail -----BEGIN PGP SIGNATURE----- Comment: GPGTools - http://gpgtools.org iQEcBAEBAgAGBQJTR4uUAAoJEDulekoEoTV3zngIAL9gHM8JTU/KqNnHYrs2o9v4 /lsraoYS706fuFRe2+BuZrE0UO2pmpCrOQAtKv7D9A9SAq96FOnYmPXEbRVQuLb6 c6A7zOiP1kheKhndNQTsSkHGbvWG8mx3vwFxCq662adRO/mHx0mY8B5u6xxE95SH F/u9yL5C1tyyLyOaNkAL0KXU0JXCrvMJ6phLR5WbZuUBFWpNkojL0UiEk6yZLz+K bJqRhjNqAfzQN3qyFLsLCUsBbk1zb+kK8M0pirMGuPTva2aWBH/5T2MABeS0z2UR BU+ruJytZomjLcBHTNiqJcd/6Hgb+v3byrkJaGVfiez5JQa1W0JTB3YV0kIh4bk= =XDf+ -----END PGP SIGNATURE----- --Apple-Mail=_521BB0BA-590F-40CA-BBE3-1FAEE91354DB--