* [ECOS] RedBoot doesn't handle telnet WILL properly.
@ 2006-04-01 17:56 Grant Edwards
2006-04-07 22:59 ` Gary Thomas
0 siblings, 1 reply; 3+ messages in thread
From: Grant Edwards @ 2006-04-01 17:56 UTC (permalink / raw)
To: ecos-discuss
Why does RedBoot handle DO but not WILL? It's normal for a
telnet client to send a bunch of WILL commands after connecting
to a server.
The current code in net_io_getc_nonblock() handles the telnet
DO by replying with a WONT (which is a correct). But, when it
receives a WILL sequence from the client, it just returns the
option code as a received character and doesn't reply to the
client.
This causes the first command read by the main loop to contain
a bunch of "garbage" characters consisting of all of the option
codes which the client said it "WILL" do during option
negotiation.
I've added code to net_io_getc_nonblock() in my version of
RedBoot to fix this problem.
Is there interest in merging this fix into CVS?
------------------------------8<------------------------------
--- net_io.c-old 2006-04-01 11:52:30.000000000 -0600
+++ net_io.c 2006-04-01 11:52:52.000000000 -0600
@@ -161,18 +161,20 @@
// Functions in this module
static void net_io_flush(void);
static void net_io_revert_console(void);
static void net_io_putc(void*, cyg_uint8);
// Special characters used by Telnet - must be interpretted here
#define TELNET_IAC 0xFF // Interpret as command (escape)
#define TELNET_IP 0xF4 // Interrupt process
-#define TELNET_WONT 0xFC // I Won't do it
+#define TELNET_WILL 0xFB // I Will do XXX
+#define TELNET_WONT 0xFC // I Won't do XXX
#define TELNET_DO 0xFD // Will you XXX
+#define TELNET_DONT 0xFE // Don't you XXX
#define TELNET_TM 0x06 // Time marker (special DO/WONT after IP)
static cyg_bool
_net_io_getc_nonblock(void* __ch_data, cyg_uint8* ch)
{
if (in_buflen == 0) {
__tcp_poll();
if (tcp_sock.state == _CLOSE_WAIT) {
@@ -239,16 +241,24 @@
case TELNET_DO:
// Telnet DO option
while (!_net_io_getc_nonblock(__ch_data, &esc)) ;
// Respond with WONT option
net_io_putc(__ch_data, TELNET_IAC);
net_io_putc(__ch_data, TELNET_WONT);
net_io_putc(__ch_data, esc);
return false; // Ignore this whole thing!
+ case TELNET_WILL:
+ // Telnet WILL option
+ while (!_net_io_getc_nonblock(__ch_data, &esc)) ;
+ // Respond with DONT option
+ net_io_putc(__ch_data, TELNET_IAC);
+ net_io_putc(__ch_data, TELNET_DONT);
+ net_io_putc(__ch_data, esc);
+ return false; // Ignore this whole thing!
default:
return false;
}
}
static cyg_uint8
net_io_getc(void* __ch_data)
{
------------------------------8<------------------------------
--
Grant Edwards grante Yow! Yow! It's a hole
at all the way to downtown
visi.com Burbank!
--
Before posting, please read the FAQ: http://ecos.sourceware.org/fom/ecos
and search the list archive: http://ecos.sourceware.org/ml/ecos-discuss
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: [ECOS] RedBoot doesn't handle telnet WILL properly.
2006-04-01 17:56 [ECOS] RedBoot doesn't handle telnet WILL properly Grant Edwards
@ 2006-04-07 22:59 ` Gary Thomas
2006-04-07 23:25 ` [ECOS] " Grant Edwards
0 siblings, 1 reply; 3+ messages in thread
From: Gary Thomas @ 2006-04-07 22:59 UTC (permalink / raw)
To: Grant Edwards; +Cc: eCos Discussion
On Sat, 2006-04-01 at 17:56 +0000, Grant Edwards wrote:
> Why does RedBoot handle DO but not WILL? It's normal for a
> telnet client to send a bunch of WILL commands after connecting
> to a server.
>
> The current code in net_io_getc_nonblock() handles the telnet
> DO by replying with a WONT (which is a correct). But, when it
> receives a WILL sequence from the client, it just returns the
> option code as a received character and doesn't reply to the
> client.
>
> This causes the first command read by the main loop to contain
> a bunch of "garbage" characters consisting of all of the option
> codes which the client said it "WILL" do during option
> negotiation.
>
> I've added code to net_io_getc_nonblock() in my version of
> RedBoot to fix this problem.
Seems reasonable - applied (with a ChangeLog - next time, please
provide one and send to ecos-patches :-)
--
------------------------------------------------------------
Gary Thomas | Consulting for the
MLB Associates | Embedded world
------------------------------------------------------------
--
Before posting, please read the FAQ: http://ecos.sourceware.org/fom/ecos
and search the list archive: http://ecos.sourceware.org/ml/ecos-discuss
^ permalink raw reply [flat|nested] 3+ messages in thread
* [ECOS] Re: RedBoot doesn't handle telnet WILL properly.
2006-04-07 22:59 ` Gary Thomas
@ 2006-04-07 23:25 ` Grant Edwards
0 siblings, 0 replies; 3+ messages in thread
From: Grant Edwards @ 2006-04-07 23:25 UTC (permalink / raw)
To: Gary Thomas; +Cc: eCos Discussion
On Fri, Apr 07, 2006 at 04:59:24PM -0600, Gary Thomas wrote:
> On Sat, 2006-04-01 at 17:56 +0000, Grant Edwards wrote:
> > Why does RedBoot handle DO but not WILL? It's normal for a
> > telnet client to send a bunch of WILL commands after connecting
> > to a server.
> >
> > The current code in net_io_getc_nonblock() handles the telnet
> > DO by replying with a WONT (which is a correct). But, when it
> > receives a WILL sequence from the client, it just returns the
> > option code as a received character and doesn't reply to the
> > client.
> >
> > This causes the first command read by the main loop to contain
> > a bunch of "garbage" characters consisting of all of the option
> > codes which the client said it "WILL" do during option
> > negotiation.
> >
> > I've added code to net_io_getc_nonblock() in my version of
> > RedBoot to fix this problem.
>
> Seems reasonable - applied (with a ChangeLog - next time, please
> provide one and send to ecos-patches :-)
I was planning on doing that if somebody expressed interest in
the fix. I wasn't sure if it was something anybody else cared
about or not.
I've got a RedBoot TCP stack fix for which I need to gen a
patch too...
--
Grant Edwards
grante@visi.com
--
Before posting, please read the FAQ: http://ecos.sourceware.org/fom/ecos
and search the list archive: http://ecos.sourceware.org/ml/ecos-discuss
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2006-04-07 23:25 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2006-04-01 17:56 [ECOS] RedBoot doesn't handle telnet WILL properly Grant Edwards
2006-04-07 22:59 ` Gary Thomas
2006-04-07 23:25 ` [ECOS] " Grant Edwards
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).