All of lore.kernel.org
 help / color / mirror / Atom feed
From: Tehn Yit Chin <tehn-yit.chin@greyinnovation.com>
To: u-boot@lists.denx.de
Subject: [U-Boot-Users] bootp resetting serverip
Date: Wed, 23 Nov 2005 16:02:35 +1100	[thread overview]
Message-ID: <4383F7EB.8010200@greyinnovation.com> (raw)

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 

             reply	other threads:[~2005-11-23  5:02 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2005-11-23  5:02 Tehn Yit Chin [this message]
2005-11-23  7:51 ` [U-Boot-Users] bootp resetting serverip Wolfgang Denk

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=4383F7EB.8010200@greyinnovation.com \
    --to=tehn-yit.chin@greyinnovation.com \
    --cc=u-boot@lists.denx.de \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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.