summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authordimitri staessens <dimitri.staessens@intec.ugent.be>2016-08-09 14:30:49 +0200
committerdimitri staessens <dimitri.staessens@intec.ugent.be>2016-08-09 14:30:49 +0200
commit4450f5e612a40a10f385e67d5931a91a5c326c26 (patch)
tree3ee0a5c73d78ea210157e0a41de0d53a5aa15bc0 /src
parentf941ec364b6f97c3861a46bd2c3b629dc2eec860 (diff)
parent58bf8390779bfa61c03e9c4db0355f04c4d99f08 (diff)
downloadouroboros-4450f5e612a40a10f385e67d5931a91a5c326c26.tar.gz
ouroboros-4450f5e612a40a10f385e67d5931a91a5c326c26.zip
Merged in sandervrijders/ouroboros/be-enroll-fix (pull request #193)
ipcpd: Fix locking of shim-eth-llc
Diffstat (limited to 'src')
-rw-r--r--src/ipcpd/shim-eth-llc/main.c11
1 files changed, 2 insertions, 9 deletions
diff --git a/src/ipcpd/shim-eth-llc/main.c b/src/ipcpd/shim-eth-llc/main.c
index e2799c19..7471e319 100644
--- a/src/ipcpd/shim-eth-llc/main.c
+++ b/src/ipcpd/shim-eth-llc/main.c
@@ -746,7 +746,6 @@ static void * eth_llc_ipcp_sdu_reader(void * o)
ntohs(size),
llc_frame->src_hwaddr);
} else {
- pthread_rwlock_rdlock(&_ipcp->state_lock);
pthread_rwlock_rdlock(&shim_data(_ipcp)->flows_lock);
i = addr_and_saps_to_index(llc_frame->src_hwaddr,
@@ -755,7 +754,6 @@ static void * eth_llc_ipcp_sdu_reader(void * o)
if (i < 0) {
pthread_rwlock_unlock(&shim_data(_ipcp)->
flows_lock);
- pthread_rwlock_unlock(&_ipcp->state_lock);
#if defined(PACKET_RX_RING) && defined(PACKET_TX_RING)
offset = (offset + 1)
& (SHM_BUFFER_SIZE - 1);
@@ -781,7 +779,6 @@ static void * eth_llc_ipcp_sdu_reader(void * o)
;
pthread_rwlock_unlock(&shim_data(_ipcp)->flows_lock);
- pthread_rwlock_unlock(&_ipcp->state_lock);
}
#if defined(PACKET_RX_RING) && defined(PACKET_TX_RING)
offset = (offset + 1) & (SHM_BUFFER_SIZE -1);
@@ -803,9 +800,8 @@ static void * eth_llc_ipcp_sdu_writer(void * o)
uint8_t dsap;
e = shm_ap_rbuff_read(shim_data(_ipcp)->rb);
- if (e == NULL) {
+ if (e == NULL)
continue;
- }
pthread_rwlock_rdlock(&_ipcp->state_lock);
@@ -813,12 +809,12 @@ static void * eth_llc_ipcp_sdu_writer(void * o)
pthread_rwlock_unlock(&_ipcp->state_lock);
return (void *) 1; /* -ENOTENROLLED */
}
+ pthread_rwlock_unlock(&_ipcp->state_lock);
len = shm_du_map_read((uint8_t **) &buf,
shim_data(_ipcp)->dum,
e->index);
if (len <= 0) {
- pthread_rwlock_unlock(&_ipcp->state_lock);
free(e);
LOG_ERR("Length of du map read was %d.", len);
continue;
@@ -830,7 +826,6 @@ static void * eth_llc_ipcp_sdu_writer(void * o)
if (i < 0) {
free(e);
pthread_rwlock_unlock(&shim_data(_ipcp)->flows_lock);
- pthread_rwlock_unlock(&_ipcp->state_lock);
continue;
}
@@ -846,8 +841,6 @@ static void * eth_llc_ipcp_sdu_writer(void * o)
if (shim_data(_ipcp)->dum != NULL)
shm_du_map_remove(shim_data(_ipcp)->dum, e->index);
- pthread_rwlock_unlock(&_ipcp->state_lock);
-
free(e);
}