[NET] NETNS: Omit sock->sk_net without CONFIG_NET_NS.
[deliverable/linux.git] / net / ipv6 / icmp.c
index 6b5391ab83462437eff92f4a18bb6e733871b53a..63309d10df3a1f1ddadd74ae7d0a28a7972a8b76 100644 (file)
@@ -163,7 +163,7 @@ static inline int icmpv6_xrlim_allow(struct sock *sk, int type,
                                     struct flowi *fl)
 {
        struct dst_entry *dst;
-       struct net *net = sk->sk_net;
+       struct net *net = sock_net(sk);
        int res = 0;
 
        /* Informational messages are not limited. */
@@ -306,7 +306,7 @@ static inline void mip6_addr_swap(struct sk_buff *skb) {}
 void icmpv6_send(struct sk_buff *skb, int type, int code, __u32 info,
                 struct net_device *dev)
 {
-       struct net *net = skb->dev->nd_net;
+       struct net *net = dev_net(skb->dev);
        struct inet6_dev *idev = NULL;
        struct ipv6hdr *hdr = ipv6_hdr(skb);
        struct sock *sk;
@@ -464,9 +464,7 @@ route_done:
        else
                hlimit = np->hop_limit;
        if (hlimit < 0)
-               hlimit = dst_metric(dst, RTAX_HOPLIMIT);
-       if (hlimit < 0)
-               hlimit = ipv6_get_hoplimit(dst->dev);
+               hlimit = ip6_dst_hoplimit(dst);
 
        tclass = np->tclass;
        if (tclass < 0)
@@ -509,7 +507,7 @@ EXPORT_SYMBOL(icmpv6_send);
 
 static void icmpv6_echo_reply(struct sk_buff *skb)
 {
-       struct net *net = skb->dev->nd_net;
+       struct net *net = dev_net(skb->dev);
        struct sock *sk;
        struct inet6_dev *idev;
        struct ipv6_pinfo *np;
@@ -560,9 +558,7 @@ static void icmpv6_echo_reply(struct sk_buff *skb)
        else
                hlimit = np->hop_limit;
        if (hlimit < 0)
-               hlimit = dst_metric(dst, RTAX_HOPLIMIT);
-       if (hlimit < 0)
-               hlimit = ipv6_get_hoplimit(dst->dev);
+               hlimit = ip6_dst_hoplimit(dst);
 
        tclass = np->tclass;
        if (tclass < 0)
This page took 0.02504 seconds and 5 git commands to generate.