summaryrefslogtreecommitdiff
path: root/src/ipcpd
diff options
context:
space:
mode:
authorSander Vrijders <sander.vrijders@ugent.be>2017-04-05 11:55:57 +0200
committerSander Vrijders <sander.vrijders@ugent.be>2017-04-05 11:55:57 +0200
commitfa1590539e66c17902bb4f09221e6447b3233bfb (patch)
treece016f05cf4bad8efc5cf464a5420b1e0ec5a3e8 /src/ipcpd
parent10195b445b6788c60dfd851e3095fdfcb903e574 (diff)
downloadouroboros-fa1590539e66c17902bb4f09221e6447b3233bfb.tar.gz
ouroboros-fa1590539e66c17902bb4f09221e6447b3233bfb.zip
ipcpd: shim-eth-llc: Fix state check in reader
The state check should be done first to avoid blocking on the recv call.
Diffstat (limited to 'src/ipcpd')
-rw-r--r--src/ipcpd/shim-eth-llc/main.c6
1 files changed, 3 insertions, 3 deletions
diff --git a/src/ipcpd/shim-eth-llc/main.c b/src/ipcpd/shim-eth-llc/main.c
index 5a80aa91..d42e6fff 100644
--- a/src/ipcpd/shim-eth-llc/main.c
+++ b/src/ipcpd/shim-eth-llc/main.c
@@ -536,14 +536,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__