This error message could also indicate a bug in the TFTP code; try using an external tftp
client (busybox in this example), by specifying the `-c` flag instead of the `-f` flag:
-`# nmrpflash -i eth0 -c "busybox tftp -p -l EX2700-V1.0.1.8.img @IP@"`
+`# nmrpflash -i eth0 -c "busybox tftp -p -l EX2700-V1.0.1.8.img \$IP"`
###### "Timeout while waiting for CLOSE_REQ."
#else
"C:\\> nmrpflash.exe -i net0 -f firmware.bin\n"
#endif
+ "\n"
+ "When using -c, the environment variables IP, NETMASK and MAC are\n"
+ "set to the device IP address, subnet mask and MAC address.\n"
"\n"
"nmrpflash %s, Copyright (C) 2016 Joseph C. Lehner\n"
"nmrpflash is free software, licensed under the GNU GPLv3.\n"
#define PACKED __attribute__((__packed__))
#endif
+#ifdef NMRPFLASH_WINDOWS
+#define setenv(name, value, overwrite) SetEnvironmentVariable(name, value)
+#endif
+
enum nmrp_code {
NMRP_C_NONE = 0,
NMRP_C_ADVERTISE = 1,
status = 0;
if (args->tftpcmd) {
- printf("Executing '%s' ... ", args->tftpcmd);
- fflush(stdout);
+ printf("Executing '%s' ... \n", args->tftpcmd);
+ setenv("IP", inet_ntoa(ipconf.addr), 1);
+ setenv("MAC", mac_to_str(rx.eh.ether_shost), 1);
+ setenv("NETMASK", inet_ntoa(ipconf.mask), 1);
status = system(args->tftpcmd);
- printf("\n");
}
if (!status && args->file_local) {