public inbox for u-boot@lists.denx.de
 help / color / mirror / Atom feed
* [U-Boot-Users] [PATCH] TFTP: add host ip addr support
@ 2007-12-24 15:55 Jean-Christophe PLAGNIOL-VILLARD
  2007-12-24 16:40 ` Jerry Van Baren
  2007-12-26 20:42 ` [U-Boot-Users] [PATCH] " Haavard Skinnemoen
  0 siblings, 2 replies; 21+ messages in thread
From: Jean-Christophe PLAGNIOL-VILLARD @ 2007-12-24 15:55 UTC (permalink / raw)
  To: u-boot

Signed-off-by: Jean-Christophe PLAGNIOL-VILLARD <plagnioj@jcrosoft.com>

diff --git a/common/cmd_net.c b/common/cmd_net.c
index 21682c0..2fb0e7c 100644
--- a/common/cmd_net.c
+++ b/common/cmd_net.c
@@ -51,7 +51,7 @@ int do_tftpb (cmd_tbl_t *cmdtp, int flag, int argc, char *argv[])
 U_BOOT_CMD(
 	tftpboot,	3,	1,	do_tftpb,
 	"tftpboot- boot image via network using TFTP protocol\n",
-	"[loadAddress] [bootfilename]\n"
+	"[loadAddress] [host ip addr:bootfilename]\n"
 );
 
 int do_rarpb (cmd_tbl_t *cmdtp, int flag, int argc, char *argv[])
diff --git a/net/tftp.c b/net/tftp.c
index 8b95bcf..d5d6e65 100644
--- a/net/tftp.c
+++ b/net/tftp.c
@@ -34,7 +34,7 @@
 #define TFTP_ERROR	5
 #define TFTP_OACK	6
 
-
+static IPaddr_t TftpServerIP;
 static int	TftpServerPort;		/* The UDP port at their end		*/
 static int	TftpOurPort;		/* The UDP port at our end		*/
 static int	TftpTimeoutCount;
@@ -231,7 +231,7 @@ TftpSend (void)
 		break;
 	}
 
-	NetSendUDPPacket(NetServerEther, NetServerIP, TftpServerPort, TftpOurPort, len);
+	NetSendUDPPacket(NetServerEther, TftpServerIP, TftpServerPort, TftpOurPort, len);
 }
 
 
@@ -464,19 +464,27 @@ TftpStart (void)
 		printf ("*** Warning: no boot file name; using '%s'\n",
 			tftp_filename);
 	} else {
-		tftp_filename = BootFile;
+		char *p=BootFile;
+		p = strchr (p, ':');
+		if (p != NULL) {
+			TftpServerIP = string_to_ip (BootFile);
+			++p;
+			strcpy (tftp_filename, p);
+		} else {
+			strcpy (tftp_filename, BootFile);
+		}
 	}
 
 #if defined(CONFIG_NET_MULTI)
 	printf ("Using %s device\n", eth_get_name());
 #endif
