summaryrefslogtreecommitdiff
path: root/src/ipcpd/unicast/pol/alternate_pff.c
diff options
context:
space:
mode:
authorDimitri Staessens <[email protected]>2020-02-16 13:42:18 +0100
committerSander Vrijders <[email protected]>2020-02-16 18:32:21 +0100
commitaf8e7f78af9b13c2cf6615dc9eb6c52c51b2bc2c (patch)
treed9ff5e60b3bf8be2477b46ee98fc441c815cab63 /src/ipcpd/unicast/pol/alternate_pff.c
parent52e44a55d3b12819a79566067ff0361854da5002 (diff)
downloadouroboros-af8e7f78af9b13c2cf6615dc9eb6c52c51b2bc2c.tar.gz
ouroboros-af8e7f78af9b13c2cf6615dc9eb6c52c51b2bc2c.zip
Add equal-cost multipath routing policy
This adds an equal-cost multipath routing policy to Ouroboros, based on Nick Aerts' code. When selected, flows will send packets over all paths with equal cost (hop count). Path selection is round-robin. It does not yet take into account flows that are down. Signed-off-by: Dimitri Staessens <[email protected]> Signed-off-by: Sander Vrijders <[email protected]>
Diffstat (limited to 'src/ipcpd/unicast/pol/alternate_pff.c')
-rw-r--r--src/ipcpd/unicast/pol/alternate_pff.c12
1 files changed, 6 insertions, 6 deletions
diff --git a/src/ipcpd/unicast/pol/alternate_pff.c b/src/ipcpd/unicast/pol/alternate_pff.c
index 80c93f0e..f26bb047 100644
--- a/src/ipcpd/unicast/pol/alternate_pff.c
+++ b/src/ipcpd/unicast/pol/alternate_pff.c
@@ -27,13 +27,13 @@
#include <ouroboros/errno.h>
#include <ouroboros/list.h>
+#include "pft.h"
+#include "alternate_pff.h"
+
#include <string.h>
#include <assert.h>
#include <pthread.h>
-#include "pft.h"
-#include "alternate_pff.h"
-
struct nhop {
struct list_head next;
int fd;
@@ -336,7 +336,7 @@ int alternate_flow_state_change(struct pff_i * pff_i,
int fd,
bool up)
{
- struct list_head * pos = NULL;
+ struct list_head * p;
size_t len;
int * fds;
size_t i;
@@ -358,8 +358,8 @@ int alternate_flow_state_change(struct pff_i * pff_i,
}
}
- list_for_each(pos, &pff_i->addrs) {
- struct addr * e = list_entry(pos, struct addr, next);
+ list_for_each(p, &pff_i->addrs) {
+ struct addr * e = list_entry(p, struct addr, next);
if (pft_lookup(pff_i->pft, e->addr, &fds, &len)) {
pthread_rwlock_unlock(&pff_i->lock);
return -1;