]> pilppa.com Git - linux-2.6-omap-h63xx.git/commitdiff
[IPVS] bug: endianness breakage in ip_vs_ftp
authorAl Viro <viro@zeniv.linux.org.uk>
Thu, 28 Sep 2006 21:31:49 +0000 (14:31 -0700)
committerDavid S. Miller <davem@sunset.davemloft.net>
Fri, 29 Sep 2006 01:03:05 +0000 (18:03 -0700)
(p[3]<<24) | (p[2]<<16) | (p[1]<<8) | p[0] is not a valid
way to spell get_unaligned((__be32 *)p

Signed-off-by: Al Viro <viro@zeniv.linux.org.uk>
Signed-off-by: David S. Miller <davem@davemloft.net>
net/ipv4/ipvs/ip_vs_ftp.c

index b3bbb4a07ae090590420a68696d90b6d066af7d1..e433cb0ff894b19899f30788ea824b14fa237873 100644 (file)
@@ -32,6 +32,7 @@
 #include <linux/ip.h>
 #include <net/protocol.h>
 #include <net/tcp.h>
+#include <asm/unaligned.h>
 
 #include <net/ip_vs.h>
 
@@ -114,8 +115,8 @@ static int ip_vs_ftp_get_addrport(char *data, char *data_limit,
        if (i != 5)
                return -1;
 
-       *addr = (p[3]<<24) | (p[2]<<16) | (p[1]<<8) | p[0];
-       *port = (p[5]<<8) | p[4];
+       *addr = get_unaligned((__be32 *)p);
+       *port = get_unaligned((__be16 *)(p + 4));
        return 1;
 }