diff options
author | Al Viro | 2006-09-28 14:31:49 -0700 |
---|---|---|
committer | David S. Miller | 2006-09-28 18:03:05 -0700 |
commit | 96d2ca4ec0bb8d0f344e5960224700be3dec3515 (patch) | |
tree | f1e8dce6214ee5e35dc290da7ed39e7168afaf8a /net | |
parent | 014d730d56b559eacb11e91969a1f41c3feb36f9 (diff) |
[IPVS] bug: endianness breakage in ip_vs_ftp
(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>
Diffstat (limited to 'net')
-rw-r--r-- | net/ipv4/ipvs/ip_vs_ftp.c | 5 |
1 files changed, 3 insertions, 2 deletions
diff --git a/net/ipv4/ipvs/ip_vs_ftp.c b/net/ipv4/ipvs/ip_vs_ftp.c index b3bbb4a07ae0..e433cb0ff894 100644 --- a/net/ipv4/ipvs/ip_vs_ftp.c +++ b/net/ipv4/ipvs/ip_vs_ftp.c @@ -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; } |