Commit e6f1cebf authored by Al Viro's avatar Al Viro Committed by David S. Miller

[NET] endianness noise: INADDR_ANY

Signed-off-by: default avatarAl Viro <viro@zeniv.linux.org.uk>
Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
parent fc4d30a6
...@@ -659,7 +659,7 @@ sunos_nfs_get_server_fd (int fd, struct sockaddr_in *addr) ...@@ -659,7 +659,7 @@ sunos_nfs_get_server_fd (int fd, struct sockaddr_in *addr)
socket = SOCKET_I(inode); socket = SOCKET_I(inode);
local.sin_family = AF_INET; local.sin_family = AF_INET;
local.sin_addr.s_addr = INADDR_ANY; local.sin_addr.s_addr = htonl(INADDR_ANY);
/* IPPORT_RESERVED = 1024, can't find the definition in the kernel */ /* IPPORT_RESERVED = 1024, can't find the definition in the kernel */
try_port = 1024; try_port = 1024;
......
...@@ -618,7 +618,7 @@ sunos_nfs_get_server_fd (int fd, struct sockaddr_in *addr) ...@@ -618,7 +618,7 @@ sunos_nfs_get_server_fd (int fd, struct sockaddr_in *addr)
socket = SOCKET_I(inode); socket = SOCKET_I(inode);
local.sin_family = AF_INET; local.sin_family = AF_INET;
local.sin_addr.s_addr = INADDR_ANY; local.sin_addr.s_addr = htonl(INADDR_ANY);
/* IPPORT_RESERVED = 1024, can't find the definition in the kernel */ /* IPPORT_RESERVED = 1024, can't find the definition in the kernel */
try_port = 1024; try_port = 1024;
......
...@@ -632,7 +632,7 @@ static int nfs_verify_server_address(struct sockaddr *addr) ...@@ -632,7 +632,7 @@ static int nfs_verify_server_address(struct sockaddr *addr)
switch (addr->sa_family) { switch (addr->sa_family) {
case AF_INET: { case AF_INET: {
struct sockaddr_in *sa = (struct sockaddr_in *)addr; struct sockaddr_in *sa = (struct sockaddr_in *)addr;
return sa->sin_addr.s_addr != INADDR_ANY; return sa->sin_addr.s_addr != htonl(INADDR_ANY);
} }
case AF_INET6: { case AF_INET6: {
struct in6_addr *sa = &((struct sockaddr_in6 *)addr)->sin6_addr; struct in6_addr *sa = &((struct sockaddr_in6 *)addr)->sin6_addr;
......
...@@ -458,7 +458,7 @@ int inet_bind(struct socket *sock, struct sockaddr *uaddr, int addr_len) ...@@ -458,7 +458,7 @@ int inet_bind(struct socket *sock, struct sockaddr *uaddr, int addr_len)
err = -EADDRNOTAVAIL; err = -EADDRNOTAVAIL;
if (!sysctl_ip_nonlocal_bind && if (!sysctl_ip_nonlocal_bind &&
!inet->freebind && !inet->freebind &&
addr->sin_addr.s_addr != INADDR_ANY && addr->sin_addr.s_addr != htonl(INADDR_ANY) &&
chk_addr_ret != RTN_LOCAL && chk_addr_ret != RTN_LOCAL &&
chk_addr_ret != RTN_MULTICAST && chk_addr_ret != RTN_MULTICAST &&
chk_addr_ret != RTN_BROADCAST) chk_addr_ret != RTN_BROADCAST)
......
...@@ -583,7 +583,7 @@ static int do_ip_setsockopt(struct sock *sk, int level, ...@@ -583,7 +583,7 @@ static int do_ip_setsockopt(struct sock *sk, int level,
} }
if (!mreq.imr_ifindex) { if (!mreq.imr_ifindex) {
if (mreq.imr_address.s_addr == INADDR_ANY) { if (mreq.imr_address.s_addr == htonl(INADDR_ANY)) {
inet->mc_index = 0; inet->mc_index = 0;
inet->mc_addr = 0; inet->mc_addr = 0;
err = 0; err = 0;
......
...@@ -103,6 +103,7 @@ ...@@ -103,6 +103,7 @@
- '3' from resolv.h */ - '3' from resolv.h */
#define NONE __constant_htonl(INADDR_NONE) #define NONE __constant_htonl(INADDR_NONE)
#define ANY __constant_htonl(INADDR_ANY)
/* /*
* Public IP configuration * Public IP configuration
...@@ -1479,19 +1480,19 @@ static int __init ip_auto_config_setup(char *addrs) ...@@ -1479,19 +1480,19 @@ static int __init ip_auto_config_setup(char *addrs)
DBG(("IP-Config: Parameter #%d: `%s'\n", num, ip)); DBG(("IP-Config: Parameter #%d: `%s'\n", num, ip));
switch (num) { switch (num) {
case 0: case 0:
if ((ic_myaddr = in_aton(ip)) == INADDR_ANY) if ((ic_myaddr = in_aton(ip)) == ANY)
ic_myaddr = NONE; ic_myaddr = NONE;
break; break;
case 1: case 1:
if ((ic_servaddr = in_aton(ip)) == INADDR_ANY) if ((ic_servaddr = in_aton(ip)) == ANY)
ic_servaddr = NONE; ic_servaddr = NONE;
break; break;
case 2: case 2:
if ((ic_gateway = in_aton(ip)) == INADDR_ANY) if ((ic_gateway = in_aton(ip)) == ANY)
ic_gateway = NONE; ic_gateway = NONE;
break; break;
case 3: case 3:
if ((ic_netmask = in_aton(ip)) == INADDR_ANY) if ((ic_netmask = in_aton(ip)) == ANY)
ic_netmask = NONE; ic_netmask = NONE;
break; break;
case 4: case 4:
......
...@@ -337,14 +337,14 @@ static int sctp_v4_cmp_addr(const union sctp_addr *addr1, ...@@ -337,14 +337,14 @@ static int sctp_v4_cmp_addr(const union sctp_addr *addr1,
static void sctp_v4_inaddr_any(union sctp_addr *addr, __be16 port) static void sctp_v4_inaddr_any(union sctp_addr *addr, __be16 port)
{ {
addr->v4.sin_family = AF_INET; addr->v4.sin_family = AF_INET;
addr->v4.sin_addr.s_addr = INADDR_ANY; addr->v4.sin_addr.s_addr = htonl(INADDR_ANY);
addr->v4.sin_port = port; addr->v4.sin_port = port;
} }
/* Is this a wildcard address? */ /* Is this a wildcard address? */
static int sctp_v4_is_any(const union sctp_addr *addr) static int sctp_v4_is_any(const union sctp_addr *addr)
{ {
return INADDR_ANY == addr->v4.sin_addr.s_addr; return htonl(INADDR_ANY) == addr->v4.sin_addr.s_addr;
} }
/* This function checks if the address is a valid address to be used for /* This function checks if the address is a valid address to be used for
...@@ -375,7 +375,7 @@ static int sctp_v4_available(union sctp_addr *addr, struct sctp_sock *sp) ...@@ -375,7 +375,7 @@ static int sctp_v4_available(union sctp_addr *addr, struct sctp_sock *sp)
int ret = inet_addr_type(&init_net, addr->v4.sin_addr.s_addr); int ret = inet_addr_type(&init_net, addr->v4.sin_addr.s_addr);
if (addr->v4.sin_addr.s_addr != INADDR_ANY && if (addr->v4.sin_addr.s_addr != htonl(INADDR_ANY) &&
ret != RTN_LOCAL && ret != RTN_LOCAL &&
!sp->inet.freebind && !sp->inet.freebind &&
!sysctl_ip_nonlocal_bind) !sysctl_ip_nonlocal_bind)
...@@ -785,8 +785,8 @@ static int sctp_inet_cmp_addr(const union sctp_addr *addr1, ...@@ -785,8 +785,8 @@ static int sctp_inet_cmp_addr(const union sctp_addr *addr1,
/* PF_INET only supports AF_INET addresses. */ /* PF_INET only supports AF_INET addresses. */
if (addr1->sa.sa_family != addr2->sa.sa_family) if (addr1->sa.sa_family != addr2->sa.sa_family)
return 0; return 0;
if (INADDR_ANY == addr1->v4.sin_addr.s_addr || if (htonl(INADDR_ANY) == addr1->v4.sin_addr.s_addr ||
INADDR_ANY == addr2->v4.sin_addr.s_addr) htonl(INADDR_ANY) == addr2->v4.sin_addr.s_addr)
return 1; return 1;
if (addr1->v4.sin_addr.s_addr == addr2->v4.sin_addr.s_addr) if (addr1->v4.sin_addr.s_addr == addr2->v4.sin_addr.s_addr)
return 1; return 1;
......
...@@ -185,7 +185,7 @@ int svc_create_xprt(struct svc_serv *serv, char *xprt_name, unsigned short port, ...@@ -185,7 +185,7 @@ int svc_create_xprt(struct svc_serv *serv, char *xprt_name, unsigned short port,
struct svc_xprt_class *xcl; struct svc_xprt_class *xcl;
struct sockaddr_in sin = { struct sockaddr_in sin = {
.sin_family = AF_INET, .sin_family = AF_INET,
.sin_addr.s_addr = INADDR_ANY, .sin_addr.s_addr = htonl(INADDR_ANY),
.sin_port = htons(port), .sin_port = htons(port),
}; };
dprintk("svc: creating transport %s[%d]\n", xprt_name, port); dprintk("svc: creating transport %s[%d]\n", xprt_name, port);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment