]> err.no Git - linux-2.6/commitdiff
[XFRM]: Fix MTU calculation for non-ESP SAs
authorPatrick McHardy <kaber@trash.net>
Tue, 19 Jun 2007 05:30:15 +0000 (22:30 -0700)
committerDavid S. Miller <davem@davemloft.net>
Tue, 19 Jun 2007 05:30:15 +0000 (22:30 -0700)
My IPsec MTU optimization patch introduced a regression in MTU calculation
for non-ESP SAs, the SA's header_len needs to be subtracted from the MTU if
the transform doesn't provide a ->get_mtu() function.

Reported-and-tested-by: Marco Berizzi <pupilla@hotmail.com>
Signed-off-by: Patrick McHardy <kaber@trash.net>
Signed-off-by: David S. Miller <davem@davemloft.net>
net/xfrm/xfrm_state.c

index 85f3f43a6cca402a3339aa4ef8317d7b41eaaa00..dfacb9c2a6e3861837b1a25b2d919bcc19b88d5a 100644 (file)
@@ -1729,7 +1729,7 @@ int xfrm_state_mtu(struct xfrm_state *x, int mtu)
            x->type && x->type->get_mtu)
                res = x->type->get_mtu(x, mtu);
        else
-               res = mtu;
+               res = mtu - x->props.header_len;
        spin_unlock_bh(&x->lock);
        return res;
 }