[U-Boot] [PATCH] net/dns.c: Fix endian conversion for big-endian in dns command
Wolfgang Denk
wd at denx.de
Sun Oct 23 22:57:04 CEST 2011
Dear Bernhard Kaindl,
In message <1318759162-10523-1-git-send-email-bernhard.kaindl at gmx.net> you wrote:
> From: Bernhard Kaindl <bernhard.kaindl at thalesgroup.com>
>
> net/dns.c used endian conversion macros wrongly (shorts in reply
> were put swapped into CPU, and then ntohs() was used to swap it
> back, which broke on big-endian).
>
> Fix this by using the correct linux conversion macro for reading
> a unaligned short in network byte order: get_unaligned_be16()
> Thanks to Mike Frysinger pointing at the best macro to use.
>
> Tested on big and little endian qemu boards (mips and versatile)
>
> Signed-off-by: Bernhard Kaindl <bernhard.kaindl at thalesgroup.com>
> Cc: Pieter Voorthuijsen <pieter.voorthuijsen at prodrive.nl>
> Cc: Robin Getz <rgetz at blackfin.uclinux.org>
> ---
> net/dns.c | 20 ++++++++------------
> 1 files changed, 8 insertions(+), 12 deletions(-)
Applied, thanks.
Best regards,
Wolfgang Denk
--
DENX Software Engineering GmbH, MD: Wolfgang Denk & Detlev Zundel
HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell, Germany
Phone: (+49)-8142-66989-10 Fax: (+49)-8142-66989-80 Email: wd at denx.de
The Wright Bothers weren't the first to fly. They were just the first
not to crash.
More information about the U-Boot
mailing list