s4-interfaces Rename interfaces code so not to conflict with source3/
authorAndrew Bartlett <abartlet@samba.org>
Mon, 2 May 2011 05:57:19 +0000 (15:57 +1000)
committerAndrew Tridgell <tridge@samba.org>
Sun, 8 May 2011 10:57:04 +0000 (12:57 +0200)
The iface_count, iface_n_bcast, and load_interfaces functions
conflicted with functions of the same name in source3, so the source4
functions were renamed.  Hopefully we can actually wrap one around the
other in future.

Andrew Bartlett

29 files changed:
libcli/nbt/tools/nmblookup.c
source4/cldap_server/cldap_server.c
source4/cldap_server/netlogon.c
source4/dns_server/dns_server.c
source4/echo_server/echo_server.c
source4/kdc/kdc.c
source4/ldap_server/ldap_server.c
source4/lib/socket/interface.c
source4/lib/socket/testsuite.c
source4/libcli/resolve/bcast.c
source4/libcli/resolve/wins.c
source4/libcli/wrepl/winsrepl.c
source4/nbt_server/interfaces.c
source4/nbt_server/nbt_server.c
source4/nbt_server/wins/wins_ldb.c
source4/nbt_server/wins/winsserver.c
source4/rpc_server/dcerpc_server.c
source4/scripting/python/pyglue.c
source4/smb_server/service_smb.c
source4/smb_server/smb_samba3.c
source4/torture/nbt/dgram.c
source4/torture/nbt/register.c
source4/torture/nbt/wins.c
source4/torture/nbt/winsbench.c
source4/torture/nbt/winsreplication.c
source4/torture/rpc/spoolss_notify.c
source4/web_server/web_server.c
source4/wrepl_server/wrepl_in_connection.c
source4/wrepl_server/wrepl_server.c

