Skip to contentSkip to conversation

tftp: Displace check for server ip

PATCH New Maxime Hadjinlian 2 participants 2 messages Oct 5, 2014 – Oct 27, 2014 Networking

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 tftp: Displace check for server ip

If for some reason, 'serverip' is not set, and you are passing the remote IP on the command line, the tftp command will fail, stating that the 'serverip' is not set.

By displacing this check, it fixes the issues.

---

 net/net.c  | 6 ------
 net/tftp.c | 4 ++++
 2 files changed, 4 insertions(+), 6 deletions(-)
net/net.c +0 -6
index 722089f..044ee71 100644
@@ -1235,12 +1235,6 @@ static int net_check_prereq(enum proto_t protocol)
 #if defined(CONFIG_CMD_NFS)
 	case NFS:
 #endif
-	case TFTPGET:
-	case TFTPPUT:
-		if (NetServerIP == 0) {
-			puts("*** ERROR: `serverip' not set\n");
-			return 1;
-		}
 #if	defined(CONFIG_CMD_PING) || defined(CONFIG_CMD_SNTP) || \
 	defined(CONFIG_CMD_DNS)
 common:
net/tftp.c +4 -0
index 966d1cf..eb93df5 100644
@@ -736,6 +736,10 @@ void TftpStart(enum proto_t protocol)
 			tftp_filename[MAX_LEN-1] = 0;
 		}
 	}
+	if (TftpRemoteIP == 0) {
+		printf("*** ERRROR: No server IP found.\n");
+		return;
+	}
 
 	printf("Using %s device\n", eth_get_name());
 	printf("TFTP %s server %pI4; our IP address is %pI4",
Signature · 1 line
2.1.1
#1 lore raw

PATCH 1/1 tftp: Displace check for server ip

Quoted 18 lines · Maxime Hadjinlian

If for some reason, 'serverip' is not set, and you are passing the remote IP on the command line, the tftp command will fail, stating that the 'serverip' is not set.

By displacing this check, it fixes the issues.

---

 net/net.c  | 6 ------
 net/tftp.c | 4 ++++
 2 files changed, 4 insertions(+), 6 deletions(-)
net/net.c +0 -0
index 722089f..044ee71 100644

net/net.c static int net_check_prereq(enum proto_t protocol) · line 1243

Quoted 9 lines
net/net.c +0 -6
@@ -1235,12 +1235,6 @@ static int net_check_prereq(enum proto_t protocol)
 #if defined(CONFIG_CMD_NFS)
 	case NFS:
 #endif
-	case TFTPGET:
-	case TFTPPUT:
-		if (NetServerIP == 0) {
-			puts("*** ERROR: `serverip' not set\n");
-			return 1;
-		}

Moving the check to TftpServer() seems fine but right here you've also removed the check from the NFS cmd which is wrong. This needs to be re-worked so that the current check is under #if defined(CONFIG_CMD_NFS) and we continue case'ing TFTPGET/TFTPPUT through the common part that follows and so forth. Thanks!

Quoted 25 lines
net/net.c +0 -0
 #if	defined(CONFIG_CMD_PING) || defined(CONFIG_CMD_SNTP) || \
 	defined(CONFIG_CMD_DNS)
 common:
net/tftp.c +4 -0
index 966d1cf..eb93df5 100644
@@ -736,6 +736,10 @@ void TftpStart(enum proto_t protocol)
 			tftp_filename[MAX_LEN-1] = 0;
 		}
 	}
+	if (TftpRemoteIP == 0) {
+		printf("*** ERRROR: No server IP found.\n");
+		return;
+	}
 
 	printf("Using %s device\n", eth_get_name());
 	printf("TFTP %s server %pI4; our IP address is %pI4",
Signature · 6 lines
2.1.1

_______________________________________________
U-Boot mailing list
U-Boot at lists.denx.de
http://lists.denx.de/mailman/listinfo/u-boot
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/20141027/612213f4/attachment.pgp>