From 965153054a80def1d7df09151a474e870d404b7e Mon Sep 17 00:00:00 2001 From: Yu Watanabe Date: Sun, 14 Nov 2021 17:36:33 +0900 Subject: [PATCH] network: routing policy rule: introduce fr_act_type_full_to_string() --- src/network/networkd-routing-policy-rule.c | 10 ++++++++++ src/network/networkd-routing-policy-rule.h | 2 ++ 2 files changed, 12 insertions(+) diff --git a/src/network/networkd-routing-policy-rule.c b/src/network/networkd-routing-policy-rule.c index 72ef39f457..90086f35a7 100644 --- a/src/network/networkd-routing-policy-rule.c +++ b/src/network/networkd-routing-policy-rule.c @@ -29,8 +29,18 @@ static const char *const fr_act_type_table[__FR_ACT_MAX] = { [FR_ACT_PROHIBIT] = "prohibit", }; +static const char *const fr_act_type_full_table[__FR_ACT_MAX] = { + [FR_ACT_TO_TBL] = "table", + [FR_ACT_GOTO] = "goto", + [FR_ACT_NOP] = "nop", + [FR_ACT_BLACKHOLE] = "blackhole", + [FR_ACT_UNREACHABLE] = "unreachable", + [FR_ACT_PROHIBIT] = "prohibit", +}; + assert_cc(__FR_ACT_MAX <= UINT8_MAX); DEFINE_PRIVATE_STRING_TABLE_LOOKUP_FROM_STRING(fr_act_type, int); +DEFINE_STRING_TABLE_LOOKUP_TO_STRING(fr_act_type_full, int); RoutingPolicyRule *routing_policy_rule_free(RoutingPolicyRule *rule) { if (!rule) diff --git a/src/network/networkd-routing-policy-rule.h b/src/network/networkd-routing-policy-rule.h index ac65fe8af4..f52943bd2e 100644 --- a/src/network/networkd-routing-policy-rule.h +++ b/src/network/networkd-routing-policy-rule.h @@ -54,6 +54,8 @@ typedef struct RoutingPolicyRule { int32_t suppress_ifgroup; } RoutingPolicyRule; +const char *fr_act_type_full_to_string(int t) _const_; + RoutingPolicyRule *routing_policy_rule_free(RoutingPolicyRule *rule); void routing_policy_rule_hash_func(const RoutingPolicyRule *rule, struct siphash *state);