diff options
author | Herbert Xu <herbert@gondor.apana.org.au> | 2007-10-10 18:44:44 -0400 |
---|---|---|
committer | David S. Miller <davem@sunset.davemloft.net> | 2007-10-10 19:55:54 -0400 |
commit | 37fedd3aab6517daec628764c5d66dd8761fbe5f (patch) | |
tree | 12227aec3944168bff04173dccd580240f4496aa /net/ipv4/ah4.c | |
parent | 7b277b1a5fb147cb828e5d8b9780cee60f31a9bf (diff) |
[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/ah4.c')
-rw-r--r-- | net/ipv4/ah4.c | 6 |
1 files changed, 3 insertions, 3 deletions
diff --git a/net/ipv4/ah4.c b/net/ipv4/ah4.c index dbb1f11721e4..e4f7aa39978d 100644 --- a/net/ipv4/ah4.c +++ b/net/ipv4/ah4.c | |||
@@ -82,14 +82,14 @@ static int ah_output(struct xfrm_state *x, struct sk_buff *skb) | |||
82 | goto error; | 82 | goto error; |
83 | } | 83 | } |
84 | 84 | ||
85 | ah = (struct ip_auth_hdr *)((char *)top_iph+top_iph->ihl*4); | 85 | ah = (struct ip_auth_hdr *)skb_transport_header(skb); |
86 | ah->nexthdr = top_iph->protocol; | 86 | ah->nexthdr = *skb_mac_header(skb); |
87 | *skb_mac_header(skb) = IPPROTO_AH; | ||
87 | 88 | ||
88 | top_iph->tos = 0; | 89 | top_iph->tos = 0; |
89 | top_iph->tot_len = htons(skb->len); | 90 | top_iph->tot_len = htons(skb->len); |
90 | top_iph->frag_off = 0; | 91 | top_iph->frag_off = 0; |
91 | top_iph->ttl = 0; | 92 | top_iph->ttl = 0; |
92 | top_iph->protocol = IPPROTO_AH; | ||
93 | top_iph->check = 0; | 93 | top_iph->check = 0; |
94 | 94 | ||
95 | ahp = x->data; | 95 | ahp = x->data; |