public inbox for u-boot@lists.denx.de
 help / color / mirror / Atom feed
* [U-Boot] [PATCH] net: bootp: as CONFIG_BOOTP_SERVERIP is defined, keep bootfile not changed
@ 2014-11-18  5:07 Josh Wu
  2014-12-04  2:38 ` Josh Wu
  2014-12-08 21:41 ` [U-Boot] " Tom Rini
  0 siblings, 2 replies; 3+ messages in thread
From: Josh Wu @ 2014-11-18  5:07 UTC (permalink / raw)
  To: u-boot

Currenly when CONFIG_BOOTP_SERVERIP is defined, the SERVERIP is not changed
when receive the BOOTP packet. But BOOTFILE is changed via BOOTP packet.

As we will load the BOOTFILE from SERVERIP, if the BOOTFILE is modified
by bootp packet but SERVERIP is not, that is not make sense.

This patch make SERVERIP and BOOTFILE be consistent. If we define the
CONFIG_BOOTP_SERVERIP, then SERVERIP and BOOTFILE will not changed by
BOOTP packet. Only IP address is changed.

Signed-off-by: Josh Wu <josh.wu@atmel.com>
---
 net/bootp.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/net/bootp.c b/net/bootp.c
index 189a003..479bb20 100644
--- a/net/bootp.c
+++ b/net/bootp.c
@@ -104,8 +104,6 @@ static void BootpCopyNetParams(struct Bootp_t *bp)
 	if (tmp_ip != 0)
 		NetCopyIP(&NetServerIP, &bp->bp_siaddr);
 	memcpy(NetServerEther, ((struct ethernet_hdr *)NetRxPacket)->et_src, 6);
-#endif
-	NetCopyIP(&NetOurIP, &bp->bp_yiaddr);
 	if (strlen(bp->bp_file) > 0)
 		copy_filename(BootFile, bp->bp_file, sizeof(BootFile));
 
@@ -117,6 +115,8 @@ static void BootpCopyNetParams(struct Bootp_t *bp)
 	 */
 	if (*BootFile)
 		setenv("bootfile", BootFile);
+#endif
+	NetCopyIP(&NetOurIP, &bp->bp_yiaddr);
 }
 
 static int truncate_sz(const char *name, int maxlen, int curlen)
-- 
1.9.1

^ permalink raw reply related	[flat|nested] 3+ messages in thread

* [U-Boot] [PATCH] net: bootp: as CONFIG_BOOTP_SERVERIP is defined, keep bootfile not changed
  2014-11-18  5:07 [U-Boot] [PATCH] net: bootp: as CONFIG_BOOTP_SERVERIP is defined, keep bootfile not changed Josh Wu
@ 2014-12-04  2:38 ` Josh Wu
  2014-12-08 21:41 ` [U-Boot] " Tom Rini
  1 sibling, 0 replies; 3+ messages in thread
From: Josh Wu @ 2014-12-04  2:38 UTC (permalink / raw)
  To: u-boot

Hi,

Any feedback for this patch?

Best Regards,
Josh Wu

On 11/18/2014 1:07 PM, Josh Wu wrote:
> Currenly when CONFIG_BOOTP_SERVERIP is defined, the SERVERIP is not changed
> when receive the BOOTP packet. But BOOTFILE is changed via BOOTP packet.
>
> As we will load the BOOTFILE from SERVERIP, if the BOOTFILE is modified
> by bootp packet but SERVERIP is not, that is not make sense.
>
> This patch make SERVERIP and BOOTFILE be consistent. If we define the
> CONFIG_BOOTP_SERVERIP, then SERVERIP and BOOTFILE will not changed by
> BOOTP packet. Only IP address is changed.
>
> Signed-off-by: Josh Wu <josh.wu@atmel.com>
> ---
>   net/bootp.c | 4 ++--
>   1 file changed, 2 insertions(+), 2 deletions(-)
>
> diff --git a/net/bootp.c b/net/bootp.c
> index 189a003..479bb20 100644
> --- a/net/bootp.c
> +++ b/net/bootp.c
> @@ -104,8 +104,6 @@ static void BootpCopyNetParams(struct Bootp_t *bp)
>   	if (tmp_ip != 0)
>   		NetCopyIP(&NetServerIP, &bp->bp_siaddr);
>   	memcpy(NetServerEther, ((struct ethernet_hdr *)NetRxPacket)->et_src, 6);
> -#endif
> -	NetCopyIP(&NetOurIP, &bp->bp_yiaddr);
>   	if (strlen(bp->bp_file) > 0)
>   		copy_filename(BootFile, bp->bp_file, sizeof(BootFile));
>   
> @@ -117,6 +115,8 @@ static void BootpCopyNetParams(struct Bootp_t *bp)
>   	 */
>   	if (*BootFile)
>   		setenv("bootfile", BootFile);
> +#endif
> +	NetCopyIP(&NetOurIP, &bp->bp_yiaddr);
>   }
>   
>   static int truncate_sz(const char *name, int maxlen, int curlen)

^ permalink raw reply	[flat|nested] 3+ messages in thread

* [U-Boot] net: bootp: as CONFIG_BOOTP_SERVERIP is defined, keep bootfile not changed
  2014-11-18  5:07 [U-Boot] [PATCH] net: bootp: as CONFIG_BOOTP_SERVERIP is defined, keep bootfile not changed Josh Wu
  2014-12-04  2:38 ` Josh Wu
@ 2014-12-08 21:41 ` Tom Rini
  1 sibling, 0 replies; 3+ messages in thread
From: Tom Rini @ 2014-12-08 21:41 UTC (permalink / raw)
  To: u-boot

On Tue, Nov 18, 2014 at 01:07:08PM +0800, Wu, Josh wrote:

> Currenly when CONFIG_BOOTP_SERVERIP is defined, the SERVERIP is not changed
> when receive the BOOTP packet. But BOOTFILE is changed via BOOTP packet.
> 
> As we will load the BOOTFILE from SERVERIP, if the BOOTFILE is modified
> by bootp packet but SERVERIP is not, that is not make sense.
> 
> This patch make SERVERIP and BOOTFILE be consistent. If we define the
> CONFIG_BOOTP_SERVERIP, then SERVERIP and BOOTFILE will not changed by
> BOOTP packet. Only IP address is changed.
> 
> Signed-off-by: Josh Wu <josh.wu@atmel.com>

Applied to u-boot/master, thanks!

-- 
Tom
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 836 bytes
Desc: Digital signature
URL: <http://lists.denx.de/pipermail/u-boot/attachments/20141208/ba3832fc/attachment.pgp>

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2014-12-08 21:41 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2014-11-18  5:07 [U-Boot] [PATCH] net: bootp: as CONFIG_BOOTP_SERVERIP is defined, keep bootfile not changed Josh Wu
2014-12-04  2:38 ` Josh Wu
2014-12-08 21:41 ` [U-Boot] " Tom Rini

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox