summaryrefslogtreecommitdiffstats
path: root/net/ipv4/esp4.c
diff options
context:
space:
mode:
authorAnton Arapov <anton@redhat.com>2012-06-12 09:35:08 +0200
committerAnton Arapov <anton@redhat.com>2012-06-12 09:35:08 +0200
commit8a6c6e11d3f0dcecf13668e33f5095b1fe9cb613 (patch)
treeb5915846f53d9eaf8863b80ac3f0579f833385cc /net/ipv4/esp4.c
parent6792a3f47a2e42d7164292bf7f1a55cfc4c91652 (diff)
downloadkernel-uprobes-8a6c6e11d3f0dcecf13668e33f5095b1fe9cb613.tar.gz
kernel-uprobes-8a6c6e11d3f0dcecf13668e33f5095b1fe9cb613.tar.xz
kernel-uprobes-8a6c6e11d3f0dcecf13668e33f5095b1fe9cb613.zip
fedora kernel: a8283add14054ab2cdd473edb61f21ff05848650v3.4.2-1
Signed-off-by: Anton Arapov <anton@redhat.com>
Diffstat (limited to 'net/ipv4/esp4.c')
-rw-r--r--net/ipv4/esp4.c24
1 files changed, 9 insertions, 15 deletions
diff --git a/net/ipv4/esp4.c b/net/ipv4/esp4.c
index 89a47b35905..cb982a61536 100644
--- a/net/ipv4/esp4.c
+++ b/net/ipv4/esp4.c
@@ -459,28 +459,22 @@ static u32 esp4_get_mtu(struct xfrm_state *x, int mtu)
struct esp_data *esp = x->data;
u32 blksize = ALIGN(crypto_aead_blocksize(esp->aead), 4);
u32 align = max_t(u32, blksize, esp->padlen);
- u32 rem;
-
- mtu -= x->props.header_len + crypto_aead_authsize(esp->aead);
- rem = mtu & (align - 1);
- mtu &= ~(align - 1);
+ unsigned int net_adj;
switch (x->props.mode) {
- case XFRM_MODE_TUNNEL:
- break;
- default:
case XFRM_MODE_TRANSPORT:
- /* The worst case */
- mtu -= blksize - 4;
- mtu += min_t(u32, blksize - 4, rem);
- break;
case XFRM_MODE_BEET:
- /* The worst case. */
- mtu += min_t(u32, IPV4_BEET_PHMAXLEN, rem);
+ net_adj = sizeof(struct iphdr);
break;
+ case XFRM_MODE_TUNNEL:
+ net_adj = 0;
+ break;
+ default:
+ BUG();
}
- return mtu - 2;
+ return ((mtu - x->props.header_len - crypto_aead_authsize(esp->aead) -
+ net_adj) & ~(align - 1)) + (net_adj - 2);
}
static void esp4_err(struct sk_buff *skb, u32 info)