Provided by: manpages-zh_1.5.2-1_all bug

NAME

       ()PF_PACKET - PF_PACKET  PF  protocol family()

SYNOPSIS

       #include <sys/socket.h>
       #include <features.h> /*  glibc  */
       #if __GLIBC__ >= 2 && __GLIBC_MINOR >= 1
       #include <netpacket/packet.h>
       #include <net/ethernet.h> /* L2 */
       #else
       #include <asm/types.h>
       #include <linux/if_packet.h>
       #include <linux/if_ether.h> /*  */
       #endif

       packet_socket=socket(PF_PACKET,intsocket_type,intprotocol);

DESCRIPTION

       ()(OSI ) (raw )

       socket_type    SOCK_RAW   socket_type   SOCK_DGRAM  sockaddr_ll  socket
       protocol  IEEE 802.3  protocol  htons(ETH_P_ALL)

       DGRAM htons  hosts to networks of a short (16)

        uid  0  CAP_NET_RAW

        SOCK_RAW  SOCK_RAW ,  sockaddr_ll   SOCK_RAW  ,  SOCK_RAW   Linux  2.0
       SOCK_PACKET

        SOCK_DGRAM  SOCK_DGRAM  sockaddr_ll

        bind(2) sockaddr_ll  sll_protocol  sll_ifindex

        connect(2) ()

ADDRESS TYPES

       sockaddr_ll

              struct sockaddr_ll
              {
              unsigned short sll_family; /*  AF_PACKET */
              unsigned short sll_protocol; /*  */
              int sll_ifindex; /*  */
              unsigned short sll_hatype; /*  */
              unsigned char sll_pkttype; /*  */
              unsigned char sll_halen; /*  */
              unsigned char sll_addr[8]; /*  */
              };

       sll_protocol    linux/if_ether.h   sll_ifindex   (   netdevice(2))0  ()
       sll_hatype     linux/if_arp.h      ARP     sll_pkttype      PACKET_HOST
       PACKET_BROADCAST    PACKET_MULTICAST   (promiscuous)   PACKET_OTHERHOST
       PACKET_OUTGOINGsll_addr  sll_halen ( IEEE 802.3)

        (1) (ethernet) OSI , IEEE 802  OSI MAC(medium access control) MAC  LLC
       (logical link control) OSI BSD TCP/IP  TCP/IP OSI TCP/IP  UNIX  MAC (2)
       (0) (1)(1) DP8390  D2  NIC D3  NIC D4  NIC (Promiscuous)

SOCKET OPTIONS

               setsockopt(2)         SOL_PACKET          PACKET_ADD_MEMBERSHIP
       PACKET_DROP_MEMBERSHIP  packet_mreq

              struct packet_mreq
              {
              int mr_ifindex; /*  */
              unsigned short mr_type; /*  */
              unsigned short mr_alen; /*  */
              unsigned char mr_address[8]; /*  */
              };

       mr_ifindex  mr_ifindex  mr_type  PACKET_MR_PROMISC  PACKET_MR_MULTICAST
       mr_address  mr_alen PACKET_MR_ALLMULTI

        ioctls  SIOCSIFFLAGS, SIOCADDMULTI, SIOCDELMULTI

IOCTLS

       SIOCGSTAMP timeval

        netdevice(7)  socket(7)  ioctl

ERROR HANDLING


COMPATIBILITY

         Linux  2.0  socket(PF_INET,   SOCK_PACKET,   protocol)    SOCK_PACKET
       sockaddr_pkt ()

              struct sockaddr_pkt
              {
              unsigned short spkt_family;
              unsigned char spkt_device[14];
              unsigned short spkt_protocol;
              };

       spkt_family spkt_protocol  IEEE 802.3 spkt_device  null  eth0

       : "who is nntp"  null (' ')

NOTES

        pcap(3)  PF_PACKET  PF_PACKET

        ftp://ftp.ee.lbl.gov/libpcap.tar.Z

       SOCK_DGRAM   IEEE  802.3  IEEE 802.2 LLC  ETH_P_802_3  802.3 LLC  802.3
       DSAP/SSAP  ETH_P_802_2  LLC  ETH_P_802_3  ETH_P_802_2  DIX

       :  1518  IEEE 802.3 1536  DIX DIX  D  DECI  Intel X  Xerox

ERRORS

       ENETDOWN

       ENOTCONN

       ENODEV

       EMSGSIZE
               MTU()

       ENOBUFS

       EFAULT

       EINVAL

       ENXIO

       EPERM

       EADDRNOTAVAIL

       ENOENT

VERSIONS

       PF_PACKET  Linux 2.2 Linux SOCK_PACKET

BUGS

       glibc 2.1  SOL_PACKET
              #ifndef SOL_PACKET
              #define SOL_PACKET 263
              #endif
        glibc  libc5

        IEEE 802.2/803.3 LLC

CREDITS

        Andi Kleen  Matthew Wilcox  Linux  2.2   PF_PACKET   Alexey  Kuznetsov
       Alan Cox

SEE ALSO

       ip(7),socket(7),socket(2),raw(7),pcap(3).             RFC894-IPEthernet
       RFC1700-IPIEEE802.3 linux/if_ether.h

[]

       mhss <jijingzhisheng@up369.com>

[]

       2000/10/15

linuxman:

       http://cmpp.linuxforum.net