LinuxQuestions.org
Help answer threads with 0 replies.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Software
User Name
Password
Linux - Software This forum is for Software issues.
Having a problem installing a new program? Want to know which application is best for the job? Post your question in this forum.

Notices


Reply
  Search this Thread
Old 03-30-2005, 05:50 AM   #1
Ephracis
Senior Member
 
Registered: Sep 2004
Location: Sweden
Distribution: Ubuntu, Debian
Posts: 1,109

Rep: Reputation: 50
hping: physical layer header size unknown


I can't use hping for some reason.

Code:
$ hping 127.0.0.1
HPING 127.0.0.1 (lo 127.0.0.1): S set, 40 headers + 0 data bytes
(I have blocked ping)

--- 127.0.0.1 hping statistic ---
2 packets tramitted, 0 packets received, 100% packet loss
round-trip min/avg/max = 0.0/0.0/0.0 ms
$ hping 192.168.0.48
[main] physical layer header size unknown
$ hping linuxquestions.org
[main] physical layer header size unknown
$ hping -i ath0 192.168.0.48
[main] physical layer header size unknown
$ ifconfig
ath0      Link encap:Ethernet  HWaddr 00:11:95:CA:78:64  
          inet addr:192.168.0.252  Bcast:192.168.0.255  Mask:255.255.255.0
          UP BROADCAST NOTRAILERS RUNNING MULTICAST  MTU:1500  Metric:1
          RX packets:1659 errors:90 dropped:0 overruns:0 frame:90
          TX packets:1641 errors:3 dropped:0 overruns:0 carrier:0
          collisions:0 txqueuelen:199 
          RX bytes:708812 (692.1 Kb)  TX bytes:243849 (238.1 Kb)
          Interrupt:18 Memory:ccfc0000-ccfd0000 

lo        Link encap:Local Loopback  
          inet addr:127.0.0.1  Mask:255.0.0.0
          UP LOOPBACK RUNNING  MTU:16436  Metric:1
          RX packets:54 errors:0 dropped:0 overruns:0 frame:0
          TX packets:54 errors:0 dropped:0 overruns:0 carrier:0
          collisions:0 txqueuelen:0 
          RX bytes:3336 (3.2 Kb)  TX bytes:3336 (3.2 Kb)
$ ping 192.168.0.48
PING 192.168.0.48 (192.168.0.48) 56(84) bytes of data.
64 bytes from 192.168.0.48: icmp_seq=1 ttl=64 time=4.88 ms
64 bytes from 192.168.0.48: icmp_seq=2 ttl=64 time=0.876 ms

--- 192.168.0.48 ping statistics ---
2 packets transmitted, 2 received, 0% packet loss, time 1000ms
rtt min/avg/max/mdev = 0.876/2.881/4.886/2.005 ms
Is there anything special when using hping on a wireless interface?
 
Old 10-20-2006, 12:13 AM   #2
zitstif
LQ Newbie
 
Registered: Aug 2005
Location: Carmen Electra's pants..
Distribution: Mandrake 10.1
Posts: 13

Rep: Reputation: 0
I have the exact same problem:

SUSE 10 alpha

hping 127.0.0.1
HPING 127.0.0.1 (lo 127.0.0.1): NO FLAGS are set, 40 headers + 0 data bytes
len=40 ip=127.0.0.1 ttl=64 DF id=0 sport=0 flags=RA seq=0 win=0 rtt=0.3 ms
len=40 ip=127.0.0.1 ttl=64 DF id=0 sport=0 flags=RA seq=1 win=0 rtt=0.2 ms
len=40 ip=127.0.0.1 ttl=64 DF id=0 sport=0 flags=RA seq=2 win=0 rtt=0.2 ms
1: len=40 ip=127.0.0.1 ttl=64 DF id=0 sport=1 flags=RA seq=3 win=0 rtt=0.2 ms
len=40 ip=127.0.0.1 ttl=64 DF id=0 sport=1 flags=RA seq=4 win=0 rtt=0.2 ms

but trying a remote host results in:

hping www.google.com
[main] physical layer header size unknown

and even with remote ip addresses

hping2 72.14.203.104
[main] physical layer header size unknown

anyone find a solution?

seems like it's making a call to this function..


if ( get_linkhdrsize(ifname) == -1 )
{
printf("[main] physical layer header size unknown\n");
exit(1);
}
 
Old 01-20-2008, 07:50 PM   #3
bugmenot
LQ Newbie
 
Registered: Jan 2006
Posts: 12

Rep: Reputation: 0
I had no luck trying to hping my bridge interface. Works fine with the eth0 interface which is part of it, though.

# hping2 -I br0 -S 123.456.789.123 -c 3 -p 22
[main] physical layer header size unknown

# hping2 -I eth0 -S 123.456.789.123 -c 3 -p 22
HPING 123.456.789.123 (lo 123.456.789.123): S set, 40 headers + 0 data bytes
len=44 ip=123.456.789.123 ttl=64 DF id=0 sport=22 flags=SA seq=0 win=32792 rtt=0.2 ms
len=44 ip=123.456.789.123 ttl=64 DF id=0 sport=22 flags=SA seq=1 win=32792 rtt=0.1 ms
len=44 ip=123.456.789.123 ttl=64 DF id=0 sport=22 flags=SA seq=2 win=32792 rtt=0.1 ms


I investigated further and found this:

/* header size of some physical layer type */
#define PPPHDR_SIZE 0
#define ETHHDR_SIZE sizeof(struct ethhdr)
#define LOHDR_SIZE sizeof(struct ethhdr)
#define UNKNOWNHDR_SIZE 0


int get_linkhdrsize(char *ifname)
{
if ( strstr(ifname, "ppp") )
{
linkhdr_size = PPPHDR_SIZE;
return 0;
}
else if ( strstr(ifname, "eth") )
{
linkhdr_size = ETHHDR_SIZE;
return 0;
}
else if ( strstr(ifname, "lo") )
{
linkhdr_size = LOHDR_SIZE;
return 0;
}
else
return 1;
}
 
Old 07-16-2008, 05:10 AM   #4
via_strass
LQ Newbie
 
Registered: Feb 2005
Posts: 8

Rep: Reputation: 0
I had the same problem using hping2 over a wireless interface but hping3 worked fine.
 
Old 03-27-2009, 06:57 PM   #5
flembot
LQ Newbie
 
Registered: Mar 2009
Posts: 1

Rep: Reputation: 0
Fix is simple, just modify getlhs.c and return ETHHDR_SIZE

Like this:
...
} else if ( strstr(ifname, "eth") ) {
linkhdr_size = ETHHDR_SIZE;
return 0;
} else if ( strstr(ifname, "br") ) { // << ADD THIS FOR YOUR BRIDGE DEVICES like br0
linkhdr_size = ETHHDR_SIZE;
return 0;
} else if (strstr(ifname, "ets")) {
...

Recompile, and you should be golden.
 
  


Reply



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
Size in superblock is different from the physical size of the partition cyberfishee Linux - Hardware 18 09-11-2016 08:48 AM
Determine Physical RAM size skistner Linux - Hardware 18 02-22-2010 12:57 PM
Size of physical RAM bkankur Linux - General 3 07-21-2006 05:27 AM
/proc/kcore size doesn't match with physical ram size cash_05 Linux - Newbie 2 06-01-2005 01:23 PM
Determine physical disk size Kristijan Linux - General 4 01-23-2005 05:56 PM

LinuxQuestions.org > Forums > Linux Forums > Linux - Software

All times are GMT -5. The time now is 05:12 PM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration