summaryrefslogtreecommitdiff
path: root/pathd
diff options
context:
space:
mode:
Diffstat (limited to 'pathd')
-rw-r--r--pathd/path_cli.c4
-rw-r--r--pathd/path_main.c3
-rw-r--r--pathd/path_memory.c25
-rw-r--r--pathd/path_memory.h26
-rw-r--r--pathd/path_nb_config.c8
-rw-r--r--pathd/path_pcep.c6
-rw-r--r--pathd/path_pcep.h4
-rw-r--r--pathd/path_pcep_cli.c3
-rw-r--r--pathd/path_pcep_lib.c7
-rw-r--r--pathd/path_pcep_memory.c27
-rw-r--r--pathd/path_pcep_memory.h28
-rw-r--r--pathd/path_pcep_pcc.c7
-rw-r--r--pathd/path_pcep_pcc.h6
-rw-r--r--pathd/pathd.c15
-rw-r--r--pathd/pathd.h9
-rw-r--r--pathd/subdir.am4
16 files changed, 41 insertions, 141 deletions
diff --git a/pathd/path_cli.c b/pathd/path_cli.c
index 8beb428135..cf14aa8c61 100644
--- a/pathd/path_cli.c
+++ b/pathd/path_cli.c
@@ -20,6 +20,7 @@
#include <math.h>
#include <zebra.h>
+#include "memory.h"
#include "log.h"
#include "command.h"
#include "mpls.h"
@@ -28,7 +29,6 @@
#include "pathd/pathd.h"
#include "pathd/path_nb.h"
-#include "pathd/path_memory.h"
#ifndef VTYSH_EXTRACT_PL
#include "pathd/path_cli_clippy.c"
#endif
@@ -46,7 +46,7 @@ static int config_write_traffic_eng(struct vty *vty);
static int config_write_segment_lists(struct vty *vty);
static int config_write_sr_policies(struct vty *vty);
-DEFINE_MTYPE_STATIC(PATHD, PATH_CLI, "Client")
+DEFINE_MTYPE_STATIC(PATHD, PATH_CLI, "Client");
/* Vty node structures. */
static struct cmd_node segment_routing_node = {
diff --git a/pathd/path_main.c b/pathd/path_main.c
index 8b7d4aba48..f54ab736c4 100644
--- a/pathd/path_main.c
+++ b/pathd/path_main.c
@@ -114,7 +114,8 @@ FRR_DAEMON_INFO(pathd, PATH, .vty_port = PATH_VTY_PORT,
.signals = path_signals, .n_signals = array_size(path_signals),
.privs = &pathd_privs, .yang_modules = pathd_yang_modules,
- .n_yang_modules = array_size(pathd_yang_modules), )
+ .n_yang_modules = array_size(pathd_yang_modules),
+);
int main(int argc, char **argv, char **envp)
{
diff --git a/pathd/path_memory.c b/pathd/path_memory.c
deleted file mode 100644
index ad4904a298..0000000000
--- a/pathd/path_memory.c
+++ /dev/null
@@ -1,25 +0,0 @@
-/*
- * Copyright (C) 2020 NetDEF, Inc.
- *
- * This program is free software; you can redistribute it and/or modify it
- * under the terms of the GNU General Public License as published by the Free
- * Software Foundation; either version 2 of the License, or (at your option)
- * any later version.
- *
- * This program is distributed in the hope that it will be useful, but WITHOUT
- * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
- * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
- * more details.
- *
- * You should have received a copy of the GNU General Public License along
- * with this program; see the file COPYING; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
- */
-
-#include <zebra.h>
-
-#include <memory.h>
-
-#include "pathd/path_memory.h"
-
-DEFINE_MGROUP(PATHD, "pathd")
diff --git a/pathd/path_memory.h b/pathd/path_memory.h
deleted file mode 100644
index e2f6787f66..0000000000
--- a/pathd/path_memory.h
+++ /dev/null
@@ -1,26 +0,0 @@
-/*
- * Copyright (C) 2020 NetDEF, Inc.
- *
- * This program is free software; you can redistribute it and/or modify it
- * under the terms of the GNU General Public License as published by the Free
- * Software Foundation; either version 2 of the License, or (at your option)
- * any later version.
- *
- * This program is distributed in the hope that it will be useful, but WITHOUT
- * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
- * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
- * more details.
- *
- * You should have received a copy of the GNU General Public License along
- * with this program; see the file COPYING; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
- */
-
-#ifndef _FRR_PATH_MEMORY_H_
-#define _FRR_PATH_MEMORY_H_
-
-#include "memory.h"
-
-DECLARE_MGROUP(PATHD)
-
-#endif /* _FRR_PATH_MEMORY_H_ */
diff --git a/pathd/path_nb_config.c b/pathd/path_nb_config.c
index 669db169ae..af54f5bce2 100644
--- a/pathd/path_nb_config.c
+++ b/pathd/path_nb_config.c
@@ -302,7 +302,6 @@ int pathd_srte_policy_binding_sid_modify(struct nb_cb_modify_args *args)
struct srte_policy *policy;
mpls_label_t binding_sid;
- policy = nb_running_get_entry(args->dnode, NULL, true);
binding_sid = yang_dnode_get_uint32(args->dnode, NULL);
switch (args->event) {
@@ -315,6 +314,7 @@ int pathd_srte_policy_binding_sid_modify(struct nb_cb_modify_args *args)
case NB_EV_ABORT:
break;
case NB_EV_APPLY:
+ policy = nb_running_get_entry(args->dnode, NULL, true);
srte_policy_update_binding_sid(policy, binding_sid);
SET_FLAG(policy->flags, F_POLICY_MODIFIED);
break;
@@ -668,12 +668,12 @@ int pathd_srte_policy_candidate_path_segment_list_name_modify(
struct srte_candidate *candidate;
const char *segment_list_name;
- candidate = nb_running_get_entry(args->dnode, NULL, true);
- segment_list_name = yang_dnode_get_string(args->dnode, NULL);
-
if (args->event != NB_EV_APPLY)
return NB_OK;
+ candidate = nb_running_get_entry(args->dnode, NULL, true);
+ segment_list_name = yang_dnode_get_string(args->dnode, NULL);
+
candidate->segment_list = srte_segment_list_find(segment_list_name);
candidate->lsp->segment_list = candidate->segment_list;
assert(candidate->segment_list);
diff --git a/pathd/path_pcep.c b/pathd/path_pcep.c
index 8b5ca8aff3..d6cd48ecdb 100644
--- a/pathd/path_pcep.c
+++ b/pathd/path_pcep.c
@@ -19,6 +19,7 @@
#include <zebra.h>
#include "pceplib/pcep_utils_counters.h"
+#include "memory.h"
#include "log.h"
#include "command.h"
#include "libfrr.h"
@@ -31,13 +32,13 @@
#include "pathd/pathd.h"
#include "pathd/path_errors.h"
-#include "pathd/path_pcep_memory.h"
#include "pathd/path_pcep.h"
#include "pathd/path_pcep_cli.h"
#include "pathd/path_pcep_controller.h"
#include "pathd/path_pcep_lib.h"
#include "pathd/path_pcep_config.h"
+DEFINE_MTYPE(PATHD, PCEP, "PCEP module");
/*
* Globals.
@@ -317,4 +318,5 @@ int pcep_module_init(void)
FRR_MODULE_SETUP(.name = "frr_pathd_pcep", .version = FRR_VERSION,
.description = "FRR pathd PCEP module",
- .init = pcep_module_init)
+ .init = pcep_module_init,
+);
diff --git a/pathd/path_pcep.h b/pathd/path_pcep.h
index b131b31445..654d089cbc 100644
--- a/pathd/path_pcep.h
+++ b/pathd/path_pcep.h
@@ -22,11 +22,13 @@
#include <stdbool.h>
#include <debug.h>
#include <netinet/tcp.h>
+#include "memory.h"
#include "pceplib/pcep_utils_logging.h"
#include "pceplib/pcep_pcc_api.h"
#include "mpls.h"
#include "pathd/pathd.h"
-#include "pathd/path_pcep_memory.h"
+
+DECLARE_MTYPE(PCEP);
#define PCEP_DEFAULT_PORT 4189
#define MAX_PCC 32
diff --git a/pathd/path_pcep_cli.c b/pathd/path_pcep_cli.c
index 7bbed9464d..14404b1d08 100644
--- a/pathd/path_pcep_cli.c
+++ b/pathd/path_pcep_cli.c
@@ -33,7 +33,6 @@
#include "pathd/pathd.h"
#include "pathd/path_errors.h"
-#include "pathd/path_pcep_memory.h"
#include "pathd/path_pcep.h"
#include "pathd/path_pcep_cli.h"
#include "pathd/path_pcep_controller.h"
@@ -1046,7 +1045,7 @@ static int path_pcep_cli_pcc_pcc_peer(struct vty *vty, const char *peer_name,
XMALLOC(MTYPE_PCEP, sizeof(struct pcc_opts));
memcpy(&pcc_opts_copy->addr,
&pce_opts_cli->pce_opts.config_opts.source_ip,
- sizeof(struct pcc_opts));
+ sizeof(pcc_opts_copy->addr));
pcc_opts_copy->msd = pcc_msd_g;
pcc_opts_copy->port = pce_opts_cli->pce_opts.config_opts.source_port;
if (pcep_ctrl_update_pcc_options(pcep_g->fpt, pcc_opts_copy)) {
diff --git a/pathd/path_pcep_lib.c b/pathd/path_pcep_lib.c
index 1d2f25889e..e9d699de47 100644
--- a/pathd/path_pcep_lib.c
+++ b/pathd/path_pcep_lib.c
@@ -18,15 +18,18 @@
#include <zebra.h>
+#include "memory.h"
+
#include <debug.h>
#include "pceplib/pcep_utils_counters.h"
#include "pceplib/pcep_timers.h"
#include "pathd/path_errors.h"
-#include "pathd/path_memory.h"
#include "pathd/path_pcep.h"
#include "pathd/path_pcep_lib.h"
#include "pathd/path_pcep_debug.h"
-#include "pathd/path_pcep_memory.h"
+
+DEFINE_MTYPE_STATIC(PATHD, PCEPLIB_INFRA, "PCEPlib Infrastructure");
+DEFINE_MTYPE_STATIC(PATHD, PCEPLIB_MESSAGES, "PCEPlib PCEP Messages");
#define CLASS_TYPE(CLASS, TYPE) (((CLASS) << 16) | (TYPE))
#define DEFAULT_LSAP_SETUP_PRIO 4
diff --git a/pathd/path_pcep_memory.c b/pathd/path_pcep_memory.c
deleted file mode 100644
index 8f608090a6..0000000000
--- a/pathd/path_pcep_memory.c
+++ /dev/null
@@ -1,27 +0,0 @@
-/*
- * Copyright (C) 2020 NetDEF, Inc.
- *
- * This program is free software; you can redistribute it and/or modify it
- * under the terms of the GNU General Public License as published by the Free
- * Software Foundation; either version 2 of the License, or (at your option)
- * any later version.
- *
- * This program is distributed in the hope that it will be useful, but WITHOUT
- * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
- * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
- * more details.
- *
- * You should have received a copy of the GNU General Public License along
- * with this program; see the file COPYING; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
- */
-
-#include <zebra.h>
-
-#include <memory.h>
-
-#include "pathd/path_pcep_memory.h"
-
-DEFINE_MTYPE(PATHD, PCEP, "PCEP module")
-DEFINE_MTYPE(PATHD, PCEPLIB_INFRA, "PCEPlib Infrastructure")
-DEFINE_MTYPE(PATHD, PCEPLIB_MESSAGES, "PCEPlib PCEP Messages")
diff --git a/pathd/path_pcep_memory.h b/pathd/path_pcep_memory.h
deleted file mode 100644
index 05c5e2d82b..0000000000
--- a/pathd/path_pcep_memory.h
+++ /dev/null
@@ -1,28 +0,0 @@
-/*
- * Copyright (C) 2020 NetDEF, Inc.
- *
- * This program is free software; you can redistribute it and/or modify it
- * under the terms of the GNU General Public License as published by the Free
- * Software Foundation; either version 2 of the License, or (at your option)
- * any later version.
- *
- * This program is distributed in the hope that it will be useful, but WITHOUT
- * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
- * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
- * more details.
- *
- * You should have received a copy of the GNU General Public License along
- * with this program; see the file COPYING; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
- */
-
-#ifndef _FRR_PATH_PCEP_MEMORY_H_
-#define _FRR_PATH_PCEP_MEMORY_H_
-
-#include "pathd/path_memory.h"
-
-DECLARE_MTYPE(PCEP)
-DECLARE_MTYPE(PCEPLIB_INFRA)
-DECLARE_MTYPE(PCEPLIB_MESSAGES)
-
-#endif /* _FRR_PATH_PCEP_MEMORY_H_ */
diff --git a/pathd/path_pcep_pcc.c b/pathd/path_pcep_pcc.c
index 899ce805fe..a2c1e7cd4c 100644
--- a/pathd/path_pcep_pcc.c
+++ b/pathd/path_pcep_pcc.c
@@ -41,7 +41,6 @@
#include "pathd/pathd.h"
#include "pathd/path_zebra.h"
#include "pathd/path_errors.h"
-#include "pathd/path_pcep_memory.h"
#include "pathd/path_pcep.h"
#include "pathd/path_pcep_controller.h"
#include "pathd/path_pcep_lib.h"
@@ -147,10 +146,10 @@ static uint32_t req_map_hash(const struct req_map_data *e);
/* Data Structure Declarations */
DECLARE_HASH(plspid_map, struct plspid_map_data, mi, plspid_map_cmp,
- plspid_map_hash)
+ plspid_map_hash);
DECLARE_HASH(nbkey_map, struct nbkey_map_data, mi, nbkey_map_cmp,
- nbkey_map_hash)
-DECLARE_HASH(req_map, struct req_map_data, mi, req_map_cmp, req_map_hash)
+ nbkey_map_hash);
+DECLARE_HASH(req_map, struct req_map_data, mi, req_map_cmp, req_map_hash);
static inline int req_entry_compare(const struct req_entry *a,
const struct req_entry *b)
diff --git a/pathd/path_pcep_pcc.h b/pathd/path_pcep_pcc.h
index c07a6ae541..ceac6f3278 100644
--- a/pathd/path_pcep_pcc.h
+++ b/pathd/path_pcep_pcc.h
@@ -30,9 +30,9 @@ enum pcc_status {
PCEP_PCC_OPERATING
};
-PREDECL_HASH(plspid_map)
-PREDECL_HASH(nbkey_map)
-PREDECL_HASH(req_map)
+PREDECL_HASH(plspid_map);
+PREDECL_HASH(nbkey_map);
+PREDECL_HASH(req_map);
struct plspid_map_data {
struct plspid_map_item mi;
diff --git a/pathd/pathd.c b/pathd/pathd.c
index 14f5167bff..ae82186315 100644
--- a/pathd/pathd.c
+++ b/pathd/pathd.c
@@ -24,22 +24,23 @@
#include "network.h"
#include "pathd/pathd.h"
-#include "pathd/path_memory.h"
#include "pathd/path_zebra.h"
#include "pathd/path_debug.h"
#define HOOK_DELAY 3
-DEFINE_MTYPE_STATIC(PATHD, PATH_SEGMENT_LIST, "Segment List")
-DEFINE_MTYPE_STATIC(PATHD, PATH_SR_POLICY, "SR Policy")
-DEFINE_MTYPE_STATIC(PATHD, PATH_SR_CANDIDATE, "SR Policy candidate path")
+DEFINE_MGROUP(PATHD, "pathd");
+
+DEFINE_MTYPE_STATIC(PATHD, PATH_SEGMENT_LIST, "Segment List");
+DEFINE_MTYPE_STATIC(PATHD, PATH_SR_POLICY, "SR Policy");
+DEFINE_MTYPE_STATIC(PATHD, PATH_SR_CANDIDATE, "SR Policy candidate path");
DEFINE_HOOK(pathd_candidate_created, (struct srte_candidate * candidate),
- (candidate))
+ (candidate));
DEFINE_HOOK(pathd_candidate_updated, (struct srte_candidate * candidate),
- (candidate))
+ (candidate));
DEFINE_HOOK(pathd_candidate_removed, (struct srte_candidate * candidate),
- (candidate))
+ (candidate));
static void trigger_pathd_candidate_created(struct srte_candidate *candidate);
static int trigger_pathd_candidate_created_timer(struct thread *thread);
diff --git a/pathd/pathd.h b/pathd/pathd.h
index 4879239db8..9c4d256cef 100644
--- a/pathd/pathd.h
+++ b/pathd/pathd.h
@@ -19,11 +19,14 @@
#ifndef _FRR_PATHD_H_
#define _FRR_PATHD_H_
+#include "lib/memory.h"
#include "lib/mpls.h"
#include "lib/ipaddr.h"
#include "lib/srte.h"
#include "lib/hook.h"
+DECLARE_MGROUP(PATHD);
+
enum srte_protocol_origin {
SRTE_ORIGIN_UNDEFINED = 0,
SRTE_ORIGIN_PCEP = 1,
@@ -338,11 +341,11 @@ RB_HEAD(srte_policy_head, srte_policy);
RB_PROTOTYPE(srte_policy_head, srte_policy, entry, srte_policy_compare)
DECLARE_HOOK(pathd_candidate_created, (struct srte_candidate * candidate),
- (candidate))
+ (candidate));
DECLARE_HOOK(pathd_candidate_updated, (struct srte_candidate * candidate),
- (candidate))
+ (candidate));
DECLARE_HOOK(pathd_candidate_removed, (struct srte_candidate * candidate),
- (candidate))
+ (candidate));
extern struct srte_segment_list_head srte_segment_lists;
extern struct srte_policy_head srte_policies;
diff --git a/pathd/subdir.am b/pathd/subdir.am
index 452d824669..b4501214bf 100644
--- a/pathd/subdir.am
+++ b/pathd/subdir.am
@@ -23,7 +23,6 @@ pathd_libpath_a_SOURCES = \
pathd/path_debug.c \
pathd/path_errors.c \
pathd/path_main.c \
- pathd/path_memory.c \
pathd/path_nb.c \
pathd/path_nb_config.c \
pathd/path_nb_state.c \
@@ -39,14 +38,12 @@ clippy_scan += \
noinst_HEADERS += \
pathd/path_debug.h \
pathd/path_errors.h \
- pathd/path_memory.h \
pathd/path_nb.h \
pathd/path_pcep.h \
pathd/path_pcep_cli.h \
pathd/path_pcep_controller.h \
pathd/path_pcep_debug.h \
pathd/path_pcep_lib.h \
- pathd/path_pcep_memory.h \
pathd/path_pcep_config.h \
pathd/path_pcep_pcc.h \
pathd/path_zebra.h \
@@ -65,7 +62,6 @@ pathd_pathd_pcep_la_SOURCES = \
pathd/path_pcep_controller.c \
pathd/path_pcep_debug.c \
pathd/path_pcep_lib.c \
- pathd/path_pcep_memory.c \
pathd/path_pcep_config.c \
pathd/path_pcep_pcc.c \
# end