aboutsummaryrefslogtreecommitdiffstats
path: root/net/core
diff options
context:
space:
mode:
authorSabrina Dubroca <sd@queasysnail.net>2018-10-09 11:48:14 -0400
committerDavid S. Miller <davem@davemloft.net>2018-10-11 01:44:46 -0400
commitaf7d6cce53694a88d6a1bb60c9a239a6a5144459 (patch)
treedf65be744e3e4f829bd8d361276ed0516c9de298 /net/core
parent7abab7b9b498650404800a08765f44929fee8f31 (diff)
net: ipv4: update fnhe_pmtu when first hop's MTU changes
Since commit 5aad1de5ea2c ("ipv4: use separate genid for next hop exceptions"), exceptions get deprecated separately from cached routes. In particular, administrative changes don't clear PMTU anymore. As Stefano described in commit e9fa1495d738 ("ipv6: Reflect MTU changes on PMTU of exceptions for MTU-less routes"), the PMTU discovered before the local MTU change can become stale: - if the local MTU is now lower than the PMTU, that PMTU is now incorrect - if the local MTU was the lowest value in the path, and is increased, we might discover a higher PMTU Similarly to what commit e9fa1495d738 did for IPv6, update PMTU in those cases. If the exception was locked, the discovered PMTU was smaller than the minimal accepted PMTU. In that case, if the new local MTU is smaller than the current PMTU, let PMTU discovery figure out if locking of the exception is still needed. To do this, we need to know the old link MTU in the NETDEV_CHANGEMTU notifier. By the time the notifier is called, dev->mtu has been changed. This patch adds the old MTU as additional information in the notifier structure, and a new call_netdevice_notifiers_u32() function. Fixes: 5aad1de5ea2c ("ipv4: use separate genid for next hop exceptions") Signed-off-by: Sabrina Dubroca <sd@queasysnail.net> Reviewed-by: Stefano Brivio <sbrivio@redhat.com> Reviewed-by: David Ahern <dsahern@gmail.com> Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'net/core')
-rw-r--r--net/core/dev.c28
1 files changed, 26 insertions, 2 deletions
diff --git a/net/core/dev.c b/net/core/dev.c
index 82114e1111e6..93243479085f 100644
--- a/net/core/dev.c
+++ b/net/core/dev.c
@@ -1752,6 +1752,28 @@ int call_netdevice_notifiers(unsigned long val, struct net_device *dev)
1752} 1752}
1753EXPORT_SYMBOL(call_netdevice_notifiers); 1753EXPORT_SYMBOL(call_netdevice_notifiers);
1754 1754
1755/**
1756 * call_netdevice_notifiers_mtu - call all network notifier blocks
1757 * @val: value passed unmodified to notifier function
1758 * @dev: net_device pointer passed unmodified to notifier function
1759 * @arg: additional u32 argument passed to the notifier function
1760 *
1761 * Call all network notifier blocks. Parameters and return value
1762 * are as for raw_notifier_call_chain().
1763 */
1764static int call_netdevice_notifiers_mtu(unsigned long val,
1765 struct net_device *dev, u32 arg)
1766{
1767 struct netdev_notifier_info_ext info = {
1768 .info.dev = dev,
1769 .ext.mtu = arg,
1770 };
1771
1772 BUILD_BUG_ON(offsetof(struct netdev_notifier_info_ext, info) != 0);
1773
1774 return call_netdevice_notifiers_info(val, &info.info);
1775}
1776
1755#ifdef CONFIG_NET_INGRESS 1777#ifdef CONFIG_NET_INGRESS
1756static DEFINE_STATIC_KEY_FALSE(ingress_needed_key); 1778static DEFINE_STATIC_KEY_FALSE(ingress_needed_key);
1757 1779
@@ -7574,14 +7596,16 @@ int dev_set_mtu_ext(struct net_device *dev, int new_mtu,
7574 err = __dev_set_mtu(dev, new_mtu); 7596 err = __dev_set_mtu(dev, new_mtu);
7575 7597
7576 if (!err) { 7598 if (!err) {
7577 err = call_netdevice_notifiers(NETDEV_CHANGEMTU, dev); 7599 err = call_netdevice_notifiers_mtu(NETDEV_CHANGEMTU, dev,
7600 orig_mtu);
7578 err = notifier_to_errno(err); 7601 err = notifier_to_errno(err);
7579 if (err) { 7602 if (err) {
7580 /* setting mtu back and notifying everyone again, 7603 /* setting mtu back and notifying everyone again,
7581 * so that they have a chance to revert changes. 7604 * so that they have a chance to revert changes.
7582 */ 7605 */
7583 __dev_set_mtu(dev, orig_mtu); 7606 __dev_set_mtu(dev, orig_mtu);
7584 call_netdevice_notifiers(NETDEV_CHANGEMTU, dev); 7607 call_netdevice_notifiers_mtu(NETDEV_CHANGEMTU, dev,
7608 new_mtu);
7585 } 7609 }
7586 } 7610 }
7587 return err; 7611 return err;