summaryrefslogtreecommitdiff
path: root/net/ipv4/ipcomp.c
diff options
context:
space:
mode:
authorHerbert Xu <herbert@gondor.apana.org.au>2007-10-10 15:44:44 -0700
committerDavid S. Miller <davem@sunset.davemloft.net>2007-10-10 16:55:54 -0700
commit37fedd3aab6517daec628764c5d66dd8761fbe5f (patch)
tree12227aec3944168bff04173dccd580240f4496aa /net/ipv4/ipcomp.c
parent7b277b1a5fb147cb828e5d8b9780cee60f31a9bf (diff)
downloadlinux-stable-37fedd3aab6517daec628764c5d66dd8761fbe5f.tar.gz
linux-stable-37fedd3aab6517daec628764c5d66dd8761fbe5f.tar.bz2
linux-stable-37fedd3aab6517daec628764c5d66dd8761fbe5f.zip
[IPSEC]: Use IPv6 calling convention as the convention for x->mode->output
The IPv6 calling convention for x->mode->output is more general and could help an eventual protocol-generic x->type->output implementation. This patch adopts it for IPv4 as well and modifies the IPv4 type output functions accordingly. It also rewrites the IPv6 mac/transport header calculation to be based off the network header where practical. Signed-off-by: Herbert Xu <herbert@gondor.apana.org.au> Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'net/ipv4/ipcomp.c')
-rw-r--r--net/ipv4/ipcomp.c10
1 files changed, 5 insertions, 5 deletions
diff --git a/net/ipv4/ipcomp.c b/net/ipv4/ipcomp.c
index 1929d451dab5..bf74f64fe5fb 100644
--- a/net/ipv4/ipcomp.c
+++ b/net/ipv4/ipcomp.c
@@ -98,10 +98,10 @@ out:
static int ipcomp_compress(struct xfrm_state *x, struct sk_buff *skb)
{
struct ipcomp_data *ipcd = x->data;
- const int ihlen = ip_hdrlen(skb);
+ const int ihlen = skb_transport_offset(skb);
const int plen = skb->len - ihlen;
int dlen = IPCOMP_SCRATCH_SIZE;
- u8 *start = skb->data + ihlen;
+ u8 *start = skb_transport_header(skb);
const int cpu = get_cpu();
u8 *scratch = *per_cpu_ptr(ipcomp_scratches, cpu);
struct crypto_comp *tfm = *per_cpu_ptr(ipcd->tfms, cpu);
@@ -154,11 +154,11 @@ static int ipcomp_output(struct xfrm_state *x, struct sk_buff *skb)
/* Install ipcomp header, convert into ipcomp datagram. */
iph->tot_len = htons(skb->len);
- ipch = (struct ip_comp_hdr *)((char *)iph + iph->ihl * 4);
- ipch->nexthdr = iph->protocol;
+ ipch = (struct ip_comp_hdr *)skb_transport_header(skb);
+ ipch->nexthdr = *skb_mac_header(skb);
ipch->flags = 0;
ipch->cpi = htons((u16 )ntohl(x->id.spi));
- iph->protocol = IPPROTO_COMP;
+ *skb_mac_header(skb) = IPPROTO_COMP;
ip_send_check(iph);
return 0;