summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorDimitri Staessens <dimitri.staessens@ugent.be>2017-08-05 12:15:52 -0600
committerDimitri Staessens <dimitri.staessens@ugent.be>2017-08-05 12:15:52 -0600
commit3f9fb4c957e639b96df672190c9d03eec02dce3e (patch)
treee5c19c7f7d40da05103f47f915180cf2edf4f6a8 /src
parent57784d85969a0bcf8599442e3be5ae7edf1fbe10 (diff)
downloadouroboros-3f9fb4c957e639b96df672190c9d03eec02dce3e.tar.gz
ouroboros-3f9fb4c957e639b96df672190c9d03eec02dce3e.zip
irmd: Don't self-query an IPCP
Upon flow_allocation, the IRMd queries IPCPs for the destination name. After this commit, when an IPCP allocates a flow, the IRMd won't query that IPCP.
Diffstat (limited to 'src')
-rw-r--r--src/irmd/main.c9
1 files changed, 5 insertions, 4 deletions
diff --git a/src/irmd/main.c b/src/irmd/main.c
index a8ccccb2..3f83ab2c 100644
--- a/src/irmd/main.c
+++ b/src/irmd/main.c
@@ -222,7 +222,8 @@ static struct ipcp_entry * get_ipcp_entry_by_name(const char * name)
return NULL;
}
-static struct ipcp_entry * get_ipcp_by_dst_name(const char * name)
+static struct ipcp_entry * get_ipcp_by_dst_name(const char * name,
+ pid_t src)
{
struct list_head * p;
struct list_head * h;
@@ -233,7 +234,7 @@ static struct ipcp_entry * get_ipcp_by_dst_name(const char * name)
list_for_each_safe(p, h, &irmd.ipcps) {
struct ipcp_entry * e = list_entry(p, struct ipcp_entry, next);
- if (e->dif_name == NULL)
+ if (e->dif_name == NULL || e->api == src)
continue;
hash = malloc(IPCP_HASH_LEN(e));
@@ -1103,7 +1104,7 @@ static int flow_alloc(pid_t api,
int state;
uint8_t * hash;
- ipcp = get_ipcp_by_dst_name(dst);
+ ipcp = get_ipcp_by_dst_name(dst, api);
if (ipcp == NULL) {
log_info("Destination %s unreachable.", dst);
return -1;
@@ -1199,7 +1200,7 @@ static int flow_dealloc(pid_t api,
if (irm_flow_get_state(f) == FLOW_DEALLOC_PENDING) {
list_del(&f->next);
if ((kill(f->n_api, 0) < 0 && f->n_1_api == -1) ||
- (kill (f->n_1_api, 0) < 0 && f->n_api == -1))
+ (kill(f->n_1_api, 0) < 0 && f->n_api == -1))
irm_flow_set_state(f, FLOW_NULL);
clear_irm_flow(f);
irm_flow_destroy(f);