2 * Copyright 1994, 1995, 2000 Neil Russell.
4 * Copyright 2000, 2001 DENX Software Engineering, Wolfgang Denk, wd@denx.de
5 * Copyright 2011 Comelit Group SpA,
6 * Luca Ceresoli <luca.ceresoli@comelit.it>
14 #ifdef CONFIG_SYS_DIRECT_FLASH_TFTP
18 /* Well known TFTP port # */
19 #define WELL_KNOWN_PORT 69
20 /* Millisecs to timeout for lost pkt */
21 #define TIMEOUT 5000UL
22 #ifndef CONFIG_NET_RETRY_COUNT
23 /* # of timeouts before giving up */
24 # define TIMEOUT_COUNT 10
26 # define TIMEOUT_COUNT (CONFIG_NET_RETRY_COUNT * 2)
28 /* Number of "loading" hashes per line (for checking the image size) */
29 #define HASHES_PER_LINE 65
41 static ulong TftpTimeoutMSecs = TIMEOUT;
42 static int TftpTimeoutCountMax = TIMEOUT_COUNT;
45 * These globals govern the timeout behavior when attempting a connection to a
46 * TFTP server. TftpRRQTimeoutMSecs specifies the number of milliseconds to
47 * wait for the server to respond to initial connection. Second global,
48 * TftpRRQTimeoutCountMax, gives the number of such connection retries.
49 * TftpRRQTimeoutCountMax must be non-negative and TftpRRQTimeoutMSecs must be
50 * positive. The globals are meant to be set (and restored) by code needing
51 * non-standard timeout behavior when initiating a TFTP transfer.
53 ulong TftpRRQTimeoutMSecs = TIMEOUT;
54 int TftpRRQTimeoutCountMax = TIMEOUT_COUNT;
57 TFTP_ERR_UNDEFINED = 0,
58 TFTP_ERR_FILE_NOT_FOUND = 1,
59 TFTP_ERR_ACCESS_DENIED = 2,
60 TFTP_ERR_DISK_FULL = 3,
61 TFTP_ERR_UNEXPECTED_OPCODE = 4,
62 TFTP_ERR_UNKNOWN_TRANSFER_ID = 5,
63 TFTP_ERR_FILE_ALREADY_EXISTS = 6,
66 static IPaddr_t TftpRemoteIP;
67 /* The UDP port at their end */
68 static int TftpRemotePort;
69 /* The UDP port at our end */
70 static int TftpOurPort;
71 static int TftpTimeoutCount;
72 /* packet sequence number */
73 static ulong TftpBlock;
74 /* last packet sequence number received */
75 static ulong TftpLastBlock;
76 /* count of sequence number wraparounds */
77 static ulong TftpBlockWrap;
78 /* memory offset due to wrapping */
79 static ulong TftpBlockWrapOffset;
81 #ifdef CONFIG_TFTP_TSIZE
82 /* The file size reported by the server */
84 /* The number of hashes we printed */
85 static short TftpNumchars;
87 #ifdef CONFIG_CMD_TFTPPUT
88 static int TftpWriting; /* 1 if writing, else 0 */
89 static int TftpFinalBlock; /* 1 if we have sent the last block */
94 #define STATE_SEND_RRQ 1
96 #define STATE_TOO_LARGE 3
97 #define STATE_BAD_MAGIC 4
99 #define STATE_RECV_WRQ 6
100 #define STATE_SEND_WRQ 7
102 /* default TFTP block size */
103 #define TFTP_BLOCK_SIZE 512
104 /* sequence number is 16 bit */
105 #define TFTP_SEQUENCE_SIZE ((ulong)(1<<16))
107 #define DEFAULT_NAME_LEN (8 + 4 + 1)
108 static char default_filename[DEFAULT_NAME_LEN];
110 #ifndef CONFIG_TFTP_FILE_NAME_MAX_LEN
113 #define MAX_LEN CONFIG_TFTP_FILE_NAME_MAX_LEN
116 static char tftp_filename[MAX_LEN];
118 /* 512 is poor choice for ethernet, MTU is typically 1500.
119 * Minus eth.hdrs thats 1468. Can get 2x better throughput with
120 * almost-MTU block sizes. At least try... fall back to 512 if need be.
121 * (but those using CONFIG_IP_DEFRAG may want to set a larger block in cfg file)
123 #ifdef CONFIG_TFTP_BLOCKSIZE
124 #define TFTP_MTU_BLOCKSIZE CONFIG_TFTP_BLOCKSIZE
126 #define TFTP_MTU_BLOCKSIZE 1468
129 static unsigned short TftpBlkSize = TFTP_BLOCK_SIZE;
130 static unsigned short TftpBlkSizeOption = TFTP_MTU_BLOCKSIZE;
132 #ifdef CONFIG_MCAST_TFTP
134 #define MTFTP_BITMAPSIZE 0x1000
135 static unsigned *Bitmap;
136 static int PrevBitmapHole, Mapsize = MTFTP_BITMAPSIZE;
137 static uchar ProhibitMcast, MasterClient;
138 static uchar Multicast;
139 static int Mcast_port;
140 static ulong TftpEndingBlock; /* can get 'last' block before done..*/
142 static void parse_multicast_oack(char *pkt, int len);
148 eth_mcast_join(Mcast_addr, 0);
152 Mcast_addr = Multicast = Mcast_port = 0;
153 TftpEndingBlock = -1;
156 #endif /* CONFIG_MCAST_TFTP */
159 store_block(unsigned block, uchar *src, unsigned len)
161 ulong offset = block * TftpBlkSize + TftpBlockWrapOffset;
162 ulong newsize = offset + len;
163 #ifdef CONFIG_SYS_DIRECT_FLASH_TFTP
166 for (i = 0; i < CONFIG_SYS_MAX_FLASH_BANKS; i++) {
167 /* start address in flash? */
168 if (flash_info[i].flash_id == FLASH_UNKNOWN)
170 if (load_addr + offset >= flash_info[i].start[0]) {
176 if (rc) { /* Flash is destination for this packet */
177 rc = flash_write((char *)src, (ulong)(load_addr+offset), len);
180 net_set_state(NETLOOP_FAIL);
184 #endif /* CONFIG_SYS_DIRECT_FLASH_TFTP */
186 (void)memcpy((void *)(load_addr + offset), src, len);
188 #ifdef CONFIG_MCAST_TFTP
190 ext2_set_bit(block, Bitmap);
193 if (NetBootFileXferSize < newsize)
194 NetBootFileXferSize = newsize;
197 /* Clear our state ready for a new transfer */
198 static void new_transfer(void)
202 TftpBlockWrapOffset = 0;
203 #ifdef CONFIG_CMD_TFTPPUT
208 #ifdef CONFIG_CMD_TFTPPUT
210 * Load the next block from memory to be sent over tftp.
212 * @param block Block number to send
213 * @param dst Destination buffer for data
214 * @param len Number of bytes in block (this one and every other)
215 * @return number of bytes loaded
217 static int load_block(unsigned block, uchar *dst, unsigned len)
219 /* We may want to get the final block from the previous set */
220 ulong offset = ((int)block - 1) * len + TftpBlockWrapOffset;
223 tosend = min(NetBootFileXferSize - offset, tosend);
224 (void)memcpy(dst, (void *)(save_addr + offset), tosend);
225 debug("%s: block=%d, offset=%ld, len=%d, tosend=%ld\n", __func__,
226 block, offset, len, tosend);
231 static void TftpSend(void);
232 static void TftpTimeout(void);
234 /**********************************************************************/
236 static void show_block_marker(void)
238 #ifdef CONFIG_TFTP_TSIZE
240 ulong pos = TftpBlock * TftpBlkSize + TftpBlockWrapOffset;
242 while (TftpNumchars < pos * 50 / TftpTsize) {
249 if (((TftpBlock - 1) % 10) == 0)
251 else if ((TftpBlock % (10 * HASHES_PER_LINE)) == 0)
257 * restart the current transfer due to an error
259 * @param msg Message to print for user
261 static void restart(const char *msg)
263 printf("\n%s; starting again\n", msg);
264 #ifdef CONFIG_MCAST_TFTP
271 * Check if the block number has wrapped, and update progress
273 * TODO: The egregious use of global variables in this file should be tidied.
275 static void update_block_number(void)
278 * RFC1350 specifies that the first data packet will
279 * have sequence number 1. If we receive a sequence
280 * number of 0 this means that there was a wrap
281 * around of the (16 bit) counter.
283 if (TftpBlock == 0) {
285 TftpBlockWrapOffset += TftpBlkSize * TFTP_SEQUENCE_SIZE;
286 TftpTimeoutCount = 0; /* we've done well, reset thhe timeout */
292 /* The TFTP get or put is complete */
293 static void tftp_complete(void)
295 #ifdef CONFIG_TFTP_TSIZE
296 /* Print hash marks for the last packet received */
297 while (TftpTsize && TftpNumchars < 49) {
303 net_set_state(NETLOOP_SUCCESS);
314 #ifdef CONFIG_MCAST_TFTP
315 /* Multicast TFTP.. non-MasterClients do not ACK data. */
317 && (TftpState == STATE_DATA)
318 && (MasterClient == 0))
322 * We will always be sending some sort of packet, so
323 * cobble together the packet headers now.
325 pkt = NetTxPacket + NetEthHdrSize() + IP_UDP_HDR_SIZE;
332 #ifdef CONFIG_CMD_TFTPPUT
333 *s++ = htons(TftpState == STATE_SEND_RRQ ? TFTP_RRQ :
336 *s++ = htons(TFTP_RRQ);
339 strcpy((char *)pkt, tftp_filename);
340 pkt += strlen(tftp_filename) + 1;
341 strcpy((char *)pkt, "octet");
342 pkt += 5 /*strlen("octet")*/ + 1;
343 strcpy((char *)pkt, "timeout");
344 pkt += 7 /*strlen("timeout")*/ + 1;
345 sprintf((char *)pkt, "%lu", TftpTimeoutMSecs / 1000);
346 debug("send option \"timeout %s\"\n", (char *)pkt);
347 pkt += strlen((char *)pkt) + 1;
348 #ifdef CONFIG_TFTP_TSIZE
349 pkt += sprintf((char *)pkt, "tsize%c%lu%c",
350 0, NetBootFileXferSize, 0);
352 /* try for more effic. blk size */
353 pkt += sprintf((char *)pkt, "blksize%c%d%c",
354 0, TftpBlkSizeOption, 0);
355 #ifdef CONFIG_MCAST_TFTP
356 /* Check all preconditions before even trying the option */
357 if (!ProhibitMcast) {
358 Bitmap = malloc(Mapsize);
359 if (Bitmap && eth_get_dev()->mcast) {
362 pkt += sprintf((char *)pkt, "multicast%c%c",
366 #endif /* CONFIG_MCAST_TFTP */
371 #ifdef CONFIG_MCAST_TFTP
372 /* My turn! Start at where I need blocks I missed.*/
374 TftpBlock = ext2_find_next_zero_bit(Bitmap,
383 s[0] = htons(TFTP_ACK);
384 s[1] = htons(TftpBlock);
385 pkt = (uchar *)(s + 2);
386 #ifdef CONFIG_CMD_TFTPPUT
388 int toload = TftpBlkSize;
389 int loaded = load_block(TftpBlock, pkt, toload);
391 s[0] = htons(TFTP_DATA);
393 TftpFinalBlock = (loaded < toload);
399 case STATE_TOO_LARGE:
402 *s++ = htons(TFTP_ERROR);
406 strcpy((char *)pkt, "File too large");
407 pkt += 14 /*strlen("File too large")*/ + 1;
411 case STATE_BAD_MAGIC:
414 *s++ = htons(TFTP_ERROR);
417 strcpy((char *)pkt, "File has bad magic");
418 pkt += 18 /*strlen("File has bad magic")*/ + 1;
423 NetSendUDPPacket(NetServerEther, TftpRemoteIP, TftpRemotePort,
427 #ifdef CONFIG_CMD_TFTPPUT
428 static void icmp_handler(unsigned type, unsigned code, unsigned dest,
429 IPaddr_t sip, unsigned src, uchar *pkt, unsigned len)
431 if (type == ICMP_NOT_REACH && code == ICMP_NOT_REACH_PORT) {
432 /* Oh dear the other end has gone away */
433 restart("TFTP server died");
439 TftpHandler(uchar *pkt, unsigned dest, IPaddr_t sip, unsigned src,
446 if (dest != TftpOurPort) {
447 #ifdef CONFIG_MCAST_TFTP
449 && (!Mcast_port || (dest != Mcast_port)))
453 if (TftpState != STATE_SEND_RRQ && src != TftpRemotePort &&
454 TftpState != STATE_RECV_WRQ && TftpState != STATE_SEND_WRQ)
460 /* warning: don't use increment (++) in ntohs() macros!! */
464 switch (ntohs(proto)) {
470 #ifdef CONFIG_CMD_TFTPPUT
472 if (TftpFinalBlock) {
476 * Move to the next block. We want our block
477 * count to wrap just like the other end!
479 int block = ntohs(*s);
480 int ack_ok = (TftpBlock == block);
482 TftpBlock = (unsigned short)(block + 1);
483 update_block_number();
485 TftpSend(); /* Send next data block */
494 #ifdef CONFIG_CMD_TFTPSRV
498 TftpRemotePort = src;
499 TftpOurPort = 1024 + (get_timer(0) % 3072);
501 TftpSend(); /* Send ACK(0) */
506 debug("Got OACK: %s %s\n",
508 pkt + strlen((char *)pkt) + 1);
509 TftpState = STATE_OACK;
510 TftpRemotePort = src;
512 * Check for 'blksize' option.
513 * Careful: "i" is signed, "len" is unsigned, thus
514 * something like "len-8" may give a *huge* number
516 for (i = 0; i+8 < len; i++) {
517 if (strcmp((char *)pkt+i, "blksize") == 0) {
518 TftpBlkSize = (unsigned short)
519 simple_strtoul((char *)pkt+i+8, NULL,
521 debug("Blocksize ack: %s, %d\n",
522 (char *)pkt+i+8, TftpBlkSize);
524 #ifdef CONFIG_TFTP_TSIZE
525 if (strcmp((char *)pkt+i, "tsize") == 0) {
526 TftpTsize = simple_strtoul((char *)pkt+i+6,
528 debug("size = %s, %d\n",
529 (char *)pkt+i+6, TftpTsize);
533 #ifdef CONFIG_MCAST_TFTP
534 parse_multicast_oack((char *)pkt, len-1);
535 if ((Multicast) && (!MasterClient))
536 TftpState = STATE_DATA; /* passive.. */
539 #ifdef CONFIG_CMD_TFTPPUT
541 /* Get ready to send the first block */
542 TftpState = STATE_DATA;
546 TftpSend(); /* Send ACK or first data block */
552 TftpBlock = ntohs(*(ushort *)pkt);
554 update_block_number();
556 if (TftpState == STATE_SEND_RRQ)
557 debug("Server did not acknowledge timeout option!\n");
559 if (TftpState == STATE_SEND_RRQ || TftpState == STATE_OACK ||
560 TftpState == STATE_RECV_WRQ) {
561 /* first block received */
562 TftpState = STATE_DATA;
563 TftpRemotePort = src;
566 #ifdef CONFIG_MCAST_TFTP
567 if (Multicast) { /* start!=1 common if mcast */
568 TftpLastBlock = TftpBlock - 1;
571 if (TftpBlock != 1) { /* Assertion */
572 printf("\nTFTP error: "
573 "First block is not block 1 (%ld)\n"
574 "Starting again\n\n",
581 if (TftpBlock == TftpLastBlock) {
583 * Same block again; ignore it.
588 TftpLastBlock = TftpBlock;
589 TftpTimeoutCountMax = TIMEOUT_COUNT;
590 NetSetTimeout(TftpTimeoutMSecs, TftpTimeout);
592 store_block(TftpBlock - 1, pkt + 2, len);
595 * Acknowledge the block just received, which will prompt
596 * the remote for the next one.
598 #ifdef CONFIG_MCAST_TFTP
599 /* if I am the MasterClient, actively calculate what my next
600 * needed block is; else I'm passive; not ACKING
603 if (len < TftpBlkSize) {
604 TftpEndingBlock = TftpBlock;
605 } else if (MasterClient) {
606 TftpBlock = PrevBitmapHole =
607 ext2_find_next_zero_bit(
611 if (TftpBlock > ((Mapsize*8) - 1)) {
612 printf("tftpfile too big\n");
613 /* try to double it and retry */
619 TftpLastBlock = TftpBlock;
625 #ifdef CONFIG_MCAST_TFTP
627 if (MasterClient && (TftpBlock >= TftpEndingBlock)) {
628 puts("\nMulticast tftp done\n");
630 net_set_state(NETLOOP_SUCCESS);
634 if (len < TftpBlkSize)
639 printf("\nTFTP error: '%s' (%d)\n",
640 pkt + 2, ntohs(*(ushort *)pkt));
642 switch (ntohs(*(ushort *)pkt)) {
643 case TFTP_ERR_FILE_NOT_FOUND:
644 case TFTP_ERR_ACCESS_DENIED:
645 puts("Not retrying...\n");
647 net_set_state(NETLOOP_FAIL);
649 case TFTP_ERR_UNDEFINED:
650 case TFTP_ERR_DISK_FULL:
651 case TFTP_ERR_UNEXPECTED_OPCODE:
652 case TFTP_ERR_UNKNOWN_TRANSFER_ID:
653 case TFTP_ERR_FILE_ALREADY_EXISTS:
655 puts("Starting again\n\n");
656 #ifdef CONFIG_MCAST_TFTP
670 if (++TftpTimeoutCount > TftpTimeoutCountMax) {
671 restart("Retry count exceeded");
674 NetSetTimeout(TftpTimeoutMSecs, TftpTimeout);
675 if (TftpState != STATE_RECV_WRQ)
681 void TftpStart(enum proto_t protocol)
683 char *ep; /* Environment pointer */
686 * Allow the user to choose TFTP blocksize and timeout.
687 * TFTP protocol has a minimal timeout of 1 second.
689 ep = getenv("tftpblocksize");
691 TftpBlkSizeOption = simple_strtol(ep, NULL, 10);
693 ep = getenv("tftptimeout");
695 TftpTimeoutMSecs = simple_strtol(ep, NULL, 10);
697 if (TftpTimeoutMSecs < 1000) {
698 printf("TFTP timeout (%ld ms) too low, "
699 "set minimum = 1000 ms\n",
701 TftpTimeoutMSecs = 1000;
704 debug("TFTP blocksize = %i, timeout = %ld ms\n",
705 TftpBlkSizeOption, TftpTimeoutMSecs);
707 TftpRemoteIP = NetServerIP;
708 if (BootFile[0] == '\0') {
709 sprintf(default_filename, "%02X%02X%02X%02X.img",
711 (NetOurIP >> 8) & 0xFF,
712 (NetOurIP >> 16) & 0xFF,
713 (NetOurIP >> 24) & 0xFF);
715 strncpy(tftp_filename, default_filename, MAX_LEN);
716 tftp_filename[MAX_LEN-1] = 0;
718 printf("*** Warning: no boot file name; using '%s'\n",
721 char *p = strchr(BootFile, ':');
724 strncpy(tftp_filename, BootFile, MAX_LEN);
725 tftp_filename[MAX_LEN-1] = 0;
727 TftpRemoteIP = string_to_ip(BootFile);
728 strncpy(tftp_filename, p + 1, MAX_LEN);
729 tftp_filename[MAX_LEN-1] = 0;
733 printf("Using %s device\n", eth_get_name());
734 printf("TFTP %s server %pI4; our IP address is %pI4",
735 #ifdef CONFIG_CMD_TFTPPUT
736 protocol == TFTPPUT ? "to" : "from",
740 &TftpRemoteIP, &NetOurIP);
742 /* Check if we need to send across this subnet */
743 if (NetOurGatewayIP && NetOurSubnetMask) {
744 IPaddr_t OurNet = NetOurIP & NetOurSubnetMask;
745 IPaddr_t RemoteNet = TftpRemoteIP & NetOurSubnetMask;
747 if (OurNet != RemoteNet)
748 printf("; sending through gateway %pI4",
753 printf("Filename '%s'.", tftp_filename);
755 if (NetBootFileSize) {
756 printf(" Size is 0x%x Bytes = ", NetBootFileSize<<9);
757 print_size(NetBootFileSize<<9, "");
761 #ifdef CONFIG_CMD_TFTPPUT
762 TftpWriting = (protocol == TFTPPUT);
764 printf("Save address: 0x%lx\n", save_addr);
765 printf("Save size: 0x%lx\n", save_size);
766 NetBootFileXferSize = save_size;
768 TftpState = STATE_SEND_WRQ;
773 printf("Load address: 0x%lx\n", load_addr);
774 puts("Loading: *\b");
775 TftpState = STATE_SEND_RRQ;
778 TftpTimeoutCountMax = TftpRRQTimeoutCountMax;
780 NetSetTimeout(TftpTimeoutMSecs, TftpTimeout);
781 net_set_udp_handler(TftpHandler);
782 #ifdef CONFIG_CMD_TFTPPUT
783 net_set_icmp_handler(icmp_handler);
785 TftpRemotePort = WELL_KNOWN_PORT;
786 TftpTimeoutCount = 0;
787 /* Use a pseudo-random port unless a specific port is set */
788 TftpOurPort = 1024 + (get_timer(0) % 3072);
790 #ifdef CONFIG_TFTP_PORT
791 ep = getenv("tftpdstp");
793 TftpRemotePort = simple_strtol(ep, NULL, 10);
794 ep = getenv("tftpsrcp");
796 TftpOurPort = simple_strtol(ep, NULL, 10);
800 /* zero out server ether in case the server ip has changed */
801 memset(NetServerEther, 0, 6);
802 /* Revert TftpBlkSize to dflt */
803 TftpBlkSize = TFTP_BLOCK_SIZE;
804 #ifdef CONFIG_MCAST_TFTP
807 #ifdef CONFIG_TFTP_TSIZE
815 #ifdef CONFIG_CMD_TFTPSRV
817 TftpStartServer(void)
819 tftp_filename[0] = 0;
821 printf("Using %s device\n", eth_get_name());
822 printf("Listening for TFTP transfer on %pI4\n", &NetOurIP);
823 printf("Load address: 0x%lx\n", load_addr);
825 puts("Loading: *\b");
827 TftpTimeoutCountMax = TIMEOUT_COUNT;
828 TftpTimeoutCount = 0;
829 TftpTimeoutMSecs = TIMEOUT;
830 NetSetTimeout(TftpTimeoutMSecs, TftpTimeout);
832 /* Revert TftpBlkSize to dflt */
833 TftpBlkSize = TFTP_BLOCK_SIZE;
835 TftpOurPort = WELL_KNOWN_PORT;
837 #ifdef CONFIG_TFTP_TSIZE
842 TftpState = STATE_RECV_WRQ;
843 net_set_udp_handler(TftpHandler);
845 #endif /* CONFIG_CMD_TFTPSRV */
847 #ifdef CONFIG_MCAST_TFTP
848 /* Credits: atftp project.
851 /* pick up BcastAddr, Port, and whether I am [now] the master-client. *
853 * +-------+-----------+---+-------~~-------+---+
854 * | opc | multicast | 0 | addr, port, mc | 0 |
855 * +-------+-----------+---+-------~~-------+---+
856 * The multicast addr/port becomes what I listen to, and if 'mc' is '1' then
857 * I am the new master-client so must send ACKs to DataBlocks. If I am not
858 * master-client, I'm a passive client, gathering what DataBlocks I may and
859 * making note of which ones I got in my bitmask.
860 * In theory, I never go from master->passive..
861 * .. this comes in with pkt already pointing just past opc
863 static void parse_multicast_oack(char *pkt, int len)
867 char *mc_adr, *port, *mc;
869 mc_adr = port = mc = NULL;
870 /* march along looking for 'multicast\0', which has to start at least
871 * 14 bytes back from the end.
873 for (i = 0; i < len-14; i++)
874 if (strcmp(pkt+i, "multicast") == 0)
876 if (i >= (len-14)) /* non-Multicast OACK, ign. */
879 i += 10; /* strlen multicast */
881 for (; i < len; i++) {
882 if (*(pkt+i) == ',') {
892 if (!port || !mc_adr || !mc)
894 if (Multicast && MasterClient) {
895 printf("I got a OACK as master Client, WRONG!\n");
898 /* ..I now accept packets destined for this MCAST addr, port */
901 printf("Internal failure! no mcast.\n");
907 /* I malloc instead of pre-declare; so that if the file ends
908 * up being too big for this bitmap I can retry
910 Bitmap = malloc(Mapsize);
912 printf("No Bitmap, no multicast. Sorry.\n");
916 memset(Bitmap, 0, Mapsize);
920 addr = string_to_ip(mc_adr);
921 if (Mcast_addr != addr) {
923 eth_mcast_join(Mcast_addr, 0);
925 if (eth_mcast_join(Mcast_addr, 1)) {
926 printf("Fail to set mcast, revert to TFTP\n");
932 MasterClient = (unsigned char)simple_strtoul((char *)mc, NULL, 10);
933 Mcast_port = (unsigned short)simple_strtoul(port, NULL, 10);
934 printf("Multicast: %s:%d [%d]\n", mc_adr, Mcast_port, MasterClient);
938 #endif /* Multicast TFTP */