git: 673685a50aeb - stable/12 - lagg(4): Correctly define some sysctl variables

From: Zhenlei Huang <>
Date: Fri, 21 Apr 2023 10:17:51 UTC
The branch stable/12 has been updated by zlei:


commit 673685a50aeb090b81bbd84f5c606728e00aba68
Author:     Zhenlei Huang <>
AuthorDate: 2023-04-17 10:24:35 +0000
Commit:     Zhenlei Huang <>
CommitDate: 2023-04-21 10:16:10 +0000

    lagg(4): Correctly define some sysctl variables
    939a050ad96c virtualized lagg(4), but the corresponding sysctl of some
    virtualized global variables are not marked with CTLFLAG_VNET. A try to
    operate on those variables via sysctl will effectively go to the 'master'
    copies and the virtualized ones are not read or set accordingly. As a
    side effect, on updating the 'master' copy, the virtualized global
    variables of newly created vnets will have correct values.
    PR:             270705
    Reviewed by:    kp
    Fixes:          939a050ad96c Virtualize lagg(4) cloner
    MFC after:      3 days
    Differential Revision:
    (cherry picked from commit 401f03445e4aa42960e337604560593c7096e589)
    (cherry picked from commit 774a2ee9ad7a512c5faf0fc30b13aa1de33ceb2f)
 sys/net/if_lagg.c | 8 ++++----
 1 file changed, 4 insertions(+), 4 deletions(-)

diff --git a/sys/net/if_lagg.c b/sys/net/if_lagg.c
index 796aa7f24dcd..34bcd37bed73 100644
--- a/sys/net/if_lagg.c
+++ b/sys/net/if_lagg.c
@@ -269,15 +269,15 @@ SYSCTL_INT(_net_link_lagg, OID_AUTO, failover_rx_all, CTLFLAG_RW | CTLFLAG_VNET,
 /* Default value for using flowid */
 VNET_DEFINE_STATIC(int, def_use_flowid) = 0;
 #define	V_def_use_flowid	VNET(def_use_flowid)
-SYSCTL_INT(_net_link_lagg, OID_AUTO, default_use_flowid, CTLFLAG_RWTUN,
-    &VNET_NAME(def_use_flowid), 0,
+SYSCTL_INT(_net_link_lagg, OID_AUTO, default_use_flowid,
+    CTLFLAG_RWTUN | CTLFLAG_VNET, &VNET_NAME(def_use_flowid), 0,
     "Default setting for using flow id for load sharing");
 /* Default value for flowid shift */
 VNET_DEFINE_STATIC(int, def_flowid_shift) = 16;
 #define	V_def_flowid_shift	VNET(def_flowid_shift)
-SYSCTL_INT(_net_link_lagg, OID_AUTO, default_flowid_shift, CTLFLAG_RWTUN,
-    &VNET_NAME(def_flowid_shift), 0,
+SYSCTL_INT(_net_link_lagg, OID_AUTO, default_flowid_shift,
+    CTLFLAG_RWTUN | CTLFLAG_VNET, &VNET_NAME(def_flowid_shift), 0,
     "Default setting for flowid shift for load sharing");
 static void