diff --git a/include/haproxy/stick_table-t.h b/include/haproxy/stick_table-t.h index c89c3ec8e..79fee4897 100644 --- a/include/haproxy/stick_table-t.h +++ b/include/haproxy/stick_table-t.h @@ -127,6 +127,7 @@ struct stktable_data_type { int arg_type; /* type of optional argument, ARG_T_* */ uint is_array:1; /* this is an array of gpc/gpt */ uint is_local:1; /* this is local only and never learned */ + uint as_is:1; /* cannot be processed / used with arithmetic operations */ }; /* stick table keyword type */ diff --git a/src/stick_table.c b/src/stick_table.c index 91d697b9e..4bf46ef38 100644 --- a/src/stick_table.c +++ b/src/stick_table.c @@ -1316,8 +1316,8 @@ int stktable_compatible_sample(struct sample_expr *expr, unsigned long table_typ * at run time. */ struct stktable_data_type stktable_data_types[STKTABLE_DATA_TYPES] = { - [STKTABLE_DT_SERVER_ID] = { .name = "server_id", .std_type = STD_T_SINT }, - [STKTABLE_DT_GPT0] = { .name = "gpt0", .std_type = STD_T_UINT }, + [STKTABLE_DT_SERVER_ID] = { .name = "server_id", .std_type = STD_T_SINT, .as_is = 1 }, + [STKTABLE_DT_GPT0] = { .name = "gpt0", .std_type = STD_T_UINT, .as_is = 1 }, [STKTABLE_DT_GPC0] = { .name = "gpc0", .std_type = STD_T_UINT }, [STKTABLE_DT_GPC0_RATE] = { .name = "gpc0_rate", .std_type = STD_T_FRQP, .arg_type = ARG_T_DELAY }, [STKTABLE_DT_CONN_CNT] = { .name = "conn_cnt", .std_type = STD_T_UINT }, @@ -1335,10 +1335,10 @@ struct stktable_data_type stktable_data_types[STKTABLE_DATA_TYPES] = { [STKTABLE_DT_BYTES_OUT_RATE]= { .name = "bytes_out_rate", .std_type = STD_T_FRQP, .arg_type = ARG_T_DELAY }, [STKTABLE_DT_GPC1] = { .name = "gpc1", .std_type = STD_T_UINT }, [STKTABLE_DT_GPC1_RATE] = { .name = "gpc1_rate", .std_type = STD_T_FRQP, .arg_type = ARG_T_DELAY }, - [STKTABLE_DT_SERVER_KEY] = { .name = "server_key", .std_type = STD_T_DICT }, + [STKTABLE_DT_SERVER_KEY] = { .name = "server_key", .std_type = STD_T_DICT, .as_is = 1 }, [STKTABLE_DT_HTTP_FAIL_CNT] = { .name = "http_fail_cnt", .std_type = STD_T_UINT }, [STKTABLE_DT_HTTP_FAIL_RATE]= { .name = "http_fail_rate", .std_type = STD_T_FRQP, .arg_type = ARG_T_DELAY }, - [STKTABLE_DT_GPT] = { .name = "gpt", .std_type = STD_T_UINT, .is_array = 1 }, + [STKTABLE_DT_GPT] = { .name = "gpt", .std_type = STD_T_UINT, .is_array = 1, .as_is = 1 }, [STKTABLE_DT_GPC] = { .name = "gpc", .std_type = STD_T_UINT, .is_array = 1 }, [STKTABLE_DT_GPC_RATE] = { .name = "gpc_rate", .std_type = STD_T_FRQP, .is_array = 1, .arg_type = ARG_T_DELAY }, };