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/+/19918 ) Change subject: tests: Add test to showcase osmo_sock_init2 bug with AF_UNSPEC ...................................................................... tests: Add test to showcase osmo_sock_init2 bug with AF_UNSPEC The function is checking for IP version matching between local and remote addresses even if only one is needed based on flags. For example, if user only desired to bind, the remote address should not be used nor checked. Bug was introduced here: 2c962f5de1eeea119cfac7d9d92db31c570353b9 Change-Id: I87afd1db9bd017426abcc959fa515d15784cdf1c --- M tests/socket/socket_test.c M tests/socket/socket_test.err M tests/socket/socket_test.ok 3 files changed, 8 insertions(+), 0 deletions(-) git pull ssh://gerrit.osmocom.org:29418/libosmocore refs/changes/18/19918/1 diff --git a/tests/socket/socket_test.c b/tests/socket/socket_test.c index a2e103c..5cf20b7 100644 --- a/tests/socket/socket_test.c +++ b/tests/socket/socket_test.c @@ -24,6 +24,7 @@ #include <string.h> #include <fcntl.h> #include <inttypes.h> +#include <errno.h> #include <sys/socket.h> #include <arpa/inet.h> @@ -143,6 +144,11 @@ OSMO_SOCK_F_BIND|OSMO_SOCK_F_CONNECT); OSMO_ASSERT(fd >= 0); + printf("Checking osmo_sock_init2(AF_UNSPEC) BIND on IPv4\n"); + fd = osmo_sock_init2(AF_UNSPEC, SOCK_DGRAM, IPPROTO_UDP, "127.0.0.1", 0, NULL, 0, + OSMO_SOCK_F_BIND); + OSMO_ASSERT(fd == -ENODEV); /* BUG! */ + talloc_free(name); return 0; diff --git a/tests/socket/socket_test.err b/tests/socket/socket_test.err index 0f0f8da..37504e7 100644 --- a/tests/socket/socket_test.err +++ b/tests/socket/socket_test.err @@ -2,3 +2,4 @@ invalid: you have to specify either BIND or CONNECT flags Unable to find a common protocol (IPv4 or IPv6) for local host: 127.0.0.1 and remote host: ::1. Unable to find a common protocol (IPv4 or IPv6) for local host: ::1 and remote host: 127.0.0.1. +Unable to find a common protocol (IPv4 or IPv6) for local host: 127.0.0.1 and remote host: (null). diff --git a/tests/socket/socket_test.ok b/tests/socket/socket_test.ok index 4265be8..696e356 100644 --- a/tests/socket/socket_test.ok +++ b/tests/socket/socket_test.ok @@ -9,3 +9,4 @@ Checking osmo_sock_init2(AF_UNSPEC) must fail on mixed IPv6 & IPv4 Checking osmo_sock_init2(AF_UNSPEC) BIND + CONNECT on IPv4 Checking osmo_sock_init2(AF_UNSPEC) BIND + CONNECT on IPv6 +Checking osmo_sock_init2(AF_UNSPEC) BIND on IPv4 -- To view, visit https://gerrit.osmocom.org/c/libosmocore/+/19918 To unsubscribe, or for help writing mail filters, visit https://gerrit.osmocom.org/settings Gerrit-Project: libosmocore Gerrit-Branch: master Gerrit-Change-Id: I87afd1db9bd017426abcc959fa515d15784cdf1c Gerrit-Change-Number: 19918 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/20200831/0a6a95c6/attachment.htm>