From: Alastair Poole <alastair@unixtrix.com>
To: Michal Schmidt <xschmi00@stud.feec.vutbr.cz>
Cc: linux-kernel@vger.kernel.org
Subject: Re: BUG: Unusual TCP Connect() results.
Date: Fri, 10 Jun 2005 16:55:35 +0000 [thread overview]
Message-ID: <42A9C607.4030209@unixtrix.com> (raw)
In-Reply-To: <42A9B193.1020602@stud.feec.vutbr.cz>
[-- Attachment #1: Type: text/plain, Size: 862 bytes --]
Michal Schmidt wrote:
>>> What is the last version that works as expected for you?
>>
Kernel 2.6.11, though I can't check others due to bandwidth
restrictions. 2.6.11.10 through 2.6.12-rc6 all have the same issue.
>>> Are you testing your scanner only on localhost? Maybe you are just
>>> lucky and connect your TCP socket to itself.
>>
This problem only occurs on localhost. I don't think it is mere luck,
these are too frequent and strange for this.
>>>
>>> What are these asterisks doing there? Next time when you copy&paste
>>> code, please make sure you don't mangle it.
>>>
I apologise for this, included this time is an attatchment in the hope
you are able to reproduce the strange results I and others have been
able to. Try testing multiple times, I find that 18 out of 20 runs
produces the same type of results.
sincerely
Alastair Poole
[-- Attachment #2: scan.c --]
[-- Type: text/plain, Size: 1184 bytes --]
#include <stdio.h>
#include <stdlib.h>
#include <unistd.h>
#include <errno.h>
#include <sys/types.h>
#include <sys/socket.h>
#include <netinet/in.h>
#include <arpa/inet.h>
#include <netdb.h>
#include <time.h>
#include <string.h>
int
main (int argc, char **argv)
{
int sd, result, server_port;
struct hostent *he;
struct sockaddr_in servaddr;
printf ("Test TCP/IP port scanner:\n");
if (argc != 2)
{
printf ("Usage: %s host\n", argv[0]);
exit (1);
}
if ((he = gethostbyname (argv[1])) == NULL)
{
perror ("gethostbyname()");
exit (1);
}
printf ("Scanning %s\n", argv[1]);
for (server_port = 0; server_port < 65536; server_port++)
{
if ((sd = socket (PF_INET, SOCK_STREAM, IPPROTO_TCP)) == -1)
{
perror ("socket()");
exit (1);
}
bzero (&servaddr, sizeof servaddr);
servaddr.sin_family = AF_INET;
servaddr.sin_port = htons (server_port);
servaddr.sin_addr = *((struct in_addr *) he->h_addr);
result = connect (sd, (struct sockaddr *) &servaddr, sizeof servaddr);
if (result != -1)
{
printf ("open port: %d\n",server_port);
}
close (sd);
}
return result;
}
next prev parent reply other threads:[~2005-06-10 15:56 UTC|newest]
Thread overview: 60+ messages / expand[flat|nested] mbox.gz Atom feed top
2005-06-09 20:51 BUG: Unusual TCP Connect() results Alastair Poole
2005-06-10 2:23 ` [OT] " Kyle Moffett
2005-06-10 13:24 ` Alastair Poole
2005-06-10 15:28 ` Michal Schmidt
2005-06-10 16:55 ` Alastair Poole [this message]
2005-06-10 16:06 ` Michal Schmidt
2005-06-10 22:26 ` Willy TARREAU
2005-06-10 22:38 ` Willy Tarreau
2005-06-10 22:42 ` David S. Miller
2005-06-11 6:24 ` Willy TARREAU
2005-06-11 7:43 ` [PATCH] fix small DoS on connect() (was Re: BUG: Unusual TCP Connect() results.) Willy Tarreau
2005-06-11 19:32 ` Herbert Xu
2005-06-11 19:51 ` Willy Tarreau
2005-06-11 19:51 ` Willy Tarreau
2005-06-12 8:13 ` Herbert Xu
2005-06-12 8:34 ` Willy Tarreau
2005-06-12 10:30 ` Herbert Xu
2005-06-12 10:30 ` Herbert Xu
2005-06-12 11:40 ` Willy Tarreau
2005-06-12 11:40 ` Willy Tarreau
2005-06-12 12:06 ` Herbert Xu
2005-06-12 12:06 ` Herbert Xu
2005-06-12 12:22 ` Thomas Graf
2005-06-12 12:22 ` Thomas Graf
2005-06-12 13:16 ` Herbert Xu
2005-06-12 12:32 ` Willy Tarreau
2005-06-12 13:13 ` Herbert Xu
2005-06-12 13:33 ` Herbert Xu
2005-06-12 13:33 ` Herbert Xu
2005-06-12 13:47 ` Willy Tarreau
2005-06-12 13:47 ` Willy Tarreau
2005-06-12 13:50 ` Herbert Xu
2005-06-12 14:24 ` Willy Tarreau
2005-06-12 14:24 ` Willy Tarreau
2005-06-13 4:48 ` Herbert Xu
2005-06-13 5:21 ` Willy Tarreau
2005-06-13 5:21 ` Willy Tarreau
2005-06-13 5:24 ` Herbert Xu
2005-06-13 6:17 ` Willy Tarreau
2005-06-13 6:17 ` Willy Tarreau
2005-06-13 7:45 ` Herbert Xu
2005-06-13 8:10 ` Willy Tarreau
2005-06-13 20:57 ` [PATCH] fix small DoS on connect() David S. Miller
2005-06-13 4:48 ` [PATCH] fix small DoS on connect() (was Re: BUG: Unusual TCP Connect() results.) Herbert Xu
2005-06-12 13:36 ` Willy Tarreau
2005-06-12 14:44 ` Thomas Graf
2005-06-12 15:02 ` Willy Tarreau
2005-06-12 14:44 ` Thomas Graf
2005-06-12 13:13 ` Herbert Xu
2005-06-12 12:32 ` Willy Tarreau
2005-06-12 8:34 ` Willy Tarreau
2005-06-12 8:13 ` Herbert Xu
2005-06-12 17:10 ` Denis Vlasenko
2005-06-12 17:36 ` Willy Tarreau
2005-06-12 17:47 ` Denis Vlasenko
2005-06-12 18:14 ` Willy Tarreau
2005-06-13 2:04 ` Valdis.Kletnieks
2005-06-13 2:04 ` Valdis.Kletnieks
2005-06-11 15:34 ` BUG: Unusual TCP Connect() results Alastair Poole
2005-06-11 14:38 ` Willy Tarreau
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=42A9C607.4030209@unixtrix.com \
--to=alastair@unixtrix.com \
--cc=linux-kernel@vger.kernel.org \
--cc=xschmi00@stud.feec.vutbr.cz \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.