pim6sd icon indicating copy to clipboard operation
pim6sd copied to clipboard

Code cleanup, test on musl libc using Alpine or Void Linux

Open troglobit opened this issue 5 years ago • 1 comments

@lemmi reports on IRC there are several old anachronisms in the code base (c.f. pimd which already has all this cleaned up).

Here's a build sample from Void Linux

Making all in include
make[1]: Entering directory '/builddir/pim6sd-master/include'
make  all-am
make[2]: Entering directory '/builddir/pim6sd-master/include'
make[2]: Nothing to be done for 'all-am'.
make[2]: Leaving directory '/builddir/pim6sd-master/include'
make[1]: Leaving directory '/builddir/pim6sd-master/include'
Making all in src
make[1]: Entering directory '/builddir/pim6sd-master/src'
make  all-am
make[2]: Entering directory '/builddir/pim6sd-master/src'
  CCLD     pim6sd
/usr/bin/ld: pim6sd-mld6.o: in function `send_mld6':
mld6.c:(.text+0xba4): undefined reference to `inet6_option_init'
/usr/bin/ld: mld6.c:(.text+0xbc6): undefined reference to `inet6_option_append'
/usr/bin/ld: mld6.c:(.text+0xca0): undefined reference to `inet6_option_space'
/usr/bin/ld: pim6sd-mld6v2.o: in function `send_mld6v2':
mld6v2.c:(.text+0x618): undefined reference to `inet6_option_space'
/usr/bin/ld: mld6v2.c:(.text+0x6d3): undefined reference to `inet6_option_init'
/usr/bin/ld: mld6v2.c:(.text+0x6f5): undefined reference to `inet6_option_append'
collect2: error: ld returned 1 exit status
make[2]: *** [Makefile:455: pim6sd] Error 1
make[2]: Leaving directory '/builddir/pim6sd-master/src'
make[1]: *** [Makefile:369: all] Error 2
make[1]: Leaving directory '/builddir/pim6sd-master/src'
make: *** [Makefile:396: all-recursive] Error 1
=> ERROR: pim6sd-2.1.0_1: do_build: '${make_cmd} ${makejobs} ${make_build_args} ${make_build_target}' exited with 2
=> ERROR:   in do_build() at common/build-style/gnu-configure.sh:13

troglobit avatar Feb 25 '20 21:02 troglobit

I already mentioned it in the cleanup #27, but to clarify a couple bits here:

The log above still shows what happens, but it kind of hides the actual issue. Because RFC 3542 is not available, an older implementation using RFC 2292 is selected, which is also not available and even deprecated by now. So that code path should be avoided.

There are two solutions to this. A custom compatibility implementation could be written that implements the needed inet6_opt_* functions, or rewrite the code such that it assembles the packets more or less directly.

  • https://github.com/troglobit/pim6sd/blob/master/src/mld6.c#L536-L543
  • https://github.com/troglobit/pim6sd/blob/master/src/mld6.c#L587-L609
  • https://github.com/troglobit/pim6sd/blob/master/src/mld6v2.c#L247-L255
  • https://github.com/troglobit/pim6sd/blob/master/src/mld6v2.c#L296-L316

lemmi avatar Dec 13 '20 12:12 lemmi