diff options
author | Sander Vrijders <[email protected]> | 2017-09-21 14:26:51 +0200 |
---|---|---|
committer | Sander Vrijders <[email protected]> | 2017-09-21 16:55:31 +0200 |
commit | f6071ecf0cd3768eaed9a847f676433c120ea89e (patch) | |
tree | 21f2738c9f0130653ae4253b374f34061d119399 /src/ipcpd/normal/pol/simple_pff.c | |
parent | 6b6f82c8a58b2edbd029909be2ba1057c00cd6ed (diff) | |
download | ouroboros-f6071ecf0cd3768eaed9a847f676433c120ea89e.tar.gz ouroboros-f6071ecf0cd3768eaed9a847f676433c120ea89e.zip |
ipcpd: normal: Add alternate hop PFF
This adds a PFF that returns an alternate hop as next hop in case the
hop that would have been returned is down.
Diffstat (limited to 'src/ipcpd/normal/pol/simple_pff.c')
-rw-r--r-- | src/ipcpd/normal/pol/simple_pff.c | 14 |
1 files changed, 7 insertions, 7 deletions
diff --git a/src/ipcpd/normal/pol/simple_pff.c b/src/ipcpd/normal/pol/simple_pff.c index 28f7aa2e..7af4663c 100644 --- a/src/ipcpd/normal/pol/simple_pff.c +++ b/src/ipcpd/normal/pol/simple_pff.c @@ -109,7 +109,7 @@ int simple_pff_add(struct pff_i * pff_i, *val = fd[0]; - if (htable_insert(pff_i->table, addr, val)) { + if (htable_insert(pff_i->table, addr, val, 1)) { free(val); return -1; } @@ -137,7 +137,7 @@ int simple_pff_update(struct pff_i * pff_i, return -1; } - if (htable_insert(pff_i->table, addr, val)) { + if (htable_insert(pff_i->table, addr, val, 1)) { free(val); return -1; } @@ -166,16 +166,16 @@ void simple_pff_flush(struct pff_i * pff_i) int simple_pff_nhop(struct pff_i * pff_i, uint64_t addr) { - int * j; - int fd = -1; + void * j; + size_t len; + int fd = -1; assert(pff_i); pthread_rwlock_rdlock(&pff_i->lock); - j = (int *) htable_lookup(pff_i->table, addr); - if (j != NULL) - fd = *j; + if (!htable_lookup(pff_i->table, addr, &j, &len)) + fd = *((int *) j); pthread_rwlock_unlock(&pff_i->lock); |