r25624: Remove ipv4_addr hack. Only causes 4 extra includes of system/network.h becau...
authorJelmer Vernooij <jelmer@samba.org>
Sat, 13 Oct 2007 18:24:37 +0000 (20:24 +0200)
committerStefan Metzmacher <metze@samba.org>
Fri, 21 Dec 2007 04:43:00 +0000 (05:43 +0100)
21 files changed:
source/auth/auth_server.c
source/client/mount.cifs.c
source/client/smbmount.c
source/lib/ldb/include/ldb.h
source/lib/samba3/samba3.h
source/lib/samba3/winsdb.c
source/lib/socket/interface.c
source/lib/socket/socket_ip.c
source/lib/tdr/tdr.c
source/lib/util/system.c
source/lib/util/util.c
source/lib/util/util.h
source/libcli/resolve/host.c
source/libcli/resolve/resolve.c
source/librpc/ndr/libndr.h
source/librpc/ndr/ndr_basic.c
source/librpc/ndr/ndr_misc.c
source/nbt_server/interfaces.c
source/nbt_server/wins/winsserver.c
source/scripting/ejs/smbcalls_samba3.c
source/torture/local/resolve.c

index abc052c9eae5548a96f3af43feefd70246808a6f..b4fbeea2f5128c432dbd5ae0312d8829c509752c 100644 (file)
@@ -28,7 +28,7 @@ static struct smbcli_state *server_cryptkey(TALLOC_CTX *mem_ctx)
 {
        struct smbcli_state *cli = NULL;
        fstring desthost;
-       struct ipv4_addr dest_ip;
+       struct in_addr dest_ip;
        const char *p;
        char *pserver;
        bool connected_ok = false;
index 829040381589413631ba59b20f31eeb9bb4bd7b6..7167859d7b2e6fa403c604b0205c367da00dfa2b 100644 (file)
@@ -197,7 +197,7 @@ char * parse_server(char * unc_name)
        char * share;
        char * ipaddress_string = NULL;
        struct hostent * host_entry;
-       struct ipv4_addr server_ipaddr;
+       struct in_addr server_ipaddr;
        int rc,j;
        char temp[64];
 
index 31e7628fcd23a4dcc7d21feadb8c2449a4e6dd8c..8a106974c2f682a353fd8d6303237679e459a602 100644 (file)
@@ -33,7 +33,7 @@ static pstring mpoint;
 static pstring service;
 static pstring options;
 
-static struct ipv4_addr dest_ip;
+static struct in_addr dest_ip;
 static bool have_ip;
 static int smb_port = 0;
 static bool got_user;
@@ -116,7 +116,7 @@ static struct smbcli_state *do_connection(char *the_service)
        struct smbcli_state *c;
        struct nmb_name called, calling;
        char *server_n;
-       struct ipv4_addr ip;
+       struct in_addr ip;
        pstring server;
        char *share;
 
index 41d23b5d1030b9b51d460fd97ce846e7038ea721..301db4dadc0763c37056149117b5df6b1d5c7477 100644 (file)
@@ -735,12 +735,14 @@ struct ldb_register_partition {
        struct ldb_dn *dn;
 };
 
+enum ldb_sequence_type {
+       LDB_SEQ_HIGHEST_SEQ,
+       LDB_SEQ_HIGHEST_TIMESTAMP,
+       LDB_SEQ_NEXT
+};
+
 struct ldb_sequence_number {
-       enum ldb_sequence_type {
-               LDB_SEQ_HIGHEST_SEQ,
-               LDB_SEQ_HIGHEST_TIMESTAMP,
-               LDB_SEQ_NEXT
-       } type;
+       enum ldb_sequence_type type;
        uint64_t seq_num;
        uint32_t flags;
 };
index bc73e8941dab0e3c976975ff25d1e10d2eb16b67..202ac767ec072f0125ae444f63b3ae51e9d0e544 100644 (file)
@@ -98,7 +98,7 @@ struct samba3_winsdb_entry
        int type;
        time_t ttl;
        uint32_t ip_count;
-       struct ipv4_addr *ips;
+       struct in_addr *ips;
 };
 
 struct samba3_policy
