diff options
author | Andrew Tridgell <tridge@samba.org> | 2005-02-10 03:22:47 +0000 |
---|---|---|
committer | Gerald (Jerry) Carter <jerry@samba.org> | 2007-10-10 13:09:37 -0500 |
commit | b9bb7f596de51496c18580863efbb8ac17c78970 (patch) | |
tree | e8ea83908a7a2e259e97b309595208481ef70b3d /source4/lib | |
parent | 57f69e6f37949636ae14c646517792fa40c9c75b (diff) | |
download | samba-b9bb7f596de51496c18580863efbb8ac17c78970.tar.gz samba-b9bb7f596de51496c18580863efbb8ac17c78970.tar.bz2 samba-b9bb7f596de51496c18580863efbb8ac17c78970.zip |
r5294: - added a separate NBT-WINS test for WINS operations (register, refresh, release and query)
- change the iface_n_*() functions to return a "const char *" instead of a "struct ipv4_addr"
I think that in general we should move towards "const char *" for
all IP addresses, as this makes IPv6 much easier, and is also easier
to debug. Andrew, when you get a chance, could you fix some of the
auth code to use strings for IPs ?
- return a NTSTATUS error on bad name queries and node status instead
of using rcode. This makes the calling code simpler.
- added low level name release code in libcli/nbt/
- use a real IP in the register and wins nbt torture tests, as w2k3
WINS server silently rejects some operations that don't come from the
IP being used (eg. it says "yes" to a release, but does not in fact
release the name)
(This used to be commit bb1ab11d8e0ea0bd9ae34aebeb565d36fe4b495f)
Diffstat (limited to 'source4/lib')
-rw-r--r-- | source4/lib/netif/interface.c | 59 |
1 files changed, 15 insertions, 44 deletions
diff --git a/source4/lib/netif/interface.c b/source4/lib/netif/interface.c index bf1e147e02..31354e359a 100644 --- a/source4/lib/netif/interface.c +++ b/source4/lib/netif/interface.c @@ -1,7 +1,9 @@ /* Unix SMB/CIFS implementation. + multiple interface handling - Copyright (C) Andrew Tridgell 1992-1998 + + Copyright (C) Andrew Tridgell 1992-2005 This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by @@ -276,20 +278,6 @@ BOOL ismyip(struct ipv4_addr ip) } /**************************************************************************** - check if a packet is from a local (known) net - **************************************************************************/ -BOOL is_local_net(struct ipv4_addr from) -{ - struct interface *i; - for (i=local_interfaces;i;i=i->next) { - if((from.addr & i->nmask.addr) == - (i->ip.addr & i->nmask.addr)) - return True; - } - return False; -} - -/**************************************************************************** how many interfaces do we have **************************************************************************/ int iface_count(void) @@ -305,65 +293,48 @@ int iface_count(void) /**************************************************************************** return IP of the Nth interface **************************************************************************/ -struct ipv4_addr *iface_n_ip(int n) +const char *iface_n_ip(int n) { struct interface *i; for (i=local_interfaces;i && n;i=i->next) n--; - if (i) return &i->ip; + if (i) { + return sys_inet_ntoa(i->ip); + } return NULL; } /**************************************************************************** return bcast of the Nth interface **************************************************************************/ -struct ipv4_addr *iface_n_bcast(int n) +const char *iface_n_bcast(int n) { struct interface *i; for (i=local_interfaces;i && n;i=i->next) n--; - if (i) return &i->bcast; + if (i) { + return sys_inet_ntoa(i->bcast); + } return NULL; } /**************************************************************************** return netmask of the Nth interface **************************************************************************/ -struct ipv4_addr *iface_n_netmask(int n) +const char *iface_n_netmask(int n) { struct interface *i; for (i=local_interfaces;i && n;i=i->next) n--; - if (i) return &i->nmask; + if (i) { + return sys_inet_ntoa(i->nmask); + } return NULL; } -/* these 3 functions return the ip/bcast/nmask for the interface - most appropriate for the given ip address. If they can't find - an appropriate interface they return the requested field of the - first known interface. */ - -struct ipv4_addr *iface_ip(struct ipv4_addr ip) -{ - struct in_addr in; - struct interface *i; - in.s_addr = ip.addr; - i = iface_find(in, True); - return(i ? &i->ip : &local_interfaces->ip); -} - -/* - return True if a IP is directly reachable on one of our interfaces -*/ -BOOL iface_local(struct ipv4_addr ip) -{ - struct in_addr in; - in.s_addr = ip.addr; - return iface_find(in, True) ? True : False; -} |