Subject: Re: [PATCH net 1/5] net: netdevsim: fix inconsistent carrier state after link/unlink

From: Yohei Kojima <[email-masked]>
Date: Tue, 30 Dec 2025 04:56:16 +0900

On Mon, Dec 29, 2025 at 07:39:29PM +0100, Andrew Lunn wrote:
> On Tue, Dec 30, 2025 at 03:32:34AM +0900, [email-masked] wrote:
> > From: Yohei Kojima <[email-masked]>
> > 
> > This patch fixes the edge case behavior on ifup/ifdown and
> > linking/unlinking two netdevsim interfaces:
> > 
> > 1. unlink two interfaces netdevsim1 and netdevsim2
> > 2. ifdown netdevsim1
> > 3. ifup netdevsim1
> > 4. link two interfaces netdevsim1 and netdevsim2
> > 5. (Now two interfaces are linked in terms of netdevsim peer, but
> >     carrier state of the two interfaces remains DOWN.)
> > 
> > This inconsistent behavior is caused by the current implementation,
> > which only cares about the "link, then ifup" order, not "ifup, then
> > link" order. This patch fixes the inconsistency by calling
> > netif_carrier_on() when two netdevsim interfaces are linked.
> > 
> > This patch solves buggy behavior on NetworkManager-based systems which
> > causes the netdevsim test to fail with the following error:
> > 
> >   # timeout set to 600
> >   # selftests: drivers/net/netdevsim: peer.sh
> >   # 2025/12/25 00:54:03 socat[9115] W address is opened in read-write mode but only supports read-only
> >   # 2025/12/25 00:56:17 socat[9115] W connect(7, AF=2 192.168.1.1:1234, 16): Connection timed out
> >   # 2025/12/25 00:56:17 socat[9115] E TCP:192.168.1.1:1234: Connection timed out
> >   # expected 3 bytes, got 0
> >   # 2025/12/25 00:56:17 socat[9109] W exiting on signal 15
> >   not ok 13 selftests: drivers/net/netdevsim: peer.sh # exit=1
> > 
> > This patch also fixes timeout on TCP Fast Open (TFO) test because the
> > test also depends on netdevsim.
> > 
> > Fixes: 1a8fed52f7be ("netdevsim: set the carrier when the device goes up")
> 
> Stable rules say:
> 
>    It must either fix a real bug that bothers people or just add a device ID.

Thank you for the quick reply. I don't intend for this patch to be
backported to the stable tree. My understanding was that bugfix patches
to the net tree should have Fixes: tag for historical tracking.

> 
> netdevsim is not a real device. Do its bugs actually bother people?

This patch fixes a real bug that is seen when a developer tries to test
TFO or netdevsim tests on NetworkManager-enabled systems: it causes
false positives in kselftests on such systems.

> Should this patch have a Fixes: tag?

The patch 1a8fed52f7be ("netdevsim: set the carrier when the device goes
up"), which does a similar change, has Fixes: tag. Since this patch fixes
the corner-case behavior which was missed in the previous fix, this
patch should have Fixes: tag for consistency.

>        Andrew

Thank you,
Yohei Kojima