]> err.no Git - linux-2.6/commitdiff
[NET] endianness noise: INADDR_ANY
authorAl Viro <viro@zeniv.linux.org.uk>
Tue, 18 Mar 2008 05:44:53 +0000 (22:44 -0700)
committerDavid S. Miller <davem@davemloft.net>
Tue, 18 Mar 2008 05:44:53 +0000 (22:44 -0700)
Signed-off-by: Al Viro <viro@zeniv.linux.org.uk>
Signed-off-by: David S. Miller <davem@davemloft.net>
arch/sparc/kernel/sys_sunos.c
arch/sparc64/kernel/sys_sunos32.c
fs/nfs/super.c
net/ipv4/af_inet.c
net/ipv4/ip_sockglue.c
net/ipv4/ipconfig.c
net/sctp/protocol.c
net/sunrpc/svc_xprt.c

index 28c187c5d9fd68dc4eea2008fa253d63d8e0b9d8..f5b608bbe8aff79bacd298b07e0b6831d3dd969d 100644 (file)
@@ -659,7 +659,7 @@ sunos_nfs_get_server_fd (int fd, struct sockaddr_in *addr)
 
        socket = SOCKET_I(inode);
        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 */
        try_port = 1024;
index cfc22d3fe54c1cdd631ff3ffe1160d73e78aec18..e91194fe39d7fb3c9a2eea05cba13f21b8dae684 100644 (file)
@@ -618,7 +618,7 @@ sunos_nfs_get_server_fd (int fd, struct sockaddr_in *addr)
 
        socket = SOCKET_I(inode);
        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 */
        try_port = 1024;
index 1fb3818436501bc7bfd7637d7744576fe09e6041..bdcf6d3ef62f3ddb69d6355272c7484e48c1ac8f 100644 (file)
@@ -632,7 +632,7 @@ static int nfs_verify_server_address(struct sockaddr *addr)
        switch (addr->sa_family) {
        case AF_INET: {
                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: {
                struct in6_addr *sa = &((struct sockaddr_in6 *)addr)->sin6_addr;
index 09ca5293d08f3c354ad85cea31ddbb9f75c4c4db..0d109504ed86ca0d6e634e5437028f36f441c4a1 100644 (file)
@@ -458,7 +458,7 @@ int inet_bind(struct socket *sock, struct sockaddr *uaddr, int addr_len)
        err = -EADDRNOTAVAIL;
        if (!sysctl_ip_nonlocal_bind &&
            !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_MULTICAST &&
            chk_addr_ret != RTN_BROADCAST)
index de0572c888590c10d0de778785c4aa29c4ff0220..f72457b4b0a7c5eae44f808686915048651981d7 100644 (file)
@@ -583,7 +583,7 @@ static int do_ip_setsockopt(struct sock *sk, int level,
                }
 
                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_addr  = 0;
                                err = 0;
index 5dd938579eeb62187ddee9ebce6f6eb2e9d7602a..7c992fbbc2c3ae512ccb705ede7c1f012b2d5302 100644 (file)
                                           - '3' from resolv.h */
 
 #define NONE __constant_htonl(INADDR_NONE)
+#define ANY __constant_htonl(INADDR_ANY)
 
 /*
  * Public IP configuration
@@ -1479,19 +1480,19 @@ static int __init ip_auto_config_setup(char *addrs)
                        DBG(("IP-Config: Parameter #%d: `%s'\n", num, ip));
                        switch (num) {
                        case 0:
-                               if ((ic_myaddr = in_aton(ip)) == INADDR_ANY)
+                               if ((ic_myaddr = in_aton(ip)) == ANY)
                                        ic_myaddr = NONE;
                                break;
                        case 1:
-                               if ((ic_servaddr = in_aton(ip)) == INADDR_ANY)
+                               if ((ic_servaddr = in_aton(ip)) == ANY)
                                        ic_servaddr = NONE;
                                break;
                        case 2:
-                               if ((ic_gateway = in_aton(ip)) == INADDR_ANY)
+                               if ((ic_gateway = in_aton(ip)) == ANY)
                                        ic_gateway = NONE;
                                break;
                        case 3:
-                               if ((ic_netmask = in_aton(ip)) == INADDR_ANY)
+                               if ((ic_netmask = in_aton(ip)) == ANY)
                                        ic_netmask = NONE;
                                break;
                        case 4:
index ad0a4069b95be0b78a3c54dc1f4b205d77cde3a2..7a7646a9565c1636deec532f764aebfdd7a37f3f 100644 (file)
@@ -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)
 {
        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;
 }
 
 /* Is this a wildcard address? */
 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
@@ -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);
 
 
-       if (addr->v4.sin_addr.s_addr != INADDR_ANY &&
+       if (addr->v4.sin_addr.s_addr != htonl(INADDR_ANY) &&
           ret != RTN_LOCAL &&
           !sp->inet.freebind &&
           !sysctl_ip_nonlocal_bind)
@@ -785,8 +785,8 @@ static int sctp_inet_cmp_addr(const union sctp_addr *addr1,
        /* PF_INET only supports AF_INET addresses. */
        if (addr1->sa.sa_family != addr2->sa.sa_family)
                return 0;
-       if (INADDR_ANY == addr1->v4.sin_addr.s_addr ||
-           INADDR_ANY == addr2->v4.sin_addr.s_addr)
+       if (htonl(INADDR_ANY) == addr1->v4.sin_addr.s_addr ||
+           htonl(INADDR_ANY) == addr2->v4.sin_addr.s_addr)
                return 1;
        if (addr1->v4.sin_addr.s_addr == addr2->v4.sin_addr.s_addr)
                return 1;
index ea377e06afae0d1a56812e9b6771a3c055c7a410..332eb47539e16a18a5dd7313dfaf76525078976b 100644 (file)
@@ -185,7 +185,7 @@ int svc_create_xprt(struct svc_serv *serv, char *xprt_name, unsigned short port,
        struct svc_xprt_class *xcl;
        struct sockaddr_in sin = {
                .sin_family             = AF_INET,
-               .sin_addr.s_addr        = INADDR_ANY,
+               .sin_addr.s_addr        = htonl(INADDR_ANY),
                .sin_port               = htons(port),
        };
        dprintk("svc: creating transport %s[%d]\n", xprt_name, port);