diff --git a/filter/f-inst.c b/filter/f-inst.c index 6c3724ad..6820b898 100644 --- a/filter/f-inst.c +++ b/filter/f-inst.c @@ -886,6 +886,8 @@ }]]); } } + else if (da->empty) + RESULT_VAL(da->empty(da)); else if ((empty = f_get_empty(da->type)).type != T_VOID) RESULT_VAL(empty); else diff --git a/filter/test.conf b/filter/test.conf index 24094e80..39ec0edc 100644 --- a/filter/test.conf +++ b/filter/test.conf @@ -2301,9 +2301,9 @@ bool t; krt_source = 17; krt_metric = 19; -# krt_lock_mtu = false; +# if krt_lock_congctl then krt_lock_mtu = false; # krt_lock_window = true; -# krt_lock_rtt = krt_lock_rttvar && krt_lock_sstresh || krt_lock_cwnd; +# krt_lock_rtt = krt_lock_rttvar && krt_lock_ssthresh || krt_lock_cwnd; accept "ok I take that"; } diff --git a/lib/route.h b/lib/route.h index 8d744e43..882e6fd4 100644 --- a/lib/route.h +++ b/lib/route.h @@ -278,6 +278,7 @@ struct ea_class { void (*format)(const eattr *ea, byte *buf, uint size); \ void (*stored)(const eattr *ea); /* When stored into global hash */ \ void (*freed)(const eattr *ea); /* When released from global hash */ \ + struct f_val (*empty)(const struct ea_class *); /* Return this instead of T_VOID as default value for filters */ \ EA_CLASS_INSIDE; }; diff --git a/sysdep/linux/netlink.c b/sysdep/linux/netlink.c index 6e10f543..ea79a1aa 100644 --- a/sysdep/linux/netlink.c +++ b/sysdep/linux/netlink.c @@ -51,6 +51,8 @@ struct nl_parse_state #define KRT_FEATURES_MAX 4 static void krt_bitfield_format(const eattr *e, byte *buf, uint buflen); +static struct f_val krt_bitfield_empty(const struct ea_class *cls UNUSED) +{ return (struct f_val) { .type = T_INT }; } static struct ea_class ea_krt_prefsrc = { @@ -71,11 +73,13 @@ static struct ea_class ea_krt_metrics[] = { .name = "krt_lock", .type = T_INT, .format = krt_bitfield_format, + .empty = krt_bitfield_empty, }, [RTAX_FEATURES] = { .name = "krt_features", .type = T_INT, .format = krt_bitfield_format, + .empty = krt_bitfield_empty, }, [RTAX_CC_ALGO] = { .name = "krt_congctl",