[IPSEC]: Get rid of ipv6_{auth,esp,comp}_hdr
This patch removes the duplicate ipv6_{auth,esp,comp}_hdr structures since they're identical to the IPv4 versions. Duplicating them would only create problems for ourselves later when we need to add things like extended sequence numbers. I've also added transport header type conversion headers for these types which are now used by the transforms. 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
37fedd3aab
commit
87bdc48d30
@@ -60,7 +60,7 @@ static int esp_output(struct xfrm_state *x, struct sk_buff *skb)
|
||||
|
||||
skb_push(skb, -skb_network_offset(skb));
|
||||
top_iph = ip_hdr(skb);
|
||||
esph = (struct ip_esp_hdr *)skb_transport_header(skb);
|
||||
esph = ip_esp_hdr(skb);
|
||||
top_iph->tot_len = htons(skb->len + alen);
|
||||
*(skb_tail_pointer(trailer) - 1) = *skb_mac_header(skb);
|
||||
*skb_mac_header(skb) = IPPROTO_ESP;
|
||||
@@ -157,7 +157,7 @@ static int esp_input(struct xfrm_state *x, struct sk_buff *skb)
|
||||
struct sk_buff *trailer;
|
||||
int blksize = ALIGN(crypto_blkcipher_blocksize(tfm), 4);
|
||||
int alen = esp->auth.icv_trunc_len;
|
||||
int elen = skb->len - sizeof(struct ip_esp_hdr) - esp->conf.ivlen - alen;
|
||||
int elen = skb->len - sizeof(*esph) - esp->conf.ivlen - alen;
|
||||
int nfrags;
|
||||
int ihl;
|
||||
u8 nexthdr[2];
|
||||
@@ -165,7 +165,7 @@ static int esp_input(struct xfrm_state *x, struct sk_buff *skb)
|
||||
int padlen;
|
||||
int err;
|
||||
|
||||
if (!pskb_may_pull(skb, sizeof(struct ip_esp_hdr)))
|
||||
if (!pskb_may_pull(skb, sizeof(*esph)))
|
||||
goto out;
|
||||
|
||||
if (elen <= 0 || (elen & (blksize-1)))
|
||||
@@ -193,7 +193,7 @@ static int esp_input(struct xfrm_state *x, struct sk_buff *skb)
|
||||
|
||||
skb->ip_summed = CHECKSUM_NONE;
|
||||
|
||||
esph = (struct ip_esp_hdr*)skb->data;
|
||||
esph = (struct ip_esp_hdr *)skb->data;
|
||||
|
||||
/* Get ivec. This can be wrong, check against another impls. */
|
||||
if (esp->conf.ivlen)
|
||||
@@ -206,7 +206,7 @@ static int esp_input(struct xfrm_state *x, struct sk_buff *skb)
|
||||
if (!sg)
|
||||
goto out;
|
||||
}
|
||||
skb_to_sgvec(skb, sg, sizeof(struct ip_esp_hdr) + esp->conf.ivlen, elen);
|
||||
skb_to_sgvec(skb, sg, sizeof(*esph) + esp->conf.ivlen, elen);
|
||||
err = crypto_blkcipher_decrypt(&desc, sg, sg, elen);
|
||||
if (unlikely(sg != &esp->sgbuf[0]))
|
||||
kfree(sg);
|
||||
|
Reference in New Issue
Block a user