aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--include/net/route.h2
-rw-r--r--net/ipv4/icmp.c4
-rw-r--r--net/ipv4/route.c61
-rw-r--r--net/rxrpc/ar-error.c4
4 files changed, 1 insertions, 70 deletions
diff --git a/include/net/route.h b/include/net/route.h
index 6340c37677fc..cc693a5bb20d 100644
--- a/include/net/route.h
+++ b/include/net/route.h
@@ -215,8 +215,6 @@ static inline int ip_route_input_noref(struct sk_buff *skb, __be32 dst, __be32 s
215 return ip_route_input_common(skb, dst, src, tos, devin, true); 215 return ip_route_input_common(skb, dst, src, tos, devin, true);
216} 216}
217 217
218extern unsigned short ip_rt_frag_needed(struct net *net, const struct iphdr *iph,
219 unsigned short new_mtu, struct net_device *dev);
220extern void ip_rt_send_redirect(struct sk_buff *skb); 218extern void ip_rt_send_redirect(struct sk_buff *skb);
221 219
222extern unsigned int inet_addr_type(struct net *net, __be32 addr); 220extern unsigned int inet_addr_type(struct net *net, __be32 addr);
diff --git a/net/ipv4/icmp.c b/net/ipv4/icmp.c
index 0c78ef1e5dde..e1caa1abe5d1 100644
--- a/net/ipv4/icmp.c
+++ b/net/ipv4/icmp.c
@@ -673,9 +673,7 @@ static void icmp_unreach(struct sk_buff *skb)
673 LIMIT_NETDEBUG(KERN_INFO pr_fmt("%pI4: fragmentation needed and DF set\n"), 673 LIMIT_NETDEBUG(KERN_INFO pr_fmt("%pI4: fragmentation needed and DF set\n"),
674 &iph->daddr); 674 &iph->daddr);
675 } else { 675 } else {
676 info = ip_rt_frag_needed(net, iph, 676 info = ntohs(icmph->un.frag.mtu);
677 ntohs(icmph->un.frag.mtu),
678 skb->dev);
679 if (!info) 677 if (!info)
680 goto out; 678 goto out;
681 } 679 }
diff --git a/net/ipv4/route.c b/net/ipv4/route.c
index 03e5b614370e..4f5834c4a667 100644
--- a/net/ipv4/route.c
+++ b/net/ipv4/route.c
@@ -1664,67 +1664,6 @@ out: kfree_skb(skb);
1664 return 0; 1664 return 0;
1665} 1665}
1666 1666
1667/*
1668 * The last two values are not from the RFC but
1669 * are needed for AMPRnet AX.25 paths.
1670 */
1671
1672static const unsigned short mtu_plateau[] =
1673{32000, 17914, 8166, 4352, 2002, 1492, 576, 296, 216, 128 };
1674
1675static inline unsigned short guess_mtu(unsigned short old_mtu)
1676{
1677 int i;
1678
1679 for (i = 0; i < ARRAY_SIZE(mtu_plateau); i++)
1680 if (old_mtu > mtu_plateau[i])
1681 return mtu_plateau[i];
1682 return 68;
1683}
1684
1685unsigned short ip_rt_frag_needed(struct net *net, const struct iphdr *iph,
1686 unsigned short new_mtu,
1687 struct net_device *dev)
1688{
1689 unsigned short old_mtu = ntohs(iph->tot_len);
1690 unsigned short est_mtu = 0;
1691 struct inet_peer *peer;
1692
1693 peer = inet_getpeer_v4(net->ipv4.peers, iph->daddr, 1);
1694 if (peer) {
1695 unsigned short mtu = new_mtu;
1696
1697 if (new_mtu < 68 || new_mtu >= old_mtu) {
1698 /* BSD 4.2 derived systems incorrectly adjust
1699 * tot_len by the IP header length, and report
1700 * a zero MTU in the ICMP message.
1701 */
1702 if (mtu == 0 &&
1703 old_mtu >= 68 + (iph->ihl << 2))
1704 old_mtu -= iph->ihl << 2;
1705 mtu = guess_mtu(old_mtu);
1706 }
1707
1708 if (mtu < ip_rt_min_pmtu)
1709 mtu = ip_rt_min_pmtu;
1710 if (!peer->pmtu_expires || mtu < peer->pmtu_learned) {
1711 unsigned long pmtu_expires;
1712
1713 pmtu_expires = jiffies + ip_rt_mtu_expires;
1714 if (!pmtu_expires)
1715 pmtu_expires = 1UL;
1716
1717 est_mtu = mtu;
1718 peer->pmtu_learned = mtu;
1719 peer->pmtu_expires = pmtu_expires;
1720 atomic_inc(&__rt_peer_genid);
1721 }
1722
1723 inet_putpeer(peer);
1724 }
1725 return est_mtu ? : new_mtu;
1726}
1727
1728static void check_peer_pmtu(struct dst_entry *dst, struct inet_peer *peer) 1667static void check_peer_pmtu(struct dst_entry *dst, struct inet_peer *peer)
1729{ 1668{
1730 unsigned long expires = ACCESS_ONCE(peer->pmtu_expires); 1669 unsigned long expires = ACCESS_ONCE(peer->pmtu_expires);
diff --git a/net/rxrpc/ar-error.c b/net/rxrpc/ar-error.c
index 5d6b572a6704..a9206087b4d7 100644
--- a/net/rxrpc/ar-error.c
+++ b/net/rxrpc/ar-error.c
@@ -81,10 +81,6 @@ void rxrpc_UDP_error_report(struct sock *sk)
81 _net("I/F MTU %u", mtu); 81 _net("I/F MTU %u", mtu);
82 } 82 }
83 83
84 /* ip_rt_frag_needed() may have eaten the info */
85 if (mtu == 0)
86 mtu = ntohs(icmp_hdr(skb)->un.frag.mtu);
87
88 if (mtu == 0) { 84 if (mtu == 0) {
89 /* they didn't give us a size, estimate one */ 85 /* they didn't give us a size, estimate one */
90 if (mtu > 1500) { 86 if (mtu > 1500) {