Fedora Linux Support Community & Resources Center
Old 29th January 2010, 06:02 AM
era_pk Offline
Registered User
Join Date: Jan 2008
Location: Pakistan
Posts: 20
Question socket(PF_PACKET, SOCK_RAW, htons(ETH_P_ALL) behaviour

Dear All,

I am writing a small packet sniffing application to perform some operations. The following call


works fine on my Linux kernel 2.6.20 but it returns a negative value on Linux kernel 2.4.26.
I am running my application with root privileges.

Is PF_PACKET & SOCK_RAW available to kernel 2.6 or other kernel versions as well

Any ideas?
Dont follow me. I m always late :)
Reply With Quote
Old 1st August 2010, 02:11 PM
backyes Offline
Registered User
Join Date: Aug 2010
Posts: 1
Re: socket(PF_PACKET, SOCK_RAW, htons(ETH_P_ALL) behaviour

Maybe the AF_PACKET module is invalid.
Reply With Quote
Old 1st August 2010, 03:01 PM
stevea Offline
Registered User
Join Date: Apr 2006
Location: Ohio, USA
Posts: 9,439
Re: socket(PF_PACKET, SOCK_RAW, htons(ETH_P_ALL) behaviour

This is from F13.
[root@nidula ~]# strace -f -etrace=socket /usr/sbin/tcpdump -i eth1
socket(PF_PACKET, SOCK_RAW, 768) = 3

So there is nothing wrong with socket(PF_PACKET, SOCK_RAW,...
and your third arg to socket looks correct.

Maybe it's time you checked the errno !

There is a chance that you need to deal with either SELinux or else the capabilities.
See pscap and getcap
- .. the whole of existence is an eternal process of separation and union

Last edited by stevea; 1st August 2010 at 03:57 PM.
Reply With Quote

pf_packet, socket, sock_raw

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

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 On
HTML code is Off

Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
Enabling Socket arkkundan Servers & Networking 1 4th December 2008 12:02 PM
raw socket baappi Programming & Packaging 0 21st December 2007 12:23 PM
Talk daemon and Socket operation on non-socket Br0kan Using Fedora 3 1st March 2006 08:29 PM
Socket jai Programming & Packaging 6 23rd January 2006 11:38 AM
Socket program in C/C++ JPEM Programming & Packaging 8 26th September 2005 05:08 AM

Current GMT-time: 08:44 (Sunday, 29-11-2015)

TopSubscribe to XML RSS for all Threads in all ForumsFedoraForumDotOrg Archive

All trademarks, and forum posts in this site are property of their respective owner(s).
FedoraForum.org is privately owned and is not directly sponsored by the Fedora Project or Red Hat, Inc.

Privacy Policy | Term of Use | Posting Guidelines | Archive | Contact Us | Founding Members

Powered by vBulletin® Copyright ©2000 - 2012, vBulletin Solutions, Inc.

FedoraForum is Powered by RedHat