netdev
[Top] [All Lists]

Re: [PATCH 4/6] PKT_SCHED: u32 ematch

To: Patrick McHardy <kaber@xxxxxxxxx>
Subject: Re: [PATCH 4/6] PKT_SCHED: u32 ematch
From: Thomas Graf <tgraf@xxxxxxx>
Date: Mon, 24 Jan 2005 01:58:53 +0100
Cc: "David S. Miller" <davem@xxxxxxxxxxxxx>, netdev@xxxxxxxxxxx
In-reply-to: <41F4402D.6040200@xxxxxxxxx>
References: <20050123230012.GB23931@xxxxxxxxxxxxxx> <20050123230354.GF23931@xxxxxxxxxxxxxx> <41F4402D.6040200@xxxxxxxxx>
Sender: netdev-bounce@xxxxxxxxxxx
* Patrick McHardy <41F4402D.6040200@xxxxxxxxx> 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. ;->

<Prev in Thread] Current Thread [Next in Thread>