diff options
author | Li RongQing <roy.qing.li@gmail.com> | 2012-12-28 03:07:16 -0500 |
---|---|---|
committer | Steffen Klassert <steffen.klassert@secunet.com> | 2013-01-08 06:41:30 -0500 |
commit | 7143dfac692cd25d48a24dbe8323bc17af95b4ec (patch) | |
tree | b7bd65be7b147b50b4c09f9c1523ed7097586750 /net | |
parent | c7e2e1d72ed7707239d20525e0ebcad7e3303659 (diff) |
ah4/esp4: set transport header correctly for IPsec tunnel mode.
IPsec tunnel does not set ECN field to CE in inner header when
the ECN field in the outer header is CE, and the ECN field in
the inner header is ECT(0) or ECT(1).
The cause is ipip_hdr() does not return the correct address of
inner header since skb->transport-header is not the inner header
after esp_input_done2(), or ah_input().
Signed-off-by: Li RongQing <roy.qing.li@gmail.com>
Signed-off-by: Steffen Klassert <steffen.klassert@secunet.com>
Diffstat (limited to 'net')
-rw-r--r-- | net/ipv4/ah4.c | 11 | ||||
-rw-r--r-- | net/ipv4/esp4.c | 5 |
2 files changed, 13 insertions, 3 deletions
diff --git a/net/ipv4/ah4.c b/net/ipv4/ah4.c index a0d8392491c3..a154d0a08c79 100644 --- a/net/ipv4/ah4.c +++ b/net/ipv4/ah4.c | |||
@@ -269,7 +269,11 @@ static void ah_input_done(struct crypto_async_request *base, int err) | |||
269 | skb->network_header += ah_hlen; | 269 | skb->network_header += ah_hlen; |
270 | memcpy(skb_network_header(skb), work_iph, ihl); | 270 | memcpy(skb_network_header(skb), work_iph, ihl); |
271 | __skb_pull(skb, ah_hlen + ihl); | 271 | __skb_pull(skb, ah_hlen + ihl); |
272 | skb_set_transport_header(skb, -ihl); | 272 | |
273 | if (x->props.mode == XFRM_MODE_TUNNEL) | ||
274 | skb_reset_transport_header(skb); | ||
275 | else | ||
276 | skb_set_transport_header(skb, -ihl); | ||
273 | out: | 277 | out: |
274 | kfree(AH_SKB_CB(skb)->tmp); | 278 | kfree(AH_SKB_CB(skb)->tmp); |
275 | xfrm_input_resume(skb, err); | 279 | xfrm_input_resume(skb, err); |
@@ -381,7 +385,10 @@ static int ah_input(struct xfrm_state *x, struct sk_buff *skb) | |||
381 | skb->network_header += ah_hlen; | 385 | skb->network_header += ah_hlen; |
382 | memcpy(skb_network_header(skb), work_iph, ihl); | 386 | memcpy(skb_network_header(skb), work_iph, ihl); |
383 | __skb_pull(skb, ah_hlen + ihl); | 387 | __skb_pull(skb, ah_hlen + ihl); |
384 | skb_set_transport_header(skb, -ihl); | 388 | if (x->props.mode == XFRM_MODE_TUNNEL) |
389 | skb_reset_transport_header(skb); | ||
390 | else | ||
391 | skb_set_transport_header(skb, -ihl); | ||
385 | 392 | ||
386 | err = nexthdr; | 393 | err = nexthdr; |
387 | 394 | ||
diff --git a/net/ipv4/esp4.c b/net/ipv4/esp4.c index b61e9deb7c7e..fd26ff4f3eac 100644 --- a/net/ipv4/esp4.c +++ b/net/ipv4/esp4.c | |||
@@ -346,7 +346,10 @@ static int esp_input_done2(struct sk_buff *skb, int err) | |||
346 | 346 | ||
347 | pskb_trim(skb, skb->len - alen - padlen - 2); | 347 | pskb_trim(skb, skb->len - alen - padlen - 2); |
348 | __skb_pull(skb, hlen); | 348 | __skb_pull(skb, hlen); |
349 | skb_set_transport_header(skb, -ihl); | 349 | if (x->props.mode == XFRM_MODE_TUNNEL) |
350 | skb_reset_transport_header(skb); | ||
351 | else | ||
352 | skb_set_transport_header(skb, -ihl); | ||
350 | 353 | ||
351 | err = nexthdr[1]; | 354 | err = nexthdr[1]; |
352 | 355 | ||