summaryrefslogtreecommitdiffstats
path: root/pathd/pathd.c
diff options
context:
space:
mode:
authorPhilippe Guibert <philippe.guibert@6wind.com>2022-07-25 15:06:35 +0200
committerPhilippe Guibert <philippe.guibert@6wind.com>2022-11-14 17:42:55 +0100
commitec139f60f19088611a2fa177c1f81dd64f97d744 (patch)
tree9a9dc424e500188e942281d27361283af53c76d9 /pathd/pathd.c
parentpathd: some traces are added to 'debug pathd ted' command. (diff)
downloadfrr-ec139f60f19088611a2fa177c1f81dd64f97d744.tar.xz
frr-ec139f60f19088611a2fa177c1f81dd64f97d744.zip
pathd: display SRTE policy status when removing policy
Create a function that logs the status of a given SR-TE policy. Add a call to this function when a policy is being removed. Signed-off-by: Philippe Guibert <philippe.guibert@6wind.com>
Diffstat (limited to 'pathd/pathd.c')
-rw-r--r--pathd/pathd.c24
1 files changed, 20 insertions, 4 deletions
diff --git a/pathd/pathd.c b/pathd/pathd.c
index 5baaaf515..167c88aea 100644
--- a/pathd/pathd.c
+++ b/pathd/pathd.c
@@ -110,6 +110,20 @@ RB_GENERATE(srte_policy_head, srte_policy, entry, srte_policy_compare)
struct srte_policy_head srte_policies = RB_INITIALIZER(&srte_policies);
+static void srte_policy_status_log(struct srte_policy *policy)
+{
+ char endpoint[ENDPOINT_STR_LENGTH];
+
+ ipaddr2str(&policy->endpoint, endpoint, sizeof(endpoint));
+ if (policy->status == SRTE_POLICY_STATUS_DOWN) {
+ PATH_POLICY_DEBUG("SR-TE(%s, %u): policy is DOWN", endpoint,
+ policy->color);
+ } else if (policy->status == SRTE_POLICY_STATUS_UP) {
+ PATH_POLICY_DEBUG("SR-TE(%s, %u): policy is UP", endpoint,
+ policy->color);
+ }
+}
+
/**
* Adds a segment list to pathd.
*
@@ -544,6 +558,10 @@ void srte_apply_changes(void)
RB_FOREACH_SAFE (policy, srte_policy_head, &srte_policies, safe_pol) {
if (CHECK_FLAG(policy->flags, F_POLICY_DELETED)) {
+ if (policy->status != SRTE_POLICY_STATUS_DOWN) {
+ policy->status = SRTE_POLICY_STATUS_DOWN;
+ srte_policy_status_log(policy);
+ }
srte_policy_del(policy);
continue;
}
@@ -1138,9 +1156,8 @@ void srte_candidate_status_update(struct srte_candidate *candidate, int status)
case SRTE_POLICY_STATUS_DOWN:
return;
default:
- PATH_POLICY_DEBUG("SR-TE(%s, %u): policy is DOWN",
- endpoint, policy->color);
policy->status = SRTE_POLICY_STATUS_DOWN;
+ srte_policy_status_log(policy);
break;
}
break;
@@ -1149,9 +1166,8 @@ void srte_candidate_status_update(struct srte_candidate *candidate, int status)
case SRTE_POLICY_STATUS_UP:
return;
default:
- PATH_POLICY_DEBUG("SR-TE(%s, %u): policy is UP",
- endpoint, policy->color);
policy->status = SRTE_POLICY_STATUS_UP;
+ srte_policy_status_log(policy);
break;
}
break;