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/.
pespin gerrit-no-reply at lists.osmocom.orgpespin has uploaded this change for review. ( https://gerrit.osmocom.org/c/libosmocore/+/15818 ) Change subject: socket: Remove unneeded condition check in osmo_sock_init2_multiaddr() ...................................................................... socket: Remove unneeded condition check in osmo_sock_init2_multiaddr() Since we return error at the start of the function if proto != IPPROTO_SCTP, it makes no sense to check for proto != IPPROTO_UDP later on. Fixes: CID#205088 Change-Id: Ibba7eacaa9debb77d536d47dc85170c5ee79e479 --- M src/socket.c 1 file changed, 15 insertions(+), 15 deletions(-) git pull ssh://gerrit.osmocom.org:29418/libosmocore refs/changes/18/15818/1 diff --git a/src/socket.c b/src/socket.c index 542c76e..4752881 100644 --- a/src/socket.c +++ b/src/socket.c @@ -467,21 +467,21 @@ return sfd; } - if (proto != IPPROTO_UDP || flags & OSMO_SOCK_F_UDP_REUSEADDR) { - rc = setsockopt(sfd, SOL_SOCKET, SO_REUSEADDR, - &on, sizeof(on)); - if (rc < 0) { - multiaddr_snprintf(strbuf, sizeof(strbuf), local_hosts, local_hosts_cnt); - LOGP(DLGLOBAL, LOGL_ERROR, - "cannot setsockopt socket:" - " %s:%u: %s\n", - strbuf, local_port, - strerror(errno)); - for (i = 0; i < local_hosts_cnt; i++) - freeaddrinfo(result[i]); - close(sfd); - return rc; - } + /* Since so far we only allow IPPROTO_SCTP in this function, + no need to check below for "proto != IPPROTO_UDP || flags & OSMO_SOCK_F_UDP_REUSEADDR" */ + rc = setsockopt(sfd, SOL_SOCKET, SO_REUSEADDR, + &on, sizeof(on)); + if (rc < 0) { + multiaddr_snprintf(strbuf, sizeof(strbuf), local_hosts, local_hosts_cnt); + LOGP(DLGLOBAL, LOGL_ERROR, + "cannot setsockopt socket:" + " %s:%u: %s\n", + strbuf, local_port, + strerror(errno)); + for (i = 0; i < local_hosts_cnt; i++) + freeaddrinfo(result[i]); + close(sfd); + return rc; } /* Build array of addresses taking first of same family for each host. -- To view, visit https://gerrit.osmocom.org/c/libosmocore/+/15818 To unsubscribe, or for help writing mail filters, visit https://gerrit.osmocom.org/settings Gerrit-Project: libosmocore Gerrit-Branch: master Gerrit-Change-Id: Ibba7eacaa9debb77d536d47dc85170c5ee79e479 Gerrit-Change-Number: 15818 Gerrit-PatchSet: 1 Gerrit-Owner: pespin <pespin at sysmocom.de> Gerrit-MessageType: newchange -------------- next part -------------- An HTML attachment was scrubbed... URL: <http://lists.osmocom.org/pipermail/gerrit-log/attachments/20191021/d6e76aba/attachment.htm>