summaryrefslogtreecommitdiff
path: root/source4/lib/socket
diff options
context:
space:
mode:
Diffstat (limited to 'source4/lib/socket')
-rw-r--r--source4/lib/socket/interface.c32
-rw-r--r--source4/lib/socket/testsuite.c14
2 files changed, 23 insertions, 23 deletions
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);