summaryrefslogtreecommitdiff
path: root/src/ipcpd/broadcast/main.c
diff options
context:
space:
mode:
authorDimitri Staessens <[email protected]>2023-02-12 21:05:40 +0100
committerSander Vrijders <[email protected]>2023-02-13 21:10:11 +0100
commit269f25d3bac5ab871d8044935eacc15cfeadeec6 (patch)
treed68cba31a7a4b941658836d0c0d616fc7ec6400b /src/ipcpd/broadcast/main.c
parentc3814fa77eb7afbe6e798ded0fdff2df74ad8642 (diff)
downloadouroboros-269f25d3bac5ab871d8044935eacc15cfeadeec6.tar.gz
ouroboros-269f25d3bac5ab871d8044935eacc15cfeadeec6.zip
ipcpd: refactor IPCP configuration
The ipcp configuration struct now has internal structures for the different IPCPs and for IPCP components of the unicast IPCP. Split the very long IPCP main loop into individual handler functions. Signed-off-by: Dimitri Staessens <[email protected]> Signed-off-by: Sander Vrijders <[email protected]>
Diffstat (limited to 'src/ipcpd/broadcast/main.c')
-rw-r--r--src/ipcpd/broadcast/main.c16
1 files changed, 2 insertions, 14 deletions
diff --git a/src/ipcpd/broadcast/main.c b/src/ipcpd/broadcast/main.c
index 2b8b90a5..d0becc63 100644
--- a/src/ipcpd/broadcast/main.c
+++ b/src/ipcpd/broadcast/main.c
@@ -56,36 +56,24 @@ struct ipcp ipcpi;
static int initialize_components(const struct ipcp_config * conf)
{
- ipcpi.layer_name = strdup(conf->layer_info.layer_name);
- if (ipcpi.layer_name == NULL) {
- log_err("Failed to set layer name.");
- goto fail_layer_name;
- }
-
+ strcpy(ipcpi.layer_name, conf->layer_info.layer_name);
ipcpi.dir_hash_algo = conf->layer_info.dir_hash_algo;
assert(ipcp_dir_hash_len() != 0);
if (dt_init()) {
log_err("Failed to initialize forwarding component.");
- goto fail_dt;
+ return -1;
}
ipcp_set_state(IPCP_INIT);
return 0;
-
- fail_dt:
- free(ipcpi.layer_name);
- fail_layer_name:
- return -1;
}
static void finalize_components(void)
{
dt_fini();
-
- free(ipcpi.layer_name);
}
static int start_components(void)