Re: bonding: link state question

From: Willy Tarreau
Date: Sun Aug 08 2021 - 00:49:40 EST

On Sat, Aug 07, 2021 at 08:09:31PM -0400, Jonathan Toppins wrote:
> setting miimon = 100 does appear to fix it.
> It is interesting that there is no link monitor on by default. For example
> when I enslave enp0s31f6 to a new bond with miimon == 0, enp0s31f6 starts
> admin down and will never de-assert NO-CARRIER the bond always results in an
> operstate of up. It seems like miimon = 100 should be the default since some
> modes cannot use arpmon.

Historically when miimon was implemented, not all NICs nor drivers had
support for link state checking at all! In addition, there are certain
deployments where you could rely on many devices by having a bond device
on top of a vlan or similar device, and where monitoring could cost a
lot of resources and you'd prefer to rely on external monitoring to set
all of them up or down at once.

I do think however that there remains a case with a missing state
transition in the driver: on my laptop I have a bond interface attached
to eth0, and I noticed that if I suspend the laptop with the link up,
when I wake it up with no interface connected, the bond will not turn
down, regardless of miimon. I have not looked closer yet, but I
suspect that we're relying too much on a state change between previous
and current and that one historically impossible transition does not
exist there and/or used to work because it was handled as part of
another change. I'll eventually have a look.