Skip to contentSkip to conversation

net: bootp: as CONFIG_BOOTP_SERVERIP is defined, keep bootfile not changed

PATCH In review Josh Wu 2 participants 3 messages Nov 18, 2014 – Dec 8, 2014 Networking

lore
Share & tools
lore

Josh Wu

author
#0 lore raw

PATCH 1/1 net: bootp: as CONFIG_BOOTP_SERVERIP is defined, keep bootfile not changed

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.

---
 net/bootp.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)
net/bootp.c +2 -2
index 189a003..479bb20 100644
@@ -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)
Signature · 1 line
1.9.1
author
#1 lore raw

PATCH 1/1 net: bootp: as CONFIG_BOOTP_SERVERIP is defined, keep bootfile not changed

Hi,

Any feedback for this patch?

Best Regards,
Josh Wu

Quoted 37 lines · Josh Wu

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.

---
  net/bootp.c | 4 ++--
  1 file changed, 2 insertions(+), 2 deletions(-)
net/bootp.c +2 -2
index 189a003..479bb20 100644
@@ -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)
#2 lore raw
In reply to Josh Wu
Quoted 11 lines · Josh

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.

Applied to u-boot/master, thanks!

Signature · 8 lines
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>