Commit a7863093 authored by Herbert Xu's avatar Herbert Xu Committed by David S. Miller

[IPSEC]: Revert pskb change for x->type->output

Since skb_checksum_help() has been moved to xfrm[46]_output(), we don't
need the sk_buff ** argument in x->type->output anymore.  This patch
reverts it to a sk_buff *.
Signed-off-by: default avatarHerbert Xu <herbert@gondor.apana.org.au>
Signed-off-by: default avatarDavid S. Miller <davem@redhat.com>
parent b015a5c0
...@@ -216,7 +216,7 @@ struct xfrm_type ...@@ -216,7 +216,7 @@ struct xfrm_type
void (*destructor)(struct xfrm_state *); void (*destructor)(struct xfrm_state *);
int (*input)(struct xfrm_state *, struct xfrm_decap_state *, struct sk_buff *skb); int (*input)(struct xfrm_state *, struct xfrm_decap_state *, struct sk_buff *skb);
int (*post_input)(struct xfrm_state *, struct xfrm_decap_state *, struct sk_buff *skb); int (*post_input)(struct xfrm_state *, struct xfrm_decap_state *, struct sk_buff *skb);
int (*output)(struct sk_buff **pskb); int (*output)(struct sk_buff *pskb);
/* Estimate maximal size of result of transformation of a dgram */ /* Estimate maximal size of result of transformation of a dgram */
u32 (*get_max_size)(struct xfrm_state *, int size); u32 (*get_max_size)(struct xfrm_state *, int size);
}; };
......
...@@ -53,10 +53,10 @@ static int ip_clear_mutable_options(struct iphdr *iph, u32 *daddr) ...@@ -53,10 +53,10 @@ static int ip_clear_mutable_options(struct iphdr *iph, u32 *daddr)
return 0; return 0;
} }
static int ah_output(struct sk_buff **pskb) static int ah_output(struct sk_buff *skb)
{ {
int err; int err;
struct dst_entry *dst = (*pskb)->dst; struct dst_entry *dst = skb->dst;
struct xfrm_state *x = dst->xfrm; struct xfrm_state *x = dst->xfrm;
struct iphdr *iph, *top_iph; struct iphdr *iph, *top_iph;
struct ip_auth_hdr *ah; struct ip_auth_hdr *ah;
...@@ -66,7 +66,7 @@ static int ah_output(struct sk_buff **pskb) ...@@ -66,7 +66,7 @@ static int ah_output(struct sk_buff **pskb)
char buf[60]; char buf[60];
} tmp_iph; } tmp_iph;
top_iph = (*pskb)->nh.iph; top_iph = skb->nh.iph;
iph = &tmp_iph.iph; iph = &tmp_iph.iph;
iph->tos = top_iph->tos; iph->tos = top_iph->tos;
...@@ -85,7 +85,7 @@ static int ah_output(struct sk_buff **pskb) ...@@ -85,7 +85,7 @@ static int ah_output(struct sk_buff **pskb)
ah->nexthdr = top_iph->protocol; ah->nexthdr = top_iph->protocol;
top_iph->tos = 0; top_iph->tos = 0;
top_iph->tot_len = htons((*pskb)->len); top_iph->tot_len = htons(skb->len);
top_iph->frag_off = 0; top_iph->frag_off = 0;
top_iph->ttl = 0; top_iph->ttl = 0;
top_iph->protocol = IPPROTO_AH; top_iph->protocol = IPPROTO_AH;
...@@ -98,7 +98,7 @@ static int ah_output(struct sk_buff **pskb) ...@@ -98,7 +98,7 @@ static int ah_output(struct sk_buff **pskb)
ah->reserved = 0; ah->reserved = 0;
ah->spi = x->id.spi; ah->spi = x->id.spi;
ah->seq_no = htonl(++x->replay.oseq); ah->seq_no = htonl(++x->replay.oseq);
ahp->icv(ahp, *pskb, ah->auth_data); ahp->icv(ahp, skb, ah->auth_data);
top_iph->tos = iph->tos; top_iph->tos = iph->tos;
top_iph->ttl = iph->ttl; top_iph->ttl = iph->ttl;
......
...@@ -17,10 +17,10 @@ struct esp_decap_data { ...@@ -17,10 +17,10 @@ struct esp_decap_data {
__u8 proto; __u8 proto;
}; };
int esp_output(struct sk_buff **pskb) int esp_output(struct sk_buff *skb)
{ {
int err; int err;
struct dst_entry *dst = (*pskb)->dst; struct dst_entry *dst = skb->dst;
struct xfrm_state *x = dst->xfrm; struct xfrm_state *x = dst->xfrm;
struct iphdr *top_iph; struct iphdr *top_iph;
struct ip_esp_hdr *esph; struct ip_esp_hdr *esph;
...@@ -33,13 +33,13 @@ int esp_output(struct sk_buff **pskb) ...@@ -33,13 +33,13 @@ int esp_output(struct sk_buff **pskb)
int nfrags; int nfrags;
/* Strip IP+ESP header. */ /* Strip IP+ESP header. */
__skb_pull(*pskb, (*pskb)->h.raw - (*pskb)->data); __skb_pull(skb, skb->h.raw - skb->data);
/* Now skb is pure payload to encrypt */ /* Now skb is pure payload to encrypt */
err = -ENOMEM; err = -ENOMEM;
/* Round to block size */ /* Round to block size */
clen = (*pskb)->len; clen = skb->len;
esp = x->data; esp = x->data;
alen = esp->auth.icv_trunc_len; alen = esp->auth.icv_trunc_len;
...@@ -49,22 +49,22 @@ int esp_output(struct sk_buff **pskb) ...@@ -49,22 +49,22 @@ int esp_output(struct sk_buff **pskb)
if (esp->conf.padlen) if (esp->conf.padlen)
clen = (clen + esp->conf.padlen-1)&~(esp->conf.padlen-1); clen = (clen + esp->conf.padlen-1)&~(esp->conf.padlen-1);
if ((nfrags = skb_cow_data(*pskb, clen-(*pskb)->len+alen, &trailer)) < 0) if ((nfrags = skb_cow_data(skb, clen-skb->len+alen, &trailer)) < 0)
goto error; goto error;
/* Fill padding... */ /* Fill padding... */
do { do {
int i; int i;
for (i=0; i<clen-(*pskb)->len - 2; i++) for (i=0; i<clen-skb->len - 2; i++)
*(u8*)(trailer->tail + i) = i+1; *(u8*)(trailer->tail + i) = i+1;
} while (0); } while (0);
*(u8*)(trailer->tail + clen-(*pskb)->len - 2) = (clen - (*pskb)->len)-2; *(u8*)(trailer->tail + clen-skb->len - 2) = (clen - skb->len)-2;
pskb_put(*pskb, trailer, clen - (*pskb)->len); pskb_put(skb, trailer, clen - skb->len);
__skb_push(*pskb, (*pskb)->data - (*pskb)->nh.raw); __skb_push(skb, skb->data - skb->nh.raw);
top_iph = (*pskb)->nh.iph; top_iph = skb->nh.iph;
esph = (struct ip_esp_hdr *)((*pskb)->nh.raw + top_iph->ihl*4); esph = (struct ip_esp_hdr *)(skb->nh.raw + top_iph->ihl*4);
top_iph->tot_len = htons((*pskb)->len + alen); top_iph->tot_len = htons(skb->len + alen);
*(u8*)(trailer->tail - 1) = top_iph->protocol; *(u8*)(trailer->tail - 1) = top_iph->protocol;
/* this is non-NULL only with UDP Encapsulation */ /* this is non-NULL only with UDP Encapsulation */
...@@ -76,7 +76,7 @@ int esp_output(struct sk_buff **pskb) ...@@ -76,7 +76,7 @@ int esp_output(struct sk_buff **pskb)
uh = (struct udphdr *)esph; uh = (struct udphdr *)esph;
uh->source = encap->encap_sport; uh->source = encap->encap_sport;
uh->dest = encap->encap_dport; uh->dest = encap->encap_dport;
uh->len = htons((*pskb)->len + alen - top_iph->ihl*4); uh->len = htons(skb->len + alen - top_iph->ihl*4);
uh->check = 0; uh->check = 0;
switch (encap->encap_type) { switch (encap->encap_type) {
...@@ -109,7 +109,7 @@ int esp_output(struct sk_buff **pskb) ...@@ -109,7 +109,7 @@ int esp_output(struct sk_buff **pskb)
if (!sg) if (!sg)
goto error; goto error;
} }
skb_to_sgvec(*pskb, sg, esph->enc_data+esp->conf.ivlen-(*pskb)->data, clen); skb_to_sgvec(skb, sg, esph->enc_data+esp->conf.ivlen-skb->data, clen);
crypto_cipher_encrypt(tfm, sg, sg, clen); crypto_cipher_encrypt(tfm, sg, sg, clen);
if (unlikely(sg != &esp->sgbuf[0])) if (unlikely(sg != &esp->sgbuf[0]))
kfree(sg); kfree(sg);
...@@ -121,9 +121,9 @@ int esp_output(struct sk_buff **pskb) ...@@ -121,9 +121,9 @@ int esp_output(struct sk_buff **pskb)
} }
if (esp->auth.icv_full_len) { if (esp->auth.icv_full_len) {
esp->auth.icv(esp, *pskb, (u8*)esph-(*pskb)->data, esp->auth.icv(esp, skb, (u8*)esph-skb->data,
sizeof(struct ip_esp_hdr) + esp->conf.ivlen+clen, trailer->tail); sizeof(struct ip_esp_hdr) + esp->conf.ivlen+clen, trailer->tail);
pskb_put(*pskb, trailer, alen); pskb_put(skb, trailer, alen);
} }
ip_send_check(top_iph); ip_send_check(top_iph);
......
...@@ -120,20 +120,20 @@ static int ipcomp_compress(struct xfrm_state *x, struct sk_buff *skb) ...@@ -120,20 +120,20 @@ static int ipcomp_compress(struct xfrm_state *x, struct sk_buff *skb)
return err; return err;
} }
static int ipcomp_output(struct sk_buff **pskb) static int ipcomp_output(struct sk_buff *skb)
{ {
int err; int err;
struct dst_entry *dst = (*pskb)->dst; struct dst_entry *dst = skb->dst;
struct xfrm_state *x = dst->xfrm; struct xfrm_state *x = dst->xfrm;
struct iphdr *iph; struct iphdr *iph;
struct ip_comp_hdr *ipch; struct ip_comp_hdr *ipch;
struct ipcomp_data *ipcd = x->data; struct ipcomp_data *ipcd = x->data;
int hdr_len = 0; int hdr_len = 0;
iph = (*pskb)->nh.iph; iph = skb->nh.iph;
iph->tot_len = htons((*pskb)->len); iph->tot_len = htons(skb->len);
hdr_len = iph->ihl * 4; hdr_len = iph->ihl * 4;
if (((*pskb)->len - hdr_len) < ipcd->threshold) { if ((skb->len - hdr_len) < ipcd->threshold) {
/* Don't bother compressing */ /* Don't bother compressing */
if (x->props.mode) { if (x->props.mode) {
ip_send_check(iph); ip_send_check(iph);
...@@ -141,17 +141,17 @@ static int ipcomp_output(struct sk_buff **pskb) ...@@ -141,17 +141,17 @@ static int ipcomp_output(struct sk_buff **pskb)
goto out_ok; goto out_ok;
} }
if ((skb_is_nonlinear(*pskb) || skb_cloned(*pskb)) && if ((skb_is_nonlinear(skb) || skb_cloned(skb)) &&
skb_linearize(*pskb, GFP_ATOMIC) != 0) { skb_linearize(skb, GFP_ATOMIC) != 0) {
err = -ENOMEM; err = -ENOMEM;
goto error; goto error;
} }
err = ipcomp_compress(x, *pskb); err = ipcomp_compress(x, skb);
if (err) { if (err) {
if (err == -EMSGSIZE) { if (err == -EMSGSIZE) {
if (x->props.mode) { if (x->props.mode) {
iph = (*pskb)->nh.iph; iph = skb->nh.iph;
ip_send_check(iph); ip_send_check(iph);
} }
goto out_ok; goto out_ok;
...@@ -160,8 +160,8 @@ static int ipcomp_output(struct sk_buff **pskb) ...@@ -160,8 +160,8 @@ static int ipcomp_output(struct sk_buff **pskb)
} }
/* Install ipcomp header, convert into ipcomp datagram. */ /* Install ipcomp header, convert into ipcomp datagram. */
iph = (*pskb)->nh.iph; iph = skb->nh.iph;
iph->tot_len = htons((*pskb)->len); iph->tot_len = htons(skb->len);
ipch = (struct ip_comp_hdr *)((char *)iph + iph->ihl * 4); ipch = (struct ip_comp_hdr *)((char *)iph + iph->ihl * 4);
ipch->nexthdr = iph->protocol; ipch->nexthdr = iph->protocol;
ipch->flags = 0; ipch->flags = 0;
......
...@@ -119,8 +119,7 @@ int xfrm4_output(struct sk_buff **pskb) ...@@ -119,8 +119,7 @@ int xfrm4_output(struct sk_buff **pskb)
xfrm4_encap(skb); xfrm4_encap(skb);
err = x->type->output(pskb); err = x->type->output(skb);
skb = *pskb;
if (err) if (err)
goto error; goto error;
......
...@@ -9,9 +9,8 @@ ...@@ -9,9 +9,8 @@
#include <net/ip.h> #include <net/ip.h>
#include <net/protocol.h> #include <net/protocol.h>
static int ipip_output(struct sk_buff **pskb) static int ipip_output(struct sk_buff *skb)
{ {
struct sk_buff *skb = *pskb;
struct iphdr *iph; struct iphdr *iph;
iph = skb->nh.iph; iph = skb->nh.iph;
......
...@@ -154,11 +154,11 @@ static int ipv6_clear_mutable_options(struct ipv6hdr *iph, int len) ...@@ -154,11 +154,11 @@ static int ipv6_clear_mutable_options(struct ipv6hdr *iph, int len)
return 0; return 0;
} }
int ah6_output(struct sk_buff **pskb) int ah6_output(struct sk_buff *skb)
{ {
int err; int err;
int extlen; int extlen;
struct dst_entry *dst = (*pskb)->dst; struct dst_entry *dst = skb->dst;
struct xfrm_state *x = dst->xfrm; struct xfrm_state *x = dst->xfrm;
struct ipv6hdr *top_iph; struct ipv6hdr *top_iph;
struct ip_auth_hdr *ah; struct ip_auth_hdr *ah;
...@@ -170,11 +170,11 @@ int ah6_output(struct sk_buff **pskb) ...@@ -170,11 +170,11 @@ int ah6_output(struct sk_buff **pskb)
char hdrs[0]; char hdrs[0];
} *tmp_ext; } *tmp_ext;
top_iph = (struct ipv6hdr *)(*pskb)->data; top_iph = (struct ipv6hdr *)skb->data;
top_iph->payload_len = htons((*pskb)->len - sizeof(*top_iph)); top_iph->payload_len = htons(skb->len - sizeof(*top_iph));
nexthdr = *(*pskb)->nh.raw; nexthdr = *skb->nh.raw;
*(*pskb)->nh.raw = IPPROTO_AH; *skb->nh.raw = IPPROTO_AH;
/* When there are no extension headers, we only need to save the first /* When there are no extension headers, we only need to save the first
* 8 bytes of the base IP header. * 8 bytes of the base IP header.
...@@ -182,7 +182,7 @@ int ah6_output(struct sk_buff **pskb) ...@@ -182,7 +182,7 @@ int ah6_output(struct sk_buff **pskb)
memcpy(tmp_base, top_iph, sizeof(tmp_base)); memcpy(tmp_base, top_iph, sizeof(tmp_base));
tmp_ext = NULL; tmp_ext = NULL;
extlen = (*pskb)->h.raw - (unsigned char *)(top_iph + 1); extlen = skb->h.raw - (unsigned char *)(top_iph + 1);
if (extlen) { if (extlen) {
extlen += sizeof(*tmp_ext); extlen += sizeof(*tmp_ext);
tmp_ext = kmalloc(extlen, GFP_ATOMIC); tmp_ext = kmalloc(extlen, GFP_ATOMIC);
...@@ -198,7 +198,7 @@ int ah6_output(struct sk_buff **pskb) ...@@ -198,7 +198,7 @@ int ah6_output(struct sk_buff **pskb)
goto error_free_iph; goto error_free_iph;
} }
ah = (struct ip_auth_hdr *)(*pskb)->h.raw; ah = (struct ip_auth_hdr *)skb->h.raw;
ah->nexthdr = nexthdr; ah->nexthdr = nexthdr;
top_iph->priority = 0; top_iph->priority = 0;
...@@ -214,7 +214,7 @@ int ah6_output(struct sk_buff **pskb) ...@@ -214,7 +214,7 @@ int ah6_output(struct sk_buff **pskb)
ah->reserved = 0; ah->reserved = 0;
ah->spi = x->id.spi; ah->spi = x->id.spi;
ah->seq_no = htonl(++x->replay.oseq); ah->seq_no = htonl(++x->replay.oseq);
ahp->icv(ahp, *pskb, ah->auth_data); ahp->icv(ahp, skb, ah->auth_data);
err = 0; err = 0;
......
...@@ -37,11 +37,11 @@ ...@@ -37,11 +37,11 @@
#include <net/ipv6.h> #include <net/ipv6.h>
#include <linux/icmpv6.h> #include <linux/icmpv6.h>
int esp6_output(struct sk_buff **pskb) int esp6_output(struct sk_buff *skb)
{ {
int err; int err;
int hdr_len; int hdr_len;
struct dst_entry *dst = (*pskb)->dst; struct dst_entry *dst = skb->dst;
struct xfrm_state *x = dst->xfrm; struct xfrm_state *x = dst->xfrm;
struct ipv6hdr *top_iph; struct ipv6hdr *top_iph;
struct ipv6_esp_hdr *esph; struct ipv6_esp_hdr *esph;
...@@ -54,17 +54,17 @@ int esp6_output(struct sk_buff **pskb) ...@@ -54,17 +54,17 @@ int esp6_output(struct sk_buff **pskb)
int nfrags; int nfrags;
esp = x->data; esp = x->data;
hdr_len = (*pskb)->h.raw - (*pskb)->data + hdr_len = skb->h.raw - skb->data +
sizeof(*esph) + esp->conf.ivlen; sizeof(*esph) + esp->conf.ivlen;
/* Strip IP+ESP header. */ /* Strip IP+ESP header. */
__skb_pull(*pskb, hdr_len); __skb_pull(skb, hdr_len);
/* Now skb is pure payload to encrypt */ /* Now skb is pure payload to encrypt */
err = -ENOMEM; err = -ENOMEM;
/* Round to block size */ /* Round to block size */
clen = (*pskb)->len; clen = skb->len;
alen = esp->auth.icv_trunc_len; alen = esp->auth.icv_trunc_len;
tfm = esp->conf.tfm; tfm = esp->conf.tfm;
...@@ -73,24 +73,24 @@ int esp6_output(struct sk_buff **pskb) ...@@ -73,24 +73,24 @@ int esp6_output(struct sk_buff **pskb)
if (esp->conf.padlen) if (esp->conf.padlen)
clen = (clen + esp->conf.padlen-1)&~(esp->conf.padlen-1); clen = (clen + esp->conf.padlen-1)&~(esp->conf.padlen-1);
if ((nfrags = skb_cow_data(*pskb, clen-(*pskb)->len+alen, &trailer)) < 0) { if ((nfrags = skb_cow_data(skb, clen-skb->len+alen, &trailer)) < 0) {
goto error; goto error;
} }
/* Fill padding... */ /* Fill padding... */
do { do {
int i; int i;
for (i=0; i<clen-(*pskb)->len - 2; i++) for (i=0; i<clen-skb->len - 2; i++)
*(u8*)(trailer->tail + i) = i+1; *(u8*)(trailer->tail + i) = i+1;
} while (0); } while (0);
*(u8*)(trailer->tail + clen-(*pskb)->len - 2) = (clen - (*pskb)->len)-2; *(u8*)(trailer->tail + clen-skb->len - 2) = (clen - skb->len)-2;
pskb_put(*pskb, trailer, clen - (*pskb)->len); pskb_put(skb, trailer, clen - skb->len);
top_iph = (struct ipv6hdr *)__skb_push(*pskb, hdr_len); top_iph = (struct ipv6hdr *)__skb_push(skb, hdr_len);
esph = (struct ipv6_esp_hdr *)(*pskb)->h.raw; esph = (struct ipv6_esp_hdr *)skb->h.raw;
top_iph->payload_len = htons((*pskb)->len + alen - sizeof(*top_iph)); top_iph->payload_len = htons(skb->len + alen - sizeof(*top_iph));
*(u8*)(trailer->tail - 1) = *(*pskb)->nh.raw; *(u8*)(trailer->tail - 1) = *skb->nh.raw;
*(*pskb)->nh.raw = IPPROTO_ESP; *skb->nh.raw = IPPROTO_ESP;
esph->spi = x->id.spi; esph->spi = x->id.spi;
esph->seq_no = htonl(++x->replay.oseq); esph->seq_no = htonl(++x->replay.oseq);
...@@ -106,7 +106,7 @@ int esp6_output(struct sk_buff **pskb) ...@@ -106,7 +106,7 @@ int esp6_output(struct sk_buff **pskb)
if (!sg) if (!sg)
goto error; goto error;
} }
skb_to_sgvec(*pskb, sg, esph->enc_data+esp->conf.ivlen-(*pskb)->data, clen); skb_to_sgvec(skb, sg, esph->enc_data+esp->conf.ivlen-skb->data, clen);
crypto_cipher_encrypt(tfm, sg, sg, clen); crypto_cipher_encrypt(tfm, sg, sg, clen);
if (unlikely(sg != &esp->sgbuf[0])) if (unlikely(sg != &esp->sgbuf[0]))
kfree(sg); kfree(sg);
...@@ -118,9 +118,9 @@ int esp6_output(struct sk_buff **pskb) ...@@ -118,9 +118,9 @@ int esp6_output(struct sk_buff **pskb)
} }
if (esp->auth.icv_full_len) { if (esp->auth.icv_full_len) {
esp->auth.icv(esp, *pskb, (u8*)esph-(*pskb)->data, esp->auth.icv(esp, skb, (u8*)esph-skb->data,
sizeof(struct ipv6_esp_hdr) + esp->conf.ivlen+clen, trailer->tail); sizeof(struct ipv6_esp_hdr) + esp->conf.ivlen+clen, trailer->tail);
pskb_put(*pskb, trailer, alen); pskb_put(skb, trailer, alen);
} }
err = 0; err = 0;
......
...@@ -114,10 +114,10 @@ static int ipcomp6_input(struct xfrm_state *x, struct xfrm_decap_state *decap, s ...@@ -114,10 +114,10 @@ static int ipcomp6_input(struct xfrm_state *x, struct xfrm_decap_state *decap, s
return err; return err;
} }
static int ipcomp6_output(struct sk_buff **pskb) static int ipcomp6_output(struct sk_buff *skb)
{ {
int err; int err;
struct dst_entry *dst = (*pskb)->dst; struct dst_entry *dst = skb->dst;
struct xfrm_state *x = dst->xfrm; struct xfrm_state *x = dst->xfrm;
struct ipv6hdr *top_iph; struct ipv6hdr *top_iph;
int hdr_len; int hdr_len;
...@@ -126,23 +126,23 @@ static int ipcomp6_output(struct sk_buff **pskb) ...@@ -126,23 +126,23 @@ static int ipcomp6_output(struct sk_buff **pskb)
int plen, dlen; int plen, dlen;
u8 *start, *scratch = ipcd->scratch; u8 *start, *scratch = ipcd->scratch;
hdr_len = (*pskb)->h.raw - (*pskb)->data; hdr_len = skb->h.raw - skb->data;
/* check whether datagram len is larger than threshold */ /* check whether datagram len is larger than threshold */
if (((*pskb)->len - hdr_len) < ipcd->threshold) { if ((skb->len - hdr_len) < ipcd->threshold) {
goto out_ok; goto out_ok;
} }
if ((skb_is_nonlinear(*pskb) || skb_cloned(*pskb)) && if ((skb_is_nonlinear(skb) || skb_cloned(skb)) &&
skb_linearize(*pskb, GFP_ATOMIC) != 0) { skb_linearize(skb, GFP_ATOMIC) != 0) {
err = -ENOMEM; err = -ENOMEM;
goto error; goto error;
} }
/* compression */ /* compression */
plen = (*pskb)->len - hdr_len; plen = skb->len - hdr_len;
dlen = IPCOMP_SCRATCH_SIZE; dlen = IPCOMP_SCRATCH_SIZE;
start = (*pskb)->h.raw; start = skb->h.raw;
err = crypto_comp_compress(ipcd->tfm, start, plen, scratch, &dlen); err = crypto_comp_compress(ipcd->tfm, start, plen, scratch, &dlen);
if (err) { if (err) {
...@@ -152,18 +152,18 @@ static int ipcomp6_output(struct sk_buff **pskb) ...@@ -152,18 +152,18 @@ static int ipcomp6_output(struct sk_buff **pskb)
goto out_ok; goto out_ok;
} }
memcpy(start + sizeof(struct ip_comp_hdr), scratch, dlen); memcpy(start + sizeof(struct ip_comp_hdr), scratch, dlen);
pskb_trim(*pskb, hdr_len + dlen + sizeof(struct ip_comp_hdr)); pskb_trim(skb, hdr_len + dlen + sizeof(struct ip_comp_hdr));
/* insert ipcomp header and replace datagram */ /* insert ipcomp header and replace datagram */
top_iph = (struct ipv6hdr *)(*pskb)->data; top_iph = (struct ipv6hdr *)skb->data;
top_iph->payload_len = htons((*pskb)->len - sizeof(struct ipv6hdr)); top_iph->payload_len = htons(skb->len - sizeof(struct ipv6hdr));
ipch = (struct ipv6_comp_hdr *)start; ipch = (struct ipv6_comp_hdr *)start;
ipch->nexthdr = *(*pskb)->nh.raw; ipch->nexthdr = *skb->nh.raw;
ipch->flags = 0; ipch->flags = 0;
ipch->cpi = htons((u16 )ntohl(x->id.spi)); ipch->cpi = htons((u16 )ntohl(x->id.spi));
*(*pskb)->nh.raw = IPPROTO_COMP; *skb->nh.raw = IPPROTO_COMP;
out_ok: out_ok:
err = 0; err = 0;
......
...@@ -113,8 +113,7 @@ int xfrm6_output(struct sk_buff **pskb) ...@@ -113,8 +113,7 @@ int xfrm6_output(struct sk_buff **pskb)
xfrm6_encap(skb); xfrm6_encap(skb);
err = x->type->output(pskb); err = x->type->output(skb);
skb = *pskb;
if (err) if (err)
goto error; goto error;
......
...@@ -343,9 +343,8 @@ void xfrm6_tunnel_free_spi(xfrm_address_t *saddr) ...@@ -343,9 +343,8 @@ void xfrm6_tunnel_free_spi(xfrm_address_t *saddr)
EXPORT_SYMBOL(xfrm6_tunnel_free_spi); EXPORT_SYMBOL(xfrm6_tunnel_free_spi);
static int xfrm6_tunnel_output(struct sk_buff **pskb) static int xfrm6_tunnel_output(struct sk_buff *skb)
{ {
struct sk_buff *skb = *pskb;
struct ipv6hdr *top_iph; struct ipv6hdr *top_iph;
top_iph = (struct ipv6hdr *)skb->data; top_iph = (struct ipv6hdr *)skb->data;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment