Messages in this thread Patch in this message | | | From | Beau Kuiper <> | Subject | Loopback driver bugfix for MTU setting : Patch included | Date | Mon, 28 Jun 1999 20:08:01 +0800 |
| |
Hi all
A small bug in the loopback driver (loopback.c). I have included a patch to fix it.
Description:
The MTU for the loopback driver can be set to any positive value. This allows people (root, that is why it isn't really too important) to change the MTU of the loopback (lo) driver to values too small to be usable. I have found that the stack will crash or the machine will reboot if it is set too low (less than 28). This patch provides protection for people stupid enough (me) to listen to people on IRC about the stability of windows.
How it is triggered:
executing these commands as root will reboot or crash your computer:
ifconfig lo mtu 1 ping localhost
How I fixed It:
I modified loopback.c so that there is a new function (loopback_change_mtu) to handle changing the MTU to be consistant with ethernet devices. I then modified loopback_init to set dev->change_mtu to this function. Hopefully this is the proper way to fix this bug
Email:
Beau Kuiper ekuiperba@cc.curtin.edu.au
THE PATCH: (diff -u)
--- ../../../oldlinux/linux/drivers/net/loopback.c Fri Jun 12 13:52:33 1998 +++ loopback.c Mon Jun 28 18:50:54 1999 @@ -113,10 +113,19 @@ return 0; } +static int loopback_change_mtu(struct device *dev, int new_mtu) +{ + if ((new_mtu < 28) || (new_mtu > 65536)) + return -EINVAL; + dev->mtu = new_mtu; + return 0; +} + /* Initialize the rest of the LOOPBACK device. */ __initfunc(int loopback_init(struct device *dev)) { dev->mtu = LOOPBACK_MTU; + dev->change_mtu = loopback_change_mtu; dev->tbusy = 0; dev->hard_start_xmit = loopback_xmit; dev->hard_header = eth_header; - To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majordomo@vger.rutgers.edu Please read the FAQ at http://www.tux.org/lkml/
| |