index 7950ab80015ce5fcf7bd7a11d5bc6375aec6ee12..f6117f2fa91c2914d336c802338add8264a25246 100644 (file)
@@ -246,9 +246,9 @@ static bool process_one(struct loadparm_context *lp_ctx, struct tevent_context *
        } else {
                int i, num_interfaces;
 
-               num_interfaces = iface_count(ifaces);
+               num_interfaces = iface_list_count(ifaces);
                for (i=0;i<num_interfaces;i++) {
-                       const char *bcast = iface_n_bcast(ifaces, i);
+                       const char *bcast = iface_list_n_bcast(ifaces, i);
                        if (bcast == NULL) continue;
                        status = do_node_query(nbtsock, bcast, nbt_port, 
                                               node_name, node_type, true);
@@ -357,7 +357,7 @@ int main(int argc, const char *argv[])
                exit(1);
        }
 
-       load_interfaces(NULL, lpcfg_interfaces(cmdline_lp_ctx), &ifaces);
+       load_interface_list(NULL, lpcfg_interfaces(cmdline_lp_ctx), &ifaces);
 
        ev = s4_event_context_init(talloc_autofree_context());
 
index 43eadf5affcb33f45f3677f0f78dd5c16312b665..8e79af407e884c82cafa3f7185096472400d8111 100644 (file)
@@ -153,7 +153,7 @@ static NTSTATUS cldapd_startup_interfaces(struct cldapd_server *cldapd, struct l
        TALLOC_CTX *tmp_ctx = talloc_new(cldapd);
        NTSTATUS status;
 
-       num_interfaces = iface_count(ifaces);
+       num_interfaces = iface_list_count(ifaces);
 
        /* if we are allowing incoming packets from any address, then
           we need to bind to the wildcard address */
@@ -165,7 +165,7 @@ static NTSTATUS cldapd_startup_interfaces(struct cldapd_server *cldapd, struct l
        /* now we have to also listen on the specific interfaces,
           so that replies always come from the right IP */
        for (i=0; i<num_interfaces; i++) {
-               const char *address = talloc_strdup(tmp_ctx, iface_n_ip(ifaces, i));
+               const char *address = talloc_strdup(tmp_ctx, iface_list_n_ip(ifaces, i));
                status = cldapd_add_socket(cldapd, lp_ctx, address);
                NT_STATUS_NOT_OK_RETURN(status);
        }
@@ -184,9 +184,9 @@ static void cldapd_task_init(struct task_server *task)
        NTSTATUS status;
        struct interface *ifaces;
        
-       load_interfaces(task, lpcfg_interfaces(task->lp_ctx), &ifaces);
+       load_interface_list(task, lpcfg_interfaces(task->lp_ctx), &ifaces);
 
-       if (iface_count(ifaces) == 0) {
+       if (iface_list_count(ifaces) == 0) {
                task_server_terminate(task, "cldapd: no network interfaces configured", false);
                return;
        }
index 6e455e46bd7ed76f075a907fc9310fbc987988b2..3f3da8bb4160a8b44d3c110b404d7873ff4c2e26 100644 (file)
@@ -291,16 +291,16 @@ NTSTATUS fill_netlogon_samlogon_response(struct ldb_context *sam_ctx,
        client_site      = samdb_client_site_name(sam_ctx, mem_ctx,
                                                  src_address, NULL);
        NT_STATUS_HAVE_NO_MEMORY(client_site);
-       load_interfaces(mem_ctx, lpcfg_interfaces(lp_ctx), &ifaces);
+       load_interface_list(mem_ctx, lpcfg_interfaces(lp_ctx), &ifaces);
        /*
         * TODO: the caller should pass the address which the client
         * used to trigger this call, as the client is able to reach
         * this ip.
         */
        if (src_address) {
-               pdc_ip = iface_best_ip(ifaces, src_address);
+               pdc_ip = iface_list_best_ip(ifaces, src_address);
        } else {
-               pdc_ip = iface_n_ip(ifaces, 0);
+               pdc_ip = iface_list_n_ip(ifaces, 0);
        }
        ZERO_STRUCTP(netlogon);
 
index 0e5def15c00a6964eee7eb4bd42718a690bdf29d..2c0a379fdaba9edda73e717551d3951077fe779e 100644 (file)
@@ -559,10 +559,10 @@ static NTSTATUS dns_startup_interfaces(struct dns_server *dns, struct loadparm_c
                return NT_STATUS_INTERNAL_ERROR;
        }
 
-       num_interfaces = iface_count(ifaces);
+       num_interfaces = iface_list_count(ifaces);
 
        for (i=0; i<num_interfaces; i++) {
-               const char *address = talloc_strdup(tmp_ctx, iface_n_ip(ifaces, i));
+               const char *address = talloc_strdup(tmp_ctx, iface_list_n_ip(ifaces, i));
 
                status = dns_add_socket(dns, model_ops, "dns", address, DNS_SERVICE_PORT);
                NT_STATUS_NOT_OK_RETURN(status);
@@ -617,9 +617,9 @@ static void dns_task_init(struct task_server *task)
                break;
        }
 
-       load_interfaces(task, lpcfg_interfaces(task->lp_ctx), &ifaces);
+       load_interface_list(task, lpcfg_interfaces(task->lp_ctx), &ifaces);
 
-       if (iface_count(ifaces) == 0) {
+       if (iface_list_count(ifaces) == 0) {
                task_server_terminate(task, "dns: no network interfaces configured", false);
                return;
        }
index 4be6f21af8405ff2b21152b524d57fde78fab8ae..2a4a0bb19a550a5743f43cf8d5b03db6e19193ff 100644 (file)
@@ -25,7 +25,7 @@
 #include "param/param.h"
 /* This defines task_server_terminate */
 #include "smbd/process_model.h"
-/* We get load_interfaces from here */
+/* We get load_interface_list from here */
 #include "socket/netif.h"
 /* NTSTATUS-related stuff */
 #include "libcli/util/ntstatus.h"
@@ -269,10 +269,10 @@ static NTSTATUS echo_startup_interfaces(struct echo_server *echo,
                return NT_STATUS_INTERNAL_ERROR;
        }
 
-       num_interfaces = iface_count(ifaces);
+       num_interfaces = iface_list_count(ifaces);
 
        for(i=0; i<num_interfaces; i++) {
-               const char *address = talloc_strdup(tmp_ctx, iface_n_ip(ifaces, i));
+               const char *address = talloc_strdup(tmp_ctx, iface_list_n_ip(ifaces, i));
 
                status = echo_add_socket(echo, model_ops, "echo", address, ECHO_SERVICE_PORT);
                NT_STATUS_NOT_OK_RETURN(status);
@@ -308,9 +308,9 @@ static void echo_task_init(struct task_server *task)
                break;
        }
 
-       load_interfaces(task, lpcfg_interfaces(task->lp_ctx), &ifaces);
+       load_interface_list(task, lpcfg_interfaces(task->lp_ctx), &ifaces);
 
-       if (iface_count(ifaces) == 0) {
+       if (iface_list_count(ifaces) == 0) {
                task_server_terminate(task,
                                      "echo: No network interfaces configured",
                                      false);
index 784b98b07278b08670c66d5f7ac302de3805df92..02c6f925a9f39a44a517ef196962f51d113569ab 100644 (file)
@@ -729,7 +729,7 @@ static NTSTATUS kdc_startup_interfaces(struct kdc_server *kdc, struct loadparm_c
                return NT_STATUS_INTERNAL_ERROR;
        }
 
-       num_interfaces = iface_count(ifaces);
+       num_interfaces = iface_list_count(ifaces);
 
        /* if we are allowing incoming packets from any address, then
           we need to bind to the wildcard address */
@@ -751,7 +751,7 @@ static NTSTATUS kdc_startup_interfaces(struct kdc_server *kdc, struct loadparm_c
        }
 
        for (i=0; i<num_interfaces; i++) {
-               const char *address = talloc_strdup(tmp_ctx, iface_n_ip(ifaces, i));
+               const char *address = talloc_strdup(tmp_ctx, iface_list_n_ip(ifaces, i));
 
                if (kdc_port) {
                        status = kdc_add_socket(kdc, model_ops,
@@ -895,9 +895,9 @@ static void kdc_task_init(struct task_server *task)
                break;
        }
 
-       load_interfaces(task, lpcfg_interfaces(task->lp_ctx), &ifaces);
+       load_interface_list(task, lpcfg_interfaces(task->lp_ctx), &ifaces);
 
-       if (iface_count(ifaces) == 0) {
+       if (iface_list_count(ifaces) == 0) {
                task_server_terminate(task, "kdc: no network interfaces configured", false);
                return;
        }
index 25dfadb40e6d2047d729e3a056dfecc165a9e22a..01846add64eadcbd9abd981f3f23367acb947a3e 100644 (file)
@@ -951,15 +951,15 @@ static void ldapsrv_task_init(struct task_server *task)
                int num_interfaces;
                int i;
 
-               load_interfaces(task, lpcfg_interfaces(task->lp_ctx), &ifaces);
-               num_interfaces = iface_count(ifaces);
+               load_interface_list(task, lpcfg_interfaces(task->lp_ctx), &ifaces);
+               num_interfaces = iface_list_count(ifaces);
 
                /* We have been given an interfaces line, and been 
                   told to only bind to those interfaces. Create a
                   socket per interface and bind to only these.
                */
                for(i = 0; i < num_interfaces; i++) {
-                       const char *address = iface_n_ip(ifaces, i);
+                       const char *address = iface_list_n_ip(ifaces, i);
                        status = add_socket(task, task->lp_ctx, model_ops, address, ldap_service);
                        if (!NT_STATUS_IS_OK(status)) goto failed;
                }
index 69b7ec1d4930295f3afcaf2eaa23d46558edd146..4eb4f3a5175a2b15878eaaa725c2e5b45b9966d6 100644 (file)
@@ -48,9 +48,9 @@ struct interface {
 /****************************************************************************
 Try and find an interface that matches an ip. If we cannot, return NULL
   **************************************************************************/
-static struct interface *iface_find(struct interface *interfaces, 
-                                   const struct sockaddr *ip,
-                                   bool check_mask)
+static struct interface *iface_list_find(struct interface *interfaces,
+                                        const struct sockaddr *ip,
+                                        bool check_mask)
 {
        struct interface *i;
 
@@ -79,7 +79,7 @@ static void add_interface(TALLOC_CTX *mem_ctx, const struct iface_struct *ifs, s
        char addr[INET6_ADDRSTRLEN];
        struct interface *iface;
 
-       if (iface_find(*interfaces, (const struct sockaddr *)&ifs->ip, false)) {
+       if (iface_list_find(*interfaces, (const struct sockaddr *)&ifs->ip, false)) {
                DEBUG(3,("add_interface: not adding duplicate interface %s\n",
                        print_sockaddr(addr, sizeof(addr), &ifs->ip) ));
                return;
@@ -283,7 +283,7 @@ static void interpret_interface(TALLOC_CTX *mem_ctx,
 /**
 load the list of network interfaces
 **/
-void load_interfaces(TALLOC_CTX *mem_ctx, const char **interfaces, struct interface **local_interfaces)
+void load_interface_list(TALLOC_CTX *mem_ctx, const char **interfaces, struct interface **local_interfaces)
 {
        const char **ptr = interfaces;
        int i;
@@ -322,7 +322,7 @@ void load_interfaces(TALLOC_CTX *mem_ctx, const char **interfaces, struct interf
 /**
   how many interfaces do we have
   **/
-int iface_count(struct interface *ifaces)
+int iface_list_count(struct interface *ifaces)
 {
        int ret = 0;
        struct interface *i;
@@ -335,7 +335,7 @@ int iface_count(struct interface *ifaces)
 /**
   return IP of the Nth interface
   **/
-const char *iface_n_ip(struct interface *ifaces, int n)
+const char *iface_list_n_ip(struct interface *ifaces, int n)
 {
        struct interface *i;
   
@@ -351,7 +351,7 @@ const char *iface_n_ip(struct interface *ifaces, int n)
 /**
   return bcast of the Nth interface
   **/
-const char *iface_n_bcast(struct interface *ifaces, int n)
+const char *iface_list_n_bcast(struct interface *ifaces, int n)
 {
        struct interface *i;
   
@@ -367,7 +367,7 @@ const char *iface_n_bcast(struct interface *ifaces, int n)
 /**
   return netmask of the Nth interface
   **/
-const char *iface_n_netmask(struct interface *ifaces, int n)
+const char *iface_list_n_netmask(struct interface *ifaces, int n)
 {
        struct interface *i;
   
@@ -384,32 +384,32 @@ const char *iface_n_netmask(struct interface *ifaces, int n)
   return the local IP address that best matches a destination IP, or
   our first interface if none match
 */
-const char *iface_best_ip(struct interface *ifaces, const char *dest)
+const char *iface_list_best_ip(struct interface *ifaces, const char *dest)
 {
        struct interface *iface;
        struct sockaddr_storage ss;
 
        if (!interpret_string_addr(&ss, dest, AI_NUMERICHOST)) {
-               return iface_n_ip(ifaces, 0);
+               return iface_list_n_ip(ifaces, 0);
        }
-       iface = iface_find(ifaces, (const struct sockaddr *)&ss, true);
+       iface = iface_list_find(ifaces, (const struct sockaddr *)&ss, true);
        if (iface) {
                return iface->ip_s;
        }
-       return iface_n_ip(ifaces, 0);
+       return iface_list_n_ip(ifaces, 0);
 }
 
 /**
   return true if an IP is one one of our local networks
 */
-bool iface_is_local(struct interface *ifaces, const char *dest)
+bool iface_list_is_local(struct interface *ifaces, const char *dest)
 {
        struct sockaddr_storage ss;
 
        if (!interpret_string_addr(&ss, dest, AI_NUMERICHOST)) {
                return false;
        }
-       if (iface_find(ifaces, (const struct sockaddr *)&ss, true)) {
+       if (iface_list_find(ifaces, (const struct sockaddr *)&ss, true)) {
                return true;
        }
        return false;
@@ -418,7 +418,7 @@ bool iface_is_local(struct interface *ifaces, const char *dest)
 /**
   return true if a IP matches a IP/netmask pair
 */
-bool iface_same_net(const char *ip1, const char *ip2, const char *netmask)
+bool iface_list_same_net(const char *ip1, const char *ip2, const char *netmask)
 {
        return same_net_v4(interpret_addr2(ip1),
                        interpret_addr2(ip2),
index 2489277433fba5b8d8c06db5098696b5bbf7477b..518bc72501a61a0f82361e160b7e8065a0a1acc5 100644 (file)
@@ -42,7 +42,7 @@ static bool test_udp(struct torture_context *tctx)
        TALLOC_CTX *mem_ctx = tctx;
        struct interface *ifaces;
 
-       load_interfaces(tctx, lpcfg_interfaces(tctx->lp_ctx), &ifaces);
+       load_interface_list(tctx, lpcfg_interfaces(tctx->lp_ctx), &ifaces);
 
        status = socket_create("ip", SOCKET_TYPE_DGRAM, &sock1, 0);
        torture_assert_ntstatus_ok(tctx, status, "creating DGRAM IP socket 1");
@@ -53,7 +53,7 @@ static bool test_udp(struct torture_context *tctx)
        talloc_steal(mem_ctx, sock2);
 
        localhost = socket_address_from_strings(sock1, sock1->backend_name, 
-                                               iface_best_ip(ifaces, "127.0.0.1"), 0);
+                                               iface_list_best_ip(ifaces, "127.0.0.1"), 0);
 
        torture_assert(tctx, localhost, "Localhost not found");
 
@@ -62,10 +62,10 @@ static bool test_udp(struct torture_context *tctx)
 
        srv_addr = socket_get_my_addr(sock1, mem_ctx);
        torture_assert(tctx, srv_addr != NULL && 
-                      strcmp(srv_addr->addr, iface_best_ip(ifaces, "127.0.0.1")) == 0,
+                      strcmp(srv_addr->addr, iface_list_best_ip(ifaces, "127.0.0.1")) == 0,
                                   talloc_asprintf(tctx, 
                "Expected server address of %s but got %s",
-                     iface_best_ip(ifaces, "127.0.0.1"), srv_addr ? srv_addr->addr : NULL));
+                     iface_list_best_ip(ifaces, "127.0.0.1"), srv_addr ? srv_addr->addr : NULL));
 
        torture_comment(tctx, "server port is %d\n", srv_addr->port);
 
@@ -135,9 +135,9 @@ static bool test_tcp(struct torture_context *tctx)
        torture_assert_ntstatus_ok(tctx, status, "creating IP stream socket 1");
        talloc_steal(mem_ctx, sock2);
 
-       load_interfaces(tctx, lpcfg_interfaces(tctx->lp_ctx), &ifaces);
+       load_interface_list(tctx, lpcfg_interfaces(tctx->lp_ctx), &ifaces);
        localhost = socket_address_from_strings(sock1, sock1->backend_name, 
-                                               iface_best_ip(ifaces, "127.0.0.1"), 0);
+                                               iface_list_best_ip(ifaces, "127.0.0.1"), 0);
        torture_assert(tctx, localhost, "Localhost not found");
 
        status = socket_listen(sock1, localhost, 0, 0);
@@ -147,7 +147,7 @@ static bool test_tcp(struct torture_context *tctx)
        torture_assert(tctx, srv_addr && srv_addr->addr, 
                                   "Unexpected socket_get_my_addr NULL\n");
 
-       torture_assert_str_equal(tctx, srv_addr->addr, iface_best_ip(ifaces, "127.0.0.1"), 
+       torture_assert_str_equal(tctx, srv_addr->addr, iface_list_best_ip(ifaces, "127.0.0.1"),
                        "Unexpected server address");
 
        torture_comment(tctx, "server port is %d\n", srv_addr->port);
index 0ad3e1230b5544054b552bd2b6681907161b0ddb..794ef34e202eac176aabfd8d51f4928aa2d0b16a 100644 (file)
@@ -47,13 +47,13 @@ struct composite_context *resolve_name_bcast_send(TALLOC_CTX *mem_ctx,
        int i, count=0;
        struct resolve_bcast_data *data = talloc_get_type(userdata, struct resolve_bcast_data);
 
-       num_interfaces = iface_count(data->ifaces);
+       num_interfaces = iface_list_count(data->ifaces);
 
        address_list = talloc_array(mem_ctx, const char *, num_interfaces+1);
        if (address_list == NULL) return NULL;
 
        for (i=0;i<num_interfaces;i++) {
-               const char *bcast = iface_n_bcast(data->ifaces, i);
+               const char *bcast = iface_list_n_bcast(data->ifaces, i);
                if (bcast == NULL) continue;
                address_list[count] = talloc_strdup(address_list, bcast);
                if (address_list[count] == NULL) {
@@ -101,6 +101,6 @@ bool resolve_context_add_bcast_method(struct resolve_context *ctx, struct interf
 bool resolve_context_add_bcast_method_lp(struct resolve_context *ctx, struct loadparm_context *lp_ctx)
 {
        struct interface *ifaces;
-       load_interfaces(ctx, lpcfg_interfaces(lp_ctx), &ifaces);
+       load_interface_list(ctx, lpcfg_interfaces(lp_ctx), &ifaces);
        return resolve_context_add_bcast_method(ctx, ifaces, lpcfg_nbt_port(lp_ctx), lpcfg_parm_int(lp_ctx, NULL, "nbt", "timeout", 1));
 }
index 989f40e6cda65c791e1960f76ca2992f3cd75a1e..914386ce9c3cec3f3c3ea121e177d45960f57ef5 100644 (file)
@@ -77,6 +77,6 @@ bool resolve_context_add_wins_method(struct resolve_context *ctx, const char **a
 bool resolve_context_add_wins_method_lp(struct resolve_context *ctx, struct loadparm_context *lp_ctx)
 {
        struct interface *ifaces;
-       load_interfaces(ctx, lpcfg_interfaces(lp_ctx), &ifaces);
+       load_interface_list(ctx, lpcfg_interfaces(lp_ctx), &ifaces);
        return resolve_context_add_wins_method(ctx, lpcfg_wins_server_list(lp_ctx), ifaces, lpcfg_nbt_port(lp_ctx), lpcfg_parm_int(lp_ctx, NULL, "nbt", "timeout", 1));
 }
index 842a35175ec438c06121ceb6d270b248bbfe1942..2ccc50e71e5b8c8076a4b52ae1e36be37d461ae9 100644 (file)
@@ -136,8 +136,8 @@ NTSTATUS wrepl_socket_split_stream(struct wrepl_socket *wrepl_socket,
 const char *wrepl_best_ip(struct loadparm_context *lp_ctx, const char *peer_ip)
 {
        struct interface *ifaces;
-       load_interfaces(lp_ctx, lpcfg_interfaces(lp_ctx), &ifaces);
-       return iface_best_ip(ifaces, peer_ip);
+       load_interface_list(lp_ctx, lpcfg_interfaces(lp_ctx), &ifaces);
+       return iface_list_best_ip(ifaces, peer_ip);
 }
 
 struct wrepl_connect_state {
index bd2143e26ce3cb39d2d27dfc2fa8cb18dff719ac..4bb8a0852c0b7b164fe4e53852b53d76a6a5e4f4 100644 (file)
@@ -276,7 +276,7 @@ static NTSTATUS nbtd_add_wins_socket(struct nbtd_server *nbtsrv)
 NTSTATUS nbtd_startup_interfaces(struct nbtd_server *nbtsrv, struct loadparm_context *lp_ctx,
                                 struct interface *ifaces)
 {
-       int num_interfaces = iface_count(ifaces);
+       int num_interfaces = iface_list_count(ifaces);
        int i;
        TALLOC_CTX *tmp_ctx = talloc_new(nbtsrv);
        NTSTATUS status;
@@ -290,7 +290,7 @@ NTSTATUS nbtd_startup_interfaces(struct nbtd_server *nbtsrv, struct loadparm_con
                   for non-WINS queries not made on a specific
                   interface */
                if (num_interfaces > 0) {
-                       primary_address = iface_n_ip(ifaces, 0);
+                       primary_address = iface_list_n_ip(ifaces, 0);
                } else {
                        primary_address = inet_ntoa(interpret_addr2(
                                                        lpcfg_netbios_name(lp_ctx)));
@@ -308,15 +308,15 @@ NTSTATUS nbtd_startup_interfaces(struct nbtd_server *nbtsrv, struct loadparm_con
        }
 
        for (i=0; i<num_interfaces; i++) {
-               const char *bcast = iface_n_bcast(ifaces, i);
+               const char *bcast = iface_list_n_bcast(ifaces, i);
                const char *address, *netmask;
 
                /* we can't assume every interface is broadcast capable */
                if (bcast == NULL) continue;
 
-               address = talloc_strdup(tmp_ctx, iface_n_ip(ifaces, i));
+               address = talloc_strdup(tmp_ctx, iface_list_n_ip(ifaces, i));
                bcast   = talloc_strdup(tmp_ctx, bcast);
-               netmask = talloc_strdup(tmp_ctx, iface_n_netmask(ifaces, i));
+               netmask = talloc_strdup(tmp_ctx, iface_list_n_netmask(ifaces, i));
 
                status = nbtd_add_socket(nbtsrv, lp_ctx,
                                         address, address, bcast, netmask);
@@ -346,7 +346,7 @@ const char **nbtd_address_list(struct nbtd_interface *iface, TALLOC_CTX *mem_ctx
        bool is_loopback = false;
 
        if (iface->ip_address) {
-               is_loopback = iface_same_net(iface->ip_address, "127.0.0.1", "255.0.0.0");
+               is_loopback = iface_list_same_net(iface->ip_address, "127.0.0.1", "255.0.0.0");
                ret = str_list_add(ret, iface->ip_address);
        }
 
@@ -356,7 +356,7 @@ const char **nbtd_address_list(struct nbtd_interface *iface, TALLOC_CTX *mem_ctx
                if (!iface2->ip_address) continue;
 
                if (!is_loopback) {
-                       if (iface_same_net(iface2->ip_address, "127.0.0.1", "255.0.0.0")) {
+                       if (iface_list_same_net(iface2->ip_address, "127.0.0.1", "255.0.0.0")) {
                                continue;
                        }
                }
@@ -380,7 +380,7 @@ struct nbtd_interface *nbtd_find_request_iface(struct nbtd_server *nbtd_server,
 
        /* try to find a exact match */
        for (cur=nbtd_server->interfaces;cur;cur=cur->next) {
-               if (iface_same_net(address, cur->ip_address, cur->netmask)) {
+               if (iface_list_same_net(address, cur->ip_address, cur->netmask)) {
                        DEBUG(10,("find interface for dst[%s] ip: %s/%s (iface[%p])\n",
                                  address, cur->ip_address, cur->netmask, cur));
                        return cur;
index 6dbdaf9f54c5b1aad77f320b896912c3c7b277c1..3274fdd99d8e36458ec5321a91b5877a3579cf90 100644 (file)
@@ -41,9 +41,9 @@ static void nbtd_task_init(struct task_server *task)
        NTSTATUS status;
        struct interface *ifaces;
 
-       load_interfaces(task, lpcfg_interfaces(task->lp_ctx), &ifaces);
+       load_interface_list(task, lpcfg_interfaces(task->lp_ctx), &ifaces);
 
-       if (iface_count(ifaces) == 0) {
+       if (iface_list_count(ifaces) == 0) {
                task_server_terminate(task, "nbtd: no network interfaces configured", false);
                return;
        }
index 0896e1d74e520bb6429c003231376b1b0292ea61..ae90d04c76d9b1994136c2b56e61925f28d87696 100644 (file)
@@ -92,8 +92,8 @@ static int wins_ldb_init(struct ldb_module *module)
        owner = lpcfg_parm_string(lp_ctx, NULL, "winsdb", "local_owner");
        if (!owner) {
                struct interface *ifaces;
-               load_interfaces(module, lpcfg_interfaces(lp_ctx), &ifaces);
-               owner = iface_n_ip(ifaces, 0);
+               load_interface_list(module, lpcfg_interfaces(lp_ctx), &ifaces);
+               owner = iface_list_n_ip(ifaces, 0);
                if (!owner) {
                        owner = "0.0.0.0";
                }
index 1e6a0cfca878989cf22d3dab9ebc48b4524545b9..c58cb2709ab2ca831e27d6b87245e2b1e2ebcc0f 100644 (file)
@@ -688,7 +688,7 @@ static void nbtd_wins_randomize1Clist(struct loadparm_context *lp_ctx,
                bool same;
 
                /* if the current one is in the same subnet, use it */
-               same = iface_same_net(addresses[idx], src->addr, mask);
+               same = iface_list_same_net(addresses[idx], src->addr, mask);
                if (same) {
                        sidx = idx;
                        break;
@@ -1057,8 +1057,8 @@ NTSTATUS nbtd_winsserver_init(struct nbtd_server *nbtsrv)
 
        if (owner == NULL) {
                struct interface *ifaces;
-               load_interfaces(nbtsrv->task, lpcfg_interfaces(nbtsrv->task->lp_ctx), &ifaces);
-               owner = iface_n_ip(ifaces, 0);
+               load_interface_list(nbtsrv->task, lpcfg_interfaces(nbtsrv->task->lp_ctx), &ifaces);
+               owner = iface_list_n_ip(ifaces, 0);
        }
 
        nbtsrv->winssrv->wins_db     = winsdb_connect(nbtsrv->winssrv, nbtsrv->task->event_ctx, 
index 580503d0932f13ccacfabb361b5a14e5a7484f90..fcf3f2f7e672bb9e04fb0c12e464c8be294b65b9 100644 (file)
@@ -1678,11 +1678,11 @@ static NTSTATUS dcesrv_add_ep_tcp(struct dcesrv_context *dce_ctx,
                int i;
                struct interface *ifaces;
 
-               load_interfaces(dce_ctx, lpcfg_interfaces(lp_ctx), &ifaces);
+               load_interface_list(dce_ctx, lpcfg_interfaces(lp_ctx), &ifaces);
 
-               num_interfaces = iface_count(ifaces);
+               num_interfaces = iface_list_count(ifaces);
                for(i = 0; i < num_interfaces; i++) {
-                       const char *address = iface_n_ip(ifaces, i);
+                       const char *address = iface_list_n_ip(ifaces, i);
                        status = add_socket_rpc_tcp_iface(dce_ctx, e, event_ctx, model_ops, address);
                        NT_STATUS_NOT_OK_RETURN(status);
                }
index f89785f971f7133b498b14baf94ed60f23d27882..03460db8ff454791b018e2a9c3829d6399db137d 100644 (file)
@@ -149,22 +149,22 @@ static PyObject *py_interface_ips(PyObject *self, PyObject *args)
                return NULL;
        }
 
-       load_interfaces(tmp_ctx, lpcfg_interfaces(lp_ctx), &ifaces);
+       load_interface_list(tmp_ctx, lpcfg_interfaces(lp_ctx), &ifaces);
 
-       count = iface_count(ifaces);
+       count = iface_list_count(ifaces);
 
        /* first count how many are not loopback addresses */
        for (ifcount = i = 0; i<count; i++) {
-               const char *ip = iface_n_ip(ifaces, i);
-               if (!(!all_interfaces && iface_same_net(ip, "127.0.0.1", "255.0.0.0"))) {
+               const char *ip = iface_list_n_ip(ifaces, i);
+               if (!(!all_interfaces && iface_list_same_net(ip, "127.0.0.1", "255.0.0.0"))) {
                        ifcount++;
                }
        }
 
        pylist = PyList_New(ifcount);
        for (ifcount = i = 0; i<count; i++) {
-               const char *ip = iface_n_ip(ifaces, i);
-               if (!(!all_interfaces && iface_same_net(ip, "127.0.0.1", "255.0.0.0"))) {
+               const char *ip = iface_list_n_ip(ifaces, i);
+               if (!(!all_interfaces && iface_list_same_net(ip, "127.0.0.1", "255.0.0.0"))) {
                        PyList_SetItem(pylist, ifcount, PyString_FromString(ip));
                        ifcount++;
                }
index 583360bbe790f7a105f2a91d57280f90287cb561..48666958657d08feb6266cdd3602bfe089cff532 100644 (file)
@@ -48,16 +48,16 @@ static void smbsrv_task_init(struct task_server *task)
                int i;
                struct interface *ifaces;
 
-               load_interfaces(task, lpcfg_interfaces(task->lp_ctx), &ifaces);
+               load_interface_list(task, lpcfg_interfaces(task->lp_ctx), &ifaces);
 
-               num_interfaces = iface_count(ifaces);
+               num_interfaces = iface_list_count(ifaces);
 
                /* We have been given an interfaces line, and been 
                   told to only bind to those interfaces. Create a
                   socket per interface and bind to only these.
                */
                for(i = 0; i < num_interfaces; i++) {
-                       const char *address = iface_n_ip(ifaces, i);
+                       const char *address = iface_list_n_ip(ifaces, i);
                        status = smbsrv_add_socket(task, task->event_ctx, task->lp_ctx, task->model_ops, address);
                        if (!NT_STATUS_IS_OK(status)) goto failed;
                }
index b0ed38cf6a88e8a4e4cc02975a07842f8a43b453..86e67ec20da34100772c33e7166f65615ca296e9 100644 (file)
@@ -135,16 +135,16 @@ static void samba3_smb_task_init(struct task_server *task)
                int i;
                struct interface *ifaces;
 
-               load_interfaces(task, lpcfg_interfaces(task->lp_ctx), &ifaces);
+               load_interface_list(task, lpcfg_interfaces(task->lp_ctx), &ifaces);
 
-               num_interfaces = iface_count(ifaces);
+               num_interfaces = iface_list_count(ifaces);
 
                /* We have been given an interfaces line, and been
                   told to only bind to those interfaces. Create a
                   socket per interface and bind to only these.
                */
                for(i = 0; i < num_interfaces; i++) {
-                       const char *address = iface_n_ip(ifaces, i);
+                       const char *address = iface_list_n_ip(ifaces, i);
                        status = samba3_add_socket(task,
                                                   task->event_ctx,
                                                   task->lp_ctx,
index 7306c54deb110b3ca3fd5168ed1d932d054a8c2f..b33afec68f6741582813525c5edbc5a34e05cf02 100644 (file)
@@ -91,8 +91,8 @@ static bool nbt_test_netlogon(struct torture_context *tctx)
                                                   &name, tctx, &address, tctx->ev),
                                   talloc_asprintf(tctx, "Failed to resolve %s", name.name));
 
-       load_interfaces(tctx, lpcfg_interfaces(tctx->lp_ctx), &ifaces);
-       myaddress = talloc_strdup(dgmsock, iface_best_ip(ifaces, address));
+       load_interface_list(tctx, lpcfg_interfaces(tctx->lp_ctx), &ifaces);
+       myaddress = talloc_strdup(dgmsock, iface_list_best_ip(ifaces, address));
 
 
        socket_address = socket_address_from_strings(dgmsock, dgmsock->sock->backend_name,
@@ -187,8 +187,8 @@ static bool nbt_test_netlogon2(struct torture_context *tctx)
                                                   &name, tctx, &address, tctx->ev),
                                   talloc_asprintf(tctx, "Failed to resolve %s", name.name));
 
-       load_interfaces(tctx, lpcfg_interfaces(tctx->lp_ctx), &ifaces);
-       myaddress = talloc_strdup(dgmsock, iface_best_ip(ifaces, address));
+       load_interface_list(tctx, lpcfg_interfaces(tctx->lp_ctx), &ifaces);
+       myaddress = talloc_strdup(dgmsock, iface_list_best_ip(ifaces, address));
 
        socket_address = socket_address_from_strings(dgmsock, dgmsock->sock->backend_name,
                                                     myaddress, lpcfg_dgram_port(tctx->lp_ctx));
@@ -458,8 +458,8 @@ static bool nbt_test_ntlogon(struct torture_context *tctx)
                                                   0, 0, &name, tctx, &address, tctx->ev),
                                   talloc_asprintf(tctx, "Failed to resolve %s", name.name));
 
-       load_interfaces(tctx, lpcfg_interfaces(tctx->lp_ctx), &ifaces);
-       myaddress = talloc_strdup(dgmsock, iface_best_ip(ifaces, address));
+       load_interface_list(tctx, lpcfg_interfaces(tctx->lp_ctx), &ifaces);
+       myaddress = talloc_strdup(dgmsock, iface_list_best_ip(ifaces, address));
 
        socket_address = socket_address_from_strings(dgmsock, dgmsock->sock->backend_name,
                                                     myaddress, lpcfg_dgram_port(tctx->lp_ctx));
index d52ae4181ec6f9b6e4a50013cfe593d302afae10..8405d91c184e1ea587e65f769ed8257cc09d6f63 100644 (file)
@@ -54,9 +54,9 @@ static bool nbt_register_own(struct torture_context *tctx)
        if (!torture_nbt_get_name(tctx, &name, &address))
                return false;
 
-       load_interfaces(tctx, lpcfg_interfaces(tctx->lp_ctx), &ifaces);
+       load_interface_list(tctx, lpcfg_interfaces(tctx->lp_ctx), &ifaces);
 
-       myaddress = iface_best_ip(ifaces, address);
+       myaddress = iface_list_best_ip(ifaces, address);
 
        socket_address = socket_address_from_strings(tctx, nbtsock->sock->backend_name,
                                                     myaddress, 0);
@@ -123,9 +123,9 @@ static bool nbt_refresh_own(struct torture_context *tctx)
        if (!torture_nbt_get_name(tctx, &name, &address))
                return false;
        
-       load_interfaces(tctx, lpcfg_interfaces(tctx->lp_ctx), &ifaces);
+       load_interface_list(tctx, lpcfg_interfaces(tctx->lp_ctx), &ifaces);
 
-       myaddress = iface_best_ip(ifaces, address);
+       myaddress = iface_list_best_ip(ifaces, address);
 
        socket_address = socket_address_from_strings(tctx, nbtsock->sock->backend_name,
                                                     myaddress, 0);
index 0ddaa8a05a1ea2fcb432ab35666fae820b14d31b..635683ffbf9d1cc75d63947ce87e8745eaf4e94a 100644 (file)
@@ -65,9 +65,9 @@ static bool nbt_test_wins_name(struct torture_context *tctx, const char *address
        struct interface *ifaces;
        bool low_port = try_low_port;
 
-       load_interfaces(tctx, lpcfg_interfaces(tctx->lp_ctx), &ifaces);
+       load_interface_list(tctx, lpcfg_interfaces(tctx->lp_ctx), &ifaces);
 
-       myaddress = talloc_strdup(tctx, iface_best_ip(ifaces, address));
+       myaddress = talloc_strdup(tctx, iface_list_best_ip(ifaces, address));
 
        socket_address = socket_address_from_strings(tctx, 
                                                     nbtsock->sock->backend_name,
index aff620878c8f1b46d3fc749f2e722999092d23f6..07c7e952cba6bcc6ecae532db4b7387b25457b76 100644 (file)
@@ -246,8 +246,8 @@ static bool bench_wins(struct torture_context *tctx)
        state->registered = talloc_zero_array(state, bool, state->num_names);
        state->wins_server = address;
        state->wins_port = lpcfg_nbt_port(tctx->lp_ctx);
-       load_interfaces(tctx, lpcfg_interfaces(tctx->lp_ctx), &ifaces);
-       state->my_ip = talloc_strdup(tctx, iface_best_ip(ifaces, address));
+       load_interface_list(tctx, lpcfg_interfaces(tctx->lp_ctx), &ifaces);
+       state->my_ip = talloc_strdup(tctx, iface_list_best_ip(ifaces, address));
        state->ttl = timelimit;
 
        my_ip = socket_address_from_strings(nbtsock, nbtsock->sock->backend_name, 
index e30bfdd852fae2d4b669c9a2f9f86c24851583c2..40f7ac33ea0adb45f23115cc5fa4a35022142931 100644 (file)
@@ -615,14 +615,14 @@ static struct test_wrepl_conflict_conn *test_create_conflict_ctx(
        ctx->nbtsock = nbt_name_socket_init(ctx, tctx->ev);
        if (!ctx->nbtsock) return NULL;
 
-       load_interfaces(tctx, lpcfg_interfaces(tctx->lp_ctx), &ifaces);
+       load_interface_list(tctx, lpcfg_interfaces(tctx->lp_ctx), &ifaces);
 
-       ctx->myaddr = socket_address_from_strings(tctx, ctx->nbtsock->sock->backend_name, iface_best_ip(ifaces, address), 0);
+       ctx->myaddr = socket_address_from_strings(tctx, ctx->nbtsock->sock->backend_name, iface_list_best_ip(ifaces, address), 0);
        if (!ctx->myaddr) return NULL;
 
-       for (i = 0; i < iface_count(ifaces); i++) {
-               if (strcmp(ctx->myaddr->addr, iface_n_ip(ifaces, i)) == 0) continue;
-               ctx->myaddr2 = socket_address_from_strings(tctx, ctx->nbtsock->sock->backend_name, iface_n_ip(ifaces, i), 0);
+       for (i = 0; i < iface_list_count(ifaces); i++) {
+               if (strcmp(ctx->myaddr->addr, iface_list_n_ip(ifaces, i)) == 0) continue;
+               ctx->myaddr2 = socket_address_from_strings(tctx, ctx->nbtsock->sock->backend_name, iface_list_n_ip(ifaces, i), 0);
                if (!ctx->myaddr2) return NULL;
                break;
        }
@@ -679,12 +679,12 @@ static struct test_wrepl_conflict_conn *test_create_conflict_ctx(
        ctx->addresses_best[0].owner    = ctx->b.address;
        ctx->addresses_best[0].ip       = ctx->myaddr->addr;
 
-       ctx->addresses_all_num = iface_count(ifaces);
+       ctx->addresses_all_num = iface_list_count(ifaces);
        ctx->addresses_all = talloc_array(ctx, struct wrepl_ip, ctx->addresses_all_num);
        if (!ctx->addresses_all) return NULL;
        for (i=0; i < ctx->addresses_all_num; i++) {
                ctx->addresses_all[i].owner     = ctx->b.address;
-               ctx->addresses_all[i].ip        = talloc_strdup(ctx->addresses_all, iface_n_ip(ifaces, i));
+               ctx->addresses_all[i].ip        = talloc_strdup(ctx->addresses_all, iface_list_n_ip(ifaces, i));
                if (!ctx->addresses_all[i].ip) return NULL;
        }
 
index ec29c3944fe0dd5518ab7663b0296075ac0ffd43..04cd01b4a324f3d95e5a4aa0e577950d352a60cf 100644 (file)
@@ -455,8 +455,8 @@ static bool test_start_dcerpc_server(struct torture_context *tctx,
 
        lpcfg_set_cmdline(tctx->lp_ctx, "dcerpc endpoint servers", "spoolss");
 
-       load_interfaces(tctx, lpcfg_interfaces(tctx->lp_ctx), &ifaces);
-       address = iface_n_ip(ifaces, 0);
+       load_interface_list(tctx, lpcfg_interfaces(tctx->lp_ctx), &ifaces);
+       address = iface_list_n_ip(ifaces, 0);
 
        torture_comment(tctx, "Listening for callbacks on %s\n", address);
 
index 338cc2b57a3784be13d64b2add3afd4922c9f14d..ab8f63b2ec9f329b1339bc8d761176127394eea7 100644 (file)
@@ -319,11 +319,11 @@ static void websrv_task_init(struct task_server *task)
                int i;
                struct interface *ifaces;
 
-               load_interfaces(NULL, lpcfg_interfaces(task->lp_ctx), &ifaces);
+               load_interface_list(NULL, lpcfg_interfaces(task->lp_ctx), &ifaces);
 
-               num_interfaces = iface_count(ifaces);
+               num_interfaces = iface_list_count(ifaces);
                for(i = 0; i < num_interfaces; i++) {
-                       const char *address = iface_n_ip(ifaces, i);
+                       const char *address = iface_list_n_ip(ifaces, i);
                        status = stream_setup_socket(task,
                                                     task->event_ctx,
                                                     task->lp_ctx, model_ops,
index 9d3ddbf0da7364b48e0ed4c7fb7d1045c8381782..dc6beb3f2ad5753c306e7b7ddaf3c5c51f8de998 100644 (file)
@@ -441,16 +441,16 @@ NTSTATUS wreplsrv_setup_sockets(struct wreplsrv_service *service, struct loadpar
                int i;
                struct interface *ifaces;
 
-               load_interfaces(task, lpcfg_interfaces(lp_ctx), &ifaces);
+               load_interface_list(task, lpcfg_interfaces(lp_ctx), &ifaces);
 
-               num_interfaces = iface_count(ifaces);
+               num_interfaces = iface_list_count(ifaces);
 
                /* We have been given an interfaces line, and been 
                   told to only bind to those interfaces. Create a
                   socket per interface and bind to only these.
                */
                for(i = 0; i < num_interfaces; i++) {
-                       address = iface_n_ip(ifaces, i);
+                       address = iface_list_n_ip(ifaces, i);
                        status = stream_setup_socket(task, task->event_ctx,
                                                     task->lp_ctx, model_ops,
                                                     &wreplsrv_stream_ops,
index e5317045d03453140f1d0f3a9df55f09d29eab53..45cf8a94d2c2a5aff69cffc921df35be9aba0d45 100644 (file)
@@ -78,8 +78,8 @@ static NTSTATUS wreplsrv_open_winsdb(struct wreplsrv_service *service,
 
        if (owner == NULL) {
                struct interface *ifaces;
-               load_interfaces(service, lpcfg_interfaces(lp_ctx), &ifaces);
-               owner = iface_n_ip(ifaces, 0);
+               load_interface_list(service, lpcfg_interfaces(lp_ctx), &ifaces);
+               owner = iface_list_n_ip(ifaces, 0);
        }
 
        service->wins_db     = winsdb_connect(service, service->task->event_ctx, lp_ctx, owner, WINSDB_HANDLE_CALLER_WREPL);