Received: with ECARTIS (v1.0.0; list netdev); Sun, 23 Jan 2005 16:58:37 -0800 (PST) Received: from b.mx.projectdream.org (eth0-0.arisu.projectdream.org [194.158.4.191]) by oss.sgi.com (8.13.0/8.13.0) with ESMTP id j0O0wXlm003164 for ; Sun, 23 Jan 2005 16:58:33 -0800 Received: from postel.suug.ch (postel.suug.ch [195.134.158.23]) (using TLSv1 with cipher EDH-RSA-DES-CBC3-SHA (168/168 bits)) (No client certificate requested) by b.mx.projectdream.org (Postfix) with ESMTP id 6F83085; Mon, 24 Jan 2005 01:58:10 +0100 (CET) Received: by postel.suug.ch (Postfix, from userid 10001) id 8A2FC1C0EA; Mon, 24 Jan 2005 01:58:53 +0100 (CET) Date: Mon, 24 Jan 2005 01:58:53 +0100 From: Thomas Graf To: Patrick McHardy Cc: "David S. Miller" , netdev@oss.sgi.com Subject: Re: [PATCH 4/6] PKT_SCHED: u32 ematch Message-ID: <20050124005853.GN23931@postel.suug.ch> References: <20050123230012.GB23931@postel.suug.ch> <20050123230354.GF23931@postel.suug.ch> <41F4402D.6040200@trash.net> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <41F4402D.6040200@trash.net> X-Virus-Scanned: ClamAV 0.80/650/Sun Jan 2 19:00:02 2005 clamav-milter version 0.80j on 127.0.0.1 X-Virus-Status: Clean X-archive-position: 691 X-ecartis-version: Ecartis v1.0.0 Sender: netdev-bounce@oss.sgi.com Errors-to: netdev-bounce@oss.sgi.com X-original-sender: tgraf@suug.ch Precedence: bulk X-list: netdev Content-Length: 807 Lines: 23 * Patrick McHardy <41F4402D.6040200@trash.net> 2005-01-24 01:24 > Thomas Graf wrote: > >+static int em_u32_match(struct sk_buff *skb, struct tcf_ematch *em, > >+ struct tcf_pkt_info *info) > >+{ > >+ struct tc_u32_key *key = (struct tc_u32_key *) em->data; > >+ unsigned char *ptr = skb->nh.raw; > >+ > >+ if (info) { > >+ if (info->ptr) > >+ ptr = info->ptr; > >+ ptr += (info->nexthdr & key->offmask); > >+ } > >+ > >+ return !((*(u32*) (ptr + key->off) ^ key->val) & key->mask); > > > > > This needs to make sure it stays inside the skb. I know cls_u32's checks > are pretty weak, but having nothing doesn't seem right. It's a exact copy with all the weaknesses inherited. I'll add a call to tcf_valid_offset, we'll lose the _feature_ to match areas in the page beyond the skb data though. ;->