summaryrefslogtreecommitdiff
path: root/src/ipcpd/unicast/pff/simple.c
diff options
context:
space:
mode:
authorDimitri Staessens <dimitri@ouroboros.rocks>2026-07-29 18:47:41 +0200
committerSander Vrijders <sander@ouroboros.rocks>2026-08-03 08:49:59 +0200
commitadd9f4a99cc358749b276157d9957c527fef4fe7 (patch)
tree25b968b54abd7d4f8a568c8d4dc62442356e70a6 /src/ipcpd/unicast/pff/simple.c
parent3388bd9e9b82df6d7fe79fa4eee7c22a3277624e (diff)
downloadouroboros-add9f4a99cc358749b276157d9957c527fef4fe7.tar.gz
ouroboros-add9f4a99cc358749b276157d9957c527fef4fe7.zip
ipcpd: Flush fd from pff after disconnect
The flow descriptors were not immediately removed from the routing tables when they were disconnected, so forwarding paths could still use the fd after the IPCP has deallocated the flow. Refactors the tests and adds some for the del_fd function. Signed-off-by: Dimitri Staessens <dimitri@ouroboros.rocks> Signed-off-by: Sander Vrijders <sander@ouroboros.rocks>
Diffstat (limited to 'src/ipcpd/unicast/pff/simple.c')
-rw-r--r--src/ipcpd/unicast/pff/simple.c20
1 files changed, 19 insertions, 1 deletions
diff --git a/src/ipcpd/unicast/pff/simple.c b/src/ipcpd/unicast/pff/simple.c
index 7befa42f..4347dcba 100644
--- a/src/ipcpd/unicast/pff/simple.c
+++ b/src/ipcpd/unicast/pff/simple.c
@@ -47,7 +47,7 @@ struct pff_ops simple_pff_ops = {
.del = simple_pff_del,
.flush = simple_pff_flush,
.nhop = simple_pff_nhop,
- .flow_state_change = NULL
+ .flow_state_change = simple_pff_flow_state_change
};
struct pff_i * simple_pff_create(void)
@@ -170,6 +170,24 @@ void simple_pff_flush(struct pff_i * pff_i)
pft_flush(pff_i->pft);
}
+int simple_pff_flow_state_change(struct pff_i * pff_i,
+ int fd,
+ bool up)
+{
+ assert(pff_i);
+
+ if (up)
+ return 0;
+
+ pthread_rwlock_wrlock(&pff_i->lock);
+
+ pft_del_fd(pff_i->pft, fd);
+
+ pthread_rwlock_unlock(&pff_i->lock);
+
+ return 0;
+}
+
int simple_pff_nhop(struct pff_i * pff_i,
uint64_t addr)
{