Script 'mail_helper' called by obssrc
Hello community,

here is the log from the commit of package aws-c-io for openSUSE:Factory 
checked in at 2024-07-22 17:15:46
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Comparing /work/SRC/openSUSE:Factory/aws-c-io (Old)
 and      /work/SRC/openSUSE:Factory/.aws-c-io.new.17339 (New)
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++

Package is "aws-c-io"

Mon Jul 22 17:15:46 2024 rev:9 rq:1188593 version:0.14.12

Changes:
--------
--- /work/SRC/openSUSE:Factory/aws-c-io/aws-c-io.changes        2024-07-15 
19:49:36.516413484 +0200
+++ /work/SRC/openSUSE:Factory/.aws-c-io.new.17339/aws-c-io.changes     
2024-07-22 17:16:16.789148215 +0200
@@ -1,0 +2,11 @@
+Mon Jul 15 10:53:10 UTC 2024 - John Paul Adrian Glaubitz 
<adrian.glaub...@suse.com>
+
+- Update to version 0.14.12
+  * Mark the network interface API internal by @waahm7 in (#654)
+- from version 0.14.11
+  * Fix FreeBSD CI to install default python packages
+    by @TingDaoK in (#653)
+  * Socket option for binding to a network interface by name
+    by @waahm7 in (#647)
+
+-------------------------------------------------------------------

Old:
----
  v0.14.10.tar.gz

New:
----
  v0.14.12.tar.gz

++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++

Other differences:
------------------
++++++ aws-c-io.spec ++++++
--- /var/tmp/diff_new_pack.ymDkla/_old  2024-07-22 17:16:17.681184107 +0200
+++ /var/tmp/diff_new_pack.ymDkla/_new  2024-07-22 17:16:17.685184268 +0200
@@ -20,7 +20,7 @@
 %define library_version 1.0.0
 %define library_soversion 0unstable
 Name:           aws-c-io
-Version:        0.14.10
+Version:        0.14.12
 Release:        0
 Summary:        I/O and TLS package AWS SDK for C
 License:        Apache-2.0

++++++ v0.14.10.tar.gz -> v0.14.12.tar.gz ++++++
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/aws-c-io-0.14.10/.github/workflows/ci.yml 
new/aws-c-io-0.14.12/.github/workflows/ci.yml
--- old/aws-c-io-0.14.10/.github/workflows/ci.yml       2024-07-10 
18:58:47.000000000 +0200
+++ new/aws-c-io-0.14.12/.github/workflows/ci.yml       2024-07-13 
00:24:26.000000000 +0200
@@ -6,7 +6,7 @@
       - 'main'
 
 env:
-  BUILDER_VERSION: v0.9.57
+  BUILDER_VERSION: v0.9.61
   BUILDER_SOURCE: releases
   BUILDER_HOST: https://d19elf31gohf1l.cloudfront.net
   PACKAGE_NAME: aws-c-io
@@ -170,7 +170,7 @@
           cpu_count: 4
           shell: bash
           run: |
-            sudo pkg install -y python3 py39-urllib3
+            sudo pkg install -y python3 net/py-urllib3
             python3 -c "from urllib.request import urlretrieve; 
urlretrieve('${{ env.BUILDER_HOST }}/${{ env.BUILDER_SOURCE }}/${{ 
env.BUILDER_VERSION }}/builder.pyz?run=${{ env.RUN }}', 'builder')"
             chmod a+x builder
             ./builder build -p ${{ env.PACKAGE_NAME }}
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/aws-c-io-0.14.10/include/aws/io/socket.h 
new/aws-c-io-0.14.12/include/aws/io/socket.h
--- old/aws-c-io-0.14.10/include/aws/io/socket.h        2024-07-10 
18:58:47.000000000 +0200
+++ new/aws-c-io-0.14.12/include/aws/io/socket.h        2024-07-13 
00:24:26.000000000 +0200
@@ -30,6 +30,8 @@
     AWS_SOCKET_DGRAM,
 };
 
+#define AWS_NETWORK_INTERFACE_NAME_MAX 16
+
 struct aws_socket_options {
     enum aws_socket_type type;
     enum aws_socket_domain domain;
@@ -43,6 +45,17 @@
      * lost. If zero OS defaults are used. On Windows, this option is 
meaningless until Windows 10 1703.*/
     uint16_t keep_alive_max_failed_probes;
     bool keepalive;
+
+    /**
+     * THIS IS AN EXPERIMENTAL AND UNSTABLE API
+     * (Optional)
+     * This property is used to bind the socket to a particular network 
interface by name, such as eth0 and ens32.
+     * If this is empty, the socket will not be bound to any interface and 
will use OS defaults. If the provided name
+     * is invalid, `aws_socket_init()` will error out with 
AWS_IO_SOCKET_INVALID_OPTIONS. This option is only
+     * supported on Linux, macOS, and platforms that have either 
SO_BINDTODEVICE or IP_BOUND_IF. It is not supported on
+     * Windows. `AWS_ERROR_PLATFORM_NOT_SUPPORTED` will be raised on 
unsupported platforms.
+     */
+    char network_interface_name[AWS_NETWORK_INTERFACE_NAME_MAX];
 };
 
 struct aws_socket;
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/aws-c-io-0.14.10/source/posix/socket.c 
new/aws-c-io-0.14.12/source/posix/socket.c
--- old/aws-c-io-0.14.10/source/posix/socket.c  2024-07-10 18:58:47.000000000 
+0200
+++ new/aws-c-io-0.14.12/source/posix/socket.c  2024-07-13 00:24:26.000000000 
+0200
@@ -18,7 +18,7 @@
 #include <aws/io/io.h>
 #include <errno.h>
 #include <fcntl.h>
-#include <inttypes.h>
+#include <net/if.h>
 #include <netinet/tcp.h>
 #include <sys/socket.h>
 #include <sys/types.h>
@@ -1254,7 +1254,95 @@
             socket->io_handle.data.fd,
             errno_value);
     }
