[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
@@ -619,7 +619,7 @@ static int ipgre_rcv(struct sk_buff *skb)
|
||||
#ifdef CONFIG_NET_IPGRE_BROADCAST
|
||||
if (ipv4_is_multicast(iph->daddr)) {
|
||||
/* Looped back packet, drop it! */
|
||||
if (((struct rtable*)skb->dst)->fl.iif == 0)
|
||||
if (skb->rtable->fl.iif == 0)
|
||||
goto drop;
|
||||
tunnel->stat.multicast++;
|
||||
skb->pkt_type = PACKET_BROADCAST;
|
||||
@@ -699,7 +699,7 @@ static int ipgre_tunnel_xmit(struct sk_buff *skb, struct net_device *dev)
|
||||
}
|
||||
|
||||
if (skb->protocol == htons(ETH_P_IP)) {
|
||||
rt = (struct rtable*)skb->dst;
|
||||
rt = skb->rtable;
|
||||
if ((dst = rt->rt_gateway) == 0)
|
||||
goto tx_error_icmp;
|
||||
}
|
||||
|
Reference in New Issue
Block a user