]> err.no Git - linux-2.6/blobdiff - net/ipv6/ip6_output.c
[IPV6]: Sparse: Reuse previous delaration where appropriate.
[linux-2.6] / net / ipv6 / ip6_output.c
index ed6482667a256f803df1f3dbd804158bf5b02792..c0dbe549cc4258289c18442c3bb516ba1f476beb 100644 (file)
@@ -55,6 +55,7 @@
 #include <net/icmp.h>
 #include <net/xfrm.h>
 #include <net/checksum.h>
+#include <linux/mroute6.h>
 
 static int ip6_fragment(struct sk_buff *skb, int (*output)(struct sk_buff *));
 
@@ -137,8 +138,9 @@ static int ip6_output2(struct sk_buff *skb)
                struct inet6_dev *idev = ip6_dst_idev(skb->dst);
 
                if (!(dev->flags & IFF_LOOPBACK) && (!np || np->mc_loop) &&
-                   ipv6_chk_mcast_addr(dev, &ipv6_hdr(skb)->daddr,
-                                       &ipv6_hdr(skb)->saddr)) {
+                   ((mroute6_socket && !(IP6CB(skb)->flags & IP6SKB_FORWARDED)) ||
+                    ipv6_chk_mcast_addr(dev, &ipv6_hdr(skb)->daddr,
+                                        &ipv6_hdr(skb)->saddr))) {
                        struct sk_buff *newskb = skb_clone(skb, GFP_ATOMIC);
 
                        /* Do not check for IFF_ALLMULTI; multicast routing
@@ -237,9 +239,7 @@ int ip6_xmit(struct sock *sk, struct sk_buff *skb, struct flowi *fl,
        if (np)
                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 = -1;
        if (np)
@@ -404,7 +404,7 @@ int ip6_forward(struct sk_buff *skb)
        struct dst_entry *dst = skb->dst;
        struct ipv6hdr *hdr = ipv6_hdr(skb);
        struct inet6_skb_parm *opt = IP6CB(skb);
-       struct net *net = dst->dev->nd_net;
+       struct net *net = dev_net(dst->dev);
 
        if (ipv6_devconf.forwarding == 0)
                goto error;
@@ -912,7 +912,7 @@ static int ip6_dst_lookup_tail(struct sock *sk,
                               struct dst_entry **dst, struct flowi *fl)
 {
        int err;
-       struct net *net = sk->sk_net;
+       struct net *net = sock_net(sk);
 
        if (*dst == NULL)
                *dst = ip6_route_output(net, sk, fl);
@@ -922,7 +922,9 @@ static int ip6_dst_lookup_tail(struct sock *sk,
 
        if (ipv6_addr_any(&fl->fl6_src)) {
                err = ipv6_dev_get_saddr(ip6_dst_idev(*dst)->dev,
-                                        &fl->fl6_dst, &fl->fl6_src);
+                                        &fl->fl6_dst,
+                                        sk ? inet6_sk(sk)->srcprefs : 0,
+                                        &fl->fl6_src);
                if (err)
                        goto out_err_release;
        }