diff options
Diffstat (limited to 'source4/nbt_server')
-rw-r--r-- | source4/nbt_server/interfaces.c | 29 | ||||
-rw-r--r-- | source4/nbt_server/nbt_server.c | 4 | ||||
-rw-r--r-- | source4/nbt_server/wins/wins_ldb.c | 4 | ||||
-rw-r--r-- | source4/nbt_server/wins/winsdb.c | 4 | ||||
-rw-r--r-- | source4/nbt_server/wins/winsserver.c | 6 |
5 files changed, 27 insertions, 20 deletions
diff --git a/source4/nbt_server/interfaces.c b/source4/nbt_server/interfaces.c index bd2143e26c..ccbc89accf 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; @@ -286,15 +286,16 @@ NTSTATUS nbtd_startup_interfaces(struct nbtd_server *nbtsrv, struct loadparm_con if (!lpcfg_bind_interfaces_only(lp_ctx)) { const char *primary_address; + primary_address = iface_list_first_v4(ifaces); + /* the primary address is the address we will return for non-WINS queries not made on a specific interface */ - if (num_interfaces > 0) { - primary_address = iface_n_ip(ifaces, 0); - } else { + if (primary_address == NULL) { primary_address = inet_ntoa(interpret_addr2( - lpcfg_netbios_name(lp_ctx))); + lpcfg_netbios_name(lp_ctx))); } + primary_address = talloc_strdup(tmp_ctx, primary_address); NT_STATUS_HAVE_NO_MEMORY(primary_address); @@ -308,15 +309,21 @@ 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; const char *address, *netmask; + if (!iface_list_n_is_v4(ifaces, i)) { + /* v4 only for NBT protocol */ + continue; + } + + bcast = iface_list_n_bcast(ifaces, i); /* 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 +353,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 +363,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 +387,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..175ad5e4a4 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, 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..304c98d803 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, lp_ctx, &ifaces); + owner = iface_list_first_v4(ifaces); if (!owner) { owner = "0.0.0.0"; } diff --git a/source4/nbt_server/wins/winsdb.c b/source4/nbt_server/wins/winsdb.c index 791ce957c7..4a1486092b 100644 --- a/source4/nbt_server/wins/winsdb.c +++ b/source4/nbt_server/wins/winsdb.c @@ -975,7 +975,7 @@ static bool winsdb_check_or_add_module_list(struct tevent_context *ev_ctx, flags |= LDB_FLG_NOSYNC; } - h->ldb = ldb_wrap_connect(h, ev_ctx, lp_ctx, lock_path(h, lp_ctx, lpcfg_wins_url(lp_ctx)), + h->ldb = ldb_wrap_connect(h, ev_ctx, lp_ctx, lpcfg_lock_path(h, lp_ctx, lpcfg_wins_url(lp_ctx)), NULL, NULL, flags); if (!h->ldb) goto failed; @@ -1011,7 +1011,7 @@ struct winsdb_handle *winsdb_connect(TALLOC_CTX *mem_ctx, flags |= LDB_FLG_NOSYNC; } - h->ldb = ldb_wrap_connect(h, ev_ctx, lp_ctx, lock_path(h, lp_ctx, lpcfg_wins_url(lp_ctx)), + h->ldb = ldb_wrap_connect(h, ev_ctx, lp_ctx, lpcfg_lock_path(h, lp_ctx, lpcfg_wins_url(lp_ctx)), NULL, NULL, flags); if (!h->ldb) goto failed; diff --git a/source4/nbt_server/wins/winsserver.c b/source4/nbt_server/wins/winsserver.c index 1e6a0cfca8..5f1f41747f 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, nbtsrv->task->lp_ctx, &ifaces); + owner = iface_list_first_v4(ifaces); } nbtsrv->winssrv->wins_db = winsdb_connect(nbtsrv->winssrv, nbtsrv->task->event_ctx, |