diff options
author | Sander Vrijders <[email protected]> | 2017-04-05 12:41:49 +0000 |
---|---|---|
committer | dimitri staessens <[email protected]> | 2017-04-05 12:41:49 +0000 |
commit | 901a97a2a51ece0fd9991797b9764f60268962b3 (patch) | |
tree | e60083545da6ce0dc5fdacd06610d907b90c5aee /src/ipcpd/shim-eth-llc | |
parent | 10195b445b6788c60dfd851e3095fdfcb903e574 (diff) | |
parent | c5b092665c219c679ede91b3dc816c61f2f9dabe (diff) | |
download | ouroboros-901a97a2a51ece0fd9991797b9764f60268962b3.tar.gz ouroboros-901a97a2a51ece0fd9991797b9764f60268962b3.zip |
Merged in sandervrijders/ouroboros/be-fix-llc (pull request #462)
Be fix llc
Diffstat (limited to 'src/ipcpd/shim-eth-llc')
-rw-r--r-- | src/ipcpd/shim-eth-llc/main.c | 12 |
1 files changed, 8 insertions, 4 deletions
diff --git a/src/ipcpd/shim-eth-llc/main.c b/src/ipcpd/shim-eth-llc/main.c index 5a80aa91..142ca680 100644 --- a/src/ipcpd/shim-eth-llc/main.c +++ b/src/ipcpd/shim-eth-llc/main.c @@ -347,19 +347,23 @@ static int eth_llc_ipcp_sap_req(uint8_t r_sap, { int fd; - pthread_rwlock_wrlock(ð_llc_data.flows_lock); + pthread_mutex_lock(&ipcpi.alloc_lock); /* reply to IRM, called under lock to prevent race */ fd = ipcp_flow_req_arr(getpid(), dst_name, cube); if (fd < 0) { + pthread_mutex_unlock(&ipcpi.alloc_lock); log_err("Could not get new flow from IRMd."); return -1; } + pthread_rwlock_wrlock(ð_llc_data.flows_lock); + eth_llc_data.fd_to_ef[fd].r_sap = r_sap; memcpy(eth_llc_data.fd_to_ef[fd].r_addr, r_addr, MAC_SIZE); pthread_rwlock_unlock(ð_llc_data.flows_lock); + pthread_mutex_unlock(&ipcpi.alloc_lock); log_dbg("New flow request, fd %d, remote SAP %d.", fd, r_sap); @@ -536,14 +540,14 @@ static void * eth_llc_ipcp_sdu_reader(void * o) memset(br_addr, 0xff, MAC_SIZE * sizeof(uint8_t)); while (true) { + if (ipcp_get_state() != IPCP_OPERATIONAL) + return (void *) 0; + frame_len = recv(eth_llc_data.s_fd, buf, SHIM_ETH_LLC_MAX_SDU_SIZE, 0); if (frame_len < 0) continue; - if (ipcp_get_state() != IPCP_OPERATIONAL) - return (void *) 0; - llc_frame = (struct eth_llc_frame *) buf; #ifdef __FreeBSD__ |