FedoraForum.org - Fedora Support Forums and Community
Results 1 to 3 of 3
  1. #1
    Join Date
    Jan 2008
    Location
    Pakistan
    Posts
    20
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    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

    SOCKET_ID = socket(PF_PACKET, SOCK_RAW, htons(ETH_P_ALL));

    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 :)

  2. #2
    Join Date
    Aug 2010
    Posts
    1
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Re: socket(PF_PACKET, SOCK_RAW, htons(ETH_P_ALL) behaviour

    Maybe the AF_PACKET module is invalid.

  3. #3
    stevea Guest

    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
    socket(PF_INET, SOCK_DGRAM, IPPROTO_IP) = 4
    socket(PF_FILE, SOCK_STREAM|SOCK_CLOEXEC|SOCK_NONBLOCK, 0) = 4
    ....


    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
    Last edited by stevea; 1st August 2010 at 03:57 PM.

Similar Threads

  1. Talk daemon and Socket operation on non-socket
    By Br0kan in forum Using Fedora
    Replies: 5
    Last Post: 6th December 2021, 10:36 PM
  2. Enabling Socket
    By arkkundan in forum Servers & Networking
    Replies: 1
    Last Post: 4th December 2008, 12:02 PM
  3. raw socket
    By baappi in forum Programming & Packaging
    Replies: 0
    Last Post: 21st December 2007, 12:23 PM
  4. Socket
    By jai in forum Programming & Packaging
    Replies: 6
    Last Post: 23rd January 2006, 11:38 AM
  5. Socket program in C/C++
    By JPEM in forum Programming & Packaging
    Replies: 8
    Last Post: 26th September 2005, 05:08 AM

Tags for this Thread

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •