diff options
author | Jan Moskyto Matejka <mq@ucw.cz> | 2016-05-10 14:30:49 +0200 |
---|---|---|
committer | Jan Moskyto Matejka <mq@ucw.cz> | 2016-05-10 14:30:49 +0200 |
commit | 0c6dfe52369a59d7f3da8ee6bc7c505e3da5c064 (patch) | |
tree | 264aa0aa4e9393491d74d473181faab4ae288cb9 /nest | |
parent | 7a7ac656829223713f9e6bcef63d2b5a5efce7d2 (diff) | |
parent | 92912f063a94bd7c743a25628ca2073380e09ef4 (diff) |
Merge branch 'int-new' into int-new-merged
Diffstat (limited to 'nest')
-rw-r--r-- | nest/Makefile | 10 | ||||
-rw-r--r-- | nest/password.h | 2 | ||||
-rw-r--r-- | nest/protocol.h | 4 | ||||
-rw-r--r-- | nest/route.h | 4 | ||||
-rw-r--r-- | nest/rt-dev.c | 15 | ||||
-rw-r--r-- | nest/rt-table.c | 14 |
6 files changed, 20 insertions, 29 deletions
diff --git a/nest/Makefile b/nest/Makefile index 478a82b7..6f0f9a08 100644 --- a/nest/Makefile +++ b/nest/Makefile @@ -1,6 +1,4 @@ -source=rt-table.c rt-fib.c rt-attr.c proto.c iface.c rt-dev.c password.c cli.c locks.c cmds.c neighbor.c \ - a-path.c a-set.c -root-rel=../ -dir-name=nest - -include ../Rules +src := a-path.c a-set.c cli.c cmds.c iface.c locks.c neighbor.c password.c proto.c rt-attr.c rt-dev.c rt-fib.c rt-table.c +obj := $(src-o-files) +$(all-daemon) +$(cf-local) diff --git a/nest/password.h b/nest/password.h index 1d9de53c..cbf80b99 100644 --- a/nest/password.h +++ b/nest/password.h @@ -9,7 +9,7 @@ #ifndef PASSWORD_H #define PASSWORD_H -#include "lib/timer.h" +#include "sysdep/unix/timer.h" struct password_item { node n; diff --git a/nest/protocol.h b/nest/protocol.h index 19f5d070..2d640504 100644 --- a/nest/protocol.h +++ b/nest/protocol.h @@ -12,7 +12,7 @@ #include "lib/lists.h" #include "lib/resource.h" #include "lib/event.h" -#include "lib/timer.h" +#include "sysdep/unix/timer.h" #include "nest/route.h" #include "conf/conf.h" @@ -271,7 +271,7 @@ proto_get_router_id(struct proto_config *pc) } /* Moved from route.h to avoid dependency conflicts */ -static inline void rte_update(struct proto *p, net *net, rte *new) { rte_update2(p->main_channel, net, new, p->main_source); } +static inline void rte_update(struct proto *p, net_addr *n, rte *new) { rte_update2(p->main_channel, n, new, p->main_source); } extern list proto_list; diff --git a/nest/route.h b/nest/route.h index 11b08ce5..39475309 100644 --- a/nest/route.h +++ b/nest/route.h @@ -11,7 +11,7 @@ #include "lib/lists.h" #include "lib/resource.h" -#include "lib/timer.h" +#include "sysdep/unix/timer.h" //#include "nest/protocol.h" struct ea_list; @@ -276,7 +276,7 @@ static inline net *net_get(rtable *tab, const net_addr *addr) { return (net *) f rte *rte_find(net *net, struct rte_src *src); rte *rte_get_temp(struct rta *); -void rte_update2(struct channel *c, net *net, rte *new, struct rte_src *src); +void rte_update2(struct channel *c, net_addr *n, rte *new, struct rte_src *src); /* rte_update() moved to protocol.h to avoid dependency conflicts */ void rte_discard(rtable *tab, rte *old); int rt_examine(rtable *t, net_addr *a, struct proto *p, struct filter *filter); diff --git a/nest/rt-dev.c b/nest/rt-dev.c index a996f4fc..098885b9 100644 --- a/nest/rt-dev.c +++ b/nest/rt-dev.c @@ -55,24 +55,15 @@ dev_ifa_notify(struct proto *P, uint flags, struct ifa *ad) if (flags & IF_CHANGE_DOWN) { - net *n; - DBG("dev_if_notify: %s:%I going down\n", ad->iface->name, ad->ip); - n = net_find(c->table, &ad->prefix); - if (!n) - { - DBG("dev_if_notify: device shutdown: prefix not found\n"); - return; - } /* Use iface ID as local source ID */ struct rte_src *src = rt_get_source(P, ad->iface->index); - rte_update2(c, n, NULL, src); + rte_update2(c, &ad->prefix, NULL, src); } else if (flags & IF_CHANGE_UP) { rta *a; - net *n; rte *e; DBG("dev_if_notify: %s:%I going up\n", ad->iface->name, ad->ip); @@ -90,11 +81,9 @@ dev_ifa_notify(struct proto *P, uint flags, struct ifa *ad) }; a = rta_lookup(&a0); - n = net_get(c->table, &ad->prefix); e = rte_get_temp(a); - e->net = n; e->pflags = 0; - rte_update2(c, n, e, src); + rte_update2(c, &ad->prefix, e, src); } } diff --git a/nest/rt-table.c b/nest/rt-table.c index 03ab3b92..9614d9ef 100644 --- a/nest/rt-table.c +++ b/nest/rt-table.c @@ -1267,19 +1267,23 @@ rte_unhide_dummy_routes(net *net, rte **dummy) */ void -rte_update2(struct channel *c, net *net, rte *new, struct rte_src *src) +rte_update2(struct channel *c, net_addr *n, rte *new, struct rte_src *src) { struct proto *p = c->proto; struct proto_stats *stats = &c->stats; struct filter *filter = c->in_filter; ea_list *tmpa = NULL; rte *dummy = NULL; + net *nn; ASSERT(c->channel_state == CS_UP); rte_update_lock(); if (new) { + nn = net_get(c->table, n); + + new->net = nn; new->sender = c; if (!new->pref) @@ -1333,7 +1337,7 @@ rte_update2(struct channel *c, net *net, rte *new, struct rte_src *src) { stats->imp_withdraws_received++; - if (!net || !src) + if (!(nn = net_find(c->table, n)) || !src) { stats->imp_withdraws_ignored++; rte_update_unlock(); @@ -1342,9 +1346,9 @@ rte_update2(struct channel *c, net *net, rte *new, struct rte_src *src) } recalc: - rte_hide_dummy_routes(net, &dummy); - rte_recalculate(c, net, new, src); - rte_unhide_dummy_routes(net, &dummy); + rte_hide_dummy_routes(nn, &dummy); + rte_recalculate(c, nn, new, src); + rte_unhide_dummy_routes(nn, &dummy); rte_update_unlock(); return; |