[IPV4]: Add 'rtable' field in struct sk_buff to alias 'dst' 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 skb->rtable in place. Signed-off-by: Eric Dumazet <dada1@cosmosbay.com> Signed-off-by: David S. Miller <davem@davemloft.net>
This commit is contained in:
committed by
David S. Miller
parent
a05c44f6d5
commit
ee6b967301
@@ -351,7 +351,7 @@ static int ip_rcv_finish(struct sk_buff *skb)
|
||||
if (iph->ihl > 5 && ip_rcv_options(skb))
|
||||
goto drop;
|
||||
|
||||
rt = (struct rtable*)skb->dst;
|
||||
rt = skb->rtable;
|
||||
if (rt->rt_type == RTN_MULTICAST)
|
||||
IP_INC_STATS_BH(IPSTATS_MIB_INMCASTPKTS);
|
||||
else if (rt->rt_type == RTN_BROADCAST)
|
||||
|
Reference in New Issue
Block a user