File: raw.7

package info (click to toggle)
cman 0.0.7-1
  • links: PTS
  • area: main
  • in suites: woody
  • size: 6,664 kB
  • ctags: 1,518
  • sloc: perl: 555; sh: 148; makefile: 65
file content (195 lines) | stat: -rw-r--r-- 5,259 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
.\" t
.\" Don't change the first line, it tells man that we need tbl.
.\" This man page is Copyright (C) 1999 Andi Kleen .
.\" İȨ redcandle, Laser www.linuxforum.net 2000
.\" Permission is granted to distribute possibly modified copies
.\" of this page provided the header is included verbatim,
.\" and in case of nontrivial modification author and date
.\" of the modification is added to the header.
.\" Please send bug reports, corrections and suggestions for improvements to 
.\" 
.\" $Id: raw.7,v 1.1.1.1 2000/12/27 12:24:48 BitBIRD Exp $
.\" 򴫲Ĺ޸ģıݿĶ

.TH RAW 7 "2 Oct 1998" "Linux ֲҳ" "Linux Աֲ" 
.SH 
raw, SOCK_RAW \- Linux IPv4 raw socket.

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

.SH  
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 Э. Dz͡

.TS
tab(:) allbox;
c s
l l.
IP_HDRINCL ڴʱ޸ IP ͷ
IP Checksum: д롣
Source Address:Ϊ 0 ʱд롣
Packet Id:Ϊ 0 ʱд롣
Total Length:д롣
.TE

.PP
ָ IP_HDRINCL  IP ͷеĿĵַ 0ô
 socket Ŀĵַ·ɸð
ָ MSG_DONTROUTE Ŀĵַ
Ӧָijؽӿڡ·бң·ɻᱻ
ԡδ趨 IP_HDRINCL ͨ setsockopt (2) 
raw socket 趨 IP header ѡο ip (7) ˽
Ϣ

 Linux 2.2 ¿ IP socket ѡе 
IP ͷѡ. ζֻͨµЭ
ûûЭҪ raw socket ( ICMP).
յһʱȱ󶨵Эκ raw socket
ȻŴЭ(handler)
(磮ںЭģ). 

.SH ַʽ
raw socket ʹ ip (7) жı׼ sockaddr_in ַṹ
sin_port ָ IP Эţ Linux 2.2 ´ʱӦ
ԣӦһֱΪ0 (μ BUGS).

ڽյİsin_port ΪðЭš
ο аЧ IP Эļ. 

.SH SOCKETѡ
raw socket ѡʹ setsockopt (2) ã
getsockopt (2)жȡͨ SOL_RAW ־. 

.TP
.B ICMP_FILTER
󶨵 IPPROTO_ICMP Эһ raw socket Ĺ
ֵÿ ICMP Ϣһλ룩
԰ ICMP Ϣ˵ȱʡʱDz ICMP Ϣ

⣬֧жݱ socket Ч ip(7) SOL_IP 
socket ѡ

.SH ע 
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. һֲijԣ
 BSD socket ʵⷽоޣ

Linux Ӳıûİ (ǰ
ᵽ IP_HDRINCL һЩ0ֶ). raw socket
ʵַʽDzͬģ

RAW socket ֲͨ. socket ʱʹ sin_port õ
Э飬 Linux2.2 ²ˣ취ʹ IP_HDRINCL.

.SH 
ֻ socket  IP_RECVERR ΪЧʱŻ
͸ûΪԵԭֻ EMSGSIZE  EPROTO 
 socket.

.SH  
.TP
.B IP_RECVERR
ʹеĴ洢 error queueУ. 

.TP
.B EMSGSIZE 
̫󡣻Ϊ· MTU  IP_PMTU_DISCOVER
ΪЧΪijߴ糬 IPv4 涨İ
ߴ 64KB. 

.TP
.B EACCES
ûͼ͵ij㲥ַDzδsocketù㲥
־

.TP
.B EPROTO
ICMP 󱨸в⡣

.TP
.B EFAULT
Чڴַ

.TP
.B EOPNOTSUPP
͸ socket ı־Ч(磺MSG_OOB ).

.TP
.B EINVAL
Ч.

.TP
.B EPERM
ûȨ raw socket. ֻû id Ϊ 0 
CAP_NET_RAW Էɡ

.SH  
IP_RECVERR  ICMP_FILTER  Linux 2.2 ʵ.
ڿֲ

 SO_BSDCOMPAT ־
Linux 2.0 к BSD ݵ raw socket 
 2.2 Ѿ޲ˣ

.SH BUGS
û͸չ.

 IP_HDRINCL ѡdatagramsѰַݰᱻֶ
 MTU .  Linux 2.2 .

 Linux 2.2 sin_port õ IP Эᶪʧʹõǰ
socket Э飬 socket (2)ʼָЭ顣

.SH  
Andi Kleen. 
.SH  
.BR ip (7), 
.BR socket (7), 
.BR recvmsg (2), 
.BR sendmsg (2).
.PP
RFC1191 for path MTU discovery.
.br
RFC791 and the include file for the IP protocol.
.br
.SH İά
RedCandle E-mail:redcandle51@chinaren.com
.SH ݸ
2000/10/15
.br
.B й Linux ̳ man ֲҳƻ : www.cmpp.net/