summaryrefslogtreecommitdiff
path: root/sysdep/unix
diff options
context:
space:
mode:
authorMaria Jan Matejka <mq@jmq.cz>2021-12-07 16:59:44 +0000
committerMaria Jan Matejka <mq@jmq.cz>2021-12-07 16:59:44 +0000
commit493d45d95076ea1f375346942a1ce4e21dcc55e6 (patch)
treecf1a9fe0166f88d63f36d0dff2261010127549db /sysdep/unix
parentf9e098c98af98096c8f47a054b57cff63d345074 (diff)
Fixed build errors for OpenBSD
Diffstat (limited to 'sysdep/unix')
-rw-r--r--sysdep/unix/alloc.c8
-rw-r--r--sysdep/unix/krt.c13
2 files changed, 15 insertions, 6 deletions
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