Subject: [PATCH 1/1 net-2.6] Re-enable IP when MTU > 68

From: Breno Leitao <[email-masked]>
Date: Fri, 29 Aug 2008 11:53:31 -0300

Actually if you run "ifconfig ethX mtu 56; ifconfig ethX mtu 1500",
then your interface will get corrupted. On an attempt to assign an IP
to the interface, it'll result in:
SIOCSIFADDR: No buffer space available
This happens because when decreasing the MTU under 68, it'll destroy the
in_dev reference forever, even after getting MTU higher than 68 bytes.

This patch just checks if the in_dev is NULL on a NETDEV_CHANGEMTU event
and if MTU is bigger than 68, then re-enable in_dev 

Signed-off-by: Breno Leitao <[email-masked]>

---

diff --git a/net/ipv4/devinet.c b/net/ipv4/devinet.c
index 91d3d96..758b4f6 100644
--- a/net/ipv4/devinet.c
+++ b/net/ipv4/devinet.c
@@ -1048,6 +1048,10 @@ static int inetdev_event(struct notifier_block *this, unsigned long event,
 				IN_DEV_CONF_SET(in_dev, NOXFRM, 1);
 				IN_DEV_CONF_SET(in_dev, NOPOLICY, 1);
 			}
+		} else if (event == NETDEV_CHANGEMTU) {
+			/* Re-enabling IP */
+			if (dev->mtu > 68)
+				in_dev = inetdev_init(dev);
 		}
 		goto out;
 	}