This is merely a historical archive of years 2008-2021, before the migration to mailman3.
A maintained and still updated list archive can be found at https://lists.osmocom.org/hyperkitty/list/gerrit-log@lists.osmocom.org/.
Arran Cudbard-bell gerrit-no-reply at lists.osmocom.orgReview at https://gerrit.osmocom.org/1194 Set SO_NOSIGPIPE on SCTP connections, for patforms which support it (macOS, FreeBSD etc...) Change-Id: If4f2a99b2baf143551a7122f40ed1f9088c5936c Signed-off-by: Arran Cudbard-Bell <a.cudbardb at freeradius.org> --- M src/stream.c 1 file changed, 17 insertions(+), 1 deletion(-) git pull ssh://gerrit.osmocom.org:29418/libosmo-netif refs/changes/94/1194/1 diff --git a/src/stream.c b/src/stream.c index fd02b74..7d40df2 100644 --- a/src/stream.c +++ b/src/stream.c @@ -26,6 +26,14 @@ #include <netinet/sctp.h> #endif +/* + * Platforms that don't have MSG_NOSIGNAL (which disables SIGPIPE) + * usually have SO_NOSIGPIPE (set via setsockopt). + */ +#ifndef MSG_NOSIGNAL +#define MSG_NOSIGNAL 0 +#endif + static int sctp_sock_activate_events(int fd) { #ifdef HAVE_LIBSCTP @@ -167,8 +175,16 @@ ofd->when &= ~BSC_FD_WRITE; LOGP(DLINP, LOGL_DEBUG, "connection done.\n"); cli->state = STREAM_CLI_STATE_CONNECTED; - if (cli->proto == IPPROTO_SCTP) + if (cli->proto == IPPROTO_SCTP) { +#ifdef SO_NOSIGPIPE + int val = 1; + + ret = setsockopt(ofd->fd, SOL_SOCKET, SO_NOSIGPIPE, (void*)&val, sizeof(val)); + if (ret < 0) + LOGP(DLINP, LOGL_DEBUG, "Failed setting SO_NOSIGPIPE: %s\n", strerror(errno)); +#endif sctp_sock_activate_events(ofd->fd); + } if (cli->connect_cb) cli->connect_cb(cli); break; -- To view, visit https://gerrit.osmocom.org/1194 To unsubscribe, visit https://gerrit.osmocom.org/settings Gerrit-MessageType: newchange Gerrit-Change-Id: If4f2a99b2baf143551a7122f40ed1f9088c5936c Gerrit-PatchSet: 1 Gerrit-Project: libosmo-netif Gerrit-Branch: master Gerrit-Owner: Arran Cudbard-bell <a.cudbardb at freeradius.org>