Hello Alexander, nice catch!

I have put it in our internal issues and the team will fix it for future versions of BIRD.

Thanks a lot for the find and have a good rest of the week,
David

David Petera (he/him) | BIRD Tech Support | CZ.NIC, z.s.p.o.

On 9/30/25 21:41, Alexander Zubkov via Bird-users wrote:
Hi all!

I've accidentally found a "mistake" in lib/timer.c (master branch). Mistake in quotes, because it is rather a configuration mistake, as I found later. There is a function prototype definition inside "#ifdef USE_PTHREADS", which is then used outside of it, but in "#ifdef CONFIG_BFD":

#ifdef USE_PTHREADS
...
void wakeup_kick_current(void);
#else
...
#endif
...
void
tm_set(timer *t, btime when)
{
...
#ifdef CONFIG_BFD
  /* Hack to notify BFD loops */
  if ((loop != &main_timeloop) && (t->index == 1))
    wakeup_kick_current();
#endif
}

So in case USE_PTHREADS is not defined and CONFIG_BFD is defined, the compilation would fail with implicit function declaration error. It could be reproduced with:

./configure --disable-pthreads --with-protocols=bfd
make
...
lib/timer.c: In function 'tm_set':
lib/timer.c:165:5: error: implicit declaration of function 'wakeup_kick_current' [-Wimplicit-function-declaration]
  165 |     wakeup_kick_current();
      |     ^~~~~~~~~~~~~~~~~~~
make: *** [Makefile:115: obj/lib/timer.o] Error 1

But even moving that function prototype out of "#ifdef USE_PTHREADS" does not help. It then fails on proto/bfd/io.c using undefined references, because it uses pthreads unconditionally.

I think it would be better to fail on "configure" stage with a meaningful message that bfd requires pthreads. I see there is now only a workaround to exclude bfd from the default set of protocols if pthreads is not enabled. I've made some patch that shows an error if bfd is enabled and pthreads support is disabled.

Regards,
Alexander Zubkov
  • bird & pthreads Alexander Zubkov via Bird-users
    • Re: bird & pthreads David Petera via Bird-users

Reply via email to