[U-Boot] [PATCH v2 2/6] NET: pass source IP address to packet handlers

Detlev Zundel dzu at denx.de
Tue Apr 19 16:15:13 CEST 2011


Hi Luca,

> This is needed for the upcoming TFTP server implementation.
>
> This also simplifies PingHandler() and fixes rxhand_f documentation.
>
> Signed-off-by: Luca Ceresoli <luca.ceresoli at comelit.it>
> Cc: Wolfgang Denk <wd at denx.de>
> ---
> Changes in v2:
>  - fixed checkpatch issues.
>
>  drivers/net/netconsole.c |    5 +++--
>  include/net.h            |   15 ++++++++++-----
>  net/bootp.c              |    9 ++++++---
>  net/dns.c                |    2 +-
>  net/net.c                |   30 +++++++++++++++++-------------
>  net/nfs.c                |    2 +-
>  net/rarp.c               |    3 ++-
>  net/sntp.c               |    3 ++-
>  net/tftp.c               |    3 ++-
>  9 files changed, 44 insertions(+), 28 deletions(-)
>

[...]

> diff --git a/net/net.c b/net/net.c
> index a609632..132f99b 100644
> --- a/net/net.c
> +++ b/net/net.c

[...]

> @@ -1596,11 +1598,12 @@ NetReceive(volatile uchar * inpkt, int len)
>  				 *	IP header OK.  Pass the packet to the current handler.
>  				 */
>  				/* XXX point to ip packet */
> -				(*packetHandler)((uchar *)ip, 0, 0, 0);
> +				(*packetHandler)((uchar *)ip, 0, src_ip, 0, 0);
>  				return;
>  			case ICMP_ECHO_REQUEST:
> -				debug("Got ICMP ECHO REQUEST, return %d bytes \n",
> -					ETHER_HDR_SIZE + len);
> +				debug("Got ICMP ECHO REQUEST, "
> +				      "return %d bytes\n",
> +				      ETHER_HDR_SIZE + len);
>  
>  				memcpy (&et->et_dest[0], &et->et_src[0], 6);
>  				memcpy (&et->et_src[ 0], NetOurEther, 6);

This second hunk is not related to the patch at hand, so strictly
speaking it should not be in here.  It's not enough to NAK the patch
however, just something to look out for in the future.

Apart from that the changes look good, so

Acked-by: Detlev Zundel <dzu at denx.de>

-- 
LISP has  jokingly been  described as  "the most  intelligent way to  misuse a
computer".  I think that  description a great  compliment because it transmits
the full  flavour of  liberation:  it has assisted a number of our most gifted
fellow humans in thinking previously impossible thoughts. - Edsger W. Dijkstra
--
DENX Software Engineering GmbH,      MD: Wolfgang Denk & Detlev Zundel
HRB 165235 Munich,  Office: Kirchenstr.5, D-82194 Groebenzell, Germany
Phone: (+49)-8142-66989-40 Fax: (+49)-8142-66989-80 Email: dzu at denx.de


More information about the U-Boot mailing list