diff options
author | Steffen Klassert <steffen.klassert@secunet.com> | 2011-11-22 21:13:31 -0500 |
---|---|---|
committer | David S. Miller <davem@davemloft.net> | 2011-11-26 14:29:51 -0500 |
commit | 618f9bc74a039da76fa027ac2600c5b785b964c5 (patch) | |
tree | ff69bc14b711c9c9d4c691d2a8c262401d62c8c9 /net | |
parent | ebb762f27fed083cb993a0816393aba4615f6544 (diff) |
net: Move mtu handling down to the protocol depended handlers
We move all mtu handling from dst_mtu() down to the protocol
layer. So each protocol can implement the mtu handling in
a different manner.
Signed-off-by: Steffen Klassert <steffen.klassert@secunet.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'net')
-rw-r--r-- | net/decnet/dn_route.c | 4 | ||||
-rw-r--r-- | net/ipv4/route.c | 11 | ||||
-rw-r--r-- | net/ipv6/route.c | 11 | ||||
-rw-r--r-- | net/xfrm/xfrm_policy.c | 4 |
4 files changed, 24 insertions, 6 deletions
diff --git a/net/decnet/dn_route.c b/net/decnet/dn_route.c index db4867963247..94f4ec036669 100644 --- a/net/decnet/dn_route.c +++ b/net/decnet/dn_route.c | |||
@@ -827,7 +827,9 @@ static unsigned int dn_dst_default_advmss(const struct dst_entry *dst) | |||
827 | 827 | ||
828 | static unsigned int dn_dst_mtu(const struct dst_entry *dst) | 828 | static unsigned int dn_dst_mtu(const struct dst_entry *dst) |
829 | { | 829 | { |
830 | return dst->dev->mtu; | 830 | unsigned int mtu = dst_metric_raw(dst, RTAX_MTU); |
831 | |||
832 | return mtu ? : dst->dev->mtu; | ||
831 | } | 833 | } |
832 | 834 | ||
833 | static struct neighbour *dn_dst_neigh_lookup(const struct dst_entry *dst, const void *daddr) | 835 | static struct neighbour *dn_dst_neigh_lookup(const struct dst_entry *dst, const void *daddr) |
diff --git a/net/ipv4/route.c b/net/ipv4/route.c index f1ac3efc5524..11d1b2080a16 100644 --- a/net/ipv4/route.c +++ b/net/ipv4/route.c | |||
@@ -1816,7 +1816,12 @@ static unsigned int ipv4_default_advmss(const struct dst_entry *dst) | |||
1816 | 1816 | ||
1817 | static unsigned int ipv4_mtu(const struct dst_entry *dst) | 1817 | static unsigned int ipv4_mtu(const struct dst_entry *dst) |
1818 | { | 1818 | { |
1819 | unsigned int mtu = dst->dev->mtu; | 1819 | unsigned int mtu = dst_metric_raw(dst, RTAX_MTU); |
1820 | |||
1821 | if (mtu) | ||
1822 | return mtu; | ||
1823 | |||
1824 | mtu = dst->dev->mtu; | ||
1820 | 1825 | ||
1821 | if (unlikely(dst_metric_locked(dst, RTAX_MTU))) { | 1826 | if (unlikely(dst_metric_locked(dst, RTAX_MTU))) { |
1822 | const struct rtable *rt = (const struct rtable *) dst; | 1827 | const struct rtable *rt = (const struct rtable *) dst; |
@@ -2757,7 +2762,9 @@ static struct dst_entry *ipv4_blackhole_dst_check(struct dst_entry *dst, u32 coo | |||
2757 | 2762 | ||
2758 | static unsigned int ipv4_blackhole_mtu(const struct dst_entry *dst) | 2763 | static unsigned int ipv4_blackhole_mtu(const struct dst_entry *dst) |
2759 | { | 2764 | { |
2760 | return dst->dev->mtu; | 2765 | unsigned int mtu = dst_metric_raw(dst, RTAX_MTU); |
2766 | |||
2767 | return mtu ? : dst->dev->mtu; | ||
2761 | } | 2768 | } |
2762 | 2769 | ||
2763 | static void ipv4_rt_blackhole_update_pmtu(struct dst_entry *dst, u32 mtu) | 2770 | static void ipv4_rt_blackhole_update_pmtu(struct dst_entry *dst, u32 mtu) |
diff --git a/net/ipv6/route.c b/net/ipv6/route.c index 76645d7077ff..3399dd326287 100644 --- a/net/ipv6/route.c +++ b/net/ipv6/route.c | |||
@@ -157,7 +157,9 @@ static struct dst_ops ip6_dst_ops_template = { | |||
157 | 157 | ||
158 | static unsigned int ip6_blackhole_mtu(const struct dst_entry *dst) | 158 | static unsigned int ip6_blackhole_mtu(const struct dst_entry *dst) |
159 | { | 159 | { |
160 | return dst->dev->mtu; | 160 | unsigned int mtu = dst_metric_raw(dst, RTAX_MTU); |
161 | |||
162 | return mtu ? : dst->dev->mtu; | ||
161 | } | 163 | } |
162 | 164 | ||
163 | static void ip6_rt_blackhole_update_pmtu(struct dst_entry *dst, u32 mtu) | 165 | static void ip6_rt_blackhole_update_pmtu(struct dst_entry *dst, u32 mtu) |
@@ -1043,8 +1045,13 @@ static unsigned int ip6_default_advmss(const struct dst_entry *dst) | |||
1043 | 1045 | ||
1044 | static unsigned int ip6_mtu(const struct dst_entry *dst) | 1046 | static unsigned int ip6_mtu(const struct dst_entry *dst) |
1045 | { | 1047 | { |
1046 | unsigned int mtu = IPV6_MIN_MTU; | ||
1047 | struct inet6_dev *idev; | 1048 | struct inet6_dev *idev; |
1049 | unsigned int mtu = dst_metric_raw(dst, RTAX_MTU); | ||
1050 | |||
1051 | if (mtu) | ||
1052 | return mtu; | ||
1053 | |||
1054 | mtu = IPV6_MIN_MTU; | ||
1048 | 1055 | ||
1049 | rcu_read_lock(); | 1056 | rcu_read_lock(); |
1050 | idev = __in6_dev_get(dst->dev); | 1057 | idev = __in6_dev_get(dst->dev); |
diff --git a/net/xfrm/xfrm_policy.c b/net/xfrm/xfrm_policy.c index b8be51eb7e29..2118d6446630 100644 --- a/net/xfrm/xfrm_policy.c +++ b/net/xfrm/xfrm_policy.c | |||
@@ -2384,7 +2384,9 @@ static unsigned int xfrm_default_advmss(const struct dst_entry *dst) | |||
2384 | 2384 | ||
2385 | static unsigned int xfrm_mtu(const struct dst_entry *dst) | 2385 | static unsigned int xfrm_mtu(const struct dst_entry *dst) |
2386 | { | 2386 | { |
2387 | return dst_mtu(dst->path); | 2387 | unsigned int mtu = dst_metric_raw(dst, RTAX_MTU); |
2388 | |||
2389 | return mtu ? : dst_mtu(dst->path); | ||
2388 | } | 2390 | } |
2389 | 2391 | ||
2390 | static struct neighbour *xfrm_neigh_lookup(const struct dst_entry *dst, const void *daddr) | 2392 | static struct neighbour *xfrm_neigh_lookup(const struct dst_entry *dst, const void *daddr) |