From 493d45d95076ea1f375346942a1ce4e21dcc55e6 Mon Sep 17 00:00:00 2001 From: Maria Jan Matejka Date: Tue, 7 Dec 2021 16:59:44 +0000 Subject: Fixed build errors for OpenBSD --- sysdep/unix/alloc.c | 8 ++++++++ sysdep/unix/krt.c | 13 +++++++------ 2 files changed, 15 insertions(+), 6 deletions(-) (limited to 'sysdep/unix') diff --git a/sysdep/unix/alloc.c b/sysdep/unix/alloc.c index 81cd19b4..24384d0e 100644 --- a/sysdep/unix/alloc.c +++ b/sysdep/unix/alloc.c @@ -70,10 +70,14 @@ alloc_page(void) else #endif { +#ifdef HAVE_ALIGNED_ALLOC void *ret = aligned_alloc(page_size, page_size); if (!ret) bug("aligned_alloc(%lu) failed", page_size); return ret; +#else + bug("BIRD should have already died on fatal error."); +#endif } } @@ -214,7 +218,11 @@ void resource_sys_init(void) return; } +#ifdef HAVE_ALIGNED_ALLOC log(L_WARN "Got strange memory page size (%lu), using the aligned allocator instead", page_size); +#else + die("Got strange memory page size (%lu) and aligned_alloc is not available", page_size); +#endif /* Too big or strange page, use the aligned allocator instead */ page_size = 4096; diff --git a/sysdep/unix/krt.c b/sysdep/unix/krt.c index c0f2e930..0cb86213 100644 --- a/sysdep/unix/krt.c +++ b/sysdep/unix/krt.c @@ -681,7 +681,11 @@ static int krt_preexport(struct channel *c, rte *e) { if (e->src->owner == &c->proto->sources) +#ifdef CONFIG_SINGLE_ROUTE + return 1; /* Passing the route directly for rt_notify() to ignore */ +#else return -1; +#endif if (!krt_capable(e)) return -1; @@ -700,13 +704,10 @@ krt_rt_notify(struct proto *P, struct channel *ch UNUSED, const net_addr *net, #ifdef CONFIG_SINGLE_ROUTE /* - * Implicit withdraw - when the imported kernel route becomes the best one, - * we know that the previous one exported to the kernel was already removed, - * but if we processed the update as usual, we would send withdraw to the - * kernel, which would remove the new imported route instead. + * When the imported kernel route becomes the best one, we get it directly and + * we simply know that it is already there. Nothing to do. */ - rte *best = net->routes; - if (!new && best && (best->attrs->src->proto == P)) + if (new->src->owner == &P->sources) return; #endif -- cgit v1.2.3