trunk(4): fix initial linkstate

Jan Klemkow <[email protected]>
Newsgroups gmane.os.openbsd.tech
Message-ID <[email protected]>
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);
 }
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.