summaryrefslogtreecommitdiffstats
path: root/pathd
diff options
context:
space:
mode:
authorChristian Hopps <chopps@labn.net>2023-11-29 20:37:23 +0100
committerChristian Hopps <chopps@labn.net>2023-11-29 20:37:23 +0100
commit2c01083d35263fb3121340cc01f3b545075ae8e6 (patch)
tree9e0aa21dd96e59c7c4cbd24bd6b3f97f01deb75b /pathd
parentMerge pull request #14906 from Keelan10/bgp_confederation-leak (diff)
downloadfrr-2c01083d35263fb3121340cc01f3b545075ae8e6.tar.xz
frr-2c01083d35263fb3121340cc01f3b545075ae8e6.zip
lib: all: remove './' from xpath 22% speedup
fixes #8299 Signed-off-by: Christian Hopps <chopps@labn.net>
Diffstat (limited to 'pathd')
-rw-r--r--pathd/path_cli.c52
-rw-r--r--pathd/path_nb.c4
-rw-r--r--pathd/path_nb_config.c44
3 files changed, 50 insertions, 50 deletions
diff --git a/pathd/path_cli.c b/pathd/path_cli.c
index 45f4ac7ab..0d9d3bca6 100644
--- a/pathd/path_cli.c
+++ b/pathd/path_cli.c
@@ -287,7 +287,7 @@ void cli_show_srte_segment_list(struct vty *vty, const struct lyd_node *dnode,
bool show_defaults)
{
vty_out(vty, " segment-list %s\n",
- yang_dnode_get_string(dnode, "./name"));
+ yang_dnode_get_string(dnode, "name"));
}
void cli_show_srte_segment_list_end(struct vty *vty,
@@ -546,37 +546,37 @@ void cli_show_srte_segment_list_segment(struct vty *vty,
const struct lyd_node *dnode,
bool show_defaults)
{
- vty_out(vty, " index %s", yang_dnode_get_string(dnode, "./index"));
- if (yang_dnode_exists(dnode, "./sid-value")) {
+ vty_out(vty, " index %s", yang_dnode_get_string(dnode, "index"));
+ if (yang_dnode_exists(dnode, "sid-value")) {
vty_out(vty, " mpls label %s",
- yang_dnode_get_string(dnode, "./sid-value"));
+ yang_dnode_get_string(dnode, "sid-value"));
}
- if (yang_dnode_exists(dnode, "./nai")) {
+ if (yang_dnode_exists(dnode, "nai")) {
struct ipaddr addr;
struct ipaddr addr_rmt;
- switch (yang_dnode_get_enum(dnode, "./nai/type")) {
+ switch (yang_dnode_get_enum(dnode, "nai/type")) {
case SRTE_SEGMENT_NAI_TYPE_IPV4_NODE:
case SRTE_SEGMENT_NAI_TYPE_IPV4_LOCAL_IFACE:
case SRTE_SEGMENT_NAI_TYPE_IPV4_ALGORITHM:
- yang_dnode_get_ip(&addr, dnode, "./nai/local-address");
+ yang_dnode_get_ip(&addr, dnode, "nai/local-address");
vty_out(vty, " nai prefix %pI4", &addr.ipaddr_v4);
break;
case SRTE_SEGMENT_NAI_TYPE_IPV6_NODE:
case SRTE_SEGMENT_NAI_TYPE_IPV6_LOCAL_IFACE:
case SRTE_SEGMENT_NAI_TYPE_IPV6_ALGORITHM:
- yang_dnode_get_ip(&addr, dnode, "./nai/local-address");
+ yang_dnode_get_ip(&addr, dnode, "nai/local-address");
vty_out(vty, " nai prefix %pI6", &addr.ipaddr_v6);
break;
case SRTE_SEGMENT_NAI_TYPE_IPV4_ADJACENCY:
- yang_dnode_get_ip(&addr, dnode, "./nai/local-address");
+ yang_dnode_get_ip(&addr, dnode, "nai/local-address");
yang_dnode_get_ip(&addr_rmt, dnode,
"./nai/remote-address");
vty_out(vty, " nai adjacency %pI4", &addr.ipaddr_v4);
vty_out(vty, " %pI4", &addr_rmt.ipaddr_v4);
break;
case SRTE_SEGMENT_NAI_TYPE_IPV6_ADJACENCY:
- yang_dnode_get_ip(&addr, dnode, "./nai/local-address");
+ yang_dnode_get_ip(&addr, dnode, "nai/local-address");
yang_dnode_get_ip(&addr_rmt, dnode,
"./nai/remote-address");
vty_out(vty, " nai adjacency %pI6", &addr.ipaddr_v6);
@@ -585,17 +585,17 @@ void cli_show_srte_segment_list_segment(struct vty *vty,
default:
break;
}
- if (yang_dnode_exists(dnode, "./nai/local-prefix-len")) {
+ if (yang_dnode_exists(dnode, "nai/local-prefix-len")) {
vty_out(vty, "/%s",
yang_dnode_get_string(
dnode, "./nai/local-prefix-len"));
}
- if (yang_dnode_exists(dnode, "./nai/local-interface")) {
+ if (yang_dnode_exists(dnode, "nai/local-interface")) {
vty_out(vty, " iface %s",
yang_dnode_get_string(dnode,
"./nai/local-interface"));
}
- if (yang_dnode_exists(dnode, "./nai/algorithm")) {
+ if (yang_dnode_exists(dnode, "nai/algorithm")) {
vty_out(vty, " algorithm %s",
yang_dnode_get_string(dnode,
"./nai/algorithm"));
@@ -658,8 +658,8 @@ void cli_show_srte_policy(struct vty *vty, const struct lyd_node *dnode,
bool show_defaults)
{
vty_out(vty, " policy color %s endpoint %s\n",
- yang_dnode_get_string(dnode, "./color"),
- yang_dnode_get_string(dnode, "./endpoint"));
+ yang_dnode_get_string(dnode, "color"),
+ yang_dnode_get_string(dnode, "endpoint"));
}
void cli_show_srte_policy_end(struct vty *vty, const struct lyd_node *dnode)
@@ -1183,11 +1183,11 @@ static int config_write_metric_cb(const struct lyd_node *dnode, void *arg)
bool required, is_bound = false;
float value;
- type = yang_dnode_get_enum(dnode, "./type");
- value = (float)yang_dnode_get_dec64(dnode, "./value");
- required = yang_dnode_get_bool(dnode, "./required");
- if (yang_dnode_exists(dnode, "./is-bound"))
- is_bound = yang_dnode_get_bool(dnode, "./is-bound");
+ type = yang_dnode_get_enum(dnode, "type");
+ value = (float)yang_dnode_get_dec64(dnode, "value");
+ required = yang_dnode_get_bool(dnode, "required");
+ if (yang_dnode_exists(dnode, "is-bound"))
+ is_bound = yang_dnode_get_bool(dnode, "is-bound");
config_write_metric(vty, type, value, required, is_bound);
return YANG_ITER_CONTINUE;
@@ -1201,18 +1201,18 @@ void cli_show_srte_policy_candidate_path(struct vty *vty,
uint32_t affinity;
bool required;
enum objfun_type objfun_type;
- const char *type = yang_dnode_get_string(dnode, "./type");
+ const char *type = yang_dnode_get_string(dnode, "type");
vty_out(vty, " candidate-path preference %s name %s %s",
- yang_dnode_get_string(dnode, "./preference"),
- yang_dnode_get_string(dnode, "./name"), type);
+ yang_dnode_get_string(dnode, "preference"),
+ yang_dnode_get_string(dnode, "name"), type);
if (strmatch(type, "explicit"))
vty_out(vty, " segment-list %s",
- yang_dnode_get_string(dnode, "./segment-list-name"));
+ yang_dnode_get_string(dnode, "segment-list-name"));
vty_out(vty, "\n");
if (strmatch(type, "dynamic")) {
- if (yang_dnode_exists(dnode, "./constraints/bandwidth")) {
+ if (yang_dnode_exists(dnode, "constraints/bandwidth")) {
bandwidth = (float)yang_dnode_get_dec64(
dnode, "./constraints/bandwidth/value");
required = yang_dnode_get_bool(
@@ -1262,7 +1262,7 @@ void cli_show_srte_policy_candidate_path(struct vty *vty,
void cli_show_srte_policy_candidate_path_end(struct vty *vty,
const struct lyd_node *dnode)
{
- const char *type = yang_dnode_get_string(dnode, "./type");
+ const char *type = yang_dnode_get_string(dnode, "type");
if (strmatch(type, "dynamic"))
vty_out(vty, " exit\n");
diff --git a/pathd/path_nb.c b/pathd/path_nb.c
index 9e919571d..e1c0cc3ef 100644
--- a/pathd/path_nb.c
+++ b/pathd/path_nb.c
@@ -313,8 +313,8 @@ int iter_objfun_cb(const struct lyd_node *dnode, void *arg)
pref = &of_arg->prefs[of_arg->free_slot++];
- pref->index = yang_dnode_get_uint32(dnode, "./index");
- pref->type = yang_dnode_get_enum(dnode, "./type");
+ pref->index = yang_dnode_get_uint32(dnode, "index");
+ pref->type = yang_dnode_get_enum(dnode, "type");
/* Simplistic insertion sort */
p = &of_arg->first;
diff --git a/pathd/path_nb_config.c b/pathd/path_nb_config.c
index ad24f23dd..48531ba43 100644
--- a/pathd/path_nb_config.c
+++ b/pathd/path_nb_config.c
@@ -31,7 +31,7 @@ int pathd_srte_segment_list_create(struct nb_cb_create_args *args)
if (args->event != NB_EV_APPLY)
return NB_OK;
- name = yang_dnode_get_string(args->dnode, "./name");
+ name = yang_dnode_get_string(args->dnode, "name");
segment_list = srte_segment_list_add(name);
nb_running_set_entry(args->dnode, segment_list);
SET_FLAG(segment_list->flags, F_SEGMENT_LIST_NEW);
@@ -104,7 +104,7 @@ int pathd_srte_segment_list_segment_create(struct nb_cb_create_args *args)
return NB_OK;
segment_list = nb_running_get_entry(args->dnode, NULL, true);
- index = yang_dnode_get_uint32(args->dnode, "./index");
+ index = yang_dnode_get_uint32(args->dnode, "index");
segment = srte_segment_entry_add(segment_list, index);
nb_running_set_entry(args->dnode, segment);
SET_FLAG(segment_list->flags, F_SEGMENT_LIST_MODIFIED);
@@ -191,9 +191,9 @@ void pathd_srte_segment_list_segment_nai_apply_finish(
const char *algo_buf, *local_prefix_len_buf;
segment = nb_running_get_entry(args->dnode, NULL, true);
- type = yang_dnode_get_enum(args->dnode, "./type");
+ type = yang_dnode_get_enum(args->dnode, "type");
- yang_dnode_get_ip(&local_addr, args->dnode, "./local-address");
+ yang_dnode_get_ip(&local_addr, args->dnode, "local-address");
switch (type) {
case SRTE_SEGMENT_NAI_TYPE_IPV4_NODE:
@@ -208,12 +208,12 @@ void pathd_srte_segment_list_segment_nai_apply_finish(
yang_dnode_get_ip(&remote_addr, args->dnode,
"./remote-address");
local_iface =
- yang_dnode_get_uint32(args->dnode, "./local-interface");
+ yang_dnode_get_uint32(args->dnode, "local-interface");
remote_iface = yang_dnode_get_uint32(args->dnode,
"./remote-interface");
break;
case SRTE_SEGMENT_NAI_TYPE_IPV4_ALGORITHM:
- algo_buf = yang_dnode_get_string(args->dnode, "./algorithm");
+ algo_buf = yang_dnode_get_string(args->dnode, "algorithm");
algo = atoi(algo_buf);
local_prefix_len_buf = yang_dnode_get_string(
args->dnode, "./local-prefix-len");
@@ -221,7 +221,7 @@ void pathd_srte_segment_list_segment_nai_apply_finish(
break;
case SRTE_SEGMENT_NAI_TYPE_IPV4_LOCAL_IFACE:
local_iface =
- yang_dnode_get_uint32(args->dnode, "./local-interface");
+ yang_dnode_get_uint32(args->dnode, "local-interface");
local_prefix_len_buf = yang_dnode_get_string(
args->dnode, "./local-prefix-len");
local_prefix_len = atoi(local_prefix_len_buf);
@@ -254,8 +254,8 @@ int pathd_srte_policy_create(struct nb_cb_create_args *args)
if (args->event != NB_EV_APPLY)
return NB_OK;
- color = yang_dnode_get_uint32(args->dnode, "./color");
- yang_dnode_get_ip(&endpoint, args->dnode, "./endpoint");
+ color = yang_dnode_get_uint32(args->dnode, "color");
+ yang_dnode_get_ip(&endpoint, args->dnode, "endpoint");
policy = srte_policy_add(color, &endpoint, SRTE_ORIGIN_LOCAL, NULL);
nb_running_set_entry(args->dnode, policy);
@@ -377,7 +377,7 @@ int pathd_srte_policy_candidate_path_create(struct nb_cb_create_args *args)
return NB_OK;
policy = nb_running_get_entry(args->dnode, NULL, true);
- preference = yang_dnode_get_uint32(args->dnode, "./preference");
+ preference = yang_dnode_get_uint32(args->dnode, "preference");
candidate =
srte_candidate_add(policy, preference, SRTE_ORIGIN_LOCAL, NULL);
nb_running_set_entry(args->dnode, candidate);
@@ -539,7 +539,7 @@ int pathd_srte_policy_candidate_path_metrics_destroy(
assert(args->context != NULL);
candidate = nb_running_get_entry(args->dnode, NULL, true);
- type = yang_dnode_get_enum(args->dnode, "./type");
+ type = yang_dnode_get_enum(args->dnode, "type");
srte_candidate_unset_metric(candidate, type);
return NB_OK;
@@ -557,13 +557,13 @@ void pathd_srte_policy_candidate_path_metrics_apply_finish(
candidate = nb_running_get_entry(args->dnode, NULL, true);
- type = yang_dnode_get_enum(args->dnode, "./type");
- value = (float)yang_dnode_get_dec64(args->dnode, "./value");
- required = yang_dnode_get_bool(args->dnode, "./required");
- if (yang_dnode_exists(args->dnode, "./is-bound"))
- is_bound = yang_dnode_get_bool(args->dnode, "./is-bound");
- if (yang_dnode_exists(args->dnode, "./is-computed"))
- is_computed = yang_dnode_get_bool(args->dnode, "./is-computed");
+ type = yang_dnode_get_enum(args->dnode, "type");
+ value = (float)yang_dnode_get_dec64(args->dnode, "value");
+ required = yang_dnode_get_bool(args->dnode, "required");
+ if (yang_dnode_exists(args->dnode, "is-bound"))
+ is_bound = yang_dnode_get_bool(args->dnode, "is-bound");
+ if (yang_dnode_exists(args->dnode, "is-computed"))
+ is_computed = yang_dnode_get_bool(args->dnode, "is-computed");
srte_candidate_set_metric(candidate, type, value, required, is_bound,
is_computed);
@@ -597,8 +597,8 @@ void pathd_srte_policy_candidate_path_objfun_apply_finish(
bool required;
candidate = nb_running_get_entry(args->dnode, NULL, true);
- required = yang_dnode_get_bool(args->dnode, "./required");
- type = yang_dnode_get_enum(args->dnode, "./type");
+ required = yang_dnode_get_bool(args->dnode, "required");
+ type = yang_dnode_get_enum(args->dnode, "type");
srte_candidate_set_objfun(candidate, required, type);
}
@@ -739,8 +739,8 @@ void pathd_srte_policy_candidate_path_bandwidth_apply_finish(
assert(args->context != NULL);
candidate = nb_running_get_entry(args->dnode, NULL, true);
- value = (float)yang_dnode_get_dec64(args->dnode, "./value");
- required = yang_dnode_get_bool(args->dnode, "./required");
+ value = (float)yang_dnode_get_dec64(args->dnode, "value");
+ required = yang_dnode_get_bool(args->dnode, "required");
srte_candidate_set_bandwidth(candidate, value, required);
}