source: freewrt/package/atftp/patches/120-retry_setting.patch@ 428f140

freewrt_1_0 freewrt_2_0
Last change on this file since 428f140 was 475ad56, checked in by Waldemar Brodkorb <wbx@…>, 20 years ago

add OpenWrt trunk revision 3830.

git-svn-id: svn://www.freewrt.org/trunk/freewrt@1 afb5a338-a214-0410-bd46-81f09a774fd1

  • Property mode set to 100644
File size: 4.6 KB
  • tftp.c

    diff -urN atftp.old/tftp.c atftp.dev/tftp.c
    old new  
    967967          { "tftp-timeout", 1, NULL, 'T'},
    968968          { "mode", 1, NULL, 'M'},
    969969          { "option", 1, NULL, 'O'},
     970                  { "retry", 1, NULL, 'R'},
    970971#if 1
    971972          { "timeout", 1, NULL, 't'},
    972973          { "blksize", 1, NULL, 'b'},
     
    986987     };
    987988
    988989     /* Support old argument until 0.8 */
    989      while ((c = getopt_long(argc, argv, /*"gpl:r:Vh"*/ "gpl:r:Vht:b:sm",
     990     while ((c = getopt_long(argc, argv, /*"gpl:r:Vh"*/ "gpl:r:Vht:b:smR:",
    990991                             options, &option_index)) != EOF)
    991992     {
    992993          switch (c)
    993994          {
     995                  case 'R':
     996               snprintf(string, sizeof(string), "option retry %s", optarg);
     997               make_arg(string, &ac, &av);
     998               process_cmd(ac, av);
     999                       break;
    9941000          case 'g':
    9951001               interactive = 0;
    9961002               if ((action == PUT) || (action == MGET))
  • tftp_def.c

    diff -urN atftp.old/tftp_def.c atftp.dev/tftp_def.c
    old new  
    3737     { "timeout", "5", 0, 1 },  /* 2348, 2349, 2090.  */
    3838     { "blksize", "512", 0, 1 }, /* This is the default option */
    3939     { "multicast", "", 0, 1 }, /* structure */
     40         { "retry", "5", 0, 1 },
    4041     { "", "", 0, 0}
    4142};
    4243
  • tftp_def.h

    diff -urN atftp.old/tftp_def.h atftp.dev/tftp_def.h
    old new  
    4040#define OPT_TIMEOUT   3
    4141#define OPT_BLKSIZE   4
    4242#define OPT_MULTICAST 5
    43 #define OPT_NUMBER    7
     43#define OPT_RETRY     6
     44#define OPT_NUMBER    8
    4445
    4546#define OPT_SIZE     12
    4647#define VAL_SIZE     MAXLEN
  • tftp_file.c

    diff -urN atftp.old/tftp_file.c atftp.dev/tftp_file.c
    old new  
    123123     struct tftphdr *tftphdr = (struct tftphdr *)data->data_buffer;
    124124     FILE *fp = NULL;           /* the local file pointer */
    125125     int number_of_timeout = 0;
     126         int num_retry = atoi(data->tftp_options[OPT_RETRY].value);
    126127     int convert = 0;           /* if true, do netascii convertion */
    127128
    128129     int oacks = 0;             /* count OACK for improved error checking */
     
    141142
    142143     int prev_block_number = 0; /* needed to support netascii convertion */
    143144     int temp = 0;
    144 
     145         
    145146     data->file_size = 0;
    146147     tftp_cancel = 0;
    147148     from.sin_addr.s_addr = 0;
     
    288289               case GET_TIMEOUT:
    289290                    number_of_timeout++;
    290291                    fprintf(stderr, "timeout: retrying...\n");
    291                     if (number_of_timeout > NB_OF_RETRY)
     292                    if ((num_retry > 0) && (number_of_timeout > num_retry))
    292293                         state = S_ABORT;
    293294                    else
    294295                         state = timeout_state;
     
    325326                    number_of_timeout++;
    326327                    fprintf(stderr, "tftp: packet discard <%s:%d>.\n",
    327328                            inet_ntoa(from.sin_addr), ntohs(from.sin_port));
    328                     if (number_of_timeout > NB_OF_RETRY)
     329                    if ((num_retry > 0) && (number_of_timeout > num_retry))
    329330                         state = S_ABORT;
    330331                    break;
    331332               case ERR:
     
    614615     struct tftphdr *tftphdr = (struct tftphdr *)data->data_buffer;
    615616     FILE *fp;                  /* the local file pointer */
    616617     int number_of_timeout = 0;
     618         int num_retry = atoi(data->tftp_options[OPT_RETRY].value);
    617619     struct stat file_stat;
    618620     int convert = 0;           /* if true, do netascii convertion */
    619621     char string[MAXLEN];
     
    751753               case GET_TIMEOUT:
    752754                    number_of_timeout++;
    753755                    fprintf(stderr, "timeout: retrying...\n");
    754                     if (number_of_timeout > NB_OF_RETRY)
     756                    if ((num_retry > 0) && (number_of_timeout > num_retry))
    755757                         state = S_ABORT;
    756758                    else
    757759                         state = timeout_state;
     
    797799                    number_of_timeout++;
    798800                    fprintf(stderr, "tftp: packet discard <%s:%d>.\n",
    799801                            inet_ntoa(from.sin_addr), ntohs(from.sin_port));
    800                     if (number_of_timeout > NB_OF_RETRY)
     802                    if ((num_retry > 0) && (number_of_timeout > num_retry))
    801803                         state = S_ABORT;
    802804                    break;
    803805               case ERR:
Note: See TracBrowser for help on using the repository browser.