--- /sys/man/3/ip +++ /sys/man/3/ip @@ -720,6 +720,9 @@ files support the following additional messages: .TF "\fLkeepalive\fI n\fR" .PD .TP +.B close +gracefully close down this TCP connection +.TP .B hangup close down this TCP connection .TP --- /sys/src/9/ip/tcp.c +++ /sys/src/9/ip/tcp.c @@ -1439,6 +1439,16 @@ sndrst(Proto *tcp, uchar *source, uchar *dest, ushort length, Tcp *seg, uchar ve } } +/* + * close the conversation + */ +static char* +tcpclose2(Conv *s) +{ + tcpclose(s); + return nil; +} + /* * send a reset to the remote side and close the conversation * called with s qlocked @@ -3319,6 +3329,8 @@ tcpporthogdefensectl(char *val) static char* tcpctl(Conv* c, char** f, int n) { + if(n == 1 && strcmp(f[0], "close") == 0) + return tcpclose2(c); if(n == 1 && strcmp(f[0], "hangup") == 0) return tcphangup(c); if(n == 1 && strcmp(f[0], "hangupxmit") == 0)