diff options
Diffstat (limited to 'net/ipv6/ipcomp6.c')
-rw-r--r-- | net/ipv6/ipcomp6.c | 16 |
1 files changed, 7 insertions, 9 deletions
diff --git a/net/ipv6/ipcomp6.c b/net/ipv6/ipcomp6.c index 5724ba9f75de..1ee50b5782e1 100644 --- a/net/ipv6/ipcomp6.c +++ b/net/ipv6/ipcomp6.c | |||
@@ -79,9 +79,9 @@ static int ipcomp6_input(struct xfrm_state *x, struct sk_buff *skb) | |||
79 | skb->ip_summed = CHECKSUM_NONE; | 79 | skb->ip_summed = CHECKSUM_NONE; |
80 | 80 | ||
81 | /* Remove ipcomp header and decompress original payload */ | 81 | /* Remove ipcomp header and decompress original payload */ |
82 | iph = skb->nh.ipv6h; | 82 | iph = ipv6_hdr(skb); |
83 | ipch = (void *)skb->data; | 83 | ipch = (void *)skb->data; |
84 | skb->h.raw = skb->nh.raw + sizeof(*ipch); | 84 | skb->transport_header = skb->network_header + sizeof(*ipch); |
85 | __skb_pull(skb, sizeof(*ipch)); | 85 | __skb_pull(skb, sizeof(*ipch)); |
86 | 86 | ||
87 | /* decompression */ | 87 | /* decompression */ |
@@ -111,7 +111,7 @@ static int ipcomp6_input(struct xfrm_state *x, struct sk_buff *skb) | |||
111 | 111 | ||
112 | skb->truesize += dlen - plen; | 112 | skb->truesize += dlen - plen; |
113 | __skb_put(skb, dlen - plen); | 113 | __skb_put(skb, dlen - plen); |
114 | memcpy(skb->data, scratch, dlen); | 114 | skb_copy_to_linear_data(skb, scratch, dlen); |
115 | err = ipch->nexthdr; | 115 | err = ipch->nexthdr; |
116 | 116 | ||
117 | out_put_cpu: | 117 | out_put_cpu: |
@@ -124,15 +124,13 @@ static int ipcomp6_output(struct xfrm_state *x, struct sk_buff *skb) | |||
124 | { | 124 | { |
125 | int err; | 125 | int err; |
126 | struct ipv6hdr *top_iph; | 126 | struct ipv6hdr *top_iph; |
127 | int hdr_len; | ||
128 | struct ipv6_comp_hdr *ipch; | 127 | struct ipv6_comp_hdr *ipch; |
129 | struct ipcomp_data *ipcd = x->data; | 128 | struct ipcomp_data *ipcd = x->data; |
130 | int plen, dlen; | 129 | int plen, dlen; |
131 | u8 *start, *scratch; | 130 | u8 *start, *scratch; |
132 | struct crypto_comp *tfm; | 131 | struct crypto_comp *tfm; |
133 | int cpu; | 132 | int cpu; |
134 | 133 | int hdr_len = skb_transport_offset(skb); | |
135 | hdr_len = skb->h.raw - skb->data; | ||
136 | 134 | ||
137 | /* check whether datagram len is larger than threshold */ | 135 | /* check whether datagram len is larger than threshold */ |
138 | if ((skb->len - hdr_len) < ipcd->threshold) { | 136 | if ((skb->len - hdr_len) < ipcd->threshold) { |
@@ -145,7 +143,7 @@ static int ipcomp6_output(struct xfrm_state *x, struct sk_buff *skb) | |||
145 | /* compression */ | 143 | /* compression */ |
146 | plen = skb->len - hdr_len; | 144 | plen = skb->len - hdr_len; |
147 | dlen = IPCOMP_SCRATCH_SIZE; | 145 | dlen = IPCOMP_SCRATCH_SIZE; |
148 | start = skb->h.raw; | 146 | start = skb_transport_header(skb); |
149 | 147 | ||
150 | cpu = get_cpu(); | 148 | cpu = get_cpu(); |
151 | scratch = *per_cpu_ptr(ipcomp6_scratches, cpu); | 149 | scratch = *per_cpu_ptr(ipcomp6_scratches, cpu); |
@@ -166,10 +164,10 @@ static int ipcomp6_output(struct xfrm_state *x, struct sk_buff *skb) | |||
166 | top_iph->payload_len = htons(skb->len - sizeof(struct ipv6hdr)); | 164 | top_iph->payload_len = htons(skb->len - sizeof(struct ipv6hdr)); |
167 | 165 | ||
168 | ipch = (struct ipv6_comp_hdr *)start; | 166 | ipch = (struct ipv6_comp_hdr *)start; |
169 | ipch->nexthdr = *skb->nh.raw; | 167 | ipch->nexthdr = *skb_network_header(skb); |
170 | ipch->flags = 0; | 168 | ipch->flags = 0; |
171 | ipch->cpi = htons((u16 )ntohl(x->id.spi)); | 169 | ipch->cpi = htons((u16 )ntohl(x->id.spi)); |
172 | *skb->nh.raw = IPPROTO_COMP; | 170 | *skb_network_header(skb) = IPPROTO_COMP; |
173 | 171 | ||
174 | out_ok: | 172 | out_ok: |
175 | return 0; | 173 | return 0; |