@@ -1206,6 +1206,37 @@ test_ff_load_config_thread_mode_secondary_conflict(void **state)
12061206 assert_int_equal (rv , -1 );
12071207}
12081208
1209+ /* ======================================================================== */
1210+ /* CM4 (native-mt): ECN config switch (freebsd.tcp_ecn, [freebsd.boot] key) */
1211+ /* Spec: native_mt_spec/zh_cn. Parse @ff_config.c:1111, default 0 @:1519. */
1212+ /* Runtime maps tcp_ecn -> V_tcp_do_ecn (0=off / 1=passive) in */
1213+ /* ff_freebsd_init.c; that runtime effect is out of unit-test scope. */
1214+ /* ======================================================================== */
1215+
1216+ /* TC-CM4-01: no tcp_ecn key -> defaults to 0 (zero-regression). */
1217+ static void
1218+ test_ff_load_config_tcp_ecn_default_off (void * * state )
1219+ {
1220+ (void )state ;
1221+ /* valid_minimal.ini has [freebsd.boot] but NO tcp_ecn key. */
1222+ int rv = load_with_fixture (FIXTURE_PATH ("valid_minimal.ini" ));
1223+ (void )rv ;
1224+ assert_int_equal (ff_global_cfg .freebsd .tcp_ecn , 0 );
1225+ }
1226+
1227+ /* TC-CM4-02: explicit tcp_ecn=1 in [freebsd.boot] -> parsed as 1. */
1228+ static void
1229+ test_ff_load_config_tcp_ecn_enabled (void * * state )
1230+ {
1231+ (void )state ;
1232+ int rv = load_with_fixture (FIXTURE_PATH ("valid_tcp_ecn.ini" ));
1233+ (void )rv ;
1234+ assert_int_equal (ff_global_cfg .freebsd .tcp_ecn , 1 );
1235+ /* New key must not disturb sibling [freebsd.boot] parsing. */
1236+ assert_int_equal (ff_global_cfg .freebsd .hz , 100 );
1237+ assert_int_equal (ff_global_cfg .freebsd .mem_size , 256 );
1238+ }
1239+
12091240int
12101241main (void )
12111242{
@@ -1280,6 +1311,9 @@ main(void)
12801311 cmocka_unit_test_setup_teardown (test_ff_load_config_thread_mode_enabled , test_setup , NULL ),
12811312 cmocka_unit_test_setup_teardown (test_ff_load_config_thread_mode_default_off , test_setup , NULL ),
12821313 cmocka_unit_test_setup_teardown (test_ff_load_config_thread_mode_secondary_conflict , test_setup , NULL ),
1314+ /* CM4 (native-mt) ECN config switch (freebsd.tcp_ecn) */
1315+ cmocka_unit_test_setup_teardown (test_ff_load_config_tcp_ecn_default_off , test_setup , NULL ),
1316+ cmocka_unit_test_setup_teardown (test_ff_load_config_tcp_ecn_enabled , test_setup , NULL ),
12831317#ifdef FF_KERNEL_COEXIST
12841318 /* kernel_event_support: [stack] kernel_coexist */
12851319 cmocka_unit_test_setup_teardown (test_ff_load_config_stack_coexist_enabled , test_setup , NULL ),
0 commit comments