Skip site navigation (1)Skip section navigation (2)
Date:      Fri, 9 Mar 2001 12:08:17 -0800
From:      "Jonathan Graehl" <jonathan@graehl.org>
To:        "Walter Goralski" <walterg@juniper.net>
Cc:        "Freebsd-Net" <freebsd-net@freebsd.org>, "freebsd-Arch" <freebsd-arch@freebsd.org>
Subject:   missing #includes in /usr/include headers (was RE: Generating SYN packets.)
Message-ID:  <NCBBLOALCKKINBNNEDDLCEDIDMAA.jonathan@graehl.org>
In-Reply-To: <C0D6C1C24CDBE1449BFEF1B72AFBF3A7057ECEFE@postal.jnpr.net>

next in thread | previous in thread | raw e-mail | index | archive | help
cd /usr/ports/net/nemesis
make install

Nemesis (http://www.packetninja.net/nemesis/) is a command line tool that can
easily generate syn packets; if you want a flood, write a script.

There is also /usr/ports/net/libnet
http://www.packetfactory.net/Projects/Libnet/
- it is used by nemesis and is supposed to provide simplified cross-platform
support for low level packet building/injection.

Specific to your problem: it seems that <netinet/tcp.h> requires <sys/types.h>,
but does not #include it.  n_long is defined in in_systm.h and used in ip_icmp.h
and ip.h (not tcp.h)  I have complained without response (on freebsd-arch, maybe
not the right place) of similar problems with the /usr/include headers - while
they include some of their prerequisites, they seem to assume that you have
already included several other headers.

For instance, <netinet/tcp_var.h> requires tcp.h but does not include it,
udp_var.h requires udp.h and ip_var.h, icmp_var.h requires ip_icmp.h, ip.h, and
in_systm.h ... and probably others that I did not notice since I had earlier
included them for other purposes.  There seemed to be code that should have been
wrapped in an #ifdef KERNEL, although I didn't feel like #ifdefing it out and
doing a make world to test.  Correcting these compile errors in the headers
requires some tiresome find/grep work, although I suppose the whole process of
finding missing #includes could be (semi)automated.

find . -name '*.[ch]*' -exec grep -H $1 {} \;

Very few of the header files include their prereqs, although they are #ifdef
wrapped to prevent re-inclusion:

find /usr/include -name '*.h' -exec gcc -c -xc {} -o /dev/null \;

gives reams of error messages.

> -----Original Message-----
> From: owner-freebsd-net@FreeBSD.ORG
> [mailto:owner-freebsd-net@FreeBSD.ORG]On Behalf Of Walter Goralski
> Sent: Friday, March 09, 2001 8:04 AM
> To: 'freebsd-hackers@freebsd.org'; 'freebsd-net@freebsd.org'
> Subject: Generating SYN packets.
>
>
> Folks:
>
> Andreas Klemm, who ported cflowd to FreeBSD, suggested I use this vehicle to
> see if I could get some help.
>
> I am a course developer for Juniper Networks, and I have just written a
> 2-day advanced course on router firewall filters (this is one reason for the
> cflowd).
>
> We have participants in a strictly closed lab environment configuring
> filters to stop spoofs, smurf, fraggle, etc. In order to show they work, we
> also have a 4.2 FreeBSD laptop that can launch smurf, fraggle, etc. at the
> routers and the instructor's PC.
>
> The missing piece has been DOS SYN attacks. I have the really common
> "synk4.c" source that is all over the Web, but I get errors when I try to
> compile it ("it's the linux includes" someone told me). Now, I last used my
> C programming skills in the 80s on a Silent 700 teletype and a 3B20 mini, so
> I tried playing around with "programming by analogy" (hey, it sometimes
> works). I took fraggle.c and tried to substitute a tcp header for the udp
> header. Anyway, the compiler tells me there is a syntax error in tcp.h
> (right before the "n_long"), which strikes me as odd. Then it says I am
> using an "incomplete type" and dereferences all of my pointers. Sometimes I
> can force a compile and lonk, but none of my paramters get plugged into the
> packets when I use it.
>
> So: anybody got a quick and dirty SYN packet generator out there? A version
> of synk4 that runs on 4.2? An executable?
>
> I even tried to install hping2 from the FreeBSD ports collection, but of
> course *that* won't run either. (It says my ep0 interface is not defined (!)
> and seems to try to use lo.) If I use "make install," I get these run time
> errors; if I use "./configure" and then "make" I get compile errors, also
> about "overlapping" includes. (***Are my include files all screwed up?***
> How could I tell?)
>
> But the cflowd and RADIUS servers, also installed a couple of weeks ago from
> these ports, run merrily along, so the basic system seems to be intact. I
> don't think my programming efforts have scrammed the system (and I don't
> have the cd-rom, since it's a company laptop), but I am very worried that I
> have somehow harmed the .h files.
>
> Meanwhile, I'm re-learning BSD socket coding. But this might be faster if
> anyone can help.
>
> (As a note, if anyone out there works for Juniper, I can configure remote
> access to the laptop if required.)
>
> Walter Goralski
> walterg@juniper.net
> 952-938-4483
>
>
> To Unsubscribe: send mail to majordomo@FreeBSD.org
> with "unsubscribe freebsd-net" in the body of the message
>


To Unsubscribe: send mail to majordomo@FreeBSD.org
with "unsubscribe freebsd-net" in the body of the message




Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?NCBBLOALCKKINBNNEDDLCEDIDMAA.jonathan>