solanum-ircd / solanum

An IRCd for unified networks
https://solanum.chat/
GNU General Public License v2.0
225 stars 54 forks source link

Fix SCTP support on FreeBSD & NetBSD #358

Closed jailbird777 closed 2 years ago

jailbird777 commented 2 years ago

Unlike Linux, Solaris, and Illumos (and probably others), the 2 BSDs that still support SCTP didn't put SCTP into its own library; they put it into libc.

They, unlike Linux, don't set SOL_SCTP for us. The official method appears to be calling getprotobyname("sctp") & endprotoent(), with getprotobyname() returning a struct that has a p_proto entry. This all reads from /etc/protocols. However, SCTP is assigned 132 by IANA, so it's 132 everywhere, so I just set SOL_SCTP to 132 if it's not already set.

jailbird777 commented 2 years ago

LIBSCTP_LD didn't seem to be actually used at the top-level, so I removed it there.

If you don't like the SOL_SCTP hack, I can change the #ifndef to actually do the getprotoname() lookup.

aaronmdjones commented 2 years ago

(Context: from discussion on IRC; various system headers (and lksctp-tools) define IPPROTO_SCTP to the same value)