changeset 2178:9bb18751f4b7

Handle TELNET_WILL (reject) - from Grant Edwards
author gthomas
date Fri, 07 Apr 2006 23:00:00 +0000
parents 970f455a2397
children 74ad444238e4
files packages/redboot/current/ChangeLog packages/redboot/current/src/net/net_io.c
diffstat 2 files changed, 16 insertions(+), 1 deletions(-) [+]
line wrap: on
line diff
--- a/packages/redboot/current/ChangeLog
+++ b/packages/redboot/current/ChangeLog
@@ -1,3 +1,8 @@
+2006-04-07  Grant Edwards <grante@visi.com>
+
+	* src/net/net_io.c (net_io_getc_nonblock): 
+	Handle TELNET_WILL (reject same as TELNET_DO)
+
 2006-04-03  Lars Povlsen  <lpovlsen@vitesse.com>
  
  	* src/flash.c (fis_update_directory): Fixed flash region size when
--- a/packages/redboot/current/src/net/net_io.c
+++ b/packages/redboot/current/src/net/net_io.c
@@ -170,8 +170,10 @@ 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
@@ -248,6 +250,14 @@ net_io_getc_nonblock(void* __ch_data, cy
         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;
     }