aboutsummaryrefslogtreecommitdiffstats
path: root/net/ipv4/ipcomp.c
diff options
context:
space:
mode:
Diffstat (limited to 'net/ipv4/ipcomp.c')
-rw-r--r--net/ipv4/ipcomp.c32
1 files changed, 16 insertions, 16 deletions
diff --git a/net/ipv4/ipcomp.c b/net/ipv4/ipcomp.c
index 3839b706142e..aa704b88f014 100644
--- a/net/ipv4/ipcomp.c
+++ b/net/ipv4/ipcomp.c
@@ -5,7 +5,7 @@
5 * 5 *
6 * This program is free software; you can redistribute it and/or modify it 6 * This program is free software; you can redistribute it and/or modify it
7 * under the terms of the GNU General Public License as published by the Free 7 * under the terms of the GNU General Public License as published by the Free
8 * Software Foundation; either version 2 of the License, or (at your option) 8 * Software Foundation; either version 2 of the License, or (at your option)
9 * any later version. 9 * any later version.
10 * 10 *
11 * Todo: 11 * Todo:
@@ -48,7 +48,7 @@ static int ipcomp_decompress(struct xfrm_state *x, struct sk_buff *skb)
48 u8 *start, *scratch; 48 u8 *start, *scratch;
49 struct crypto_comp *tfm; 49 struct crypto_comp *tfm;
50 int cpu; 50 int cpu;
51 51
52 plen = skb->len; 52 plen = skb->len;
53 dlen = IPCOMP_SCRATCH_SIZE; 53 dlen = IPCOMP_SCRATCH_SIZE;
54 start = skb->data; 54 start = skb->data;
@@ -69,11 +69,11 @@ static int ipcomp_decompress(struct xfrm_state *x, struct sk_buff *skb)
69 err = pskb_expand_head(skb, 0, dlen - plen, GFP_ATOMIC); 69 err = pskb_expand_head(skb, 0, dlen - plen, GFP_ATOMIC);
70 if (err) 70 if (err)
71 goto out; 71 goto out;
72 72
73 skb->truesize += dlen - plen; 73 skb->truesize += dlen - plen;
74 __skb_put(skb, dlen - plen); 74 __skb_put(skb, dlen - plen);
75 memcpy(skb->data, scratch, dlen); 75 memcpy(skb->data, scratch, dlen);
76out: 76out:
77 put_cpu(); 77 put_cpu();
78 return err; 78 return err;
79} 79}
@@ -85,11 +85,11 @@ static int ipcomp_input(struct xfrm_state *x, struct sk_buff *skb)
85 struct ip_comp_hdr *ipch; 85 struct ip_comp_hdr *ipch;
86 86
87 if (skb_linearize_cow(skb)) 87 if (skb_linearize_cow(skb))
88 goto out; 88 goto out;
89 89
90 skb->ip_summed = CHECKSUM_NONE; 90 skb->ip_summed = CHECKSUM_NONE;
91 91
92 /* Remove ipcomp header and decompress original payload */ 92 /* Remove ipcomp header and decompress original payload */
93 iph = skb->nh.iph; 93 iph = skb->nh.iph;
94 ipch = (void *)skb->data; 94 ipch = (void *)skb->data;
95 iph->protocol = ipch->nexthdr; 95 iph->protocol = ipch->nexthdr;
@@ -97,7 +97,7 @@ static int ipcomp_input(struct xfrm_state *x, struct sk_buff *skb)
97 __skb_pull(skb, sizeof(*ipch)); 97 __skb_pull(skb, sizeof(*ipch));
98 err = ipcomp_decompress(x, skb); 98 err = ipcomp_decompress(x, skb);
99 99
100out: 100out:
101 return err; 101 return err;
102} 102}
103 103
@@ -109,7 +109,7 @@ static int ipcomp_compress(struct xfrm_state *x, struct sk_buff *skb)
109 u8 *start, *scratch; 109 u8 *start, *scratch;
110 struct crypto_comp *tfm; 110 struct crypto_comp *tfm;
111 int cpu; 111 int cpu;
112 112
113 ihlen = iph->ihl * 4; 113 ihlen = iph->ihl * 4;
114 plen = skb->len - ihlen; 114 plen = skb->len - ihlen;
115 dlen = IPCOMP_SCRATCH_SIZE; 115 dlen = IPCOMP_SCRATCH_SIZE;
@@ -127,14 +127,14 @@ static int ipcomp_compress(struct xfrm_state *x, struct sk_buff *skb)
127 err = -EMSGSIZE; 127 err = -EMSGSIZE;
128 goto out; 128 goto out;
129 } 129 }
130 130
131 memcpy(start + sizeof(struct ip_comp_hdr), scratch, dlen); 131 memcpy(start + sizeof(struct ip_comp_hdr), scratch, dlen);
132 put_cpu(); 132 put_cpu();
133 133
134 pskb_trim(skb, ihlen + dlen + sizeof(struct ip_comp_hdr)); 134 pskb_trim(skb, ihlen + dlen + sizeof(struct ip_comp_hdr));
135 return 0; 135 return 0;
136 136
137out: 137out:
138 put_cpu(); 138 put_cpu();
139 return err; 139 return err;
140} 140}
@@ -157,7 +157,7 @@ static int ipcomp_output(struct xfrm_state *x, struct sk_buff *skb)
157 157
158 if (skb_linearize_cow(skb)) 158 if (skb_linearize_cow(skb))
159 goto out_ok; 159 goto out_ok;
160 160
161 err = ipcomp_compress(x, skb); 161 err = ipcomp_compress(x, skb);
162 iph = skb->nh.iph; 162 iph = skb->nh.iph;
163 163
@@ -194,7 +194,7 @@ static void ipcomp4_err(struct sk_buff *skb, u32 info)
194 194
195 spi = htonl(ntohs(ipch->cpi)); 195 spi = htonl(ntohs(ipch->cpi));
196 x = xfrm_state_lookup((xfrm_address_t *)&iph->daddr, 196 x = xfrm_state_lookup((xfrm_address_t *)&iph->daddr,
197 spi, IPPROTO_COMP, AF_INET); 197 spi, IPPROTO_COMP, AF_INET);
198 if (!x) 198 if (!x)
199 return; 199 return;
200 NETDEBUG(KERN_DEBUG "pmtu discovery on SA IPCOMP/%08x/%u.%u.%u.%u\n", 200 NETDEBUG(KERN_DEBUG "pmtu discovery on SA IPCOMP/%08x/%u.%u.%u.%u\n",
@@ -202,12 +202,12 @@ static void ipcomp4_err(struct sk_buff *skb, u32 info)
202 xfrm_state_put(x); 202 xfrm_state_put(x);
203} 203}
204 204
205/* We always hold one tunnel user reference to indicate a tunnel */ 205/* We always hold one tunnel user reference to indicate a tunnel */
206static struct xfrm_state *ipcomp_tunnel_create(struct xfrm_state *x) 206static struct xfrm_state *ipcomp_tunnel_create(struct xfrm_state *x)
207{ 207{
208 struct xfrm_state *t; 208 struct xfrm_state *t;
209 u8 mode = XFRM_MODE_TUNNEL; 209 u8 mode = XFRM_MODE_TUNNEL;
210 210
211 t = xfrm_state_alloc(); 211 t = xfrm_state_alloc();
212 if (t == NULL) 212 if (t == NULL)
213 goto out; 213 goto out;
@@ -247,7 +247,7 @@ static int ipcomp_tunnel_attach(struct xfrm_state *x)
247 struct xfrm_state *t; 247 struct xfrm_state *t;
248 248
249 t = xfrm_state_lookup((xfrm_address_t *)&x->id.daddr.a4, 249 t = xfrm_state_lookup((xfrm_address_t *)&x->id.daddr.a4,
250 x->props.saddr.a4, IPPROTO_IPIP, AF_INET); 250 x->props.saddr.a4, IPPROTO_IPIP, AF_INET);
251 if (!t) { 251 if (!t) {
252 t = ipcomp_tunnel_create(x); 252 t = ipcomp_tunnel_create(x);
253 if (!t) { 253 if (!t) {