summaryrefslogtreecommitdiff
path: root/src/ipcpd/broadcast
diff options
context:
space:
mode:
authorDimitri Staessens <dimitri.staessens@ugent.be>2018-12-27 15:42:00 +0100
committerSander Vrijders <sander.vrijders@ugent.be>2018-12-27 16:08:56 +0100
commit9dab3985812e75071271ce69000561156d0d9374 (patch)
tree8569e3186cdcf37c205c7bae0d2d9b595b607602 /src/ipcpd/broadcast
parent8eed1b3fc3d4e3261a68855ccc54c35102738a79 (diff)
downloadouroboros-9dab3985812e75071271ce69000561156d0d9374.tar.gz
ouroboros-9dab3985812e75071271ce69000561156d0d9374.zip
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 <dimitri.staessens@ugent.be> Signed-off-by: Sander Vrijders <sander.vrijders@ugent.be>
Diffstat (limited to 'src/ipcpd/broadcast')
-rw-r--r--src/ipcpd/broadcast/main.c30
1 files changed, 9 insertions, 21 deletions
diff --git a/src/ipcpd/broadcast/main.c b/src/ipcpd/broadcast/main.c
index 8c6bfa71..af39dd34 100644
--- a/src/ipcpd/broadcast/main.c
+++ b/src/ipcpd/broadcast/main.c
@@ -198,31 +198,18 @@ static int broadcast_ipcp_bootstrap(const struct ipcp_config * conf)
return -1;
}
-static int broadcast_ipcp_query(const uint8_t * dst)
+static int name_check(const uint8_t * dst)
{
uint8_t * buf;
size_t len;
int ret;
- char * multicast_name;
- char * suffix = ".mc";
len = hash_len(ipcpi.dir_hash_algo);
buf = malloc(len);
if (buf == NULL)
return -ENOMEM;
- multicast_name = malloc(strlen(ipcpi.layer_name) + strlen(suffix) + 1);
- if (multicast_name == NULL) {
- free(buf);
- return -ENOMEM;
- }
-
- strcpy(multicast_name, ipcpi.layer_name);
- strcat(multicast_name, suffix);
-
- str_hash(ipcpi.dir_hash_algo, buf, multicast_name);
-
- free(multicast_name);
+ str_hash(ipcpi.dir_hash_algo, buf, ipcpi.layer_name);
ret = memcmp(buf, dst, len);
@@ -231,9 +218,9 @@ static int broadcast_ipcp_query(const uint8_t * dst)
return ret;
}
-static int broadcast_ipcp_alloc(int fd,
- const uint8_t * dst,
- qosspec_t qs)
+static int broadcast_ipcp_join(int fd,
+ const uint8_t * dst,
+ qosspec_t qs)
{
struct conn conn;
@@ -243,7 +230,7 @@ static int broadcast_ipcp_alloc(int fd,
conn.flow_info.fd = fd;
- if (broadcast_ipcp_query(dst) != 0)
+ if (name_check(dst) != 0)
return -1;
notifier_event(NOTIFY_DT_CONN_ADD, &conn);
@@ -276,8 +263,9 @@ static struct ipcp_ops broadcast_ops = {
.ipcp_disconnect = connmgr_ipcp_disconnect,
.ipcp_reg = NULL,
.ipcp_unreg = NULL,
- .ipcp_query = broadcast_ipcp_query,
- .ipcp_flow_alloc = broadcast_ipcp_alloc,
+ .ipcp_query = NULL,
+ .ipcp_flow_alloc = NULL,
+ .ipcp_flow_join = broadcast_ipcp_join,
.ipcp_flow_alloc_resp = NULL,
.ipcp_flow_dealloc = broadcast_ipcp_dealloc
};