-
+    size_t network_interface_length = 0;
+    if (aws_secure_strlen(options->network_interface_name, 
AWS_NETWORK_INTERFACE_NAME_MAX, &network_interface_length)) {
+        AWS_LOGF_ERROR(
+            AWS_LS_IO_SOCKET,
+            "id=%p fd=%d: network_interface_name max length must be %d length 
and NULL terminated",
+            (void *)socket,
+            socket->io_handle.data.fd,
+            AWS_NETWORK_INTERFACE_NAME_MAX);
+        return aws_raise_error(AWS_IO_SOCKET_INVALID_OPTIONS);
+    }
+    if (network_interface_length != 0) {
+#if defined(SO_BINDTODEVICE)
+        if (setsockopt(
+                socket->io_handle.data.fd,
+                SOL_SOCKET,
+                SO_BINDTODEVICE,
+                options->network_interface_name,
+                network_interface_length)) {
+            int errno_value = errno; /* Always cache errno before potential 
side-effect */
+            AWS_LOGF_ERROR(
+                AWS_LS_IO_SOCKET,
+                "id=%p fd=%d: setsockopt() with SO_BINDTODEVICE for \"%s\" 
failed with errno %d.",
+                (void *)socket,
+                socket->io_handle.data.fd,
+                options->network_interface_name,
+                errno_value);
+            return aws_raise_error(AWS_IO_SOCKET_INVALID_OPTIONS);
+        }
+#elif defined(IP_BOUND_IF)
+        /*
+         * If SO_BINDTODEVICE is not supported, the alternative is IP_BOUND_IF 
which requires an index instead
+         * of a name. We are not using this everywhere because this requires 2 
system calls instead of 1, and is
+         * dependent upon the type of sockets, which doesn't support 
AWS_SOCKET_LOCAL. As a future optimization, we can
+         * look into caching the result of if_nametoindex.
+         */
+        uint network_interface_index = 
if_nametoindex(options->network_interface_name);
+        if (network_interface_index == 0) {
+            int errno_value = errno; /* Always cache errno before potential 
side-effect */
+            AWS_LOGF_ERROR(
+                AWS_LS_IO_SOCKET,
+                "id=%p fd=%d: network_interface_name \"%s\" not found. 
if_nametoindex() failed with errno %d.",
+                (void *)socket,
+                socket->io_handle.data.fd,
+                options->network_interface_name,
+                errno_value);
+            return aws_raise_error(AWS_IO_SOCKET_INVALID_OPTIONS);
+        }
+        if (options->domain == AWS_SOCKET_IPV6) {
+            if (setsockopt(
+                    socket->io_handle.data.fd,
+                    IPPROTO_IPV6,
+                    IPV6_BOUND_IF,
+                    &network_interface_index,
+                    sizeof(network_interface_index))) {
+                int errno_value = errno; /* Always cache errno before 
potential side-effect */
+                AWS_LOGF_ERROR(
+                    AWS_LS_IO_SOCKET,
+                    "id=%p fd=%d: setsockopt() with IPV6_BOUND_IF for \"%s\" 
failed with errno %d.",
+                    (void *)socket,
+                    socket->io_handle.data.fd,
+                    options->network_interface_name,
+                    errno_value);
+                return aws_raise_error(AWS_IO_SOCKET_INVALID_OPTIONS);
+            }
+        } else if (setsockopt(
+                       socket->io_handle.data.fd,
+                       IPPROTO_IP,
+                       IP_BOUND_IF,
+                       &network_interface_index,
+                       sizeof(network_interface_index))) {
+            int errno_value = errno; /* Always cache errno before potential 
side-effect */
+            AWS_LOGF_ERROR(
+                AWS_LS_IO_SOCKET,
+                "id=%p fd=%d: setsockopt() with IP_BOUND_IF for \"%s\" failed 
with errno %d.",
+                (void *)socket,
+                socket->io_handle.data.fd,
+                options->network_interface_name,
+                errno_value);
+            return aws_raise_error(AWS_IO_SOCKET_INVALID_OPTIONS);
+        }
+#else
+        AWS_LOGF_ERROR(
+            AWS_LS_IO_SOCKET,
+            "id=%p fd=%d: network_interface_name is not supported on this 
platform.",
+            (void *)socket,
+            socket->io_handle.data.fd);
+        return aws_raise_error(AWS_ERROR_PLATFORM_NOT_SUPPORTED);
+#endif
+    }
     if (options->type == AWS_SOCKET_STREAM && options->domain != 
AWS_SOCKET_LOCAL) {
         if (socket->options.keepalive) {
             int keep_alive = 1;
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/aws-c-io-0.14.10/source/windows/iocp/socket.c 
new/aws-c-io-0.14.12/source/windows/iocp/socket.c
--- old/aws-c-io-0.14.10/source/windows/iocp/socket.c   2024-07-10 
18:58:47.000000000 +0200
+++ new/aws-c-io-0.14.12/source/windows/iocp/socket.c   2024-07-13 
00:24:26.000000000 +0200
@@ -2333,6 +2333,25 @@
 #endif
     }
 
+    size_t network_interface_length = 0;
+    if (aws_secure_strlen(options->network_interface_name, 
AWS_NETWORK_INTERFACE_NAME_MAX, &network_interface_length)) {
+        AWS_LOGF_ERROR(
+            AWS_LS_IO_SOCKET,
+            "id=%p fd=%d: network_interface_name max length must be %d length 
and NULL terminated",
+            (void *)socket,
+            socket->io_handle.data.fd,
+            AWS_NETWORK_INTERFACE_NAME_MAX);
+        return aws_raise_error(AWS_IO_SOCKET_INVALID_OPTIONS);
+    }
+    if (network_interface_length != 0) {
+        AWS_LOGF_ERROR(
+            AWS_LS_IO_SOCKET,
+            "id=%p fd=%d: network_interface_name is not supported on this 
platform.",
+            (void *)socket,
+            socket->io_handle.data.fd);
+        return aws_raise_error(AWS_ERROR_PLATFORM_NOT_SUPPORTED);
+    }
+
     return AWS_OP_SUCCESS;
 }
 
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/aws-c-io-0.14.10/tests/CMakeLists.txt 
new/aws-c-io-0.14.12/tests/CMakeLists.txt
--- old/aws-c-io-0.14.10/tests/CMakeLists.txt   2024-07-10 18:58:47.000000000 
+0200
+++ new/aws-c-io-0.14.12/tests/CMakeLists.txt   2024-07-13 00:24:26.000000000 
+0200
@@ -56,6 +56,8 @@
 add_test_case(local_socket_communication)
 add_net_test_case(tcp_socket_communication)
 add_net_test_case(udp_socket_communication)
