Messages in this thread | | | Date | Mon, 27 Sep 1999 18:38:00 +0100 (IST) | From | Dave Airlie <> | Subject | Re: 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); }
| |