mail archive of the barebox mailing list
 help / color / mirror / Atom feed
* tftp get and last ack hanlding
@ 2017-01-23  9:01 Yegor Yefremov
  2017-01-23  9:56 ` Yegor Yefremov
  2017-01-24  8:30 ` Sascha Hauer
  0 siblings, 2 replies; 3+ messages in thread
From: Yegor Yefremov @ 2017-01-23  9:01 UTC (permalink / raw)
  To: barebox

I'm using dnsmaq as tftp server. When I execute tftp file on barebox
2016.07.0 I get the required file, but dnsmasq complains about missing
ACK (my interpretation of dnsmaq source code). If I'm performing the
same operation in Linux using busybox ftfp - everything is OK, i.e.
instead of "failed sending" I get "sent". Is this a desired barebox
tftp behavior?

dnsmasq log:

Jan 23 08:30:25 buildroot daemon.err dnsmasq-tftp[225]: error 0
received from 192.168.0.79
Jan 23 08:30:25 buildroot daemon.info dnsmasq-tftp[225]: failed
sending /data/tftp/vmlinuz.bin to 192.168.0.79

Relevant dnsmaq code in [1], see how endcon is set:

      if (difftime(now, transfer->timeout) >= 0.0)
        {
          int endcon = 0;

          /* timeout, retransmit */
          transfer->timeout += 1 + (1<<transfer->backoff);

          /* we overwrote the buffer... */
          daemon->srv_save = NULL;

          if ((len = get_block(daemon->packet, transfer)) == -1)
            {
              len = tftp_err_oops(daemon->packet, transfer->file->filename);
              endcon = 1;
            }
          /* don't complain about timeout when we're awaiting the last
             ACK, some clients never send it */
          else if (++transfer->backoff > 7 && len != 0)
            {
              endcon = 1;
              len = 0;
            }

          if (len != 0)
            while(sendto(transfer->sockfd, daemon->packet, len, 0,
                         (struct sockaddr *)&transfer->peer,
sa_len(&transfer->peer)) == -1 && errno == EINTR);

          if (endcon || len == 0)
            {
              strcpy(daemon->namebuff, transfer->file->filename);
              sanitise(daemon->namebuff);
              my_syslog(MS_TFTP | LOG_INFO, endcon ? _("failed sending
%s to %s") : _("sent %s to %s"), daemon->namebuff, daemon->addrbuff);
              /* unlink */
              *up = tmp;
              if (endcon)
                free_transfer(transfer);
              else
                {
                  /* put on queue to be sent to script and deleted */
                  transfer->next = daemon->tftp_done_trans;
                  daemon->tftp_done_trans = transfer;
                }
              continue;
            }
        }

[1] http://thekelleys.org.uk/gitweb/?p=dnsmasq.git;a=blob;f=src/tftp.c;h=618c4062e07234336e09a6689a265763a4d7981c;hb=HEAD#l570

Yegor

_______________________________________________
barebox mailing list
barebox@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/barebox

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

* Re: tftp get and last ack hanlding
  2017-01-23  9:01 tftp get and last ack hanlding Yegor Yefremov
@ 2017-01-23  9:56 ` Yegor Yefremov
  2017-01-24  8:30 ` Sascha Hauer
  1 sibling, 0 replies; 3+ messages in thread
From: Yegor Yefremov @ 2017-01-23  9:56 UTC (permalink / raw)
  To: barebox

On Mon, Jan 23, 2017 at 10:01 AM, Yegor Yefremov
<yegorslists@googlemail.com> wrote:
> I'm using dnsmaq as tftp server. When I execute tftp file on barebox
> 2016.07.0 I get the required file, but dnsmasq complains about missing
> ACK (my interpretation of dnsmaq source code). If I'm performing the
> same operation in Linux using busybox ftfp - everything is OK, i.e.
> instead of "failed sending" I get "sent". Is this a desired barebox
> tftp behavior?
>
> dnsmasq log:
>
> Jan 23 08:30:25 buildroot daemon.err dnsmasq-tftp[225]: error 0
> received from 192.168.0.79
> Jan 23 08:30:25 buildroot daemon.info dnsmasq-tftp[225]: failed
> sending /data/tftp/vmlinuz.bin to 192.168.0.79
>
> Relevant dnsmaq code in [1], see how endcon is set:
>
>       if (difftime(now, transfer->timeout) >= 0.0)
>         {
>           int endcon = 0;
>
>           /* timeout, retransmit */
>           transfer->timeout += 1 + (1<<transfer->backoff);
>
>           /* we overwrote the buffer... */
>           daemon->srv_save = NULL;
>
>           if ((len = get_block(daemon->packet, transfer)) == -1)
>             {
>               len = tftp_err_oops(daemon->packet, transfer->file->filename);
>               endcon = 1;
>             }
>           /* don't complain about timeout when we're awaiting the last
>              ACK, some clients never send it */
>           else if (++transfer->backoff > 7 && len != 0)
>             {
>               endcon = 1;
>               len = 0;
>             }
>
>           if (len != 0)
>             while(sendto(transfer->sockfd, daemon->packet, len, 0,
>                          (struct sockaddr *)&transfer->peer,
> sa_len(&transfer->peer)) == -1 && errno == EINTR);
>
>           if (endcon || len == 0)
>             {
>               strcpy(daemon->namebuff, transfer->file->filename);
>               sanitise(daemon->namebuff);
>               my_syslog(MS_TFTP | LOG_INFO, endcon ? _("failed sending
> %s to %s") : _("sent %s to %s"), daemon->namebuff, daemon->addrbuff);
>               /* unlink */
>               *up = tmp;
>               if (endcon)
>                 free_transfer(transfer);
>               else
>                 {
>                   /* put on queue to be sent to script and deleted */
>                   transfer->next = daemon->tftp_done_trans;
>                   daemon->tftp_done_trans = transfer;
>                 }
>               continue;
>             }
>         }
>
> [1] http://thekelleys.org.uk/gitweb/?p=dnsmasq.git;a=blob;f=src/tftp.c;h=618c4062e07234336e09a6689a265763a4d7981c;hb=HEAD#l570

Perhaps it has something to do with our ar9331 network driver. Will
have to sniff, because at the end all files will be logged as "sent":

Jan 23 09:40:34 buildroot daemon.err dnsmasq-tftp[225]: error 0
received from 192.168.0.79
Jan 23 09:40:34 buildroot daemon.info dnsmasq-tftp[225]: failed
sending /data/tftp/barebox-production.bin to 192.168.0.79
Jan 23 09:40:34 buildroot daemon.err dnsmasq-tftp[225]: error 0
received from 192.168.0.79
Jan 23 09:40:34 buildroot daemon.info dnsmasq-tftp[225]: failed
sending /data/tftp/barebox-production.bin to 192.168.0.79
Jan 23 09:40:34 buildroot daemon.info dnsmasq-tftp[225]: sent
/data/tftp/barebox-production.bin to 192.168.0.79
Jan 23 09:40:38 buildroot daemon.err dnsmasq-tftp[225]: error 0
received from 192.168.0.79
Jan 23 09:40:38 buildroot daemon.info dnsmasq-tftp[225]: failed
sending /data/tftp/art.bin to 192.168.0.79
Jan 23 09:40:38 buildroot daemon.err dnsmasq-tftp[225]: error 0
received from 192.168.0.79
Jan 23 09:40:38 buildroot daemon.info dnsmasq-tftp[225]: failed
sending /data/tftp/art.bin to 192.168.0.79
Jan 23 09:40:38 buildroot daemon.info dnsmasq-tftp[225]: sent
/data/tftp/art.bin to 192.168.0.79
Jan 23 09:40:40 buildroot daemon.info dnsmasq-tftp[225]: sent
/data/tftp/data.bin to 192.168.0.79
Jan 23 09:40:40 buildroot daemon.info dnsmasq-tftp[225]: sent
/data/tftp/data.bin to 192.168.0.79
Jan 23 09:40:40 buildroot daemon.info dnsmasq-tftp[225]: sent
/data/tftp/data.bin to 192.168.0.79

Yegor

_______________________________________________
barebox mailing list
barebox@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/barebox

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

* Re: tftp get and last ack hanlding
  2017-01-23  9:01 tftp get and last ack hanlding Yegor Yefremov
  2017-01-23  9:56 ` Yegor Yefremov
@ 2017-01-24  8:30 ` Sascha Hauer
  1 sibling, 0 replies; 3+ messages in thread
From: Sascha Hauer @ 2017-01-24  8:30 UTC (permalink / raw)
  To: Yegor Yefremov; +Cc: barebox

On Mon, Jan 23, 2017 at 10:01:04AM +0100, Yegor Yefremov wrote:
> I'm using dnsmaq as tftp server. When I execute tftp file on barebox
> 2016.07.0 I get the required file, but dnsmasq complains about missing
> ACK (my interpretation of dnsmaq source code). If I'm performing the
> same operation in Linux using busybox ftfp - everything is OK, i.e.
> instead of "failed sending" I get "sent". Is this a desired barebox
> tftp behavior?

To answer this question: No, it's not a desired behaviour. It may be
because of your network driver, but I also wouldn't wonder if the tftp
code triggers this.

Sascha


-- 
Pengutronix e.K.                           |                             |
Industrial Linux Solutions                 | http://www.pengutronix.de/  |
Peiner Str. 6-8, 31137 Hildesheim, Germany | Phone: +49-5121-206917-0    |
Amtsgericht Hildesheim, HRA 2686           | Fax:   +49-5121-206917-5555 |

_______________________________________________
barebox mailing list
barebox@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/barebox

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

end of thread, other threads:[~2017-01-24  8:31 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2017-01-23  9:01 tftp get and last ack hanlding Yegor Yefremov
2017-01-23  9:56 ` Yegor Yefremov
2017-01-24  8:30 ` Sascha Hauer

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