From 541b1c5eeb5fe9f9aaa4aa6487852e5c59761139 Mon Sep 17 00:00:00 2001 From: Sander Vrijders Date: Mon, 18 Sep 2017 19:06:15 +0200 Subject: ipcpd, lib: Add flow down events This adds the flow down event to Ouroboros. In the shim-eth-llc, a netlink socket is opened which listens to device up/down events. For each event the flow is then adjusted with fccntl to notify the user the flow is down or back up again. In the normal IPCP an event is thrown if a write reports that the flow is down. --- src/ipcpd/local/main.c | 18 ++++++++---------- 1 file changed, 8 insertions(+), 10 deletions(-) (limited to 'src/ipcpd/local/main.c') diff --git a/src/ipcpd/local/main.c b/src/ipcpd/local/main.c index fb4e312b..7f44a2c6 100644 --- a/src/ipcpd/local/main.c +++ b/src/ipcpd/local/main.c @@ -99,30 +99,28 @@ static void * ipcp_local_sdu_loop(void * o) (void) o; - while (true) { - int fd; + while (ipcp_get_state() == IPCP_OPERATIONAL) { + int fd; ssize_t idx; - if (ipcp_get_state() != IPCP_OPERATIONAL) - return (void *) 1; /* -ENOTENROLLED */ - fevent(local_data.flows, local_data.fq, &timeout); while ((fd = fqueue_next(local_data.fq)) >= 0) { - pthread_rwlock_rdlock(&local_data.lock); - idx = local_flow_read(fd); + if (idx < 0) + continue; assert(idx < (SHM_BUFFER_SIZE)); + pthread_rwlock_rdlock(&local_data.lock); + fd = local_data.in_out[fd]; + pthread_rwlock_unlock(&local_data.lock); + if (fd != -1) local_flow_write(fd, idx); - - pthread_rwlock_unlock(&local_data.lock); } - } return (void *) 0; -- cgit v1.2.3