mirror of
https://github.com/samba-team/samba.git
synced 2025-07-30 19:42:05 +03:00
Big change to make nmbd code more readable/understandable.
Main change is removal of find_name_search() confusion. This has been replaced with find_name_on_subnet() which makes it explicit what is being searched. Also changed wins_subnet to be wins_client_subnet in preparation for splitting the wins subnet into client and server pieces. This is a big nmbd change and I'd appreciate any bug reports. Specific changes follow : asyncdns.c: Removed wins entry from add_netbios_entry(). This is now explicit in the subnet_record parameter. interface.c: iface_bcast(), iface_nmask(), iface_ip() return the default interface if none can be found. Made this behavior explicit - some code in nmbd incorrectly depended upon this (reply_name_status() for instance). nameannounce.c: find_name_search changes to find_name_on_subnet. namebrowse.c: wins_subnet renamed to wins_client_subnet. namedbname.c: find_name_search removed. find_name_on_subnet added. add_netbios_entry - wins parameter removed. namedbsubnet.c: find_req_subnet removed - not explicit enough. nameelect.c: wins_subnet renamed to wins_client_subnet. namepacket.c: listening() simplified. nameresp.c: wins_subnet renamed to wins_client_subnet. nameserv.c: find_name_search moved to find_name_on_subnet. nameserv.h: FIND_XXX -> changed to FIND_SELF_NAME, FIND_ANY_NAME. nameservreply.c: find_name_search moved to find_name_on_subnet. Debug entries changed. nameservresp.c: wins_subnet renamed to wins_client_subnet. namework.c: wins_subnet renamed to wins_client_subnet. nmbd.c: wins parameter removed from add_netbios_entry. nmbsync: wins_subnet renamed to wins_client_subnet. proto.h: The usual. server.c: remove accepted fd from fd_set. Jeremy (jallison@whistle.com)
This commit is contained in:
@ -438,6 +438,9 @@ struct in_addr *iface_n_ip(int n)
|
||||
return NULL;
|
||||
}
|
||||
|
||||
/****************************************************************************
|
||||
Try and find an interface that matches an ip. If we cannot, return NULL
|
||||
**************************************************************************/
|
||||
static struct interface *iface_find(struct in_addr ip)
|
||||
{
|
||||
struct interface *i;
|
||||
@ -446,7 +449,7 @@ static struct interface *iface_find(struct in_addr ip)
|
||||
for (i=local_interfaces;i;i=i->next)
|
||||
if (same_net(i->ip,ip,i->nmask)) return i;
|
||||
|
||||
return local_interfaces;
|
||||
return NULL;
|
||||
}
|
||||
|
||||
/* these 3 functions return the ip/bcast/nmask for the interface
|
||||
@ -454,17 +457,20 @@ static struct interface *iface_find(struct in_addr ip)
|
||||
|
||||
struct in_addr *iface_bcast(struct in_addr ip)
|
||||
{
|
||||
return(&iface_find(ip)->bcast);
|
||||
struct interface *i = iface_find(ip);
|
||||
return(i ? &i->bcast : &local_interfaces->bcast);
|
||||
}
|
||||
|
||||
struct in_addr *iface_nmask(struct in_addr ip)
|
||||
{
|
||||
return(&iface_find(ip)->nmask);
|
||||
struct interface *i = iface_find(ip);
|
||||
return(i ? &i->nmask : &local_interfaces->nmask);
|
||||
}
|
||||
|
||||
struct in_addr *iface_ip(struct in_addr ip)
|
||||
{
|
||||
return(&iface_find(ip)->ip);
|
||||
struct interface *i = iface_find(ip);
|
||||
return(i ? &i->ip : &local_interfaces->ip);
|
||||
}
|
||||
|
||||
|
||||
|
Reference in New Issue
Block a user