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

NAME

       raw, SOCK_RAW - Linux IPv4 raw socket.

       #include <sys/socket.h>
       #include <netinet/in.h>
       raw_socket = socket(PF_INET, SOCK_RAW, int protocol );

       Raw sockets  IPv4 raw socket  IP_HDRINCL  IPv4  IP  IP  IP

        user id  0  CAP_NET_RAW raw sockets.

        raw socket  socket.   RFC1700  getprotobyname (3).

       IPPROTO_RAW  IP_HDRINCL  IP .

       +---------------------+
       |  IP_HDRINCL  IP     |
       +---------------+-----+
       |IP Checksum    |     |
       +---------------+-----+
       |Source Address |  0  |
       +---------------+-----+
       |Packet Id      |  0  |
       +---------------+-----+
       |Total Length   |     |
       +---------------+-----+

         IP_HDRINCL   IP  0  socket  MSG_DONTROUTE  IP_HDRINCL  setsockopt (2)
       raw socket  IP header  ip (7)

        Linux 2.2  IP socket IP .   raw socket ( ICMP).   raw socket (handler)
       ().

       raw socket  ip (7)  sockaddr_in sin_port  IP  Linux 2.2 0 ( BUGS).

       sin_port   IP .

SOCKET

       raw socket  setsockopt (2) getsockopt (2) SOL_RAW .

       ICMP_FILTER
               IPPROTO_ICMP  raw socket  ICMP  ICMP  ICMP

               socket  ip(7) SOL_IP socket

       raw socket  MTU ( BUGS).   MTU  ip (7) IP_PMTU_DISCOVER

        bind (2)  raw socket  IP  SO_BINDTODEVICE  RAW socket   socket (7).

       IPPROTO_RAW   IP   packet  (7)  socket   ETH_P_IP .   packet socket raw
       socket  IP

        datagram socket  ICMP  socket  IP_RECVERR ip (7).

       raw socket  IP ,  ICMP TCP raw socket.   BSD socket

       Linux  (  IP_HDRINCL 0). raw socket

       RAW socket . socket  sin_port  Linux2.2  IP_HDRINCL.

        socket  IP_RECVERR  EMSGSIZE  EPROTO  socket.

       IP_RECVERR
               error queue.

       EMSGSIZE
               MTU  IP_PMTU_DISCOVER  IPv4  64KB.

       EACCES socket

       EPROTO ICMP

       EFAULT

       EOPNOTSUPP
               socket (MSG_OOB ).

       EINVAL .

       EPERM   raw socket.  id  0 CAP_NET_RAW

       IP_RECVERR  ICMP_FILTER  Linux 2.2 .

        SO_BSDCOMPAT Linux 2.0  BSD  raw socket  2.2

BUGS

       .

        IP_HDRINCL datagrams  MTU .  Linux 2.2 .

        Linux 2.2 sin_port  IP socket  socket (2)

       Andi Kleen.

       ip(7), socket(7), recvmsg(2), sendmsg(2).

       RFC1191 for path MTU discovery.
       RFC791 and the include file for the IP protocol.

[]

       RedCandle <redcandle51@chinaren.com>

[]

       2000/10/15

linuxman:

       http://cmpp.linuxforum.net