diff options
author | Andrew Tridgell <tridge@samba.org> | 2004-11-02 03:58:27 +0000 |
---|---|---|
committer | Gerald (Jerry) Carter <jerry@samba.org> | 2007-10-10 13:05:15 -0500 |
commit | 5011f901aa0140ed60a0b58e80ab0f14810ba432 (patch) | |
tree | 379ad85e8627394a47bbac5e783e0955a5a5d481 /source4 | |
parent | 2f7d7e47e38d88655baddad4e2e0572d4c158f70 (diff) | |
download | samba-5011f901aa0140ed60a0b58e80ab0f14810ba432.tar.gz samba-5011f901aa0140ed60a0b58e80ab0f14810ba432.tar.xz samba-5011f901aa0140ed60a0b58e80ab0f14810ba432.zip |
r3457: s_addr is a macro on solaris, so we can't use it in structure names. arrgh.
(This used to be commit 7842b23d01c53009259a2461600bd01159cecebf)
Diffstat (limited to 'source4')
-rw-r--r-- | source4/include/includes.h | 2 | ||||
-rw-r--r-- | source4/include/smb_macros.h | 1 | ||||
-rw-r--r-- | source4/lib/netif/interface.c | 30 | ||||
-rw-r--r-- | source4/lib/socket/socket_ipv4.c | 8 | ||||
-rw-r--r-- | source4/lib/system.c | 4 | ||||
-rw-r--r-- | source4/lib/util.c | 8 | ||||
-rw-r--r-- | source4/lib/util_sock.c | 4 | ||||
-rw-r--r-- | source4/lib/util_strlist.c | 2 | ||||
-rw-r--r-- | source4/libcli/namequery.c | 14 | ||||
-rw-r--r-- | source4/libcli/namequery_dc.c | 2 | ||||
-rw-r--r-- | source4/librpc/rpc/dcerpc_util.c | 2 | ||||
-rw-r--r-- | source4/torture/rpc/epmapper.c | 2 |
12 files changed, 40 insertions, 39 deletions
diff --git a/source4/include/includes.h b/source4/include/includes.h index ce8f81c5397..dca1824b228 100644 --- a/source4/include/includes.h +++ b/source4/include/includes.h @@ -169,7 +169,7 @@ typedef int socklen_t; system networking headers everywhere */ struct ipv4_addr { - uint32_t s_addr; + uint32_t addr; }; #ifndef MIN diff --git a/source4/include/smb_macros.h b/source4/include/smb_macros.h index 84978f4f709..02c8fc3af4d 100644 --- a/source4/include/smb_macros.h +++ b/source4/include/smb_macros.h @@ -130,6 +130,7 @@ true if two IP addresses are equal ****************************************************************************/ #define ip_equal(ip1,ip2) ((ip1).s_addr == (ip2).s_addr) +#define ipv4_equal(ip1,ip2) ((ip1).addr == (ip2).addr) /***************************************************************** splits out the last subkey of a key diff --git a/source4/lib/netif/interface.c b/source4/lib/netif/interface.c index 75fdf8c9762..1db0f5caee5 100644 --- a/source4/lib/netif/interface.c +++ b/source4/lib/netif/interface.c @@ -45,7 +45,7 @@ static struct interface *local_interfaces; static struct ipv4_addr tov4(struct in_addr in) { struct ipv4_addr in2; - in2.s_addr = in.s_addr; + in2.addr = in.s_addr; return in2; } @@ -60,7 +60,7 @@ static struct interface *iface_find(struct in_addr ip, BOOL CheckMask) 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).s_addr == ip.s_addr) return i; + } else if (i->ip.addr == ip.s_addr) return i; return NULL; } @@ -77,7 +77,7 @@ static void add_interface(struct in_addr ip, struct in_addr nmask) return; } - if (ip_equal(nmask, allones_ip)) { + if (nmask.s_addr == allones_ip.addr) { DEBUG(3,("not adding non-broadcast interface %s\n",inet_ntoa(ip))); return; } @@ -89,7 +89,7 @@ static void add_interface(struct in_addr ip, struct in_addr nmask) iface->ip = tov4(ip); iface->nmask = tov4(nmask); - iface->bcast.s_addr = MKBCADDR(iface->ip.s_addr, iface->nmask.s_addr); + iface->bcast.addr = MKBCADDR(iface->ip.addr, iface->nmask.addr); DLIST_ADD(local_interfaces, iface); @@ -133,10 +133,10 @@ static void interpret_interface(TALLOC_CTX *mem_ctx, const char *token) /* maybe it is a DNS name */ p = strchr_m(token,'/'); if (!p) { - ip.s_addr = interpret_addr2(token).s_addr; + ip.s_addr = interpret_addr2(token).addr; for (i=0;i<total_probed;i++) { if (ip.s_addr == probed_ifaces[i].ip.s_addr && - !ip_equal(allones_ip, probed_ifaces[i].netmask)) { + allones_ip.addr != probed_ifaces[i].netmask.s_addr) { add_interface(probed_ifaces[i].ip, probed_ifaces[i].netmask); return; @@ -149,10 +149,10 @@ static void interpret_interface(TALLOC_CTX *mem_ctx, const char *token) /* parse it into an IP address/netmasklength pair */ *p++ = 0; - ip.s_addr = interpret_addr2(token).s_addr; + ip.s_addr = interpret_addr2(token).addr; if (strlen(p) > 2) { - nmask.s_addr = interpret_addr2(p).s_addr; + nmask.s_addr = interpret_addr2(p).addr; } else { nmask.s_addr = htonl(((ALLONES >> atoi(p)) ^ ALLONES)); } @@ -219,8 +219,8 @@ void load_interfaces(void) exit(1); } for (i=0;i<total_probed;i++) { - if (probed_ifaces[i].netmask.s_addr != allones_ip.s_addr && - probed_ifaces[i].ip.s_addr != loopback_ip.s_addr) { + if (probed_ifaces[i].netmask.s_addr != allones_ip.addr && + probed_ifaces[i].ip.s_addr != loopback_ip.addr) { add_interface(probed_ifaces[i].ip, probed_ifaces[i].netmask); } @@ -270,7 +270,7 @@ BOOL ismyip(struct ipv4_addr ip) { struct interface *i; for (i=local_interfaces;i;i=i->next) - if (ip_equal(i->ip,ip)) return True; + if (ipv4_equal(i->ip,ip)) return True; return False; } @@ -281,8 +281,8 @@ BOOL is_local_net(struct ipv4_addr from) { struct interface *i; for (i=local_interfaces;i;i=i->next) { - if((from.s_addr & i->nmask.s_addr) == - (i->ip.s_addr & i->nmask.s_addr)) + if((from.addr & i->nmask.addr) == + (i->ip.addr & i->nmask.addr)) return True; } return False; @@ -339,7 +339,7 @@ struct ipv4_addr *iface_ip(struct ipv4_addr ip) { struct in_addr in; struct interface *i; - in.s_addr = ip.s_addr; + in.s_addr = ip.addr; i = iface_find(in, True); return(i ? &i->ip : &local_interfaces->ip); } @@ -350,6 +350,6 @@ struct ipv4_addr *iface_ip(struct ipv4_addr ip) BOOL iface_local(struct ipv4_addr ip) { struct in_addr in; - in.s_addr = ip.s_addr; + in.s_addr = ip.addr; return iface_find(in, True) ? True : False; } diff --git a/source4/lib/socket/socket_ipv4.c b/source4/lib/socket/socket_ipv4.c index 263f5aa2550..eebbd61219b 100644 --- a/source4/lib/socket/socket_ipv4.c +++ b/source4/lib/socket/socket_ipv4.c @@ -48,13 +48,13 @@ static NTSTATUS ipv4_tcp_connect(struct socket_context *sock, my_ip = interpret_addr2(my_address); - if (my_ip.s_addr != 0 || my_port != 0) { + if (my_ip.addr != 0 || my_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.s_addr; + my_addr.sin_addr.s_addr = my_ip.addr; my_addr.sin_port = htons(my_port); my_addr.sin_family = PF_INET; @@ -70,7 +70,7 @@ static NTSTATUS ipv4_tcp_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.s_addr; + srv_addr.sin_addr.s_addr= srv_ip.addr; srv_addr.sin_port = htons(srv_port); srv_addr.sin_family = PF_INET; @@ -105,7 +105,7 @@ static NTSTATUS ipv4_tcp_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.s_addr; + my_addr.sin_addr.s_addr = ip_addr.addr; my_addr.sin_port = htons(port); my_addr.sin_family = PF_INET; diff --git a/source4/lib/system.c b/source4/lib/system.c index 5e106c96eb5..d50005e8c8b 100644 --- a/source4/lib/system.c +++ b/source4/lib/system.c @@ -540,7 +540,7 @@ int sys_dup2(int oldfd, int newfd) const char *sys_inet_ntoa(struct ipv4_addr in) { struct in_addr in2; - in2.s_addr = in.s_addr; + in2.s_addr = in.addr; return inet_ntoa(in2); } @@ -554,7 +554,7 @@ struct ipv4_addr sys_inet_makeaddr(int net, int host) struct in_addr in; struct ipv4_addr in2; in = inet_makeaddr(net, host); - in2.s_addr = in.s_addr; + in2.addr = in.s_addr; return in2; } diff --git a/source4/lib/util.c b/source4/lib/util.c index 2ce34f58d99..5385174ce45 100644 --- a/source4/lib/util.c +++ b/source4/lib/util.c @@ -452,7 +452,7 @@ struct ipv4_addr interpret_addr2(const char *str) { struct ipv4_addr ret; uint32_t a = interpret_addr(str); - ret.s_addr = a; + ret.addr = a; return ret; } @@ -486,9 +486,9 @@ BOOL same_net(struct ipv4_addr ip1,struct ipv4_addr ip2,struct ipv4_addr mask) { uint32_t net1,net2,nmask; - nmask = ntohl(mask.s_addr); - net1 = ntohl(ip1.s_addr); - net2 = ntohl(ip2.s_addr); + nmask = ntohl(mask.addr); + net1 = ntohl(ip1.addr); + net2 = ntohl(ip2.addr); return((net1 & nmask) == (net2 & nmask)); } diff --git a/source4/lib/util_sock.c b/source4/lib/util_sock.c index dbd71b58b6f..876698535ba 100644 --- a/source4/lib/util_sock.c +++ b/source4/lib/util_sock.c @@ -170,7 +170,7 @@ ssize_t read_udp_socket(int fd, char *buf, size_t len, } if (from_addr) { - from_addr->s_addr = sock.sin_addr.s_addr; + from_addr->addr = sock.sin_addr.s_addr; } if (from_port) { *from_port = ntohs(sock.sin_port); @@ -512,7 +512,7 @@ char *get_socket_name(TALLOC_CTX *mem_ctx, int fd, BOOL force_lookup) addr = interpret_addr2(p); /* Look up the remote host name. */ - if ((hp = gethostbyaddr((char *)&addr.s_addr, sizeof(addr.s_addr), AF_INET)) == 0) { + if ((hp = gethostbyaddr((char *)&addr.addr, sizeof(addr.addr), AF_INET)) == 0) { DEBUG(1,("Gethostbyaddr failed for %s\n",p)); name_buf = talloc_strdup(mem_ctx, p); } else { diff --git a/source4/lib/util_strlist.c b/source4/lib/util_strlist.c index 0b32955ac20..db459b2f0fc 100644 --- a/source4/lib/util_strlist.c +++ b/source4/lib/util_strlist.c @@ -297,7 +297,7 @@ int ipstr_list_parse(const char* ipstr_list, struct ipv4_addr** ip_list) struct ipv4_addr addr; /* convert single token to ip address */ - if ( (addr.s_addr = sys_inet_addr(token_str)) == INADDR_NONE ) + if ( (addr.addr = sys_inet_addr(token_str)) == INADDR_NONE ) break; /* prepare place for another in_addr structure */ diff --git a/source4/libcli/namequery.c b/source4/libcli/namequery.c index 8dae5e1206d..2a67df5ffd2 100644 --- a/source4/libcli/namequery.c +++ b/source4/libcli/namequery.c @@ -236,8 +236,8 @@ int ip_compare(struct ipv4_addr *ip1, struct ipv4_addr *ip2) struct ipv4_addr ip; int bits1, bits2; ip = *iface_n_bcast(i); - bits1 = matching_quad_bits((uint8_t *)&ip1->s_addr, (uint8_t *)&ip.s_addr); - bits2 = matching_quad_bits((uint8_t *)&ip2->s_addr, (uint8_t *)&ip.s_addr); + bits1 = matching_quad_bits((uint8_t *)&ip1->addr, (uint8_t *)&ip.addr); + bits2 = matching_quad_bits((uint8_t *)&ip2->addr, (uint8_t *)&ip.addr); max_bits1 = MAX(bits1, max_bits1); max_bits2 = MAX(bits2, max_bits2); } @@ -678,7 +678,7 @@ BOOL resolve_wins(TALLOC_CTX *mem_ctx, const char *name, int name_type, DEBUG(3,("resolve_wins: using WINS server %s and tag '%s'\n", sys_inet_ntoa(wins_ip), wins_tags[t])); - sock = open_socket_in(SOCK_DGRAM, 0, 3, src_ip.s_addr, True); + sock = open_socket_in(SOCK_DGRAM, 0, 3, src_ip.addr, True); if (sock == -1) { continue; } @@ -776,12 +776,12 @@ static BOOL internal_resolve_name(TALLOC_CTX *mem_ctx, const char *name, int nam } if(is_address) { /* if it's in the form of an IP address then get the lib to interpret it */ - if (((*return_iplist)->s_addr = inet_addr(name)) == 0xFFFFFFFF ){ + if (((*return_iplist)->addr = inet_addr(name)) == 0xFFFFFFFF ){ DEBUG(1,("internal_resolve_name: inet_addr failed on %s\n", name)); return False; } } else { - (*return_iplist)->s_addr = allones ? 0xFFFFFFFF : 0; + (*return_iplist)->addr = allones ? 0xFFFFFFFF : 0; *return_count = 1; } return True; @@ -854,7 +854,7 @@ static BOOL internal_resolve_name(TALLOC_CTX *mem_ctx, const char *name, int nam int j; for (j = i + 1; j < *return_count; j++) { - if (ip_equal((*return_iplist)[i], + if (ipv4_equal((*return_iplist)[i], (*return_iplist)[j])) { is_dupe = True; break; @@ -1312,7 +1312,7 @@ BOOL get_dc_list(TALLOC_CTX *mem_ctx, const char *domain, struct ipv4_addr **ip_ continue; for ( j=i+1; j<local_count; j++ ) { - if ( ip_equal( return_iplist[i], return_iplist[j]) ) + if ( ipv4_equal( return_iplist[i], return_iplist[j]) ) zero_ip(&return_iplist[j]); } } diff --git a/source4/libcli/namequery_dc.c b/source4/libcli/namequery_dc.c index 6c341af4010..130a924b0e8 100644 --- a/source4/libcli/namequery_dc.c +++ b/source4/libcli/namequery_dc.c @@ -62,7 +62,7 @@ BOOL rpc_find_dc(const char *domain, fstring srv_name, struct ipv4_addr *ip_out) if ( use_pdc_only ) { for (i = 0; i < count; i++) { - if (ip_equal( exclude_ip, ip_list[i])) + if (ipv4_equal( exclude_ip, ip_list[i])) zero_ip(&ip_list[i]); } } diff --git a/source4/librpc/rpc/dcerpc_util.c b/source4/librpc/rpc/dcerpc_util.c index db30354609e..af92743ccb1 100644 --- a/source4/librpc/rpc/dcerpc_util.c +++ b/source4/librpc/rpc/dcerpc_util.c @@ -387,7 +387,7 @@ const char *dcerpc_floor_get_rhs_data(TALLOC_CTX *mem_ctx, struct epm_floor *flo { struct ipv4_addr in; - in.s_addr = htonl(floor->rhs.ip.address); + in.addr = htonl(floor->rhs.ip.address); return talloc_strdup(mem_ctx, sys_inet_ntoa(in)); } diff --git a/source4/torture/rpc/epmapper.c b/source4/torture/rpc/epmapper.c index 78721d075e0..714e6f3f8c1 100644 --- a/source4/torture/rpc/epmapper.c +++ b/source4/torture/rpc/epmapper.c @@ -66,7 +66,7 @@ static void display_tower(TALLOC_CTX *mem_ctx, struct epm_tower *twr) printf(" IP:"); { struct ipv4_addr in; - in.s_addr = htonl(rhs->ip.address); + in.addr = htonl(rhs->ip.address); printf("%s", sys_inet_ntoa(in)); } break; |