Commit 7a3025b1 authored by YOSHIFUJI Hideaki's avatar YOSHIFUJI Hideaki Committed by David S. Miller

[IPV6]: Introduce ip6_dst_idev() to get inet6_dev{} stored in dst_entry{}.

Otherwise, we will see a lot of casts...
Signed-off-by: default avatarYOSHIFUJI Hideaki <yoshfuji@linux-ipv6.org>
parent 40aa7b90
...@@ -107,6 +107,11 @@ struct rt6_info ...@@ -107,6 +107,11 @@ struct rt6_info
u8 rt6i_protocol; u8 rt6i_protocol;
}; };
static inline struct inet6_dev *ip6_dst_idev(struct dst_entry *dst)
{
return ((struct rt6_info *)dst)->rt6i_idev;
}
struct fib6_walker_t struct fib6_walker_t
{ {
struct fib6_walker_t *prev, *next; struct fib6_walker_t *prev, *next;
......
...@@ -1164,7 +1164,7 @@ int ipv6_dev_get_saddr(struct net_device *daddr_dev, ...@@ -1164,7 +1164,7 @@ int ipv6_dev_get_saddr(struct net_device *daddr_dev,
int ipv6_get_saddr(struct dst_entry *dst, int ipv6_get_saddr(struct dst_entry *dst,
struct in6_addr *daddr, struct in6_addr *saddr) struct in6_addr *daddr, struct in6_addr *saddr)
{ {
return ipv6_dev_get_saddr(dst ? ((struct rt6_info *)dst)->rt6i_idev->dev : NULL, daddr, saddr); return ipv6_dev_get_saddr(dst ? ip6_dst_idev(dst)->dev : NULL, daddr, saddr);
} }
......
...@@ -84,7 +84,7 @@ int ipv6_rcv(struct sk_buff *skb, struct net_device *dev, struct packet_type *pt ...@@ -84,7 +84,7 @@ int ipv6_rcv(struct sk_buff *skb, struct net_device *dev, struct packet_type *pt
* arrived via the sending interface (ethX), because of the * arrived via the sending interface (ethX), because of the
* nature of scoping architecture. --yoshfuji * nature of scoping architecture. --yoshfuji
*/ */
IP6CB(skb)->iif = skb->dst ? ((struct rt6_info *)skb->dst)->rt6i_idev->dev->ifindex : dev->ifindex; IP6CB(skb)->iif = skb->dst ? ip6_dst_idev(skb->dst)->dev->ifindex : dev->ifindex;
if (unlikely(!pskb_may_pull(skb, sizeof(*hdr)))) if (unlikely(!pskb_may_pull(skb, sizeof(*hdr))))
goto err; goto err;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment