From owner-freebsd-arch Fri Mar 9 12: 8:25 2001 Delivered-To: freebsd-arch@freebsd.org Received: from molly.straylight.com (molly.straylight.com [209.68.199.242]) by hub.freebsd.org (Postfix) with ESMTP id 5628F37B718; Fri, 9 Mar 2001 12:08:15 -0800 (PST) (envelope-from jonathan@graehl.org) Received: from dickie (case.straylight.com [209.68.199.244]) by molly.straylight.com (8.11.0/8.10.0) with SMTP id f29K88w02786; Fri, 9 Mar 2001 12:08:08 -0800 From: "Jonathan Graehl" To: "Walter Goralski" Cc: "Freebsd-Net" , "freebsd-Arch" Subject: missing #includes in /usr/include headers (was RE: Generating SYN packets.) Date: Fri, 9 Mar 2001 12:08:17 -0800 Message-ID: MIME-Version: 1.0 Content-Type: text/plain; charset="iso-8859-1" Content-Transfer-Encoding: 7bit X-Priority: 3 (Normal) X-MSMail-Priority: Normal X-Mailer: Microsoft Outlook IMO, Build 9.0.2416 (9.0.2910.0) In-Reply-To: X-MimeOLE: Produced By Microsoft MimeOLE V5.50.4522.1200 Importance: Normal Sender: owner-freebsd-arch@FreeBSD.ORG Precedence: bulk X-Loop: FreeBSD.ORG 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 requires , 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, 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-arch" in the body of the message