summaryrefslogtreecommitdiff
path: root/src/irmd/reg/ipcp.c
diff options
context:
space:
mode:
authorDimitri Staessens <dimitri@ouroboros.rocks>2025-08-16 10:54:14 +0200
committerDimitri Staessens <dimitri@ouroboros.rocks>2025-08-23 10:13:33 +0200
commit575adac4acacf7d02395df0322ff5f03b7b82aaf (patch)
treef5de69d4f3599f2be0a075b9a9e1af52a9754ad5 /src/irmd/reg/ipcp.c
parentd0b9463a9e52332b8b0b856d2f9773bbb5d42433 (diff)
downloadouroboros-575adac4acacf7d02395df0322ff5f03b7b82aaf.tar.gz
ouroboros-575adac4acacf7d02395df0322ff5f03b7b82aaf.zip
ipcpd: Fix request handling at shutdown
The IPCP states were not entirely correct causing some operations to be serviced during shutdown. This caused some use-after-free in the pff. States in the IPCP are now correctly set. IRMd states updated to the same strategy. The IRMd registry tracks if the IPCP was ENROLLED or BOOTSTRAPPED, the IPCP just goes to OPERATIONAL. IPCP state diagram:: NULL -> init() -> INIT -> start() -> BOOT -> bootstrap/enroll() -> OPERATIONAL -> shutdown() -> SHUTDOWN -> stop_components() -> BOOT -> stop() -> INIT -> fini() -> NULL Signed-off-by: Dimitri Staessens <dimitri@ouroboros.rocks>
Diffstat (limited to 'src/irmd/reg/ipcp.c')
-rw-r--r--src/irmd/reg/ipcp.c8
1 files changed, 4 insertions, 4 deletions
diff --git a/src/irmd/reg/ipcp.c b/src/irmd/reg/ipcp.c
index 6580cb5b..474527a4 100644
--- a/src/irmd/reg/ipcp.c
+++ b/src/irmd/reg/ipcp.c
@@ -40,7 +40,7 @@ struct reg_ipcp * reg_ipcp_create(const struct ipcp_info * info)
struct reg_ipcp * ipcp;
assert(info != NULL);
- assert(info->state == IPCP_BOOT);
+ assert(info->state == IPCP_INIT);
ipcp = malloc(sizeof(*ipcp));
if (ipcp == NULL) {
@@ -54,7 +54,7 @@ struct reg_ipcp * reg_ipcp_create(const struct ipcp_info * info)
list_head_init(&ipcp->next);
ipcp->info = *info;
- ipcp->info.state = IPCP_BOOT;
+ ipcp->info.state = IPCP_INIT;
strcpy(ipcp->layer.name, "Not enrolled.");
@@ -77,7 +77,7 @@ void reg_ipcp_update(struct reg_ipcp * ipcp,
const struct ipcp_info * info)
{
assert(ipcp != NULL);
- assert(info->state != IPCP_INIT);
+ assert(info->state != IPCP_NULL);
ipcp->info = *info;
}
@@ -86,7 +86,7 @@ void reg_ipcp_set_layer(struct reg_ipcp * ipcp,
const struct layer_info * info)
{
assert(ipcp != NULL);
- assert(ipcp->info.state == IPCP_OPERATIONAL);
+ assert(ipcp->info.state == IPCP_BOOT);
ipcp->layer = *info;
}