lkml.org 
[lkml]   [1999]   [Sep]   [27]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
Date
From
SubjectRe: tcp/ip bug (2.2.12) or telnet client bug
> > > I insist, there is no daemon listening on
the specified port.
> > > Anything i type in is simply echo'd.
>
> Confirmed that version 2.3.13 has that bug also.

On 2.2.12 the attached C code works to demonstrate the problem, compile
the code to a binary stest

To use it first of all run tcpdump -i lo to snoop your localhost interface
then, do
./stest <anyport with no listener>

Then do look at the tcpdump window and see socket the system is trying to
use, take this number increase it by one and then run

./stest <number+1>

This should connect now ...

e.g.

./stest 9600

tcpdump gives
18:35:21.211797 localhost.9600 > localhost.1315: R 0:0(0) ack 1 win 0

so do ./stest 1316 and it connects...

this is not meant to happen as far as I know ...

Dave.
>

------------ David Airlie, David.Airlie@ul.ie,airlied@skynet --------
Telecommunications Research Centre, ECE Dept, University of Limerick \
http://www.csn.ul.ie/~airlied -- Telecommunications Researcher \
--- TEL: +353-61-202695 -----------------------------------------------
#include <arpa/inet.h>
#include <sys/socket.h>
#include <netinet/in.h>
#include <netinet/tcp.h>
#include <stdio.h>
#include <netdb.h>

int main(int argc, char *argv[])
{
int x,s,ch;
struct sockaddr_in sa_in;
struct hostent *hp;

s=socket(PF_INET, SOCK_STREAM, 0);

hp=gethostbyname("localhost");
memcpy(&(sa_in.sin_addr), hp->h_addr, hp->h_length);

sa_in.sin_family=hp->h_addrtype;
sa_in.sin_port=htons(atoi(argv[1]));

x=connect(s, (const struct sockaddr *)&sa_in, sizeof(sa_in));
if (x==-1)
{
perror("Connect:");
exit(-1);
}
printf("connected..\n");
ch=getchar();
close(s);
}


\
 
 \ /
  Last update: 2005-03-22 13:54    [W:0.083 / U:0.572 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site