From 0c8d8e419f7c9052d88bb9765bf43b01187977d0 Mon Sep 17 00:00:00 2001 From: dimitri staessens Date: Tue, 21 Mar 2017 15:21:52 +0100 Subject: lib: Add queued SDUs when adding fd to flow_set This solves some race conditions where packets arrive on a flow before it is added to a flow_set. --- src/lib/dev.c | 6 ++++++ 1 file changed, 6 insertions(+) (limited to 'src/lib/dev.c') diff --git a/src/lib/dev.c b/src/lib/dev.c index 9ddc5b84..bd706dc8 100644 --- a/src/lib/dev.c +++ b/src/lib/dev.c @@ -1029,6 +1029,8 @@ int flow_set_add(struct flow_set * set, int fd) { int ret; + size_t sdus; + size_t i; if (set == NULL) return -EINVAL; @@ -1038,6 +1040,10 @@ int flow_set_add(struct flow_set * set, ret = shm_flow_set_add(ai.fqset, set->idx, ai.flows[fd].port_id); + sdus = shm_rbuff_queued(ai.flows[fd].rx_rb); + for (i = 0; i < sdus; i++) + shm_flow_set_notify(ai.fqset, ai.flows[fd].port_id); + pthread_rwlock_unlock(&ai.flows_lock); pthread_rwlock_unlock(&ai.data_lock); -- cgit v1.2.3