index 0a93dbb0e18c6a9c5d4c709ae465b5ef06438155..5bed3523ea2c8476ba9555e7c9ed305bc575ecb6 100644 (file)
@@ -23,6 +23,7 @@
 #include "includes.h"
 #include "system/filesys.h"
 #include "lib/samba3/samba3.h"
+#include "system/network.h"
 
 #define WINS_VERSION 1
 
@@ -110,7 +111,7 @@ NTSTATUS samba3_read_winsdb( const char *fn, TALLOC_CTX *ctx, struct samba3_wins
                }
 
                /* Allocate the space for the ip_list. */
-               if((entry.ips = talloc_array ( ctx, struct ipv4_addr, entry.ip_count)) == NULL) {
+               if((entry.ips = talloc_array ( ctx, struct in_addr, entry.ip_count)) == NULL) {
                        DEBUG(0,("initialise_wins: Malloc fail !\n"));
                        SAFE_FREE(line);
                        return NT_STATUS_NO_MEMORY;
index 9ca44505814ec08024bc62a63cf25094acc17dad..c220c4d890f2d7ec75fedab9c8395a1b8e59ec2e 100644 (file)
@@ -28,8 +28,8 @@
 /** used for network interfaces */
 struct interface {
        struct interface *next, *prev;
-       struct ipv4_addr ip;
-       struct ipv4_addr nmask;
+       struct in_addr ip;
+       struct in_addr nmask;
        const char *ip_s;
        const char *bcast_s;
        const char *nmask_s;
@@ -44,25 +44,18 @@ static struct interface *local_interfaces;
 #define MKBCADDR(_IP, _NM) ((_IP & _NM) | (_NM ^ ALLONES))
 #define MKNETADDR(_IP, _NM) (_IP & _NM)
 
-static struct ipv4_addr tov4(struct in_addr in)
-{
-       struct ipv4_addr in2;
-       in2.addr = in.s_addr;
-       return in2;
-}
-
 /****************************************************************************
 Try and find an interface that matches an ip. If we cannot, return NULL
   **************************************************************************/
 static struct interface *iface_find(struct in_addr ip, bool CheckMask)
 {
        struct interface *i;
-       if (is_zero_ip(tov4(ip))) return local_interfaces;
+       if (is_zero_ip(ip)) return local_interfaces;
 
        for (i=local_interfaces;i;i=i->next)
                if (CheckMask) {
-                       if (same_net(i->ip,tov4(ip),i->nmask)) return i;
-               } else if (i->ip.addr == ip.s_addr) return i;
+                       if (same_net(i->ip,ip,i->nmask)) return i;
+               } else if (i->ip.s_addr == ip.s_addr) return i;
 
        return NULL;
 }
@@ -74,7 +67,7 @@ add an interface to the linked list of interfaces
 static void add_interface(struct in_addr ip, struct in_addr nmask)
 {
        struct interface *iface;
-       struct ipv4_addr bcast;
+       struct in_addr bcast;
 
        if (iface_find(ip, false)) {
                DEBUG(3,("not adding duplicate interface %s\n",inet_ntoa(ip)));
@@ -86,17 +79,17 @@ static void add_interface(struct in_addr ip, struct in_addr nmask)
        
        ZERO_STRUCTPN(iface);
 
-       iface->ip = tov4(ip);
-       iface->nmask = tov4(nmask);
-       bcast.addr = MKBCADDR(iface->ip.addr, iface->nmask.addr);
+       iface->ip = ip;
+       iface->nmask = nmask;
+       bcast.s_addr = MKBCADDR(iface->ip.s_addr, iface->nmask.s_addr);
 
        /* keep string versions too, to avoid people tripping over the implied
-          static in sys_inet_ntoa() */
-       iface->ip_s = talloc_strdup(iface, sys_inet_ntoa(iface->ip));
-       iface->nmask_s = talloc_strdup(iface, sys_inet_ntoa(iface->nmask));
+          static in inet_ntoa() */
+       iface->ip_s = talloc_strdup(iface, inet_ntoa(iface->ip));
+       iface->nmask_s = talloc_strdup(iface, inet_ntoa(iface->nmask));
        
        if (nmask.s_addr != ~0) {
-               iface->bcast_s = talloc_strdup(iface, sys_inet_ntoa(bcast));
+               iface->bcast_s = talloc_strdup(iface, inet_ntoa(bcast));
        }
 
        DLIST_ADD_END(local_interfaces, iface, struct interface *);
@@ -145,7 +138,7 @@ static void interpret_interface(const char *token,
                if (strpbrk(token, "*?") != NULL) {
                        return;
                }
-               ip.s_addr = interpret_addr2(token).addr;
+               ip.s_addr = interpret_addr2(token).s_addr;
                for (i=0;i<total_probed;i++) {
                        if (ip.s_addr == probed_ifaces[i].ip.s_addr) {
                                add_interface(probed_ifaces[i].ip,
@@ -160,10 +153,10 @@ static void interpret_interface(const char *token,
        /* parse it into an IP address/netmasklength pair */
        *p++ = 0;
 
-       ip.s_addr = interpret_addr2(token).addr;
+       ip.s_addr = interpret_addr2(token).s_addr;
 
        if (strlen(p) > 2) {
-               nmask.s_addr = interpret_addr2(p).addr;
+               nmask.s_addr = interpret_addr2(p).s_addr;
        } else {
                nmask.s_addr = htonl(((ALLONES >> atoi(p)) ^ ALLONES));
        }
@@ -172,7 +165,7 @@ static void interpret_interface(const char *token,
        if (ip.s_addr == MKBCADDR(ip.s_addr, nmask.s_addr) ||
            ip.s_addr == MKNETADDR(ip.s_addr, nmask.s_addr)) {
                for (i=0;i<total_probed;i++) {
-                       if (same_net(tov4(ip), tov4(probed_ifaces[i].ip), tov4(nmask))) {
+                       if (same_net(ip, probed_ifaces[i].ip, nmask)) {
                                add_interface(probed_ifaces[i].ip, nmask);
                                return;
                        }
@@ -193,7 +186,7 @@ static void load_interfaces(void)
        const char **ptr;
        int i;
        struct iface_struct ifaces[MAX_INTERFACES];
-       struct ipv4_addr loopback_ip;
+       struct in_addr loopback_ip;
        int total_probed;
 
        if (local_interfaces != NULL) {
@@ -213,7 +206,7 @@ static void load_interfaces(void)
                        DEBUG(0,("ERROR: Could not determine network interfaces, you must use a interfaces config line\n"));
                }
                for (i=0;i<total_probed;i++) {
-                       if (ifaces[i].ip.s_addr != loopback_ip.addr) {
+                       if (ifaces[i].ip.s_addr != loopback_ip.s_addr) {
                                add_interface(ifaces[i].ip, 
                                              ifaces[i].netmask);
                        }
index 499dc93d7bf20bb840f47120217b0b6dd7e96dec..e3676ad71a789d56c8d7d08b96d8d9635c80aedb 100644 (file)
@@ -91,8 +91,8 @@ static NTSTATUS ipv4_connect(struct socket_context *sock,
                             uint32_t flags)
 {
        struct sockaddr_in srv_addr;
-       struct ipv4_addr my_ip;
-       struct ipv4_addr srv_ip;
+       struct in_addr my_ip;
+       struct in_addr srv_ip;
        int ret;
 
        if (my_address && my_address->sockaddr) {
@@ -103,13 +103,13 @@ static NTSTATUS ipv4_connect(struct socket_context *sock,
        } else if (my_address) {
                my_ip = interpret_addr2(my_address->addr);
                
-               if (my_ip.addr != 0 || my_address->port != 0) {
+               if (my_ip.s_addr != 0 || my_address->port != 0) {
                        struct sockaddr_in my_addr;
                        ZERO_STRUCT(my_addr);
 #ifdef HAVE_SOCK_SIN_LEN
                        my_addr.sin_len         = sizeof(my_addr);
 #endif
-                       my_addr.sin_addr.s_addr = my_ip.addr;
+                       my_addr.sin_addr.s_addr = my_ip.s_addr;
                        my_addr.sin_port        = htons(my_address->port);
                        my_addr.sin_family      = PF_INET;
                        
@@ -127,7 +127,7 @@ static NTSTATUS ipv4_connect(struct socket_context *sock,
                }
        } else {
                srv_ip = interpret_addr2(srv_address->addr);
-               if (!srv_ip.addr) {
+               if (!srv_ip.s_addr) {
                        return NT_STATUS_BAD_NETWORK_NAME;
                }
                
@@ -135,7 +135,7 @@ static NTSTATUS ipv4_connect(struct socket_context *sock,
 #ifdef HAVE_SOCK_SIN_LEN
                srv_addr.sin_len        = sizeof(srv_addr);
 #endif
-               srv_addr.sin_addr.s_addr= srv_ip.addr;
+               srv_addr.sin_addr.s_addr= srv_ip.s_addr;
                srv_addr.sin_port       = htons(srv_address->port);
                srv_addr.sin_family     = PF_INET;
 
@@ -158,7 +158,7 @@ static NTSTATUS ipv4_listen(struct socket_context *sock,
                            int queue_size, uint32_t flags)
 {
        struct sockaddr_in my_addr;
-       struct ipv4_addr ip_addr;
+       struct in_addr ip_addr;
        int ret;
 
        socket_set_option(sock, "SO_REUSEADDR=1", NULL);
@@ -172,7 +172,7 @@ static NTSTATUS ipv4_listen(struct socket_context *sock,
 #ifdef HAVE_SOCK_SIN_LEN
                my_addr.sin_len         = sizeof(my_addr);
 #endif
-               my_addr.sin_addr.s_addr = ip_addr.addr;
+               my_addr.sin_addr.s_addr = ip_addr.s_addr;
                my_addr.sin_port        = htons(my_address->port);
                my_addr.sin_family      = PF_INET;
                
@@ -355,17 +355,17 @@ static NTSTATUS ipv4_sendto(struct socket_context *sock,
                             dest_addr->sockaddr, dest_addr->sockaddrlen);
        } else {
                struct sockaddr_in srv_addr;
-               struct ipv4_addr addr;
+               struct in_addr addr;
                
                ZERO_STRUCT(srv_addr);
 #ifdef HAVE_SOCK_SIN_LEN
                srv_addr.sin_len         = sizeof(srv_addr);
 #endif
                addr                     = interpret_addr2(dest_addr->addr);
-               if (addr.addr == 0) {
+               if (addr.s_addr == 0) {
                        return NT_STATUS_HOST_UNREACHABLE;
                }
-               srv_addr.sin_addr.s_addr = addr.addr;
+               srv_addr.sin_addr.s_addr = addr.s_addr;
                srv_addr.sin_port        = htons(dest_addr->port);
                srv_addr.sin_family      = PF_INET;
                
index 144cfa3e35630bdae7a030f539d951a8cc59d757..8037c6de0ad82ac02402c51c998dffef2b1d2eb5 100644 (file)
@@ -203,10 +203,10 @@ NTSTATUS tdr_print_charset(struct tdr_print *tdr, const char *name, const char *
 NTSTATUS tdr_pull_ipv4address(struct tdr_pull *tdr, TALLOC_CTX *ctx, 
                                                          const char **address)
 {
-       struct ipv4_addr in;
-       TDR_CHECK(tdr_pull_uint32(tdr, ctx, &in.addr));
-       in.addr = htonl(in.addr);
-       *address = talloc_strdup(tdr, sys_inet_ntoa(in));
+       struct in_addr in;
+       TDR_CHECK(tdr_pull_uint32(tdr, ctx, &in.s_addr));
+       in.s_addr = htonl(in.s_addr);
+       *address = talloc_strdup(tdr, inet_ntoa(in));
        NT_STATUS_HAVE_NO_MEMORY(*address);
        return NT_STATUS_OK;
 }
index 1ebc6e7e0f66a2a92981a88325e6c185e5c3d352..9bd180023356cff1970acf352e9c1776ddbe37b6 100644 (file)
@@ -79,19 +79,12 @@ _PUBLIC_ struct hostent *sys_gethostbyname(const char *name)
 #endif /* REDUCE_ROOT_DNS_LOOKUPS */
 }
 
-_PUBLIC_ const char *sys_inet_ntoa(struct ipv4_addr in)
-{
-       struct in_addr in2;
-       in2.s_addr = in.addr;
-       return inet_ntoa(in2);
-}
-
-_PUBLIC_ struct ipv4_addr sys_inet_makeaddr(int net, int host)
+_PUBLIC_ struct in_addr sys_inet_makeaddr(int net, int host)
 {
        struct in_addr in;
-       struct ipv4_addr in2;
+       struct in_addr in2;
        in = inet_makeaddr(net, host);
-       in2.addr = in.s_addr;
+       in2.s_addr = in.s_addr;
        return in2;
 }
 
index 624315f99e4106571363ab0063a76d86f3ac18d6..2a2813f9af565f71874f62830eb24e46915a36fe 100644 (file)
@@ -285,11 +285,11 @@ _PUBLIC_ uint32_t interpret_addr(const char *str)
 /**
  A convenient addition to interpret_addr().
 **/
-_PUBLIC_ struct ipv4_addr interpret_addr2(const char *str)
+_PUBLIC_ struct in_addr interpret_addr2(const char *str)
 {
-       struct ipv4_addr ret;
+       struct in_addr ret;
        uint32_t a = interpret_addr(str);
-       ret.addr = a;
+       ret.s_addr = a;
        return ret;
 }
 
@@ -297,22 +297,22 @@ _PUBLIC_ struct ipv4_addr interpret_addr2(const char *str)
  Check if an IP is the 0.0.0.0.
 **/
 
-_PUBLIC_ bool is_zero_ip(struct ipv4_addr ip)
+_PUBLIC_ bool is_zero_ip(struct in_addr ip)
 {
-       return ip.addr == 0;
+       return ip.s_addr == 0;
 }
 
 /**
  Are two IPs on the same subnet?
 **/
 
-_PUBLIC_ bool same_net(struct ipv4_addr ip1,struct ipv4_addr ip2,struct ipv4_addr mask)
+_PUBLIC_ bool same_net(struct in_addr ip1, struct in_addr ip2, struct in_addr mask)
 {
        uint32_t net1,net2,nmask;
 
-       nmask = ntohl(mask.addr);
-       net1  = ntohl(ip1.addr);
-       net2  = ntohl(ip2.addr);
+       nmask = ntohl(mask.s_addr);
+       net1  = ntohl(ip1.s_addr);
+       net2  = ntohl(ip2.s_addr);
             
        return((net1 & nmask) == (net2 & nmask));
 }
index 1960aa6196a18c80182d6ef97d0b21bbd8ba4ebd..71880c1c1a59a77fcf79947b6d00058bcf25e20e 100644 (file)
@@ -254,13 +254,7 @@ void CatchChildLeaveStatus(void);
 /* The following definitions come from lib/util/system.c  */
 
 
-/*
-  we use struct ipv4_addr to avoid having to include all the
-  system networking headers everywhere
-*/
-struct ipv4_addr {
-       uint32_t addr;
-};
+struct in_addr;
 
 /**************************************************************************
 A wrapper for gethostbyname() that tries avoids looking up hostnames 
@@ -268,8 +262,8 @@ in the root domain, which can cause dial-on-demand links to come up for no
 apparent reason.
 ****************************************************************************/
 _PUBLIC_ struct hostent *sys_gethostbyname(const char *name);
-_PUBLIC_ const char *sys_inet_ntoa(struct ipv4_addr in);
-_PUBLIC_ struct ipv4_addr sys_inet_makeaddr(int net, int host);
+_PUBLIC_ const char *sys_inet_ntoa(struct in_addr in);
+_PUBLIC_ struct in_addr sys_inet_makeaddr(int net, int host);
 
 /* The following definitions come from lib/util/genrand.c  */
 
@@ -676,17 +670,17 @@ _PUBLIC_ uint32_t interpret_addr(const char *str);
 /**
  A convenient addition to interpret_addr().
 **/
-_PUBLIC_ struct ipv4_addr interpret_addr2(const char *str);
+_PUBLIC_ struct in_addr interpret_addr2(const char *str);
 
 /**
  Check if an IP is the 0.0.0.0.
 **/
-_PUBLIC_ bool is_zero_ip(struct ipv4_addr ip);
+_PUBLIC_ bool is_zero_ip(struct in_addr ip);
 
 /**
  Are two IPs on the same subnet?
 **/
-_PUBLIC_ bool same_net(struct ipv4_addr ip1,struct ipv4_addr ip2,struct ipv4_addr mask);
+_PUBLIC_ bool same_net(struct in_addr ip1,struct in_addr ip2,struct in_addr mask);
 
 /**
  Check if a process exists. Does this work on all unixes?
index ec394309ef454529a32048a17592e9718487650f..e98bbc51b221e69d1c9074a00bf744341f15cb3c 100644 (file)
@@ -65,14 +65,14 @@ static int host_destructor(struct host_state *state)
 static void run_child(struct composite_context *c, int fd)
 {
        struct host_state *state = talloc_get_type(c->private_data, struct host_state);
-       struct ipv4_addr ip;
+       struct in_addr ip;
        const char *address;
 
        /* this is the blocking call we are going to lots of trouble
           to avoid in the parent */
        ip = interpret_addr2(state->name.name);
 
-       address = sys_inet_ntoa(ip);
+       address = inet_ntoa(ip);
        if (address != NULL) {
                write(fd, address, strlen(address)+1);
        }
index 02e1fbdc04bae9a460a88f5f379ec9ec4c7f8385..24113db9f068761b57056e0aef40b9f9a4aa910e 100644 (file)
@@ -25,6 +25,7 @@
 #include "libcli/resolve/resolve.h"
 #include "librpc/gen_ndr/ndr_nbt.h"
 #include "param/param.h"
+#include "system/network.h"
 
 struct resolve_state {
        struct nbt_name name;
@@ -151,8 +152,8 @@ struct composite_context *resolve_name_send(struct nbt_name *name, struct event_
 
        if (is_ipaddress(state->name.name) || 
            strcasecmp(state->name.name, "localhost") == 0) {
-               struct ipv4_addr ip = interpret_addr2(state->name.name);
-               state->reply_addr = talloc_strdup(state, sys_inet_ntoa(ip));
+               struct in_addr ip = interpret_addr2(state->name.name);
+               state->reply_addr = talloc_strdup(state, inet_ntoa(ip));
                if (composite_nomem(state->reply_addr, c)) return c;
                composite_done(c);
                return c;
index d110a25aeb706d8752f759936e19296f5ba09971..64d5da44f9e9cbd57c5074e5837585112422161e 100644 (file)
@@ -329,7 +329,7 @@ NTSTATUS ndr_push_dom_sid28(struct ndr_push *ndr, int ndr_flags, const struct do
 NTSTATUS ndr_pull_dom_sid28(struct ndr_pull *ndr, int ndr_flags, struct dom_sid *sid);
 void ndr_print_dom_sid28(struct ndr_print *ndr, const char *name, const struct dom_sid *sid);
 size_t ndr_size_dom_sid28(const struct dom_sid *sid, int flags);
-void ndr_print_ipv4_addr(struct ndr_print *ndr, const char *name, const struct ipv4_addr *_ip);
+void ndr_print_ipv4_addr(struct ndr_print *ndr, const char *name, const struct in_addr *_ip);
 void ndr_print_GUID(struct ndr_print *ndr, const char *name, const struct GUID *guid);
 
 #endif /* __LIBNDR_H__ */
index c0a021e677532a18747b697b3b3349c30d415665..a26b67af226c54826ce9165d9ce959ac64e9c7d6 100644 (file)
@@ -585,10 +585,10 @@ _PUBLIC_ NTSTATUS ndr_pull_time_t(struct ndr_pull *ndr, int ndr_flags, time_t *t
 */
 _PUBLIC_ NTSTATUS ndr_pull_ipv4address(struct ndr_pull *ndr, int ndr_flags, const char **address)
 {
-       struct ipv4_addr in;
-       NDR_CHECK(ndr_pull_uint32(ndr, ndr_flags, &in.addr));
-       in.addr = htonl(in.addr);
-       *address = talloc_strdup(ndr->current_mem_ctx, sys_inet_ntoa(in));
+       struct in_addr in;
+       NDR_CHECK(ndr_pull_uint32(ndr, ndr_flags, &in.s_addr));
+       in.s_addr = htonl(in.s_addr);
+       *address = talloc_strdup(ndr->current_mem_ctx, inet_ntoa(in));
        NT_STATUS_HAVE_NO_MEMORY(*address);
        return NT_STATUS_OK;
 }
index a3d34643a16dbaa27d68e1423c27f424b74e0cbb..be7dab93d264c122828ce985f30b257ce7fe63cf 100644 (file)
 #include "system/network.h"
 #include "librpc/ndr/libndr.h"
 
-_PUBLIC_ void ndr_print_ipv4_addr(struct ndr_print *ndr, const char *name, const struct ipv4_addr *_ip)
+_PUBLIC_ void ndr_print_in_addr(struct ndr_print *ndr, const char *name, const struct in_addr *_ip)
 {
-       struct ipv4_addr ip;
+       struct in_addr ip;
 
-       ip.addr = htonl(_ip->addr);
+       ip.s_addr = htonl(_ip->s_addr);
 
-       ndr->print(ndr, "%-25s: %s", name, sys_inet_ntoa(ip));
+       ndr->print(ndr, "%-25s: %s", name, inet_ntoa(ip));
 }
 
 _PUBLIC_ void ndr_print_GUID(struct ndr_print *ndr, const char *name, const struct GUID *guid)
index f2a875142a8ae5fc2f8214c8ac4a839d429dbb9d..2f51cc3dec5fb4ea75c5164be6259e09a6eba07a 100644 (file)
@@ -233,7 +233,7 @@ NTSTATUS nbtd_startup_interfaces(struct nbtd_server *nbtsrv)
                if (num_interfaces > 0) {
                        primary_address = iface_n_ip(0);
                } else {
-                       primary_address = sys_inet_ntoa(interpret_addr2(
+                       primary_address = inet_ntoa(interpret_addr2(
                                                        lp_netbios_name(global_loadparm)));
                }
                primary_address = talloc_strdup(tmp_ctx, primary_address);
index 2ff5e3f69b5b13eb4d276583186552f96e3cad5a..bce80702df29dd5ea352a529934f4a9bf997ff7c 100644 (file)
@@ -560,13 +560,13 @@ done:
        nbtd_name_registration_reply(nbtsock, packet, src, rcode);
 }
 
-static uint32_t ipv4_match_bits(struct ipv4_addr ip1,struct ipv4_addr ip2)
+static uint32_t ipv4_match_bits(struct in_addr ip1, struct in_addr ip2)
 {
        uint32_t i, j, match=0;
        uint8_t *p1, *p2;
 
-       p1 = (uint8_t *)&ip1.addr;
-       p2 = (uint8_t *)&ip2.addr;
+       p1 = (uint8_t *)&ip1.s_addr;
+       p2 = (uint8_t *)&ip2.s_addr;
 
        for (i=0; i<4; i++) {
                if (p1[i] != p2[i]) break;
index 7c9ef50cf5e7a434717490842fb5712ad894e9f0..36ec2a54e4b70ef4d1680c40ac596eb1919bd3e3 100644 (file)
@@ -25,6 +25,7 @@
 #include "lib/samba3/samba3.h"
 #include "libcli/security/security.h"
 #include "librpc/gen_ndr/ndr_misc.h"
+#include "system/network.h"
 
 
 static struct MprVar mprRegistry(struct samba3_regdb *reg)
@@ -407,7 +408,7 @@ static struct MprVar mprWinsEntries(struct samba3 *samba3)
 
                for (j = 0; j < samba3->winsdb_entries[i].ip_count; j++) {
                        const char *addr;
-                       addr = sys_inet_ntoa(samba3->winsdb_entries[i].ips[j]);
+                       addr = inet_ntoa(samba3->winsdb_entries[i].ips[j]);
                        mprAddArray(&ips, j, mprString(addr));
                }
 
index 9b8050eac1f3b7076536881f2156cd895d7be4e6..b87b59b81a00c18d9aa74926898b7973acf08d63 100644 (file)
@@ -23,6 +23,7 @@
 #include "lib/events/events.h"
 #include "libcli/resolve/resolve.h"
 #include "torture/torture.h"
+#include "system/network.h"
 
 static bool test_async_resolve(struct torture_context *tctx)
 {
@@ -68,7 +69,7 @@ static bool test_sync_resolve(struct torture_context *tctx)
        torture_comment(tctx, "Testing sync resolve of '%s' for %d seconds\n", 
                        host, timelimit);
        while (timeval_elapsed(&tv) < timelimit) {
-               sys_inet_ntoa(interpret_addr2(host));
+               inet_ntoa(interpret_addr2(host));
                count++;
        }