The branch, v4-18-test has been updated
       via  c2c111688c4 s3:ctdbd_conn: fix ctdbd_public_ip_foreach() for ipv6 
addresses
      from  a149a96eaf2 ctdb-server: Drop unnecessary copy of destination 
address

https://git.samba.org/?p=samba.git;a=shortlog;h=v4-18-test


- Log -----------------------------------------------------------------
commit c2c111688c49feaffb6f6a7461537dbb213a9e2e
Author: Stefan Metzmacher <me...@samba.org>
Date:   Tue Aug 15 08:57:57 2023 +0200

    s3:ctdbd_conn: fix ctdbd_public_ip_foreach() for ipv6 addresses
    
    BUG: https://bugzilla.samba.org/show_bug.cgi?id=15534
    
    Signed-off-by: Stefan Metzmacher <me...@samba.org>
    Reviewed-by: Volker Lendecke <v...@samba.org>
    
    Autobuild-User(master): Stefan Metzmacher <me...@samba.org>
    Autobuild-Date(master): Thu Dec 21 11:09:30 UTC 2023 on atb-devel-224
    
    (cherry picked from commit 828f3c99122fb033ecb79e24ed24821b8510f0f8)
    
    Autobuild-User(v4-18-test): Jule Anger <jan...@samba.org>
    Autobuild-Date(v4-18-test): Thu Dec 28 17:09:25 UTC 2023 on atb-devel-224

-----------------------------------------------------------------------

Summary of changes:
 source3/lib/ctdbd_conn.c | 33 ++++++++++++++++++++++++++++-----
 1 file changed, 28 insertions(+), 5 deletions(-)


Changeset truncated at 500 lines:

diff --git a/source3/lib/ctdbd_conn.c b/source3/lib/ctdbd_conn.c
index a739c97f3fd..3698c9d3672 100644
--- a/source3/lib/ctdbd_conn.c
+++ b/source3/lib/ctdbd_conn.c
@@ -1438,6 +1438,32 @@ static int ctdbd_control_get_public_ips(struct 
ctdbd_connection *conn,
        return 0;
 }
 
+static struct samba_sockaddr ctdbd_sock_addr_to_samba(const ctdb_sock_addr *c)
+{
+       struct samba_sockaddr s = {};
+
+       switch (c->sa.sa_family) {
+       case AF_INET:
+               s.u.in = c->ip;
+               break;
+       case AF_INET6:
+               /*
+                * ctdb always requires HAVE_IPV6,
+                * so we don't need an ifdef here.
+                */
+               s.u.in6 = c->ip6;
+               break;
+       default:
+               /*
+                * ctdb_sock_addr only supports ipv4 and ipv6
+                */
+               smb_panic(__location__);
+               break;
+       }
+
+       return s;
+}
+
 int ctdbd_public_ip_foreach(struct ctdbd_connection *conn,
                            int (*cb)(uint32_t total_ip_count,
                                      const struct sockaddr_storage *ip,
@@ -1457,11 +1483,8 @@ int ctdbd_public_ip_foreach(struct ctdbd_connection 
*conn,
        }
 
        for (i=0; i < ips->num; i++) {
-               struct samba_sockaddr tmp = {
-                       .u = {
-                               .sa = ips->ips[i].addr.sa,
-                       },
-               };
+               const ctdb_sock_addr *addr = &ips->ips[i].addr;
+               struct samba_sockaddr tmp = ctdbd_sock_addr_to_samba(addr);
 
                ret = cb(ips->num,
                         &tmp.u.ss,


-- 
Samba Shared Repository

Reply via email to