summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorGerald (Jerry) Carter <jerry@samba.org>2008-10-03 10:51:54 -0500
committerKarolin Seeger <kseeger@samba.org>2008-10-06 13:03:57 +0200
commitd2242f9776cfed2dfff44db180dbf34fbbba2e5e (patch)
treeeafabfe134305b5493b83efa4a5608287d87fb39
parent35130846b4595cc3a937e10a113d2805a5b2c096 (diff)
downloadsamba-d2242f9776cfed2dfff44db180dbf34fbbba2e5e.tar.gz
samba-d2242f9776cfed2dfff44db180dbf34fbbba2e5e.tar.xz
samba-d2242f9776cfed2dfff44db180dbf34fbbba2e5e.zip
net_dns: Make "lwinet ads dns register" honor the "interfaces" parameter.
This is helpful on multihomed hosts that only require a subset of IP addresses be registered with DNS. (cherry picked from commit 17c9f8810598d8117befc896d12a597a52b0ac3b) (cherry picked from commit 2fb742e127f725b56f308538852d7b10b86f29c1)
-rw-r--r--source/utils/net_dns.c25
1 files changed, 12 insertions, 13 deletions
diff --git a/source/utils/net_dns.c b/source/utils/net_dns.c
index 14d45e2b0fc..46f38d42f66 100644
--- a/source/utils/net_dns.c
+++ b/source/utils/net_dns.c
@@ -150,9 +150,10 @@ int get_my_ip_address( struct sockaddr_storage **pp_ss )
struct sockaddr_storage *list = NULL;
int count = 0;
- /* find the first non-loopback address from our list of interfaces */
+ /* Honor the configured list of interfaces to register */
- n = get_interfaces(nics, MAX_INTERFACES);
+ load_interfaces();
+ n = iface_count();
if (n <= 0) {
return -1;
@@ -163,19 +164,17 @@ int get_my_ip_address( struct sockaddr_storage **pp_ss )
}
for ( i=0; i<n; i++ ) {
- if (is_loopback_addr(&nics[i].ip)) {
+ const struct sockaddr_storage *nic_sa_storage = NULL;
+
+ if ((nic_sa_storage = iface_n_sockaddr_storage(i)) == NULL)
+ continue;
+
+ /* Don't register loopback addresses */
+ if (is_loopback_addr(nic_sa_storage)) {
continue;
}
-#if defined(HAVE_IPV6)
- if ((nics[i].ip.ss_family == AF_INET6)) {
- memcpy(&list[count++], &nics[i].ip,
- sizeof(struct sockaddr_storage));
- } else
-#endif
- if (nics[i].ip.ss_family == AF_INET) {
- memcpy(&list[count++], &nics[i].ip,
- sizeof(struct sockaddr_storage));
- }
+
+ memcpy(&list[count++], nic_sa_storage, sizeof(struct sockaddr_storage));
}
*pp_ss = list;