summaryrefslogtreecommitdiff
path: root/src/irmd/ipcp.c
diff options
context:
space:
mode:
authorDimitri Staessens <[email protected]>2024-02-23 13:27:38 +0100
committerSander Vrijders <[email protected]>2024-02-23 16:41:38 +0100
commitb65e5c1d45c8bfc38b3745cb28ac9074b1c1bdc1 (patch)
tree19aac189a295822ca597b6c923b27becc6249c20 /src/irmd/ipcp.c
parentb7baa89fbaa04ceb3227d4d43089d8e6a5326b65 (diff)
downloadouroboros-b65e5c1d45c8bfc38b3745cb28ac9074b1c1bdc1.tar.gz
ouroboros-b65e5c1d45c8bfc38b3745cb28ac9074b1c1bdc1.zip
irmd: Always use reg_destroy_proc
Destroying a process will now always be done with reg_destroy_proc, regardless of whether it was an IPCP or spawned. This makes it easier to keep the registry consistent and avoid races. Also improves some logs and updates some default settings. Signed-off-by: Dimitri Staessens <[email protected]> Signed-off-by: Sander Vrijders <[email protected]>
Diffstat (limited to 'src/irmd/ipcp.c')
-rw-r--r--src/irmd/ipcp.c34
1 files changed, 33 insertions, 1 deletions
diff --git a/src/irmd/ipcp.c b/src/irmd/ipcp.c
index c8055aa1..d7abe15d 100644
--- a/src/irmd/ipcp.c
+++ b/src/irmd/ipcp.c
@@ -47,6 +47,37 @@
#include <sys/socket.h>
#include <sys/time.h>
+static char * str_ipcp_cmd(int code)
+{
+ switch (code) {
+ case IPCP_MSG_CODE__IPCP_BOOTSTRAP:
+ return "bootstrap";
+ case IPCP_MSG_CODE__IPCP_ENROLL:
+ return "enroll";
+ case IPCP_MSG_CODE__IPCP_CONNECT:
+ return "connect";
+ case IPCP_MSG_CODE__IPCP_DISCONNECT:
+ return "disconnect";
+ case IPCP_MSG_CODE__IPCP_REG:
+ return "reg";
+ case IPCP_MSG_CODE__IPCP_UNREG:
+ return "unreg";
+ case IPCP_MSG_CODE__IPCP_QUERY:
+ return "query";
+ case IPCP_MSG_CODE__IPCP_FLOW_JOIN:
+ return "join";
+ case IPCP_MSG_CODE__IPCP_FLOW_ALLOC:
+ return "alloc";
+ case IPCP_MSG_CODE__IPCP_FLOW_ALLOC_RESP:
+ return "alloc_resp";
+ case IPCP_MSG_CODE__IPCP_FLOW_DEALLOC:
+ return "dealloc";
+ default:
+ assert(false);
+ return "unknown";
+ }
+}
+
ipcp_msg_t * send_recv_ipcp_msg(pid_t pid,
ipcp_msg_t * msg)
{
@@ -139,7 +170,8 @@ ipcp_msg_t * send_recv_ipcp_msg(pid_t pid,
else {
if (errno == EAGAIN && !dealloc) {
int diff = ts_diff_ms(&tic, &toc);
- log_warn("IPCP command timed out after %d ms.", diff);
+ log_warn("IPCP %s timed out after %d ms.",
+ str_ipcp_cmd(msg->code), diff);
}
return NULL;
}