summaryrefslogtreecommitdiff
path: root/src/irmd/reg/tests/ipcp_test.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/tests/ipcp_test.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/tests/ipcp_test.c')
-rw-r--r--src/irmd/reg/tests/ipcp_test.c9
1 files changed, 2 insertions, 7 deletions
diff --git a/src/irmd/reg/tests/ipcp_test.c b/src/irmd/reg/tests/ipcp_test.c
index fb8ba71b..d7d8e524 100644
--- a/src/irmd/reg/tests/ipcp_test.c
+++ b/src/irmd/reg/tests/ipcp_test.c
@@ -31,7 +31,7 @@ static int test_reg_ipcp_create(void)
struct reg_ipcp * ipcp;
struct ipcp_info info = {
.pid = TEST_PID,
- .state = IPCP_BOOT
+ .state = IPCP_INIT
};
struct layer_info layer = {
.name = "testlayer",
@@ -51,7 +51,7 @@ static int test_reg_ipcp_create(void)
goto fail;
}
- ipcp->info.state = IPCP_OPERATIONAL;
+ ipcp->info.state = IPCP_BOOT;
reg_ipcp_set_layer(ipcp, &layer);
@@ -60,11 +60,6 @@ static int test_reg_ipcp_create(void)
goto fail;
}
- if (ipcp->info.state != IPCP_OPERATIONAL) {
- printf("IPCP state was not set.\n");
- goto fail;
- }
-
reg_ipcp_destroy(ipcp);
TEST_SUCCESS();