[Tcpick-project] [PATCH] handle TCP resets
Status: Beta
Brought to you by:
duskdruid
From: Buck H. <bu...@po...> - 2004-10-29 19:17:25
|
this patch adds minimal TCP RST processing. it may not be complete or correct, since the tcpick code is so nice and modular that i thought i could just inject a line or two without poring over the rest of the code and not break anything, so i probably overlooked something crucial --buck diff -uwr tcpick-0.1.24/src/conn_t.h tcpick.new/src/conn_t.h --- tcpick-0.1.24/src/conn_t.h Mon Aug 16 20:00:24 2004 +++ tcpick.new/src/conn_t.h Fri Oct 29 14:15:43 2004 @@ -18,6 +18,7 @@ TIME_WAIT__LAST_ACK, LAST_ACK, CLOSED, + RST, NIHL } Status_t; diff -uwr tcpick-0.1.24/src/colors.h tcpick.new/src/colors.h --- tcpick-0.1.24/src/colors.h Mon Aug 16 20:00:25 2004 +++ tcpick.new/src/colors.h Fri Oct 29 15:03:35 2004 @@ -31,6 +31,7 @@ #define _STATUS_COLOR(s) BRIGHT, s == ESTABLISHED ? GREEN : \ s == CLOSED ? RED : \ + s == RST ? RED : \ YELLOW #define c_WELCOME BRIGHT, CYAN #define c_INTERFACE BRIGHT, GREEN diff -uwr tcpick-0.1.24/src/display.c tcpick.new/src/display.c --- tcpick-0.1.24/src/display.c Tue Aug 17 03:25:39 2004 +++ tcpick.new/src/display.c Fri Oct 29 14:17:57 2004 @@ -60,6 +60,9 @@ strcpy( str, "CLOSED" ); /* should it be TIME-WAIT? */ break; + case RST: + strcpy( str, "RESET" ); + break; default: strcpy( str, "ERROR" ); break; diff -uwr tcpick-0.1.24/src/tracker.c tcpick.new/src/tracker.c --- tcpick-0.1.24/src/tracker.c Tue Aug 17 02:20:00 2004 +++ tcpick.new/src/tracker.c Fri Oct 29 14:15:17 2004 @@ -38,7 +38,7 @@ { #define CURR (prev->next) display_status( stdout, CURR, status ); - if ( status == CLOSED ) + if ( status == CLOSED || status == RST ) rmconn( prev ); else CURR->status = status; diff -uwr tcpick-0.1.24/src/verify.c tcpick.new/src/verify.c --- tcpick-0.1.24/src/verify.c Tue Aug 17 04:07:00 2004 +++ tcpick.new/src/verify.c Fri Oct 29 14:15:48 2004 @@ -88,6 +88,9 @@ CURRENT_CONN->status == TIME_WAIT__LAST_ACK && \ CURRENT_CONN->closer == Desc->side +#define IS_RST \ + tcppacket->rst == 1 + extern struct flags_t flags; extern conn_t * first_conn; @@ -204,6 +207,12 @@ /* LAST-ACK sent */ if( IS_CLOSING ) { status_switch( prev_conn, CLOSED ); + return 1; + } + +/* RST */ + if( IS_RST ) { + status_switch( prev_conn, RST ); return 1; } |