]> pilppa.org Git - linux-2.6-omap-h63xx.git/blobdiff - net/ipv6/ip6_tunnel.c
[IPv6]: Update setsockopt(IPV6_MULTICAST_IF) to support RFC 3493, try2
[linux-2.6-omap-h63xx.git] / net / ipv6 / ip6_tunnel.c
index a0902fbdb4e1ebfa71ee3f4f4d349b0735e923e2..2320cc27ff9e305328cc8bc04103851d04b88a9b 100644 (file)
@@ -235,7 +235,7 @@ static struct ip6_tnl *ip6_tnl_create(struct ip6_tnl_parm *p)
                int i;
                for (i = 1; i < IP6_TNL_MAX; i++) {
                        sprintf(name, "ip6tnl%d", i);
-                       if (__dev_get_by_name(name) == NULL)
+                       if (__dev_get_by_name(&init_net, name) == NULL)
                                break;
                }
                if (i == IP6_TNL_MAX)
@@ -385,7 +385,7 @@ parse_tlv_tnl_enc_lim(struct sk_buff *skb, __u8 * raw)
 
 static int
 ip6_tnl_err(struct sk_buff *skb, __u8 ipproto, struct inet6_skb_parm *opt,
-           int *type, int *code, int *msg, __be32 *info, int offset)
+           int *type, int *code, int *msg, __u32 *info, int offset)
 {
        struct ipv6hdr *ipv6h = (struct ipv6hdr *) skb->data;
        struct ip6_tnl *t;
@@ -435,7 +435,7 @@ ip6_tnl_err(struct sk_buff *skb, __u8 ipproto, struct inet6_skb_parm *opt,
                if ((*code) == ICMPV6_HDR_FIELD)
                        teli = parse_tlv_tnl_enc_lim(skb, skb->data);
 
-               if (teli && teli == ntohl(*info) - 2) {
+               if (teli && teli == *info - 2) {
                        tel = (struct ipv6_tlv_tnl_enc_lim *) &skb->data[teli];
                        if (tel->encap_limit == 0) {
                                if (net_ratelimit())
@@ -452,7 +452,7 @@ ip6_tnl_err(struct sk_buff *skb, __u8 ipproto, struct inet6_skb_parm *opt,
                }
                break;
        case ICMPV6_PKT_TOOBIG:
-               mtu = ntohl(*info) - offset;
+               mtu = *info - offset;
                if (mtu < IPV6_MIN_MTU)
                        mtu = IPV6_MIN_MTU;
                t->dev->mtu = mtu;
@@ -478,12 +478,12 @@ out:
 
 static int
 ip4ip6_err(struct sk_buff *skb, struct inet6_skb_parm *opt,
-          int type, int code, int offset, __u32 info)
+          int type, int code, int offset, __be32 info)
 {
        int rel_msg = 0;
        int rel_type = type;
        int rel_code = code;
-       __u32 rel_info = info;
+       __u32 rel_info = ntohl(info);
        int err;
        struct sk_buff *skb2;
        struct iphdr *eiph;
@@ -564,10 +564,9 @@ ip4ip6_err(struct sk_buff *skb, struct inet6_skb_parm *opt,
                        goto out;
 
                skb2->dst->ops->update_pmtu(skb2->dst, rel_info);
-               rel_info = htonl(rel_info);
        }
 
-       icmp_send(skb2, rel_type, rel_code, rel_info);
+       icmp_send(skb2, rel_type, rel_code, htonl(rel_info));
 
 out:
        kfree_skb(skb2);
@@ -576,12 +575,12 @@ out:
 
 static int
 ip6ip6_err(struct sk_buff *skb, struct inet6_skb_parm *opt,
-          int type, int code, int offset, __u32 info)
+          int type, int code, int offset, __be32 info)
 {
        int rel_msg = 0;
        int rel_type = type;
        int rel_code = code;
-       __u32 rel_info = info;
+       __u32 rel_info = ntohl(info);
        int err;
 
        err = ip6_tnl_err(skb, IPPROTO_IPV6, opt, &rel_type, &rel_code,
@@ -651,7 +650,7 @@ static inline int ip6_tnl_rcv_ctl(struct ip6_tnl *t)
                struct net_device *ldev = NULL;
 
                if (p->link)
-                       ldev = dev_get_by_index(p->link);
+                       ldev = dev_get_by_index(&init_net, p->link);
 
                if ((ipv6_addr_is_multicast(&p->laddr) ||
                     likely(ipv6_chk_addr(&p->laddr, ldev, 0))) &&
@@ -787,7 +786,7 @@ static inline int ip6_tnl_xmit_ctl(struct ip6_tnl *t)
                struct net_device *ldev = NULL;
 
                if (p->link)
-                       ldev = dev_get_by_index(p->link);
+                       ldev = dev_get_by_index(&init_net, p->link);
 
                if (unlikely(!ipv6_chk_addr(&p->laddr, ldev, 0)))
                        printk(KERN_WARNING
@@ -883,8 +882,8 @@ static int ip6_tnl_xmit2(struct sk_buff *skb,
         */
        max_headroom += LL_RESERVED_SPACE(tdev);
 
-       if (skb_headroom(skb) < max_headroom ||
-           skb_cloned(skb) || skb_shared(skb)) {
+       if (skb_headroom(skb) < max_headroom || skb_shared(skb) ||
+           (skb_cloned(skb) && !skb_clone_writable(skb, 0))) {
                struct sk_buff *new_skb;
 
                if (!(new_skb = skb_realloc_headroom(skb, max_headroom)))
@@ -962,8 +961,8 @@ ip4ip6_tnl_xmit(struct sk_buff *skb, struct net_device *dev)
        dsfield = ipv4_get_dsfield(iph);
 
        if ((t->parms.flags & IP6_TNL_F_USE_ORIG_TCLASS))
-               fl.fl6_flowlabel |= ntohl(((__u32)iph->tos << IPV6_TCLASS_SHIFT)
-                                         & IPV6_TCLASS_MASK);
+               fl.fl6_flowlabel |= htonl((__u32)iph->tos << IPV6_TCLASS_SHIFT)
+                                         & IPV6_TCLASS_MASK;
 
        err = ip6_tnl_xmit2(skb, dev, dsfield, &fl, encap_limit, &mtu);
        if (err != 0) {
@@ -1314,7 +1313,6 @@ ip6_tnl_change_mtu(struct net_device *dev, int new_mtu)
 
 static void ip6_tnl_dev_setup(struct net_device *dev)
 {
-       SET_MODULE_OWNER(dev);
        dev->uninit = ip6_tnl_dev_uninit;
        dev->destructor = free_netdev;
        dev->hard_start_xmit = ip6_tnl_xmit;