Index | Thread | Search

From:
Jan Klemkow <jan@openbsd.org>
Subject:
trunk(4): fix initial linkstate
To:
tech@openbsd.org
Date:
Thu, 18 Jun 2026 20:41:31 +0200

Download raw body.

Thread
  • Jan Klemkow:

    trunk(4): fix initial linkstate

Hi,

the if_link_state variable is zero (unknown) after creating a trunk interface
and adding trunkports.  Only a linkstate change of a trunkport would change
this.  So, a working trunk interface looks like it has a broken link state via
snmp.

The following diff updates the linkstate just after adding a new trunkport.

ok?

bye,
Jan

Index: net/if_trunk.c
===================================================================
RCS file: /cvs/src/sys/net/if_trunk.c,v
diff -u -p -r1.160 if_trunk.c
--- net/if_trunk.c	12 Jan 2026 04:38:15 -0000	1.160
+++ net/if_trunk.c	18 Jun 2026 18:25:14 -0000
@@ -383,6 +383,9 @@ trunk_port_create(struct trunk_softc *tr
 	NET_ASSERT_LOCKED();
 	SMR_PTR_SET_LOCKED(&ac0->ac_trport, &tp->tp_ether_port);
 
+	/* update linkstate */
+	trunk_link_active(tr, tp);
+
 	return (error);
 }