Commit 4d37d463 authored by Herbert Xu's avatar Herbert Xu Committed by David S. Miller

[IPSEC]: Use dst_mtu i n xfrm[46]_output

There was a lot of fun in laying the foundations.  Now it's time
to start using it.

This patch fixes the calculations in xfrm[46]_output so that we don't
reject properly sized packets from the TCP stack.  The previous
calculation is wrong because the xfrm overhead is not constant.

After this I'll start cleaning stuff up.  For example, tcp's
ext2_header_len and dst's path can both be removed.
Signed-off-by: default avatarHerbert Xu <herbert@gondor.apana.org.au>
Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
parent e58c2548
......@@ -124,6 +124,16 @@ dst_pmtu(const struct dst_entry *dst)
return mtu;
}
static inline u32 dst_mtu(const struct dst_entry *dst)
{
u32 mtu = dst_metric(dst, RTAX_MTU);
/*
* Alexey put it here, so ask him about it :)
*/
barrier();
return mtu;
}
static inline int
dst_metric_locked(struct dst_entry *dst, int metric)
{
......
......@@ -82,7 +82,7 @@ static int xfrm4_tunnel_check_size(struct sk_buff *skb)
goto out;
dst = skb->dst;
mtu = dst_pmtu(dst) - dst->header_len - dst->trailer_len;
mtu = dst_mtu(dst);
if (skb->len > mtu) {
icmp_send(skb, ICMP_DEST_UNREACH, ICMP_FRAG_NEEDED, htonl(mtu));
ret = -EMSGSIZE;
......
......@@ -79,7 +79,7 @@ static int xfrm6_tunnel_check_size(struct sk_buff *skb)
int mtu, ret = 0;
struct dst_entry *dst = skb->dst;
mtu = dst_pmtu(dst) - dst->header_len - dst->trailer_len;
mtu = dst_mtu(dst);
if (mtu < IPV6_MIN_MTU)
mtu = IPV6_MIN_MTU;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment