From 1a13d42a0792a4a12a40c813072355502e87c42f Mon Sep 17 00:00:00 2001 From: Dimitri Staessens Date: Fri, 18 Jun 2021 17:37:11 +0200 Subject: ipcpd: Move RIB initialization to common ground This moves Resource Information Base (RIB) initialization into the ipcp_init() function, so all IPCPs initialize a RIB. The RIB not shows some common IPCP information, such as the IPCP name, IPCP state and the layer name if the IPCP is part of a layer. The initialization of the hash algorithm and layer name was moved out of the common ipcp source because IPCPs may only know this information after enrollment. Some IPCPs were not even storing this information. Signed-off-by: Dimitri Staessens Signed-off-by: Sander Vrijders --- src/ipcpd/udp/main.c | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) (limited to 'src/ipcpd/udp/main.c') diff --git a/src/ipcpd/udp/main.c b/src/ipcpd/udp/main.c index 4314b330..13db0c1f 100644 --- a/src/ipcpd/udp/main.c +++ b/src/ipcpd/udp/main.c @@ -573,6 +573,13 @@ static int ipcp_udp_bootstrap(const struct ipcp_config * conf) assert(conf); assert(conf->type == THIS_TYPE); + ipcpi.dir_hash_algo = conf->layer_info.dir_hash_algo; + ipcpi.layer_name = strdup(conf->layer_info.layer_name); + if (ipcpi.layer_name == NULL) { + log_err("Failed to set layer name"); + return -ENOMEM; + } + if (inet_ntop(AF_INET, &conf->ip_addr, ipstr, INET_ADDRSTRLEN) == NULL) { log_err("Failed to convert IP address"); @@ -1094,7 +1101,7 @@ int main(int argc, { int i; - if (ipcp_init(argc, argv, &udp_ops) < 0) + if (ipcp_init(argc, argv, &udp_ops, THIS_TYPE) < 0) goto fail_init; if (udp_data_init() < 0) { -- cgit v1.2.3