-	puts ("TFTP from server ");	print_IPaddr (NetServerIP);
+	puts ("TFTP from server ");	print_IPaddr (TftpServerIP);
 	puts ("; our IP address is ");	print_IPaddr (NetOurIP);
 
 	/* Check if we need to send across this subnet */
 	if (NetOurGatewayIP && NetOurSubnetMask) {
 	    IPaddr_t OurNet 	= NetOurIP    & NetOurSubnetMask;
-	    IPaddr_t ServerNet 	= NetServerIP & NetOurSubnetMask;
+	    IPaddr_t ServerNet 	= TftpServerIP & NetOurSubnetMask;
 
 	    if (OurNet != ServerNet) {
 		puts ("; sending through gateway ");
-- 
1.5.3.7

^ permalink raw reply related	[flat|nested] 21+ messages in thread
* [U-Boot-Users] [PATCH] TFTP: add host ip addr support
@ 2008-01-16 23:33 Ben Warren
  2008-01-17 22:08 ` [U-Boot-Users] [PATCH 0/1] " Jean-Christophe PLAGNIOL-VILLARD
  0 siblings, 1 reply; 21+ messages in thread
From: Ben Warren @ 2008-01-16 23:33 UTC (permalink / raw)
  To: u-boot

Wolfgang Denk wrote:
> In message <20080116222754.GG31365@game.jcrosoft.org> you wrote:
>   
>>> Except that the length should be 128 to  match  the  boot  file  name
>>> length that BOOTP / DHCP can pass as per RFC.
>>>       
>> Personnaly, I'll prefer 1K length because if you use as I use a lost of
>> time a full path when downloading uImage or other so a path with a
>> length over than 512 arrive often.
>>     
>
> So is there a newer RFC that changes this? IIRC the max length is
> defined as 128 bytes.
>
> Best regards,
>
> Wolfgang Denk
>
>   
My 2c is that we go with 128, and have a CONFIG_LONG_TFTP_FILE_NAME that 
allows 1k for people with ridiculously long paths.

regards,
Ben

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

end of thread, other threads:[~2008-01-17 22:29 UTC | newest]

Thread overview: 21+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2007-12-24 15:55 [U-Boot-Users] [PATCH] TFTP: add host ip addr support Jean-Christophe PLAGNIOL-VILLARD
2007-12-24 16:40 ` Jerry Van Baren
2008-01-09 21:31   ` [U-Boot-Users] [PATCH 0/1] " Jean-Christophe PLAGNIOL-VILLARD
2008-01-09 21:31     ` [U-Boot-Users] [PATCH 1/1] Fix nfs command help to reflect that the serverip is optional Jean-Christophe PLAGNIOL-VILLARD
2008-01-09 22:26       ` Ben Warren
2008-01-09 22:53         ` Wolfgang Denk
2008-01-10 23:01           ` [U-Boot-Users] [PATCH 0/1] TFTP: add host ip addr support Jean-Christophe PLAGNIOL-VILLARD
2008-01-10 23:01             ` [U-Boot-Users] [PATCH 1/1] Fix nfs command help to reflect that the serverip is optional Jean-Christophe PLAGNIOL-VILLARD
2008-01-10 23:33             ` [U-Boot-Users] [PATCH 0/1] TFTP: add host ip addr support Andre Renaud
2008-01-11  0:12               ` Jean-Christophe PLAGNIOL-VILLARD
2008-01-09 22:35       ` [U-Boot-Users] [PATCH 1/1] Fix nfs command help to reflect that the serverip is optional Wolfgang Denk
2008-01-09 22:39     ` [U-Boot-Users] [PATCH 0/1] TFTP: add host ip addr support Wolfgang Denk
2008-01-10  9:46       ` Jean-Christophe PLAGNIOL-VILLARD
2008-01-10  9:46         ` [U-Boot-Users] [PATCH 1/1] Fix nfs command help to reflect that the serverip is optional Jean-Christophe PLAGNIOL-VILLARD
2008-01-10 22:44           ` Wolfgang Denk
2008-01-10 22:43         ` [U-Boot-Users] [PATCH 0/1] TFTP: add host ip addr support Wolfgang Denk
2008-01-11 22:46         ` Ben Warren
2007-12-26 20:42 ` [U-Boot-Users] [PATCH] " Haavard Skinnemoen
2007-12-26 23:09   ` Wolfgang Denk
  -- strict thread matches above, loose matches on Subject: below --
2008-01-16 23:33 Ben Warren
2008-01-17 22:08 ` [U-Boot-Users] [PATCH 0/1] " Jean-Christophe PLAGNIOL-VILLARD
2008-01-17 22:08   ` [U-Boot-Users] [PATCH 1/1] Fix nfs command help to reflect that the serverip is optional Jean-Christophe PLAGNIOL-VILLARD
2008-01-17 22:29     ` Ben Warren

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