diff options
author | Maria Matejka <mq@ucw.cz> | 2023-01-20 14:07:38 +0100 |
---|---|---|
committer | Maria Matejka <mq@ucw.cz> | 2023-01-20 18:31:57 +0100 |
commit | 343628d8c0f1848b968930f6dbabdd1174404b14 (patch) | |
tree | ab4e9fa467dc371529fc148c0fe1669864b47b74 /sysdep/linux/netlink.Y | |
parent | 1127f19a7a12b162064b1f521acd5c0017fbcf89 (diff) |
Fixed various build problems on FreeBSD and/or CLang
Diffstat (limited to 'sysdep/linux/netlink.Y')
-rw-r--r-- | sysdep/linux/netlink.Y | 21 |
1 files changed, 21 insertions, 0 deletions
diff --git a/sysdep/linux/netlink.Y b/sysdep/linux/netlink.Y index 7ba8c7c9..9b07e9bb 100644 --- a/sysdep/linux/netlink.Y +++ b/sysdep/linux/netlink.Y @@ -15,6 +15,8 @@ CF_KEYWORDS(KERNEL, TABLE, METRIC, NETLINK, RX, BUFFER, KRT_LOCK_SSTRESH, KRT_LOCK_CWND, KRT_LOCK_ADVMSS, KRT_LOCK_REORDERING, KRT_LOCK_HOPLIMIT, KRT_LOCK_RTO_MIN, KRT_FEATURE_ECN, KRT_FEATURE_ALLFRAG) +%type <fab> attr_bit + CF_GRAMMAR kern_proto: kern_proto kern_sys_item ';' ; @@ -42,6 +44,25 @@ attr_bit: KRT_LOCK_RTO_MIN { $$ = f_new_dynamic_attr_bit(13, "krt_lock"); } ; attr_bit: KRT_FEATURE_ECN { $$ = f_new_dynamic_attr_bit(0, "krt_features"); } ; attr_bit: KRT_FEATURE_ALLFRAG { $$ = f_new_dynamic_attr_bit(3, "krt_features"); } ; +/* Getting attribute bits (moved here to not confuse Bison on *BSD) */ +term: + attr_bit { + struct f_inst *c = f_new_inst(FI_CONSTANT, (struct f_val) { .type = T_INT, .val.i = (1U << $1.bit)}); + $$ = f_new_inst(FI_EQ, c, f_new_inst(FI_BITAND, f_new_inst(FI_EA_GET, $1.class), c)); + } + ; + +/* Setting attribute bits (moved here to not confuse Bison on *BSD) */ +cmd: + attr_bit '=' term ';' { + $$ = f_new_inst(FI_CONDITION, $3, + f_generate_complex_default(FI_BITOR, $1.class, + f_new_inst(FI_CONSTANT, (struct f_val) { .type = T_INT, .val.i = (1U << $1.bit)}), 0), + f_generate_complex_default(FI_BITAND, $1.class, + f_new_inst(FI_CONSTANT, (struct f_val) { .type = T_INT, .val.i = ~(1U << $1.bit)}), 0) + ); + } + ; CF_CODE |