diff options
Diffstat (limited to 'sysdep/unix')
-rw-r--r-- | sysdep/unix/krt.c | 4 | ||||
-rw-r--r-- | sysdep/unix/krt.h | 9 |
2 files changed, 12 insertions, 1 deletions
diff --git a/sysdep/unix/krt.c b/sysdep/unix/krt.c index 470368e2..84207251 100644 --- a/sysdep/unix/krt.c +++ b/sysdep/unix/krt.c @@ -677,7 +677,7 @@ krt_got_route(struct krt_proto *p, rte *e) if (!new) verdict = KRF_DELETE; - else if ((net->n.flags & KRF_SYNC_ERROR) || !krt_same_dest(e, new)) + else if (!bmap_test(&p->sync_map, new->id) || !krt_same_dest(e, new)) verdict = KRF_UPDATE; else verdict = KRF_SEEN; @@ -1094,6 +1094,7 @@ krt_start(struct proto *P) default: log(L_ERR "KRT: Tried to start with strange net type: %d", p->p.net_type); return PS_START; break; } + bmap_init(&p->sync_map, p->p.pool, 1024); add_tail(&krt_proto_list, &p->krt_node); #ifdef KRT_ALLOW_LEARN @@ -1133,6 +1134,7 @@ krt_shutdown(struct proto *P) krt_sys_shutdown(p); rem_node(&p->krt_node); + bmap_free(&p->sync_map); return PS_DOWN; } diff --git a/sysdep/unix/krt.h b/sysdep/unix/krt.h index 6ace2a86..c5b565f5 100644 --- a/sysdep/unix/krt.h +++ b/sysdep/unix/krt.h @@ -65,6 +65,7 @@ struct krt_proto { timer *scan_timer; #endif + struct bmap sync_map; /* Keeps track which exported routes were successfully written to kernel */ node krt_node; /* Node in krt_proto_list */ byte af; /* Kernel address family (AF_*) */ byte ready; /* Initial feed has been finished */ @@ -86,6 +87,14 @@ void kif_request_scan(void); void krt_got_route(struct krt_proto *p, struct rte *e); void krt_got_route_async(struct krt_proto *p, struct rte *e, int new); +static inline int +krt_get_sync_error(struct krt_proto *p, struct rte *e) +{ + return (p->p.proto_state == PS_UP) && + bmap_test(&p->p.main_channel->export_map, e->id) && + !bmap_test(&p->sync_map, e->id); +} + /* Values for rte->u.krt_sync.src */ #define KRT_SRC_UNKNOWN -1 /* Nobody knows */ #define KRT_SRC_BIRD 0 /* Our route (not passed in async mode) */ |