From 9dab3985812e75071271ce69000561156d0d9374 Mon Sep 17 00:00:00 2001 From: Dimitri Staessens Date: Thu, 27 Dec 2018 15:42:00 +0100 Subject: include: Add a flow_join operation for broadcast This adds a new flow_join operaiton for broadcast, which is a much safer solution than overloading destination name semantics. The internal API now also has a different IPCP_FLOW_JOIN operation. The IRMd doesn't need to query broadcasts IPCPs for the name, it can just check if an IPCP with the layer name exists. The broadcast IPCP doesn't need to implement the query proxy call anymore. Signed-off-by: Dimitri Staessens Signed-off-by: Sander Vrijders --- src/ipcpd/ipcp.c | 33 +++++++++++++++++++++++++++++++++ 1 file changed, 33 insertions(+) (limited to 'src/ipcpd/ipcp.c') diff --git a/src/ipcpd/ipcp.c b/src/ipcpd/ipcp.c index 6376bedb..dced6f64 100644 --- a/src/ipcpd/ipcp.c +++ b/src/ipcpd/ipcp.c @@ -428,6 +428,39 @@ static void * mainloop(void * o) msg->hash.data, qs); break; + case IPCP_MSG_CODE__IPCP_FLOW_JOIN: + ret_msg.has_result = true; + + if (ipcpi.ops->ipcp_flow_join == NULL) { + log_err("Broadcast unsupported."); + ret_msg.result = -ENOTSUP; + break; + } + + assert(msg->hash.len == ipcp_dir_hash_len()); + + if (ipcp_get_state() != IPCP_OPERATIONAL) { + log_err("IPCP in wrong state."); + ret_msg.result = -EIPCPSTATE; + break; + } + + qs = msg_to_spec(msg->qosspec); + fd = np1_flow_alloc(msg->pid, + msg->flow_id, + qs); + if (fd < 0) { + log_err("Failed allocating fd on flow_id %d.", + msg->flow_id); + ret_msg.result = -1; + break; + } + + ret_msg.result = + ipcpi.ops->ipcp_flow_join(fd, + msg->hash.data, + qs); + break; case IPCP_MSG_CODE__IPCP_FLOW_ALLOC_RESP: ret_msg.has_result = true; if (ipcpi.ops->ipcp_flow_alloc_resp == NULL) { -- cgit v1.2.3