]> git.karo-electronics.de Git - karo-tx-linux.git/commitdiff
[IPV6]: Introduce ip6_dst_idev() to get inet6_dev{} stored in dst_entry{}.
authorYOSHIFUJI Hideaki <yoshfuji@linux-ipv6.org>
Fri, 13 Oct 2006 07:17:25 +0000 (16:17 +0900)
committerDavid S. Miller <davem@sunset.davemloft.net>
Sun, 3 Dec 2006 05:22:07 +0000 (21:22 -0800)
Otherwise, we will see a lot of casts...

Signed-off-by: YOSHIFUJI Hideaki <yoshfuji@linux-ipv6.org>
include/net/ip6_fib.h
net/ipv6/addrconf.c
net/ipv6/ip6_input.c

index e4438de3bd6b821e3c16d627ae63b5e39e9b198b..f9cde44f93b44be4e104812f056b813d59e603c6 100644 (file)
@@ -107,6 +107,11 @@ struct rt6_info
        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 *prev, *next;
index b312a5f7a759caa298d42d4ce6763baac0b9ba04..6a98f68348cb7178cca02155f628c3a53297c8f3 100644 (file)
@@ -1164,7 +1164,7 @@ record_it:
 int ipv6_get_saddr(struct dst_entry *dst,
                   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);
 }
 
 
index 6b8e6d76a58bf2633ea46c84bd7c392367065f42..ebf54ae90a0cecaa2ac6ec1acc8d3c5e5e5f754e 100644 (file)
@@ -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
         * 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))))
                goto err;