+add_net_test_case(test_socket_with_bind_to_interface)
+add_net_test_case(test_socket_with_bind_to_invalid_interface)
 add_test_case(udp_bind_connect_communication)
 add_net_test_case(connect_timeout)
 add_net_test_case(connect_timeout_cancelation)
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/aws-c-io-0.14.10/tests/socket_handler_test.c 
new/aws-c-io-0.14.12/tests/socket_handler_test.c
--- old/aws-c-io-0.14.10/tests/socket_handler_test.c    2024-07-10 
18:58:47.000000000 +0200
+++ new/aws-c-io-0.14.12/tests/socket_handler_test.c    2024-07-13 
00:24:26.000000000 +0200
@@ -837,7 +837,7 @@
 
     struct local_server_tester local_server_tester;
     if (s_local_server_tester_init(allocator, &local_server_tester, 
&server_args, &c_tester, socket_domain, false)) {
-        /* Skip test if server can't bind to address (e.g. Gith9ub's ubuntu 
runners don't allow IPv6) */
+        /* Skip test if server can't bind to address (e.g. Codebuild's ubuntu 
runners don't allow IPv6) */
         if (aws_last_error() == AWS_IO_SOCKET_INVALID_ADDRESS) {
             return AWS_OP_SKIP;
         } else {
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/aws-c-io-0.14.10/tests/socket_test.c 
new/aws-c-io-0.14.12/tests/socket_test.c
--- old/aws-c-io-0.14.10/tests/socket_test.c    2024-07-10 18:58:47.000000000 
+0200
+++ new/aws-c-io-0.14.12/tests/socket_test.c    2024-07-13 00:24:26.000000000 
+0200
@@ -432,6 +432,70 @@
 
 AWS_TEST_CASE(tcp_socket_communication, s_test_tcp_socket_communication)
 
+static int s_test_socket_with_bind_to_interface(struct aws_allocator 
*allocator, void *ctx) {
+    (void)ctx;
+    struct aws_socket_options options;
+    AWS_ZERO_STRUCT(options);
+    options.connect_timeout_ms = 3000;
+    options.keepalive = true;
+    options.keep_alive_interval_sec = 1000;
+    options.keep_alive_timeout_sec = 60000;
+    options.type = AWS_SOCKET_STREAM;
+    options.domain = AWS_SOCKET_IPV4;
+#if defined(AWS_OS_APPLE)
+    strncpy(options.network_interface_name, "lo0", 
AWS_NETWORK_INTERFACE_NAME_MAX);
+#else
+    strncpy(options.network_interface_name, "lo", 
AWS_NETWORK_INTERFACE_NAME_MAX);
+#endif
+    struct aws_socket_endpoint endpoint = {.address = "127.0.0.1", .port = 
8127};
+    if (s_test_socket(allocator, &options, &endpoint)) {
+#if !defined(AWS_OS_APPLE) && !defined(AWS_OS_LINUX)
+        if (aws_last_error() == AWS_ERROR_PLATFORM_NOT_SUPPORTED) {
+            return AWS_OP_SKIP;
+        }
+#endif
+        ASSERT_TRUE(false, "s_test_socket() failed");
+    }
+    options.type = AWS_SOCKET_DGRAM;
+    options.domain = AWS_SOCKET_IPV4;
+    ASSERT_SUCCESS(s_test_socket(allocator, &options, &endpoint));
+
+    struct aws_socket_endpoint endpoint_ipv6 = {.address = "::1", .port = 
1024};
+    options.type = AWS_SOCKET_STREAM;
+    options.domain = AWS_SOCKET_IPV6;
+    if (s_test_socket(allocator, &options, &endpoint_ipv6)) {
+        /* Skip test if server can't bind to address (e.g. Codebuild's ubuntu 
runners don't allow IPv6) */
+        if (aws_last_error() == AWS_IO_SOCKET_INVALID_ADDRESS) {
+            return AWS_OP_SKIP;
+        }
+        ASSERT_TRUE(false, "s_test_socket() failed");
+    }
+
+    return AWS_OP_SUCCESS;
+}
+AWS_TEST_CASE(test_socket_with_bind_to_interface, 
s_test_socket_with_bind_to_interface)
+
+static int s_test_socket_with_bind_to_invalid_interface(struct aws_allocator 
*allocator, void *ctx) {
+    (void)ctx;
+    struct aws_socket_options options;
+    AWS_ZERO_STRUCT(options);
+    options.connect_timeout_ms = 3000;
+    options.keepalive = true;
+    options.keep_alive_interval_sec = 1000;
+    options.keep_alive_timeout_sec = 60000;
+    options.type = AWS_SOCKET_STREAM;
+    options.domain = AWS_SOCKET_IPV4;
+    strncpy(options.network_interface_name, "invalid", 
AWS_NETWORK_INTERFACE_NAME_MAX);
+    struct aws_socket outgoing;
+#if defined(AWS_OS_APPLE) || defined(AWS_OS_LINUX)
+    ASSERT_ERROR(AWS_IO_SOCKET_INVALID_OPTIONS, aws_socket_init(&outgoing, 
allocator, &options));
+#else
+    ASSERT_ERROR(AWS_ERROR_PLATFORM_NOT_SUPPORTED, aws_socket_init(&outgoing, 
allocator, &options));
+#endif
+    return AWS_OP_SUCCESS;
+}
+AWS_TEST_CASE(test_socket_with_bind_to_invalid_interface, 
s_test_socket_with_bind_to_invalid_interface)
+
 #if defined(USE_VSOCK)
 static int s_test_vsock_loopback_socket_communication(struct aws_allocator 
*allocator, void *ctx) {
 /* Without vsock loopback it's difficult to test vsock functionality.

Reply via email to