summaryrefslogtreecommitdiff
path: root/source4/lib/util
diff options
context:
space:
mode:
authorJelmer Vernooij <jelmer@samba.org>2007-10-13 20:24:37 +0200
committerStefan Metzmacher <metze@samba.org>2007-12-21 05:43:00 +0100
commitb09047b78e981af8ade6a72d426bfcb0e742995b (patch)
tree2547a72c9814f190d83cb0f8ecac678976a72ff5 /source4/lib/util
parent8517878144973aa23e653bfc7aabfbaef500c7e2 (diff)
downloadsamba-b09047b78e981af8ade6a72d426bfcb0e742995b.tar.gz
samba-b09047b78e981af8ade6a72d426bfcb0e742995b.tar.bz2
samba-b09047b78e981af8ade6a72d426bfcb0e742995b.zip
r25624: Remove ipv4_addr hack. Only causes 4 extra includes of system/network.h because we stripped down includes.
(This used to be commit 262c1c23a61f1f4fae13e0a61179fe98b682cecf)
Diffstat (limited to 'source4/lib/util')
-rw-r--r--source4/lib/util/system.c13
-rw-r--r--source4/lib/util/util.c18
-rw-r--r--source4/lib/util/util.h18
3 files changed, 18 insertions, 31 deletions
diff --git a/source4/lib/util/system.c b/source4/lib/util/system.c
index 1ebc6e7e0f..9bd1800233 100644
--- a/source4/lib/util/system.c
+++ b/source4/lib/util/system.c
@@ -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;
}
diff --git a/source4/lib/util/util.c b/source4/lib/util/util.c
index 624315f99e..2a2813f9af 100644
--- a/source4/lib/util/util.c
+++ b/source4/lib/util/util.c
@@ -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));
}
diff --git a/source4/lib/util/util.h b/source4/lib/util/util.h
index 1960aa6196..71880c1c1a 100644
--- a/source4/lib/util/util.h
+++ b/source4/lib/util/util.h
@@ -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?