* [PATCH net-pu] tftp: fix get
@ 2010-06-24 13:26 Baruch Siach
2010-06-24 15:59 ` Sascha Hauer
0 siblings, 1 reply; 5+ messages in thread
From: Baruch Siach @ 2010-06-24 13:26 UTC (permalink / raw)
To: barebox
With this patch tftp start requesting block 0 instead of 1. This fixes
tftp get on i.MX25 based board with tftpd-hpa server.
Signed-off-by: Baruch Siach <baruch@tkos.co.il>
---
tftp push isn't working though. I get:
error frame: 0x83705178 0x00000882
from the fec driver. I'll investigate this if I have time.
net/tftp.c | 2 +-
1 files changed, 1 insertions(+), 1 deletions(-)
diff --git a/net/tftp.c b/net/tftp.c
index c0d3278..14d9b5e 100644
--- a/net/tftp.c
+++ b/net/tftp.c
@@ -320,7 +320,7 @@ static int do_tftpb(struct command *cmdtp, int argc, char *argv[])
tftp_timer_start = get_time_ns();
tftp_state = tftp_put ? STATE_WRQ : STATE_RRQ;
- tftp_block = 1;
+ tftp_block = 0;
tftp_err = tftp_send();
if (tftp_err)
--
1.7.1
_______________________________________________
barebox mailing list
barebox@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/barebox
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: [PATCH net-pu] tftp: fix get
2010-06-24 13:26 [PATCH net-pu] tftp: fix get Baruch Siach
@ 2010-06-24 15:59 ` Sascha Hauer
2010-06-27 5:14 ` Baruch Siach
0 siblings, 1 reply; 5+ messages in thread
From: Sascha Hauer @ 2010-06-24 15:59 UTC (permalink / raw)
To: Baruch Siach; +Cc: barebox
Hi Baruch,
On Thu, Jun 24, 2010 at 04:26:16PM +0300, Baruch Siach wrote:
> With this patch tftp start requesting block 0 instead of 1. This fixes
> tftp get on i.MX25 based board with tftpd-hpa server.
This is strange. In case of tftp get this variable is not used for
sending packets. We do not request blocks with a certain number, we only
request a file and ack incoming packets. If you look at 'case TFTP_DATA'
in tftp_handler(), you'll see tftp_block getting overwritten by the
block number of the incoming packet.
The initialization of tftp_block is only used for tftp push. For tftp
push RFC1350 says that the first packet we send has to have block number
one (not zero).
>
> tftp push isn't working though. I get:
>
> error frame: 0x83705178 0x00000882
>
> from the fec driver. I'll investigate this if I have time.
I also see this message sometimes, but usually this is not a problem.
The transfer continues once the timeout handler triggers and the packet
is resent.
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] 5+ messages in thread
* Re: [PATCH net-pu] tftp: fix get
2010-06-24 15:59 ` Sascha Hauer
@ 2010-06-27 5:14 ` Baruch Siach
2010-06-28 7:55 ` Sascha Hauer
0 siblings, 1 reply; 5+ messages in thread
From: Baruch Siach @ 2010-06-27 5:14 UTC (permalink / raw)
To: Sascha Hauer; +Cc: barebox
Hi Sascha,
On Thu, Jun 24, 2010 at 05:59:07PM +0200, Sascha Hauer wrote:
> On Thu, Jun 24, 2010 at 04:26:16PM +0300, Baruch Siach wrote:
> > With this patch tftp start requesting block 0 instead of 1. This fixes
> > tftp get on i.MX25 based board with tftpd-hpa server.
>
> This is strange. In case of tftp get this variable is not used for
> sending packets. We do not request blocks with a certain number, we only
> request a file and ack incoming packets. If you look at 'case TFTP_DATA'
> in tftp_handler(), you'll see tftp_block getting overwritten by the
> block number of the incoming packet.
The code that sends the first acknowledgement (in my case, i.e. tftpd-hpa) is
at 'case STATE_OACK', in response to the "Option Acknowledgement" of the
'timeout=5' option. This code does not initialize tftp_block.
> The initialization of tftp_block is only used for tftp push. For tftp
> push RFC1350 says that the first packet we send has to have block number
> one (not zero).
I'll send a patch fixing push along the same line (for me) shortly.
> > tftp push isn't working though. I get:
> >
> > error frame: 0x83705178 0x00000882
> >
> > from the fec driver. I'll investigate this if I have time.
>
> I also see this message sometimes, but usually this is not a problem.
> The transfer continues once the timeout handler triggers and the packet
> is resent.
I see. Thanks for the info.
baruch
--
~. .~ Tk Open Systems
=}------------------------------------------------ooO--U--Ooo------------{=
- baruch@tkos.co.il - tel: +972.2.679.5364, http://www.tkos.co.il -
_______________________________________________
barebox mailing list
barebox@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/barebox
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: [PATCH net-pu] tftp: fix get
2010-06-27 5:14 ` Baruch Siach
@ 2010-06-28 7:55 ` Sascha Hauer
2010-06-28 8:22 ` Baruch Siach
0 siblings, 1 reply; 5+ messages in thread
From: Sascha Hauer @ 2010-06-28 7:55 UTC (permalink / raw)
To: Baruch Siach; +Cc: barebox
On Sun, Jun 27, 2010 at 08:14:46AM +0300, Baruch Siach wrote:
> Hi Sascha,
>
> On Thu, Jun 24, 2010 at 05:59:07PM +0200, Sascha Hauer wrote:
> > On Thu, Jun 24, 2010 at 04:26:16PM +0300, Baruch Siach wrote:
> > > With this patch tftp start requesting block 0 instead of 1. This fixes
> > > tftp get on i.MX25 based board with tftpd-hpa server.
> >
> > This is strange. In case of tftp get this variable is not used for
> > sending packets. We do not request blocks with a certain number, we only
> > request a file and ack incoming packets. If you look at 'case TFTP_DATA'
> > in tftp_handler(), you'll see tftp_block getting overwritten by the
> > block number of the incoming packet.
>
> The code that sends the first acknowledgement (in my case, i.e. tftpd-hpa) is
> at 'case STATE_OACK', in response to the "Option Acknowledgement" of the
> 'timeout=5' option. This code does not initialize tftp_block.
How about the following. This works for me with the hpa server in get
and push mode.
diff --git a/net/tftp.c b/net/tftp.c
index c0d3278..4b74dca 100644
--- a/net/tftp.c
+++ b/net/tftp.c
@@ -185,10 +185,21 @@ static void tftp_handler(char *packet, unsigned len)
case TFTP_OACK:
debug("Got OACK: %s %s\n", pkt, pkt + strlen(pkt) + 1);
- tftp_state = STATE_OACK;
tftp_server_port = ntohs(udp->uh_sport);
tftp_con->udp->uh_dport = udp->uh_sport;
- tftp_send(); /* Send ACK */
+
+ if (tftp_put) {
+ /* send first block */
+ tftp_state = STATE_WDATA;
+ tftp_block = 1;
+ } else {
+ /* send ACK */
+ tftp_state = STATE_OACK;
+ tftp_block = 0;
+ }
+
+ tftp_send();
+
break;
case TFTP_DATA:
if (len < 2)
--
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] 5+ messages in thread
* Re: [PATCH net-pu] tftp: fix get
2010-06-28 7:55 ` Sascha Hauer
@ 2010-06-28 8:22 ` Baruch Siach
0 siblings, 0 replies; 5+ messages in thread
From: Baruch Siach @ 2010-06-28 8:22 UTC (permalink / raw)
To: Sascha Hauer; +Cc: barebox
Hi Sascha,
On Mon, Jun 28, 2010 at 09:55:01AM +0200, Sascha Hauer wrote:
> On Sun, Jun 27, 2010 at 08:14:46AM +0300, Baruch Siach wrote:
> > On Thu, Jun 24, 2010 at 05:59:07PM +0200, Sascha Hauer wrote:
> > > On Thu, Jun 24, 2010 at 04:26:16PM +0300, Baruch Siach wrote:
> > > > With this patch tftp start requesting block 0 instead of 1. This fixes
> > > > tftp get on i.MX25 based board with tftpd-hpa server.
> > >
> > > This is strange. In case of tftp get this variable is not used for
> > > sending packets. We do not request blocks with a certain number, we only
> > > request a file and ack incoming packets. If you look at 'case TFTP_DATA'
> > > in tftp_handler(), you'll see tftp_block getting overwritten by the
> > > block number of the incoming packet.
> >
> > The code that sends the first acknowledgement (in my case, i.e. tftpd-hpa) is
> > at 'case STATE_OACK', in response to the "Option Acknowledgement" of the
> > 'timeout=5' option. This code does not initialize tftp_block.
>
> How about the following. This works for me with the hpa server in get
> and push mode.
Works for me too. Tested get and push.
BTW, why not s/tftp_put/tftp_push/?
baruch
> diff --git a/net/tftp.c b/net/tftp.c
> index c0d3278..4b74dca 100644
> --- a/net/tftp.c
> +++ b/net/tftp.c
> @@ -185,10 +185,21 @@ static void tftp_handler(char *packet, unsigned len)
>
> case TFTP_OACK:
> debug("Got OACK: %s %s\n", pkt, pkt + strlen(pkt) + 1);
> - tftp_state = STATE_OACK;
> tftp_server_port = ntohs(udp->uh_sport);
> tftp_con->udp->uh_dport = udp->uh_sport;
> - tftp_send(); /* Send ACK */
> +
> + if (tftp_put) {
> + /* send first block */
> + tftp_state = STATE_WDATA;
> + tftp_block = 1;
> + } else {
> + /* send ACK */
> + tftp_state = STATE_OACK;
> + tftp_block = 0;
> + }
> +
> + tftp_send();
> +
> break;
> case TFTP_DATA:
> if (len < 2)
--
~. .~ Tk Open Systems
=}------------------------------------------------ooO--U--Ooo------------{=
- baruch@tkos.co.il - tel: +972.2.679.5364, http://www.tkos.co.il -
_______________________________________________
barebox mailing list
barebox@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/barebox
^ permalink raw reply [flat|nested] 5+ messages in thread
end of thread, other threads:[~2010-06-28 8:22 UTC | newest]
Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2010-06-24 13:26 [PATCH net-pu] tftp: fix get Baruch Siach
2010-06-24 15:59 ` Sascha Hauer
2010-06-27 5:14 ` Baruch Siach
2010-06-28 7:55 ` Sascha Hauer
2010-06-28 8:22 ` Baruch Siach
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox