Gentoo Websites Logo
Go to: Gentoo Home Documentation Forums Lists Bugs Planet Store Wiki Get Gentoo!
Bug 342311 - net-misc/dhcpcd-5.2.7 fails when changing the mtu
Summary: net-misc/dhcpcd-5.2.7 fails when changing the mtu
Status: RESOLVED WONTFIX
Alias: None
Product: Gentoo Linux
Classification: Unclassified
Component: Current packages (show other bugs)
Hardware: All Linux
: High normal (vote)
Assignee: William Hubbs
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2010-10-23 13:21 UTC by Alexander Holler
Modified: 2010-10-25 15:02 UTC (History)
2 users (show)

See Also:
Package list:
Runtime testing required: ---


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Alexander Holler 2010-10-23 13:21:47 UTC
Letting dhcpcd chaning the MTU ends in an endless loop of DHCP-queries and non-functional network connection.

I'm using a MTU of 1492 in my network and distribute this MTU via DHCP. If I let dhcpcd change the MTU it results in the following:

--------------------------------------------------
Oct 23 13:38:32 dockstar2 dhcpcd[2625]: version 5.2.7 starting
Oct 23 13:38:32 dockstar2 dhcpcd[2625]: eth0: rebinding lease of x.x.x.x
Oct 23 13:38:32 dockstar2 dhcpcd[2625]: eth0: acknowledged x.x.x.x from y.y.y.y
Oct 23 13:38:32 dockstar2 dhcpcd[2625]: eth0: checking for x.x.x.x
Oct 23 13:38:37 dockstar2 dhcpcd[2625]: eth0: leased x.x.x.x for 600 seconds
Oct 23 13:38:37 dockstar2 dhcpcd: eth0: MTU set to 1492
Oct 23 13:38:37 dockstar2 dhcpcd[2625]: forked to background, child pid 2661
Oct 23 13:38:37 dockstar2 dhcpcd[2661]: eth0: carrier lost
Oct 23 13:38:37 dockstar2 dhcpcd: eth0: MTU restored to 1500
Oct 23 13:38:40 dockstar2 kernel: [   85.678149] eth0: link up, 1000 Mb/s, full duplex, flow control disabled
Oct 23 13:38:40 dockstar2 dhcpcd[2661]: eth0: carrier acquired
Oct 23 13:38:40 dockstar2 dhcpcd[2661]: eth0: rebinding lease of x.x.x.x
Oct 23 13:38:40 dockstar2 dhcpcd[2661]: eth0: acknowledged x.x.x.x from y.y.y.y
Oct 23 13:38:40 dockstar2 dhcpcd[2661]: eth0: checking for x.x.x.x
Oct 23 13:38:46 dockstar2 dhcpcd[2661]: eth0: leased x.x.x.x for 600 seconds
Oct 23 13:38:46 dockstar2 dhcpcd: eth0: MTU set to 1492
Oct 23 13:38:46 dockstar2 dhcpcd[2661]: eth0: carrier lost
Oct 23 13:38:46 dockstar2 dhcpcd: eth0: MTU restored to 1500
Oct 23 13:38:49 dockstar2 kernel: [   94.233829] eth0: link up, 1000 Mb/s, full duplex, flow control disabled
Oct 23 13:38:49 dockstar2 dhcpcd[2661]: eth0: carrier acquired
Oct 23 13:38:49 dockstar2 dhcpcd[2661]: eth0: rebinding lease of x.x.x.x
Oct 23 13:38:49 dockstar2 dhcpcd[2661]: eth0: acknowledged x.x.x.x from y.y.y.y
Oct 23 13:38:49 dockstar2 dhcpcd[2661]: eth0: checking for x.x.x.x
Oct 23 13:38:54 dockstar2 dhcpcd[2661]: eth0: leased x.x.x.x for 600 seconds
Oct 23 13:38:54 dockstar2 dhcpcd: eth0: MTU set to 1492
Oct 23 13:38:54 dockstar2 dhcpcd[2661]: eth0: carrier lost
Oct 23 13:38:55 dockstar2 dhcpcd: eth0: MTU restored to 1500
Oct 23 13:38:57 dockstar2 kernel: [  102.870805] eth0: link up, 1000 Mb/s, full duplex, flow control disabled
Oct 23 13:38:57 dockstar2 dhcpcd[2661]: eth0: carrier acquired
Oct 23 13:38:57 dockstar2 dhcpcd[2661]: eth0: rebinding lease of x.x.x.x
Oct 23 13:38:58 dockstar2 dhcpcd[2661]: eth0: acknowledged x.x.x.x from y.y.y.y
Oct 23 13:38:58 dockstar2 dhcpcd[2661]: eth0: checking for x.x.x.x
Oct 23 13:39:02 dockstar2 dhcpcd[2661]: eth0: leased x.x.x.x for 600 seconds
Oct 23 13:39:02 dockstar2 dhcpcd: eth0: MTU set to 1492
Oct 23 13:39:02 dockstar2 dhcpcd[2661]: eth0: carrier lost
Oct 23 13:39:02 dockstar2 dhcpcd: eth0: MTU restored to 1500
Oct 23 13:39:05 dockstar2 kernel: [  110.663669] eth0: link up, 1000 Mb/s, full duplex, flow control disabled
Oct 23 13:39:05 dockstar2 dhcpcd[2661]: eth0: carrier acquired
Oct 23 13:39:05 dockstar2 dhcpcd[2661]: eth0: rebinding lease of x.x.x.x
Oct 23 13:39:05 dockstar2 dhcpcd[2661]: eth0: acknowledged x.x.x.x from y.y.y.y
Oct 23 13:39:05 dockstar2 dhcpcd[2661]: eth0: checking for x.x.x.x
Oct 23 13:39:10 dockstar2 dhcpcd[2661]: eth0: leased x.x.x.x for 600 seconds
Oct 23 13:39:10 dockstar2 dhcpcd: eth0: MTU set to 1492
Oct 23 13:39:11 dockstar2 dhcpcd[2661]: eth0: carrier lost
Oct 23 13:39:11 dockstar2 dhcpcd: eth0: MTU restored to 1500
Oct 23 13:39:14 dockstar2 kernel: [  118.957185] eth0: link up, 1000 Mb/s, full duplex, flow control disabled
--------------------------------------------------

