system networking headers everywhere
*/
struct ipv4_addr {
- uint32_t s_addr;
+ uint32_t addr;
};
#ifndef MIN
****************************************************************************/
#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
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;
}
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;
}
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;
}
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);
/* 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;
/* 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));
}
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);
}
{
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;
}
{
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;
{
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);
}
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;
}
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;
#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;
#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;
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);
}
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;
}
{
struct ipv4_addr ret;
uint32_t a = interpret_addr(str);
- ret.s_addr = a;
+ ret.addr = a;
return ret;
}
{
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));
}
}
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);
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 {
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 */
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);
}
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;
}
}
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;
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;
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]);
}
}
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]);
}
}
{
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));
}
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;