diff options
author | Andrew Bartlett <abartlet@samba.org> | 2011-05-02 15:57:19 +1000 |
---|---|---|
committer | Andrew Tridgell <tridge@samba.org> | 2011-05-08 12:57:04 +0200 |
commit | 22cb631b4fd0647b70fbaaafaffda8712a84a999 (patch) | |
tree | 3522a34688c42b9698d267a8f0248b2f8c9b9dd4 | |
parent | 897ef820a40afffbf337b5487a49d957464def67 (diff) | |
download | samba-22cb631b4fd0647b70fbaaafaffda8712a84a999.tar.gz |
s4-interfaces Rename interfaces code so not to conflict with source3/
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, 116 insertions, 116 deletions
diff --git a/libcli/nbt/tools/nmblookup.c b/libcli/nbt/tools/nmblookup.c index 7950ab8001..f6117f2fa9 100644 --- a/libcli/nbt/tools/nmblookup.c +++ b/libcli/nbt/tools/nmblookup.c @@ -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()); diff --git a/source4/cldap_server/cldap_server.c b/source4/cldap_server/cldap_server.c index 43eadf5aff..8e79af407e 100644 --- a/source4/cldap_server/cldap_server.c +++ b/source4/cldap_server/cldap_server.c @@ -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; } diff --git a/source4/cldap_server/netlogon.c b/source4/cldap_server/netlogon.c index 6e455e46bd..3f3da8bb41 100644 --- a/source4/cldap_server/netlogon.c +++ b/source4/cldap_server/netlogon.c @@ -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); diff --git a/source4/dns_server/dns_server.c b/source4/dns_server/dns_server.c index 0e5def15c0..2c0a379fda 100644 --- a/source4/dns_server/dns_server.c +++ b/source4/dns_server/dns_server.c @@ -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; } diff --git a/source4/echo_server/echo_server.c b/source4/echo_server/echo_server.c index 4be6f21af8..2a4a0bb19a 100644 --- a/source4/echo_server/echo_server.c +++ b/source4/echo_server/echo_server.c @@ -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); diff --git a/source4/kdc/kdc.c b/source4/kdc/kdc.c index 784b98b072..02c6f925a9 100644 --- a/source4/kdc/kdc.c +++ b/source4/kdc/kdc.c @@ -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; } diff --git a/source4/ldap_server/ldap_server.c b/source4/ldap_server/ldap_server.c index 25dfadb40e..01846add64 100644 --- a/source4/ldap_server/ldap_server.c +++ b/source4/ldap_server/ldap_server.c @@ -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; } diff --git a/source4/lib/socket/interface.c b/source4/lib/socket/interface.c index 69b7ec1d49..4eb4f3a517 100644 --- a/source4/lib/socket/interface.c +++ b/source4/lib/socket/interface.c @@ -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), diff --git a/source4/lib/socket/testsuite.c b/source4/lib/socket/testsuite.c index 2489277433..518bc72501 100644 --- a/source4/lib/socket/testsuite.c +++ b/source4/lib/socket/testsuite.c @@ -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); diff --git a/source4/libcli/resolve/bcast.c b/source4/libcli/resolve/bcast.c index 0ad3e1230b..794ef34e20 100644 --- a/source4/libcli/resolve/bcast.c +++ b/source4/libcli/resolve/bcast.c @@ -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)); } diff --git a/source4/libcli/resolve/wins.c b/source4/libcli/resolve/wins.c index 989f40e6cd..914386ce9c 100644 --- a/source4/libcli/resolve/wins.c +++ b/source4/libcli/resolve/wins.c @@ -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)); } diff --git a/source4/libcli/wrepl/winsrepl.c b/source4/libcli/wrepl/winsrepl.c index 842a35175e..2ccc50e71e 100644 --- a/source4/libcli/wrepl/winsrepl.c +++ b/source4/libcli/wrepl/winsrepl.c @@ -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 { diff --git a/source4/nbt_server/interfaces.c b/source4/nbt_server/interfaces.c index bd2143e26c..4bb8a0852c 100644 --- a/source4/nbt_server/interfaces.c +++ b/source4/nbt_server/interfaces.c @@ -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; diff --git a/source4/nbt_server/nbt_server.c b/source4/nbt_server/nbt_server.c index 6dbdaf9f54..3274fdd99d 100644 --- a/source4/nbt_server/nbt_server.c +++ b/source4/nbt_server/nbt_server.c @@ -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; } diff --git a/source4/nbt_server/wins/wins_ldb.c b/source4/nbt_server/wins/wins_ldb.c index 0896e1d74e..ae90d04c76 100644 --- a/source4/nbt_server/wins/wins_ldb.c +++ b/source4/nbt_server/wins/wins_ldb.c @@ -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"; } diff --git a/source4/nbt_server/wins/winsserver.c b/source4/nbt_server/wins/winsserver.c index 1e6a0cfca8..c58cb2709a 100644 --- a/source4/nbt_server/wins/winsserver.c +++ b/source4/nbt_server/wins/winsserver.c @@ -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, diff --git a/source4/rpc_server/dcerpc_server.c b/source4/rpc_server/dcerpc_server.c index 580503d093..fcf3f2f7e6 100644 --- a/source4/rpc_server/dcerpc_server.c +++ b/source4/rpc_server/dcerpc_server.c @@ -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); } diff --git a/source4/scripting/python/pyglue.c b/source4/scripting/python/pyglue.c index f89785f971..03460db8ff 100644 --- a/source4/scripting/python/pyglue.c +++ b/source4/scripting/python/pyglue.c @@ -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++; } diff --git a/source4/smb_server/service_smb.c b/source4/smb_server/service_smb.c index 583360bbe7..4866695865 100644 --- a/source4/smb_server/service_smb.c +++ b/source4/smb_server/service_smb.c @@ -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; } diff --git a/source4/smb_server/smb_samba3.c b/source4/smb_server/smb_samba3.c index b0ed38cf6a..86e67ec20d 100644 --- a/source4/smb_server/smb_samba3.c +++ b/source4/smb_server/smb_samba3.c @@ -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, diff --git a/source4/torture/nbt/dgram.c b/source4/torture/nbt/dgram.c index 7306c54deb..b33afec68f 100644 --- a/source4/torture/nbt/dgram.c +++ b/source4/torture/nbt/dgram.c @@ -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)); diff --git a/source4/torture/nbt/register.c b/source4/torture/nbt/register.c index d52ae4181e..8405d91c18 100644 --- a/source4/torture/nbt/register.c +++ b/source4/torture/nbt/register.c @@ -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); diff --git a/source4/torture/nbt/wins.c b/source4/torture/nbt/wins.c index 0ddaa8a05a..635683ffbf 100644 --- a/source4/torture/nbt/wins.c +++ b/source4/torture/nbt/wins.c @@ -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, diff --git a/source4/torture/nbt/winsbench.c b/source4/torture/nbt/winsbench.c index aff620878c..07c7e952cb 100644 --- a/source4/torture/nbt/winsbench.c +++ b/source4/torture/nbt/winsbench.c @@ -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, diff --git a/source4/torture/nbt/winsreplication.c b/source4/torture/nbt/winsreplication.c index e30bfdd852..40f7ac33ea 100644 --- a/source4/torture/nbt/winsreplication.c +++ b/source4/torture/nbt/winsreplication.c @@ -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; } diff --git a/source4/torture/rpc/spoolss_notify.c b/source4/torture/rpc/spoolss_notify.c index ec29c3944f..04cd01b4a3 100644 --- a/source4/torture/rpc/spoolss_notify.c +++ b/source4/torture/rpc/spoolss_notify.c @@ -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); diff --git a/source4/web_server/web_server.c b/source4/web_server/web_server.c index 338cc2b57a..ab8f63b2ec 100644 --- a/source4/web_server/web_server.c +++ b/source4/web_server/web_server.c @@ -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, diff --git a/source4/wrepl_server/wrepl_in_connection.c b/source4/wrepl_server/wrepl_in_connection.c index 9d3ddbf0da..dc6beb3f2a 100644 --- a/source4/wrepl_server/wrepl_in_connection.c +++ b/source4/wrepl_server/wrepl_in_connection.c @@ -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, diff --git a/source4/wrepl_server/wrepl_server.c b/source4/wrepl_server/wrepl_server.c index e5317045d0..45cf8a94d2 100644 --- a/source4/wrepl_server/wrepl_server.c +++ b/source4/wrepl_server/wrepl_server.c @@ -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); |