[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>
This commit is contained in:
committed by
David S. Miller
parent
7b277b1a5f
commit
37fedd3aab
@ -82,14 +82,14 @@ static int ah_output(struct xfrm_state *x, struct sk_buff *skb)
|
||||
goto error;
|
||||
}
|
||||
|
||||
ah = (struct ip_auth_hdr *)((char *)top_iph+top_iph->ihl*4);
|
||||
ah->nexthdr = top_iph->protocol;
|
||||
ah = (struct ip_auth_hdr *)skb_transport_header(skb);
|
||||
ah->nexthdr = *skb_mac_header(skb);
|
||||
*skb_mac_header(skb) = IPPROTO_AH;
|
||||
|
||||
top_iph->tos = 0;
|
||||
top_iph->tot_len = htons(skb->len);
|
||||
top_iph->frag_off = 0;
|
||||
top_iph->ttl = 0;
|
||||
top_iph->protocol = IPPROTO_AH;
|
||||
top_iph->check = 0;
|
||||
|
||||
ahp = x->data;
|
||||
|
Reference in New Issue
Block a user