Skip to contentSkip to conversation

bootp resetting serverip

U-Boot-Users Tehn Yit Chin 2 participants 2 messages Nov 23, 2005 Networking

lore
Share & tools
lore
#0 lore 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.

net/bootp.c 2005-11-23 15:26:52.000000000 +1100 renamed from net/bootp.c 2005-11-23 15:40:52.000000000 +1100 +9 -2
@@ -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,

Signature · 6 lines
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 
#1 lore raw
Quoted 5 lines · In message <[email protected]> you wrote:

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.

man dhcpd.conf

Seach for next-server

Quoted 2 lines

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

Rejected.

Best regards,

Wolfgang Denk

Signature · 3 lines
Software Engineering:  Embedded and Realtime Systems,  Embedded Linux
Phone: (+49)-8142-66989-10 Fax: (+49)-8142-66989-80 Email: wd at denx.de
core error - bus dumped