aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorAl Viro <viro@zeniv.linux.org.uk>2008-03-18 01:44:53 -0400
committerDavid S. Miller <davem@davemloft.net>2008-03-18 01:44:53 -0400
commite6f1cebf71c4e7aae7dfa43414ce2631291def9f (patch)
treea3abf6bb3e63f2ecea1a4e05bf8d288d920acb17
parentfc4d30a6fc88121081916faef930d8c3e4ed6036 (diff)
[NET] endianness noise: INADDR_ANY
Signed-off-by: Al Viro <viro@zeniv.linux.org.uk> Signed-off-by: David S. Miller <davem@davemloft.net>
-rw-r--r--arch/sparc/kernel/sys_sunos.c2
-rw-r--r--arch/sparc64/kernel/sys_sunos32.c2
-rw-r--r--fs/nfs/super.c2
-rw-r--r--net/ipv4/af_inet.c2
-rw-r--r--net/ipv4/ip_sockglue.c2
-rw-r--r--net/ipv4/ipconfig.c9
-rw-r--r--net/sctp/protocol.c10
-rw-r--r--net/sunrpc/svc_xprt.c2
8 files changed, 16 insertions, 15 deletions
diff --git a/arch/sparc/kernel/sys_sunos.c b/arch/sparc/kernel/sys_sunos.c
index 28c187c5d9fd..f5b608bbe8af 100644
--- a/arch/sparc/kernel/sys_sunos.c
+++ b/arch/sparc/kernel/sys_sunos.c
@@ -659,7 +659,7 @@ sunos_nfs_get_server_fd (int fd, struct sockaddr_in *addr)
659 659
660 socket = SOCKET_I(inode); 660 socket = SOCKET_I(inode);
661 local.sin_family = AF_INET; 661 local.sin_family = AF_INET;
662 local.sin_addr.s_addr = INADDR_ANY; 662 local.sin_addr.s_addr = htonl(INADDR_ANY);
663 663
664 /* IPPORT_RESERVED = 1024, can't find the definition in the kernel */ 664 /* IPPORT_RESERVED = 1024, can't find the definition in the kernel */
665 try_port = 1024; 665 try_port = 1024;
diff --git a/arch/sparc64/kernel/sys_sunos32.c b/arch/sparc64/kernel/sys_sunos32.c
index cfc22d3fe54c..e91194fe39d7 100644
--- a/arch/sparc64/kernel/sys_sunos32.c
+++ b/arch/sparc64/kernel/sys_sunos32.c
@@ -618,7 +618,7 @@ sunos_nfs_get_server_fd (int fd, struct sockaddr_in *addr)
618 618
619 socket = SOCKET_I(inode); 619 socket = SOCKET_I(inode);
620 local.sin_family = AF_INET; 620 local.sin_family = AF_INET;
621 local.sin_addr.s_addr = INADDR_ANY; 621 local.sin_addr.s_addr = htonl(INADDR_ANY);
622 622
623 /* IPPORT_RESERVED = 1024, can't find the definition in the kernel */ 623 /* IPPORT_RESERVED = 1024, can't find the definition in the kernel */
624 try_port = 1024; 624 try_port = 1024;
diff --git a/fs/nfs/super.c b/fs/nfs/super.c
index 1fb381843650..bdcf6d3ef62f 100644
--- a/fs/nfs/super.c
+++ b/fs/nfs/super.c
@@ -632,7 +632,7 @@ static int nfs_verify_server_address(struct sockaddr *addr)
632 switch (addr->sa_family) { 632 switch (addr->sa_family) {
633 case AF_INET: { 633 case AF_INET: {
634 struct sockaddr_in *sa = (struct sockaddr_in *)addr; 634 struct sockaddr_in *sa = (struct sockaddr_in *)addr;
635 return sa->sin_addr.s_addr != INADDR_ANY; 635 return sa->sin_addr.s_addr != htonl(INADDR_ANY);
636 } 636 }
637 case AF_INET6: { 637 case AF_INET6: {
638 struct in6_addr *sa = &((struct sockaddr_in6 *)addr)->sin6_addr; 638 struct in6_addr *sa = &((struct sockaddr_in6 *)addr)->sin6_addr;
diff --git a/net/ipv4/af_inet.c b/net/ipv4/af_inet.c
index 09ca5293d08f..0d109504ed86 100644
--- a/net/ipv4/af_inet.c
+++ b/net/ipv4/af_inet.c
@@ -458,7 +458,7 @@ int inet_bind(struct socket *sock, struct sockaddr *uaddr, int addr_len)
458 err = -EADDRNOTAVAIL; 458 err = -EADDRNOTAVAIL;
459 if (!sysctl_ip_nonlocal_bind && 459 if (!sysctl_ip_nonlocal_bind &&
460 !inet->freebind && 460 !inet->freebind &&
461 addr->sin_addr.s_addr != INADDR_ANY && 461 addr->sin_addr.s_addr != htonl(INADDR_ANY) &&
462 chk_addr_ret != RTN_LOCAL && 462 chk_addr_ret != RTN_LOCAL &&
463 chk_addr_ret != RTN_MULTICAST && 463 chk_addr_ret != RTN_MULTICAST &&
464 chk_addr_ret != RTN_BROADCAST) 464 chk_addr_ret != RTN_BROADCAST)
diff --git a/net/ipv4/ip_sockglue.c b/net/ipv4/ip_sockglue.c
index de0572c88859..f72457b4b0a7 100644
--- a/net/ipv4/ip_sockglue.c
+++ b/net/ipv4/ip_sockglue.c
@@ -583,7 +583,7 @@ static int do_ip_setsockopt(struct sock *sk, int level,
583 } 583 }
584 584
585 if (!mreq.imr_ifindex) { 585 if (!mreq.imr_ifindex) {
586 if (mreq.imr_address.s_addr == INADDR_ANY) { 586 if (mreq.imr_address.s_addr == htonl(INADDR_ANY)) {
587 inet->mc_index = 0; 587 inet->mc_index = 0;
588 inet->mc_addr = 0; 588 inet->mc_addr = 0;
589 err = 0; 589 err = 0;
diff --git a/net/ipv4/ipconfig.c b/net/ipv4/ipconfig.c
index 5dd938579eeb..7c992fbbc2c3 100644
--- a/net/ipv4/ipconfig.c
+++ b/net/ipv4/ipconfig.c
@@ -103,6 +103,7 @@
103 - '3' from resolv.h */ 103 - '3' from resolv.h */
104 104
105#define NONE __constant_htonl(INADDR_NONE) 105#define NONE __constant_htonl(INADDR_NONE)
106#define ANY __constant_htonl(INADDR_ANY)
106 107
107/* 108/*
108 * Public IP configuration 109 * Public IP configuration
@@ -1479,19 +1480,19 @@ static int __init ip_auto_config_setup(char *addrs)
1479 DBG(("IP-Config: Parameter #%d: `%s'\n", num, ip)); 1480 DBG(("IP-Config: Parameter #%d: `%s'\n", num, ip));
1480 switch (num) { 1481 switch (num) {
1481 case 0: 1482 case 0:
1482 if ((ic_myaddr = in_aton(ip)) == INADDR_ANY) 1483 if ((ic_myaddr = in_aton(ip)) == ANY)
1483 ic_myaddr = NONE; 1484 ic_myaddr = NONE;
1484 break; 1485 break;
1485 case 1: 1486 case 1:
1486 if ((ic_servaddr = in_aton(ip)) == INADDR_ANY) 1487 if ((ic_servaddr = in_aton(ip)) == ANY)
1487 ic_servaddr = NONE; 1488 ic_servaddr = NONE;
1488 break; 1489 break;
1489 case 2: 1490 case 2:
1490 if ((ic_gateway = in_aton(ip)) == INADDR_ANY) 1491 if ((ic_gateway = in_aton(ip)) == ANY)
1491 ic_gateway = NONE; 1492 ic_gateway = NONE;
1492 break; 1493 break;
1493 case 3: 1494 case 3:
1494 if ((ic_netmask = in_aton(ip)) == INADDR_ANY) 1495 if ((ic_netmask = in_aton(ip)) == ANY)
1495 ic_netmask = NONE; 1496 ic_netmask = NONE;
1496 break; 1497 break;
1497 case 4: 1498 case 4:
diff --git a/net/sctp/protocol.c b/net/sctp/protocol.c
index ad0a4069b95b..7a7646a9565c 100644
--- a/net/sctp/protocol.c
+++ b/net/sctp/protocol.c
@@ -337,14 +337,14 @@ static int sctp_v4_cmp_addr(const union sctp_addr *addr1,
337static void sctp_v4_inaddr_any(union sctp_addr *addr, __be16 port) 337static void sctp_v4_inaddr_any(union sctp_addr *addr, __be16 port)
338{ 338{
339 addr->v4.sin_family = AF_INET; 339 addr->v4.sin_family = AF_INET;
340 addr->v4.sin_addr.s_addr = INADDR_ANY; 340 addr->v4.sin_addr.s_addr = htonl(INADDR_ANY);
341 addr->v4.sin_port = port; 341 addr->v4.sin_port = port;
342} 342}
343 343
344/* Is this a wildcard address? */ 344/* Is this a wildcard address? */
345static int sctp_v4_is_any(const union sctp_addr *addr) 345static int sctp_v4_is_any(const union sctp_addr *addr)
346{ 346{
347 return INADDR_ANY == addr->v4.sin_addr.s_addr; 347 return htonl(INADDR_ANY) == addr->v4.sin_addr.s_addr;
348} 348}
349 349
350/* This function checks if the address is a valid address to be used for 350/* 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 int ret = inet_addr_type(&init_net, addr->v4.sin_addr.s_addr); 375 int ret = inet_addr_type(&init_net, addr->v4.sin_addr.s_addr);
376 376
377 377
378 if (addr->v4.sin_addr.s_addr != INADDR_ANY && 378 if (addr->v4.sin_addr.s_addr != htonl(INADDR_ANY) &&
379 ret != RTN_LOCAL && 379 ret != RTN_LOCAL &&
380 !sp->inet.freebind && 380 !sp->inet.freebind &&
381 !sysctl_ip_nonlocal_bind) 381 !sysctl_ip_nonlocal_bind)
@@ -785,8 +785,8 @@ static int sctp_inet_cmp_addr(const union sctp_addr *addr1,
785 /* PF_INET only supports AF_INET addresses. */ 785 /* PF_INET only supports AF_INET addresses. */
786 if (addr1->sa.sa_family != addr2->sa.sa_family) 786 if (addr1->sa.sa_family != addr2->sa.sa_family)
787 return 0; 787 return 0;
788 if (INADDR_ANY == addr1->v4.sin_addr.s_addr || 788 if (htonl(INADDR_ANY) == addr1->v4.sin_addr.s_addr ||
789 INADDR_ANY == addr2->v4.sin_addr.s_addr) 789 htonl(INADDR_ANY) == addr2->v4.sin_addr.s_addr)
790 return 1; 790 return 1;
791 if (addr1->v4.sin_addr.s_addr == addr2->v4.sin_addr.s_addr) 791 if (addr1->v4.sin_addr.s_addr == addr2->v4.sin_addr.s_addr)
792 return 1; 792 return 1;
diff --git a/net/sunrpc/svc_xprt.c b/net/sunrpc/svc_xprt.c
index ea377e06afae..332eb47539e1 100644
--- a/net/sunrpc/svc_xprt.c
+++ b/net/sunrpc/svc_xprt.c
@@ -185,7 +185,7 @@ int svc_create_xprt(struct svc_serv *serv, char *xprt_name, unsigned short port,
185 struct svc_xprt_class *xcl; 185 struct svc_xprt_class *xcl;
186 struct sockaddr_in sin = { 186 struct sockaddr_in sin = {
187 .sin_family = AF_INET, 187 .sin_family = AF_INET,
188 .sin_addr.s_addr = INADDR_ANY, 188 .sin_addr.s_addr = htonl(INADDR_ANY),
189 .sin_port = htons(port), 189 .sin_port = htons(port),
190 }; 190 };
191 dprintk("svc: creating transport %s[%d]\n", xprt_name, port); 191 dprintk("svc: creating transport %s[%d]\n", xprt_name, port);