mirror of
https://gitlab.nic.cz/labs/bird.git
synced 2024-12-22 09:41:54 +00:00
Netlink: Fixed handling of undefined bitfields in filters
The default value is obviously false everywhere so we just return zero if nothing is found, instead of undef.
This commit is contained in:
parent
7491cdbd1d
commit
1dd21f6024
@ -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
|
||||
|
@ -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";
|
||||
}
|
||||
|
@ -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;
|
||||
};
|
||||
|
@ -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",
|
||||
|
Loading…
Reference in New Issue
Block a user