summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--include/ouroboros/ipcp.h5
-rw-r--r--src/ipcpd/normal/fmgr.c2
-rw-r--r--src/ipcpd/shim-eth-llc/main.c2
-rw-r--r--src/ipcpd/shim-udp/main.c2
-rw-r--r--src/lib/ipcp.c68
5 files changed, 39 insertions, 40 deletions
diff --git a/include/ouroboros/ipcp.h b/include/ouroboros/ipcp.h
index a83d8a77..98337da6 100644
--- a/include/ouroboros/ipcp.h
+++ b/include/ouroboros/ipcp.h
@@ -73,12 +73,9 @@ int ipcp_flow_alloc_reply(pid_t api,
int port_id,
int response);
-/*
- * This operation can go both ways
- * api == 0 means the IRMd is the destination
- */
int ipcp_flow_dealloc(pid_t api,
int port_id);
+int irm_flow_dealloc(int port_id);
#endif /* OUROBOROS_IPCP_H */
diff --git a/src/ipcpd/normal/fmgr.c b/src/ipcpd/normal/fmgr.c
index 3056b46d..5d54842e 100644
--- a/src/ipcpd/normal/fmgr.c
+++ b/src/ipcpd/normal/fmgr.c
@@ -583,7 +583,7 @@ int fmgr_flow_alloc_msg(struct frct_i * frct_i,
return -1;
}
- ret = ipcp_flow_dealloc(0, flow->flow.port_id);
+ ret = irm_flow_dealloc(flow->flow.port_id);
break;
default:
LOG_ERR("Got an unknown flow allocation message.");
diff --git a/src/ipcpd/shim-eth-llc/main.c b/src/ipcpd/shim-eth-llc/main.c
index d1100001..a1ded117 100644
--- a/src/ipcpd/shim-eth-llc/main.c
+++ b/src/ipcpd/shim-eth-llc/main.c
@@ -599,7 +599,7 @@ static int eth_llc_ipcp_flow_dealloc_req(uint8_t ssap,
pthread_rwlock_unlock(&shim_data(_ipcp)->flows_lock);
pthread_rwlock_unlock(&_ipcp->state_lock);
- ipcp_flow_dealloc(0, port_id);
+ irm_flow_dealloc(port_id);
LOG_DBG("Flow with port_id %d deallocated.", port_id);
diff --git a/src/ipcpd/shim-udp/main.c b/src/ipcpd/shim-udp/main.c
index 451a2a4c..34af71a7 100644
--- a/src/ipcpd/shim-udp/main.c
+++ b/src/ipcpd/shim-udp/main.c
@@ -606,7 +606,7 @@ static int ipcp_udp_flow_dealloc_req(int udp_port)
pthread_rwlock_unlock(&_ipcp->state_lock);
- ipcp_flow_dealloc(0, port_id);
+ irm_flow_dealloc(port_id);
close(fd);
diff --git a/src/lib/ipcp.c b/src/lib/ipcp.c
index e8e31e46..01741121 100644
--- a/src/lib/ipcp.c
+++ b/src/lib/ipcp.c
@@ -464,49 +464,51 @@ int ipcp_flow_alloc_reply(pid_t api,
int ipcp_flow_dealloc(pid_t api,
int port_id)
{
- if (api != 0) {
- ipcp_msg_t msg = IPCP_MSG__INIT;
- ipcp_msg_t * recv_msg = NULL;
- int ret = -1;
- msg.code = IPCP_MSG_CODE__IPCP_FLOW_DEALLOC;
- msg.has_port_id = true;
- msg.port_id = port_id;
+ ipcp_msg_t msg = IPCP_MSG__INIT;
+ ipcp_msg_t * recv_msg = NULL;
+ int ret = -1;
- recv_msg = send_recv_ipcp_msg(api, &msg);
- if (recv_msg == NULL)
- return 0;
+ msg.code = IPCP_MSG_CODE__IPCP_FLOW_DEALLOC;
+ msg.has_port_id = true;
+ msg.port_id = port_id;
- if (recv_msg->has_result == false) {
- ipcp_msg__free_unpacked(recv_msg, NULL);
- return 0;
- }
+ recv_msg = send_recv_ipcp_msg(api, &msg);
+ if (recv_msg == NULL)
+ return 0;
- ret = recv_msg->result;
+ if (recv_msg->has_result == false) {
ipcp_msg__free_unpacked(recv_msg, NULL);
+ return 0;
+ }
- return ret;
- } else {
- irm_msg_t msg = IRM_MSG__INIT;
- irm_msg_t * recv_msg = NULL;
- int ret = -1;
+ ret = recv_msg->result;
+ ipcp_msg__free_unpacked(recv_msg, NULL);
+
+ return ret;
+}
- msg.code = IRM_MSG_CODE__IPCP_FLOW_DEALLOC;
- msg.has_port_id = true;
- msg.port_id = port_id;
+int irm_flow_dealloc(int port_id)
+{
+ irm_msg_t msg = IRM_MSG__INIT;
+ irm_msg_t * recv_msg = NULL;
+ int ret = -1;
- recv_msg = send_recv_irm_msg(&msg);
- if (recv_msg == NULL)
- return 0;
+ msg.code = IRM_MSG_CODE__IPCP_FLOW_DEALLOC;
+ msg.has_port_id = true;
+ msg.port_id = port_id;
- if (recv_msg->has_result == false) {
- irm_msg__free_unpacked(recv_msg, NULL);
- return 0;
- }
+ recv_msg = send_recv_irm_msg(&msg);
+ if (recv_msg == NULL)
+ return 0;
- ret = recv_msg->result;
+ if (recv_msg->has_result == false) {
irm_msg__free_unpacked(recv_msg, NULL);
-
- return ret;
+ return 0;
}
+
+ ret = recv_msg->result;
+ irm_msg__free_unpacked(recv_msg, NULL);
+
+ return ret;
}