]> err.no Git - linux-2.6/blobdiff - net/ipv6/ip6_tunnel.c
Merge branch 'release' of git://lm-sensors.org/kernel/mhoffman/hwmon-2.6
[linux-2.6] / net / ipv6 / ip6_tunnel.c
index d8c84d8d7cf8654adfb3d1347921191bc778891c..281aee42d3f0d9c35e26c1dac4863f59628c8b62 100644 (file)
@@ -525,8 +525,8 @@ ip4ip6_err(struct sk_buff *skb, struct inet6_skb_parm *opt,
        dst_release(skb2->dst);
        skb2->dst = NULL;
        skb_pull(skb2, offset);
-       skb2->nh.raw = skb2->data;
-       eiph = skb2->nh.iph;
+       skb_reset_network_header(skb2);
+       eiph = ip_hdr(skb2);
 
        /* Try to guess incoming interface */
        memset(&fl, 0, sizeof(fl));
@@ -599,10 +599,10 @@ ip6ip6_err(struct sk_buff *skb, struct inet6_skb_parm *opt,
                dst_release(skb2->dst);
                skb2->dst = NULL;
                skb_pull(skb2, offset);
-               skb2->nh.raw = skb2->data;
+               skb_reset_network_header(skb2);
 
                /* Try to guess incoming interface */
-               rt = rt6_lookup(&skb2->nh.ipv6h->saddr, NULL, 0, 0);
+               rt = rt6_lookup(&ipv6_hdr(skb2)->saddr, NULL, 0, 0);
 
                if (rt && rt->rt6i_dev)
                        skb2->dev = rt->rt6i_dev;
@@ -625,10 +625,10 @@ static void ip4ip6_dscp_ecn_decapsulate(struct ip6_tnl *t,
        __u8 dsfield = ipv6_get_dsfield(ipv6h) & ~INET_ECN_MASK;
 
        if (t->parms.flags & IP6_TNL_F_RCV_DSCP_COPY)
-               ipv4_change_dsfield(skb->nh.iph, INET_ECN_MASK, dsfield);
+               ipv4_change_dsfield(ip_hdr(skb), INET_ECN_MASK, dsfield);
 
        if (INET_ECN_is_ce(dsfield))
-               IP_ECN_set_ce(skb->nh.iph);
+               IP_ECN_set_ce(ip_hdr(skb));
 }
 
 static void ip6ip6_dscp_ecn_decapsulate(struct ip6_tnl *t,
@@ -636,10 +636,10 @@ static void ip6ip6_dscp_ecn_decapsulate(struct ip6_tnl *t,
                                        struct sk_buff *skb)
 {
        if (t->parms.flags & IP6_TNL_F_RCV_DSCP_COPY)
-               ipv6_copy_dscp(ipv6h, skb->nh.ipv6h);
+               ipv6_copy_dscp(ipv6h, ipv6_hdr(skb));
 
        if (INET_ECN_is_ce(ipv6_get_dsfield(ipv6h)))
-               IP6_ECN_set_ce(skb->nh.ipv6h);
+               IP6_ECN_set_ce(ipv6_hdr(skb));
 }
 
 static inline int ip6_tnl_rcv_ctl(struct ip6_tnl *t)
@@ -679,10 +679,8 @@ static int ip6_tnl_rcv(struct sk_buff *skb, __u16 protocol,
                                                    struct ipv6hdr *ipv6h,
                                                    struct sk_buff *skb))
 {
-       struct ipv6hdr *ipv6h;
        struct ip6_tnl *t;
-
-       ipv6h = skb->nh.ipv6h;
+       struct ipv6hdr *ipv6h = ipv6_hdr(skb);
 
        read_lock(&ip6_tnl_lock);
 
@@ -703,8 +701,8 @@ static int ip6_tnl_rcv(struct sk_buff *skb, __u16 protocol,
                        goto discard;
                }
                secpath_reset(skb);
-               skb->mac.raw = skb->nh.raw;
-               skb->nh.raw = skb->data;
+               skb->mac_header = skb->network_header;
+               skb_reset_network_header(skb);
                skb->protocol = htons(protocol);
                skb->pkt_type = PACKET_HOST;
                memset(skb->cb, 0, sizeof(struct inet6_skb_parm));
@@ -836,7 +834,7 @@ static int ip6_tnl_xmit2(struct sk_buff *skb,
 {
        struct ip6_tnl *t = netdev_priv(dev);
        struct net_device_stats *stats = &t->stat;
-       struct ipv6hdr *ipv6h = skb->nh.ipv6h;
+       struct ipv6hdr *ipv6h = ipv6_hdr(skb);
        struct ipv6_tel_txoption opt;
        struct dst_entry *dst;
        struct net_device *tdev;
@@ -885,8 +883,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)))
@@ -900,15 +898,16 @@ static int ip6_tnl_xmit2(struct sk_buff *skb,
        dst_release(skb->dst);
        skb->dst = dst_clone(dst);
 
-       skb->h.raw = skb->nh.raw;
+       skb->transport_header = skb->network_header;
 
        proto = fl->proto;
        if (encap_limit >= 0) {
                init_tel_txopt(&opt, encap_limit);
                ipv6_push_nfrag_opts(skb, &opt.ops, &proto, NULL);
        }
-       skb->nh.raw = skb_push(skb, sizeof(struct ipv6hdr));
-       ipv6h = skb->nh.ipv6h;
+       skb_push(skb, sizeof(struct ipv6hdr));
+       skb_reset_network_header(skb);
+       ipv6h = ipv6_hdr(skb);
        *(__be32*)ipv6h = fl->fl6_flowlabel | htonl(0x60000000);
        dsfield = INET_ECN_encapsulate(0, dsfield);
        ipv6_change_dsfield(ipv6h, ~INET_ECN_MASK, dsfield);
@@ -943,7 +942,7 @@ static inline int
 ip4ip6_tnl_xmit(struct sk_buff *skb, struct net_device *dev)
 {
        struct ip6_tnl *t = netdev_priv(dev);
-       struct iphdr  *iph = skb->nh.iph;
+       struct iphdr  *iph = ip_hdr(skb);
        int encap_limit = -1;
        struct flowi fl;
        __u8 dsfield;
@@ -982,7 +981,7 @@ static inline int
 ip6ip6_tnl_xmit(struct sk_buff *skb, struct net_device *dev)
 {
        struct ip6_tnl *t = netdev_priv(dev);
-       struct ipv6hdr *ipv6h = skb->nh.ipv6h;
+       struct ipv6hdr *ipv6h = ipv6_hdr(skb);
        int encap_limit = -1;
        __u16 offset;
        struct flowi fl;
@@ -994,9 +993,10 @@ ip6ip6_tnl_xmit(struct sk_buff *skb, struct net_device *dev)
            !ip6_tnl_xmit_ctl(t) || ip6_tnl_addr_conflict(t, ipv6h))
                return -1;
 
-       if ((offset = parse_tlv_tnl_enc_lim(skb, skb->nh.raw)) > 0) {
+       offset = parse_tlv_tnl_enc_lim(skb, skb_network_header(skb));
+       if (offset > 0) {
                struct ipv6_tlv_tnl_enc_lim *tel;
-               tel = (struct ipv6_tlv_tnl_enc_lim *) &skb->nh.raw[offset];
+               tel = (struct ipv6_tlv_tnl_enc_lim *)&skb_network_header(skb)[offset];
                if (tel->encap_limit == 0) {
                        icmpv6_send(skb, ICMPV6_PARAMPROB,
                                    ICMPV6_HDR_FIELD, offset + 2, skb->dev);