[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <47CF2CFA.6000704@cosmosbay.com>
Date: Thu, 06 Mar 2008 00:30:02 +0100
From: Eric Dumazet <dada1@...mosbay.com>
To: David Miller <davem@...emloft.net>
CC: netdev@...r.kernel.org
Subject: Re: [IPV4]: Add an 'rtable' field in struct sk_buff to alias 'dst'
field and avoid casts
David Miller a écrit :
> From: Eric Dumazet <dada1@...mosbay.com>
> Date: Tue, 04 Mar 2008 08:36:43 +0100
>
>> Yes, I had this idea, but felt that it was better in this case to have a
>> dst_hold() that refers to the above affectation.
>>
>> skb->dst = &__fake_rtable.u.dst;
>> dst_hold(skb->dst);
>>
>> instead of
>>
>> skb->rtable = &__fake_rtable;
>> dst_hold(skb->dst);
>>
>> Do you prefer the later ?
>
> Wouldn't it be pleasant if you could pass
> &__fake_rtable to dst_hold() directly?
>
> Can't we do that by making it's arg an anonymous union like the thing
> you're doing here?
Hi David
Please find a 2nd version of the patch, respined to last net-2.6.26.
I could not find a clean way to use an anonymous union for dst_hold(), so I
made a small change in net/bridge/br_netfilter.c
Thank you
[IPV4]: Add an 'rtable' field in struct sk_buff to alias 'dst' field and avoid
casts
(Anonymous) unions can help us to avoid ugly casts.
A common cast it the (struct rtable *)skb->dst one.
Defining an union like :
union {
struct dst_entry *dst;
struct rtable *rtable;
};
permits to use dkb->rtable in place.
Signed-off-by: Eric Dumazet <dada1@...mosbay.com>
View attachment "rtable_alias.patch" of type "text/plain" (20784 bytes)
Powered by blists - more mailing lists