summaryrefslogtreecommitdiff
path: root/nest
diff options
context:
space:
mode:
Diffstat (limited to 'nest')
-rw-r--r--nest/password.c15
-rw-r--r--nest/password.h3
-rw-r--r--nest/route.h12
-rw-r--r--nest/rt-fib.c19
-rw-r--r--nest/rt-table.c6
5 files changed, 44 insertions, 11 deletions
diff --git a/nest/password.c b/nest/password.c
index 21e42e0e..91aaa418 100644
--- a/nest/password.c
+++ b/nest/password.c
@@ -51,3 +51,18 @@ password_find_by_id(list *l, int id)
return NULL;
}
+struct password_item *
+password_find_by_value(list *l, char *pass, uint size)
+{
+ struct password_item *pi;
+
+ if (!l)
+ return NULL;
+
+ WALK_LIST(pi, *l)
+ if (password_verify(pi, pass, size) && (pi->accfrom <= now_real) && (now_real < pi->accto))
+ return pi;
+
+ return NULL;
+}
+
diff --git a/nest/password.h b/nest/password.h
index cd120d70..1d9de53c 100644
--- a/nest/password.h
+++ b/nest/password.h
@@ -11,8 +11,6 @@
#define PASSWORD_H
#include "lib/timer.h"
-#define MD5_AUTH_SIZE 16
-
struct password_item {
node n;
char *password;
@@ -24,6 +22,7 @@ extern struct password_item *last_password_item;
struct password_item *password_find(list *l, int first_fit);
struct password_item *password_find_by_id(list *l, int id);
+struct password_item *password_find_by_value(list *l, char *pass, uint size);
static inline int password_verify(struct password_item *p1, char *p2, uint size)
{
diff --git a/nest/route.h b/nest/route.h
index 6067526d..285fb372 100644
--- a/nest/route.h
+++ b/nest/route.h
@@ -75,6 +75,8 @@ void fib_check(struct fib *); /* Consistency check for debugging */
void fit_init(struct fib_iterator *, struct fib *); /* Internal functions, don't call */
struct fib_node *fit_get(struct fib *, struct fib_iterator *);
void fit_put(struct fib_iterator *, struct fib_node *);
+void fit_put_next(struct fib *f, struct fib_iterator *i, struct fib_node *n, uint hpos);
+
#define FIB_WALK(fib, z) do { \
struct fib_node *z, **ff = (fib)->hash_table; \
@@ -103,6 +105,11 @@ void fit_put(struct fib_iterator *, struct fib_node *);
#define FIB_ITERATE_PUT(it, z) fit_put(it, z)
+#define FIB_ITERATE_PUT_NEXT(it, fib, z) fit_put_next(fib, it, z, hpos)
+
+#define FIB_ITERATE_UNLINK(it, fib) fit_get(fib, it)
+
+
/*
* Master Routing Tables. Generally speaking, each of them contains a FIB
* with each entry pointing to a list of route entries representing routes
@@ -196,10 +203,9 @@ typedef struct rte {
union { /* Protocol-dependent data (metrics etc.) */
#ifdef CONFIG_RIP
struct {
- node garbage; /* List for garbage collection */
- byte metric; /* RIP metric */
+ struct iface *from; /* Incoming iface */
+ u8 metric; /* RIP metric */
u16 tag; /* External route tag */
- struct rip_entry *entry;
} rip;
#endif
#ifdef CONFIG_OSPF
diff --git a/nest/rt-fib.c b/nest/rt-fib.c
index aa5e2357..a73de1fd 100644
--- a/nest/rt-fib.c
+++ b/nest/rt-fib.c
@@ -430,6 +430,25 @@ fit_put(struct fib_iterator *i, struct fib_node *n)
i->prev = (struct fib_iterator *) n;
}
+void
+fit_put_next(struct fib *f, struct fib_iterator *i, struct fib_node *n, uint hpos)
+{
+ if (n = n->next)
+ goto found;
+
+ while (++hpos < f->hash_size)
+ if (n = f->hash_table[hpos])
+ goto found;
+
+ /* We are at the end */
+ i->prev = i->next = NULL;
+ i->node = NULL;
+ return;
+
+found:
+ fit_put(i, n);
+}
+
#ifdef DEBUGGING
/**
diff --git a/nest/rt-table.c b/nest/rt-table.c
index 9e2c4e0d..b39f2a69 100644
--- a/nest/rt-table.c
+++ b/nest/rt-table.c
@@ -888,12 +888,6 @@ rte_recalculate(struct announce_hook *ah, net *net, rte *new, struct rte_src *sr
}
rte_free_quick(new);
-#ifdef CONFIG_RIP
- /* lastmod is used internally by RIP as the last time
- when the route was received. */
- if (src->proto->proto == &proto_rip)
- old->lastmod = now;
-#endif
return;
}
*k = old->next;