Two workarounds are working here (other than using another dhcp-client):

(1) Setting the MTU to 1492 in /etc/conf.d/net (mtu_eth0="1492")
(2) Adding 'nohook mtu' to /etc/dhcpcd.conf

The first workaround obviously ignores the reasons to distribute the MTU by DHCP.

The second workaround has the problem that the MTU won't get changed to what is distributed by DHCP and the default MTU of 1500 is still used.

Haven't looked at why dhcpcd loses the connection when the MTU will be changed by /lib/dhcpcd/dhcpcd-hooks/10-mtu, but this script just calls ifconfig $interface mtu $mtu.
Comment 1 Alexander Holler 2010-10-23 14:48:30 UTC
Having a look at the sources I think this is a problem of dhcpcd. When I'm correct, than changing the MTU of an interface disconnects active connetions, which is why dhcpcd looses the connection. So dhcpcd should ignore any up/down of the IF while changing the MTU (and it should redo all done settings to the IF it has done after the if comes up again).
Don't know if there is a way to change the MTU of an IF on-the-fly, but I assume not.
Comment 2 Alexander Holler 2010-10-23 15:12:51 UTC
I've just discovered a third workaround. In my dhcpcd.conf I've seen the following:

---------------------------
# Respect the network MTU.                                                                                                                              
option interface_mtu
---------------------------

Disabling this will have the same effect as workaround (2) (nohook mtu), the MTU will not get changed to the one received via DHCP.
                                                                                                                               
I will see if I can find out how to change the MTU while setting the other paramters of the IF like netmask, broadcast etc. (when I will find the time). I assume this would be the correct way.
Comment 3 Alexander Holler 2010-10-23 18:03:20 UTC
I've just dived a little deeper into the source of dhcpcd and decided I won't do that further.

I don't know if there exists a system which really supports changing the MTU on the fly without temporarily deactivating the interface (as currently dhcpcd 5.x seems to assume). So I can't decide if the hook for mtu makes sense somewhere or if it just should be removed completly.

I've sent the author an e-mail.
Comment 4 Alexander Holler 2010-10-23 18:11:29 UTC
Until this is fixed in dhcpcd, I strongly suggest to remove

option interface_mtu

and add 

nohook mtu

to /etc/dhcpcd.conf because it's better to live with a wrong mtu instead of having a non-functional network through a broken dhcp-client.
Comment 5 Alexander Holler 2010-10-24 12:46:03 UTC
I've got an answer from the author of dhcpcd.

He says it's a driver issue. In the used driver (mv643xx) I see the following in eth_change_mtu():
--------------
        /*
         * Stop and then re-open the interface. This will allocate RX
         * skbs of the new MTU.
         * There is a possible danger that the open will not succeed,
         * due to memory being full.
         */
--------------

But I don't know if this should be considered as a bug in the driver. Another driver here has problems with changing the MTU too:
-----------
[  908.654365] r8169: WARNING! Changing of MTU on this NIC may lead to frame reception errors!
-----------

So the down/up during a change of the MTU might be needed for some NICs. Anyway I think it is a bad behaviour of dhcpcd to enter an endless loop when such happens.
Comment 6 William Hubbs gentoo-dev 2010-10-25 05:35:01 UTC
Roy, 

is this behaviour the same in 5.2.8?

If so, is there anything you can do to work around it, or should I have the user adjust his configuration as he has already done?

Are there enough cards out there that cause this behaviour that we should consider changing the default configuration?

Thanks,

William
Comment 7 Roy Marples 2010-10-25 08:56:47 UTC
This was been default dhcpcd behaviour for quite some time now and I see no good reason to change it. Based on the number of bug reports I've had regarding this (this one for Linux, one for NetBSD wm(4) driver) I would say that most drivers operate correctly.

To work around the buggy driver the user can disable MTU or link checking in /etc/dhcpcd.conf

TBH, I personally enforce an MTU of 1492 on my network via DHCP and all of my devices (which is quite a few) have no problem here.
Comment 8 Alexander Holler 2010-10-25 10:40:39 UTC
For me it's ok to close this bug it seems to be problem of the driver.

Anyway it is not that seldom, that drivers are behaving like mv643xx does it currently. I've come across various posts while searching the web for this problem. Most of them had such an problem when they stayed temporarily in a hotel or somewhere similiar where the DHCP-server sends an unusual MTU. And the solution, if any, was almost always to change the dhcp-client.
Comment 9 Alexander Holler 2010-10-25 10:52:03 UTC
A fast solution inside dhcpcd could be to not reset the MTU when the carrier gets lost while the hook to change the MTU will be called.
Comment 10 Alexander Holler 2010-10-25 10:57:47 UTC
"to not reset the MTU to the default value of 1500" would be the correct description of my proposed solution inside dhcpcd.
Comment 11 William Hubbs gentoo-dev 2010-10-25 15:02:10 UTC
I am closing this bug per comment #8.