All of lore.kernel.org
 help / color / mirror / Atom feed
* [U-Boot-Users] bootp resetting serverip
@ 2005-11-23  5:02 Tehn Yit Chin
  2005-11-23  7:51 ` Wolfgang Denk
  0 siblings, 1 reply; 2+ messages in thread
From: Tehn Yit Chin @ 2005-11-23  5:02 UTC (permalink / raw)
  To: u-boot

Hi all,

Our environment is such that the TFTP server is a different machine to 
the DHCP server. So when I use the bootp command, serverip is set to the 
ip address of the DHCP server. This will not as it will attempt to 
transfer the file from the DHCP server instead of the TFTP server.

To overcome this issue, I have modify the BootpCopyNetParams() to check 
if serverip is empty before copying. The patch is below and attached.

--- old_u-boot/net/bootp.c      2005-11-23 15:40:52.000000000 +1100
+++ u-boot/net/bootp.c  2005-11-23 15:26:52.000000000 +1100
@@ -121,8 +121,15 @@

         NetCopyIP(&NetOurIP, &bp->bp_yiaddr);
         NetCopyIP(&tmp_ip, &bp->bp_siaddr);
-       if (tmp_ip != 0)
-               NetCopyIP(&NetServerIP, &bp->bp_siaddr);
+       if (tmp_ip != 0) {
+
+               /* check that serverip is empty before setting the value as
+               ** the DHCP server could be a different machine.
+               */
+               if (getenv("serverip") == NULL) {
+                       NetCopyIP(&NetServerIP, &bp->bp_siaddr);
+               }
+       }
         memcpy (NetServerEther, ((Ethernet_t *)NetRxPkt)->et_src, 6);
         if (strlen(bp->bp_file) > 0)
                 copy_filename (BootFile, bp->bp_file, sizeof(BootFile));

So if serverip is not empty, u-boot will assume that you know the ip 
address of the server, and have set it explicitly.

Happy for rocks to be thrown if a different solution exits.

cheers,
-- 
Tehn Yit Chin
Software Engineer, Grey Innovation Pty. Ltd.
-------------- next part --------------
An embedded and charset-unspecified text was scrubbed...
Name: patch.1
Url: http://lists.denx.de/pipermail/u-boot/attachments/20051123/bf8ab7ab/attachment.txt 

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

end of thread, other threads:[~2005-11-23  7:51 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2005-11-23  5:02 [U-Boot-Users] bootp resetting serverip Tehn Yit Chin
2005-11-23  7:51 ` Wolfgang Denk

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.