• Open Menu Close Menu
  • Apple
  • Shopping Bag
  • Apple
  • Mac
  • iPad
  • iPhone
  • Watch
  • TV
  • Music
  • Support
  • Search apple.com
  • Shopping Bag

Lists

Open Menu Close Menu
  • Terms and Conditions
  • Lists hosted on this site
  • Email the Postmaster
  • Tips for posting to public mailing lists
Re: hping2 on Intel error
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: hping2 on Intel error


  • Subject: Re: hping2 on Intel error
  • From: James Reynolds <email@hidden>
  • Date: Mon, 26 Jun 2006 17:30:28 -0600

Bryan Christianson of whatroute.net figured this one out. Here is the fix in case anyone needs it.

At 9:04 AM +1200 6/27/06, Bryan Christianson wrote:
There were a couple of problems I found with the source

1.	<sys/pcap.h> needs to be included before <pcap.h> in
libpcap_stuff.c

2.	the configure script generates systype.h which defines the OS to
be
	#define OSTYPE_DARWIN

	This type had to be added to tests in sendip.c and ars.c to
activate the weird host-order fields in the raw packet. The code was there
to do that, but OSTYPE_DARWIN was falling thru and generating the more
usual network order for the 2 affected fields.

That is, in libpcap_stuff.c change:

#include <pcap.h>
#include <net/bpf.h>

to:

#include <net/bpf.h>
#include <pcap.h>

In ars.c

#if defined OSTYPE_FREEBSD || defined OSTYPE_NETBSD || defined OSTYPE_BSDI
	ip->tot_len = ntohs(ip->tot_len);
	ip->frag_off = ntohs(ip->frag_off);

needs to be

#if defined OSTYPE_DARWIN || defined OSTYPE_FREEBSD || defined OSTYPE_NETBSD || defined OSTYPE_BSDI
ip->tot_len = ntohs(ip->tot_len);
ip->frag_off = ntohs(ip->frag_off);


In sendip.c

#if defined OSTYPE_FREEBSD || defined OSTYPE_NETBSD || defined OSTYPE_BSDI
/* FreeBSD */
/* NetBSD */
	ip->tot_len	= packetsize;

needs to be

#if defined OSTYPE_DARWIN || OSTYPE_FREEBSD || defined OSTYPE_NETBSD || defined OSTYPE_BSDI
/* FreeBSD */
/* NetBSD */
ip->tot_len = packetsize;


and

#if defined OSTYPE_FREEBSD || defined OSTYPE_NETBSD | defined OSTYPE_BSDI
/* FreeBSD */
/* NetBSD */
	ip->frag_off	|= more_fragments;
	ip->frag_off	|= fragoff >> 3;

needs to be

#if defined OSTYPE_DARWIN || OSTYPE_FREEBSD || defined OSTYPE_NETBSD | defined OSTYPE_BSDI
/* FreeBSD */
/* NetBSD */
ip->frag_off |= more_fragments;
ip->frag_off |= fragoff >> 3;


--

Thanks,

James Reynolds - University of Utah - Student Computing Labs - 801-585-9811
james(a)scl.utah.edu - james(a)magnusviri.com - http://james.magnusviri.com



I've compiled hping2 rc3 (http://www.hping.org/) on an Intel box (10.4.6, Xcode 2.3) and I get this error when running it:

[send_ip] sendto: Invalid argument

If I run it with ktrace, I get this:

  1704 hping2   CALL  sendto(0x4,0x5004d0,0x28,0,0x152d0,0x10)
  1704 hping2   RET   sendto -1 errno 22 Invalid argument
  1704 hping2   CALL  writev(0x2,0xbffff2b0,0x4)
  1704 hping2   GIO   fd 2 wrote 35 bytes
       "[send_ip] sendto: Invalid argument
       "

_______________________________________________ Do not post admin requests to the list. They will be ignored. Macnetworkprog mailing list (email@hidden) Help/Unsubscribe/Update your Subscription: This email sent to email@hidden
References: 
 >hping2 on Intel error (From: James Reynolds <email@hidden>)

  • Prev by Date: Re: Uploading files to http server
  • Next by Date: Re: mystified by PackageMaker
  • Previous by thread: hping2 on Intel error
  • Next by thread: Uploading files to http server
  • Index(es):
    • Date
    • Thread