HomeFreeBSD

net/socketbind: unbreak the library

Description

net/socketbind: unbreak the library

The code has multiple issues making it unusable with modern FreeBSD:

  • it uses long gone ascii2addr() function removed in 2007;
  • it passes hardcoded "/usr/lib/libc.so" path to dlopen(), but now it is plain text hint file;
  • this IPv4-only code neglects to check passed domain for PF_INET messing with sockets in other domains (like PF_INET6, PF_LOCAL).

Still, it is very useful while dealing with software like Nagios
that does not support binding to specific IPv4 address
for outgoing connections. The library solves the problem with single line
in /etc/rc.conf:

nagios_env="LD_PRELOAD=/usr/local/lib/libsocketbind.so.1 BINDTO=192.168.6.1"

This changes unbreaks the library making it usable again.

Details

Provenance
eugen_grosbein.netAuthored on Oct 5 2023, 1:05 PM
Parents
R11:3d9993d8ac78: audio/py-pyradio: Update to 0.9.2.15
Branches
Unknown
Tags
Unknown