OSDN Git Service

Import translated manuals from JM CVS Repository.
[linuxjm/jm.git] / manual / LDP_man-pages / draft / man7 / packet.7
1 .\" This man page is Copyright (C) 1999 Andi Kleen <ak@muc.de>.
2 .\" Permission is granted to distribute possibly modified copies
3 .\" of this page provided the header is included verbatim,
4 .\" and in case of nontrivial modification author and date
5 .\" of the modification is added to the header.
6 .\" $Id: packet.7,v 1.12 2001/06/19 07:07:38 argrath Exp $
7 .\"
8 .\" Japanese Version Copyright (c) 1999 NAKANO Takeo all rights reserved.
9 .\" Translated 1999-12-06, NAKANO Takeo <nakano@apm.seikei.ac.jp>
10 .\" Updated 2001-02-13, Kentaro Shirakata <argrath@ub32.org>
11 .\" Updated 2005-02-21, Akihiro MOTOKI <amotoki@dd.iij4u.or.jp>
12 .\"
13 .\"WORD         physical layer          ÊªÍýÁØ
14 .\"WORD         link level header(s)    ¥ê¥ó¥¯¥ì¥Ù¥ë¥Ø¥Ã¥À
15 .\"WORD         phyxical header(s)      ÊªÍý¥Ø¥Ã¥À
16 .\"WORD         effective user id       ¼Â¸ú¥æ¡¼¥¶¡¼ ID
17 .\"WORD         capability              ¥±¡¼¥Ñ¥Ó¥ê¥Æ¥£
18 .\"WORD         pending error           Ãٱ䥨¥é¡¼
19 .\"WORD         promiscuous mode        Ìµº¹Ê̥⡼¥É
20 .\"
21 .TH PACKET  7 2008-08-08 "Linux" "Linux Programmer's Manual"
22 .\"O .SH NAME
23 .SH Ì¾Á°
24 .\"O packet, AF_PACKET \- packet interface on device level.
25 packet, AF_PACKET \- ¥Ç¥Ð¥¤¥¹¥ì¥Ù¥ë¤Î¥Ñ¥±¥Ã¥È¥¤¥ó¥¿¡¼¥Õ¥§¡¼¥¹
26 .\"O .SH SYNOPSIS
27 .SH ½ñ¼°
28 .nf
29 .B #include <sys/socket.h>
30 .br
31 .B #include <netpacket/packet.h>
32 .br
33 .B #include <net/ethernet.h>     /* the L2 protocols */
34 .sp
35 .BI "packet_socket = socket(AF_PACKET, int " socket_type ", int "protocol );
36 .fi
37 .\"O .SH DESCRIPTION
38 .SH ÀâÌÀ
39 .\"O Packet sockets are used to receive or send raw packets at the device driver
40 .\"O (OSI Layer 2) level.
41 .\"O They allow the user to implement protocol modules in user space
42 .\"O on top of the physical layer.
43 packet ¥½¥±¥Ã¥È¤Ï¡¢¥Ç¥Ð¥¤¥¹¥É¥é¥¤¥Ð (OSI ¥ì¥¤¥ä 2) ¥ì¥Ù¥ë¤Ç
44 À¸¤Î¥Ñ¥±¥Ã¥È (raw packet) ¤òÁ÷¼õ¿®¤¹¤ë¤¿¤á¤ËÍѤ¤¤é¤ì¤ë¡£
45 packet ¥½¥±¥Ã¥È¤ò»È¤¦¤È¡¢¥æ¡¼¥¶¡¼¶õ´Ö¤ÇʪÍýÁؤξå¤Ë
46 ¥×¥í¥È¥³¥ë¥â¥¸¥å¡¼¥ë¤ò¼ÂÁõ¤¹¤ë¤³¤È¤¬¤Ç¤­¤ë¡£
47
48 .\"O The
49 .\"O .I socket_type
50 .\"O is either
51 .\"O .B SOCK_RAW
52 .\"O for raw packets including the link level header or
53 .\"O .B SOCK_DGRAM
54 .\"O for cooked packets with the link level header removed.
55 .\"O The link level
56 .\"O header information is available in a common format in a
57 .\"O .IR sockaddr_ll .
58 .\"O .I protocol
59 .\"O is the IEEE 802.3 protocol number in network order.
60 .\"O See the
61 .\"O .I <linux/if_ether.h>
62 .\"O include file for a list of allowed protocols.
63 .\"O When protocol
64 .\"O is set to
65 .\"O .B htons(ETH_P_ALL)
66 .\"O then all protocols are received.
67 .\"O All incoming packets of that protocol type will be passed to the packet
68 .\"O socket before they are passed to the protocols implemented in the kernel.
69 .I socket_type
70 ¤Ë¤Ï
71 .B SOCK_RAW
72 ¤È
73 .B SOCK_DGRAM
74 ¤Î¤¤¤º¤ì¤«¤ò»ØÄꤹ¤ë¡£
75 .B SOCK_RAW
76 ¤Ï¥ê¥ó¥¯¥ì¥Ù¥ë¥Ø¥Ã¥À¤ò´Þ¤à raw ¥Ñ¥±¥Ã¥È¤ò¡¢
77 .B SOCK_DGRAM
78 ¤Ï¥ê¥ó¥¯¥ì¥Ù¥ë¥Ø¥Ã¥À¤¬ºï½ü¤µ¤ì¤¿²Ã¹©ºÑ¤ß¥Ñ¥±¥Ã¥È¤ò¼¨¤¹¡£
79 ¥ê¥ó¥¯¥ì¥Ù¥ë¥Ø¥Ã¥À¾ðÊó¤Ï
80 .I sockaddr_ll
81 ¤Ç¶¦Ä̤Υե©¡¼¥Þ¥Ã¥È¤ÇÆþ¼ê¤Ç¤­¤ë¡£
82 .I protocol
83 ¤Ë¤Ï IEEE 802.3 ¥×¥í¥È¥³¥ëÈÖ¹æ¤ò
84 ¥Í¥Ã¥È¥ï¡¼¥¯¥Ð¥¤¥È¥ª¡¼¥À¡¼¤Ç»ØÄꤹ¤ë¡£
85 »ØÄê¤Ç¤­¤ë¥×¥í¥È¥³¥ë¤Î¥ê¥¹¥È¤Ï¡¢¥¤¥ó¥¯¥ë¡¼¥É¥Õ¥¡¥¤¥ë
86 .I <linux/if_ether.h>
87 ¤ò»²¾È¡£¥×¥í¥È¥³¥ë¤ò
88 .B htons(ETH_P_ALL)
89 ¤Ë¤¹¤ë¤È¡¢Á´¤Æ¤Î¥×¥í¥È¥³¥ë¤¬¼õ¿®¤µ¤ì¤ë¡£
90 ³°Éô¤«¤éÍ褿¥Ñ¥±¥Ã¥È¤Î¤¦¤Á»ØÄꤷ¤¿¥×¥í¥È¥³¥ë¤Î¤â¤Î¤Ï¡¢
91 ¥«¡¼¥Í¥ë¤Ë¼ÂÁõ¤µ¤ì¤Æ¤¤¤ë¥×¥í¥È¥³¥ë¤ËÅϤµ¤ì¤ëÁ°¤ÎÃʳ¬¤Ç¡¢
92 packet ¥½¥±¥Ã¥È¤ËÅϤµ¤ì¤ë¡£
93
94 .\"O Only processes with effective UID 0 or the
95 .\"O .B CAP_NET_RAW
96 .\"O capability may open packet sockets.
97 packet ¥½¥±¥Ã¥È¤ò¥ª¡¼¥×¥ó¤Ç¤­¤ë¤Î¤Ï¡¢
98 ¼Â¸ú¥æ¡¼¥¶¡¼ID ¤¬ 0 ¤Î¥×¥í¥»¥¹¤«¡¢
99 .B CAP_NET_RAW
100 ¥±¡¼¥Ñ¥Ó¥ê¥Æ¥£¤ò»ý¤Ä¥×¥í¥»¥¹¤À¤±¤Ç¤¢¤ë¡£
101
102 .\"O .B SOCK_RAW
103 .\"O packets are passed to and from the device driver without any changes in
104 .\"O the packet data.
105 .\"O When receiving a packet, the address is still parsed and
106 .\"O passed in a standard
107 .\"O .I sockaddr_ll
108 .\"O address structure.
109 .\"O When transmitting a packet, the user supplied buffer
110 .\"O should contain the physical layer header.
111 .\"O That packet is then
112 .\"O queued unmodified to the network driver of the interface defined by the
113 .\"O destination address.
114 .\"O Some device drivers always add other headers.
115 .\"O .B SOCK_RAW
116 .\"O is similar to but not compatible with the obsolete
117 .\"O .B AF_INET/SOCK_PACKET
118 .\"O of Linux 2.0.
119 .B SOCK_RAW
120 ¥Ñ¥±¥Ã¥È¤Ç¤Ï¡¢¥Ñ¥±¥Ã¥È¤ò¥Ç¥Ð¥¤¥¹¥É¥é¥¤¥Ð¤È¼õ¤±ÅϤ·¤¹¤ëºÝ¡¢
121 ¥Ñ¥±¥Ã¥È¥Ç¡¼¥¿¤ËÊѹ¹¤¬¹Ô¤ï¤ì¤ë¤³¤È¤Ï¤Ê¤¤¡£
122 ¥Ñ¥±¥Ã¥È¤Î¼õ¿®»þ¤Ë¤Ï¡¢¥¢¥É¥ì¥¹¤Î²òÀϤÀ¤±¤Ï¹Ô¤ï¤ì¡¢
123 ɸ½àŪ¤Ê
124 .I sockaddr_ll
125 ¥¢¥É¥ì¥¹¹½Â¤ÂΤËÅϤµ¤ì¤ë¡£¥Ñ¥±¥Ã¥È¤ÎÁ÷¿®»þ¤Ë¤Ï¡¢¥æ¡¼¥¶¤¬»ØÄꤹ¤ë
126 ¥Ð¥Ã¥Õ¥¡¤ËʪÍýÁؤΥإåÀ¤¬´Þ¤Þ¤ì¤Æ¤¤¤ëɬÍפ¬¤¢¤ë¡£
127 ¥Ñ¥±¥Ã¥È¤Ï¤½¤Î¤Þ¤Þ½¤Àµ¤ò¼õ¤±¤º¤Ë¡¢¹Ô¤­À襢¥É¥ì¥¹¤«¤é·èÄꤵ¤ì¤ë
128 ¥¤¥ó¥¿¡¼¥Õ¥§¡¼¥¹¤Î¥Í¥Ã¥È¥ï¡¼¥¯¥É¥é¥¤¥Ð¤Ë¥­¥å¡¼¥¤¥ó¥°¤µ¤ì¤ë¡£
129 ¥Ç¥Ð¥¤¥¹¥É¥é¥¤¥Ð¤Ë¤è¤Ã¤Æ¤Ï¡¢Â¾¤Î¥Ø¥Ã¥À¤ò¾ï¤ËÄɲ乤ë¤â¤Î¤â¤¢¤ë¡£
130 .B SOCK_RAW
131 ¤Ï Linux 2.0 ¤Î obosolete ¤Ê
132 .B AF_INET/SOCK_PACKET
133 ¤È»÷¤Æ¤¤¤ë¤¬¡¢¸ß´¹À­¤¬¤¢¤ë¤ï¤±¤Ç¤Ï¤Ê¤¤¡£
134
135 .\"O .B SOCK_DGRAM
136 .\"O operates on a slightly higher level.
137 .\"O The physical header is removed before the packet is passed to the user.
138 .\"O Packets sent through a
139 .\"O .B SOCK_DGRAM
140 .\"O packet socket get a suitable physical layer header based on the
141 .\"O information in the
142 .\"O .I sockaddr_ll
143 .\"O destination address before they are queued.
144 .B SOCK_DGRAM
145 ¤Ï¤ä¤ä¹â°Ì¤Î¥ì¥Ù¥ë¤ÇÆ°ºî¤¹¤ë¡£ÊªÍý¥Ø¥Ã¥À¤Ï¡¢¥Ñ¥±¥Ã¥È¤¬¥æ¡¼¥¶¡¼¤Ë
146 ÅϤµ¤ì¤ëÁ°¤Ëºï½ü¤µ¤ì¤ë¡£
147 .B SOCK_DGRAM
148 ¤Î packet ¥½¥±¥Ã¥È¤òÄ̤·¤ÆÁ÷¤é¤ì¤ë¥Ñ¥±¥Ã¥È¤Ï¡¢
149 .I sockaddr_ll
150 ¤Î¹Ô¤­À襢¥É¥ì¥¹¤Î¾ðÊó¤Ë´ð¤Å¤­¡¢Å¬ÀÚ¤ÊʪÍýÁؤΥإåÀ¤¬Éղ䵤ì¤Æ¤«¤é¡¢
151 ¥­¥å¡¼¤ËÁ÷¤é¤ì¤ë¡£
152
153 .\"O By default all packets of the specified protocol type
154 .\"O are passed to a packet socket.
155 .\"O To only get packets from a specific interface use
156 .\"O .BR bind (2)
157 .\"O specifying an address in a
158 .\"O .I struct sockaddr_ll
159 .\"O to bind the packet socket to an interface.
160 .\"O Only the
161 .\"O .I sll_protocol
162 .\"O and the
163 .\"O .I sll_ifindex
164 .\"O address fields are used for purposes of binding.
165 ¥Ç¥Õ¥©¥ë¥È¤Ç¤Ï¡¢»ØÄꤷ¤¿¥×¥í¥È¥³¥ë·¿¤Î¥Ñ¥±¥Ã¥È¤Ï¤¹¤Ù¤Æ packet
166 ¥½¥±¥Ã¥È¤ËÁ÷¤é¤ì¤ë¡£ÆÃÄê¤Î¥¤¥ó¥¿¡¼¥Õ¥§¡¼¥¹¤«¤é¤Î¥Ñ¥±¥Ã¥È¤À¤±¤ò
167 ¼èÆÀ¤·¤¿¤¤¾ì¹ç¤Ë¤Ï¡¢
168 .I struct sockaddr_ll
169 ¤Ë¥¢¥É¥ì¥¹¤ò»ØÄꤷ¤Æ
170 .BR bind (2)
171 ¤ò¸Æ¤Ó¡¢ packet ¥½¥±¥Ã¥È¤ò¤½¤Î¥¤¥ó¥¿¡¼¥Õ¥§¡¼¥¹¤Ë·ë¤ÓÉÕ¤±¤ë (¥Ð¥¤¥ó¥É¤¹¤ë)¡£
172 ¥Ð¥¤¥ó¥É¤ÎºÝ¤Ë¤Ï¡¢¥¢¥É¥ì¥¹¥Õ¥£¡¼¥ë¥É¤Î¤¦¤Á
173 .I sll_protocol
174 ¤È
175 .I sll_ifindex
176 ¤À¤±¤¬ÍѤ¤¤é¤ì¤ë¡£
177
178 .\"O The
179 .\"O .BR connect (2)
180 .\"O operation is not supported on packet sockets.
181 .BR connect (2)
182 Áàºî¤Ï packet ¥½¥±¥Ã¥È¤Ç¤Ï¥µ¥Ý¡¼¥È¤µ¤ì¤Æ¤¤¤Ê¤¤¡£
183
184 .\"O When the
185 .\"O .B MSG_TRUNC
186 .\"O flag is passed to
187 .\"O .BR recvmsg (2),
188 .\"O .BR recv (2),
189 .\"O .BR recvfrom (2)
190 .\"O the real length of the packet on the wire is always returned,
191 .\"O even when it is longer than the buffer.
192 .B MSG_TRUNC
193 ¥Õ¥é¥°¤¬
194 .BR recvmsg (2),
195 .BR recv (2),
196 .BR recvfrom (2)
197 ¤ËÅϤµ¤ì¤ë¤È¡¢ (¥Ð¥Ã¥Õ¥¡¥µ¥¤¥º¤è¤êÂ礭¤«¤Ã¤¿¤È¤·¤Æ¤â) ¾ï¤Ë¼ÂºÝ¤ËÄÌ¿®¤µ¤ì¤¿
198 ¥Ñ¥±¥Ã¥È¤ÎŤµ¤¬ÊÖ¤µ¤ì¤ë¡£
199 .\"O .SS Address Types
200 .SS ¥¢¥É¥ì¥¹¤Î¥¿¥¤¥×
201 .\"O The sockaddr_ll is a device independent physical layer address.
202 sockaddr_ll ¤Ï¥Ç¥Ð¥¤¥¹¤Ë°Í¸¤·¤Ê¤¤ÊªÍýÁؤΥ¢¥É¥ì¥¹¤Ç¤¢¤ë¡£
203
204 .in +4n
205 .nf
206 .\"O struct sockaddr_ll {
207 .\"O     unsigned short sll_family;   /* Always AF_PACKET */
208 .\"O     unsigned short sll_protocol; /* Physical layer protocol */
209 .\"O     int            sll_ifindex;  /* Interface number */
210 .\"O     unsigned short sll_hatype;   /* Header type */
211 .\"O     unsigned char  sll_pkttype;  /* Packet type */
212 .\"O     unsigned char  sll_halen;    /* Length of address */
213 .\"O     unsigned char  sll_addr[8];  /* Physical layer address */
214 .\"O };
215 struct sockaddr_ll {
216     unsigned short sll_family;   /* ¾ï¤Ë AF_PACKET */
217     unsigned short sll_protocol; /* ÊªÍýÁؤΥץí¥È¥³¥ë */
218     int            sll_ifindex;  /* ¥¤¥ó¥¿¡¼¥Õ¥§¡¼¥¹ÈÖ¹æ */
219     unsigned short sll_hatype;   /* ¥Ø¥Ã¥À¼ïÊÌ */
220     unsigned char  sll_pkttype;  /* ¥Ñ¥±¥Ã¥È¼ïÊÌ */
221     unsigned char  sll_halen;    /* ¥¢¥É¥ì¥¹¤ÎŤµ */
222     unsigned char  sll_addr[8];  /* ÊªÍýÁؤΥ¢¥É¥ì¥¹ */
223 };
224 .fi
225 .in
226
227 .\"O .I sll_protocol
228 .\"O is the standard ethernet protocol type in network order as defined
229 .\"O in the
230 .\"O .I <linux/if_ether.h>
231 .\"O include file.
232 .\"O It defaults to the socket's protocol.
233 .I sll_protocol
234 ¤Ïɸ½àŪ¤Ê¥¤¡¼¥µ¥Í¥Ã¥È¥×¥í¥È¥³¥ë¤Î¥¿¥¤¥×¤Ç¡¢
235 ¥Í¥Ã¥È¥ï¡¼¥¯¥Ð¥¤¥È¥ª¡¼¥À¡¼¤Çµ­½Ò¤¹¤ë¡£
236 ¥¤¥ó¥¯¥ë¡¼¥É¥Õ¥¡¥¤¥ë
237 .I <linux/if_ether.h>
238 ¤ÇÄêµÁ¤µ¤ì¤Æ¤¤¤ë¡£
239 ¤³¤ì¤¬¤³¤Î¥½¥±¥Ã¥È¤Î¥×¥í¥È¥³¥ë¤Î¥Ç¥Õ¥©¥ë¥È¤È¤Ê¤ë¡£
240
241 .\"O .I sll_ifindex
242 .\"O is the interface index of the interface
243 .\"O (see
244 .\"O .BR netdevice (7));
245 .\"O 0 matches any interface (only permitted for binding).
246 .I sll_ifindex
247 ¤Ï¤½¤Î¥¤¥ó¥¿¡¼¥Õ¥§¡¼¥¹¤Î interface index ¤Ç¤¢¤ë
248 .RB ( netdevice (7)
249 ¤ò»²¾È)¡£
250 0 ¤Ï (¥Ð¥¤¥ó¥É¤¬µö²Ä¤µ¤ì¤Æ¤¤¤ë)  Ç¤°Õ¤Î¥¤¥ó¥¿¡¼¥Õ¥§¡¼¥¹¤Ë¥Þ¥Ã¥Á¤¹¤ë¡£
251
252 .\"O .I sll_hatype
253 .\"O is a ARP type as defined in the
254 .\"O .I <linux/if_arp.h>
255 .\"O include file.
256 .I sll_hatype
257 ¤Ï¡¢¥¤¥ó¥¯¥ë¡¼¥É¥Õ¥¡¥¤¥ë
258 .I <linux/if_arp.h>
259 ¤ÇÄêµÁ¤µ¤ì¤Æ¤¤¤ë ARP ¼ïÊ̤Ǥ¢¤ë¡£
260
261 .\"O .I sll_pkttype
262 .\"O contains the packet type.
263 .\"O Valid types are
264 .\"O .B PACKET_HOST
265 .\"O for a packet addressed to the local host,
266 .\"O .B PACKET_BROADCAST
267 .\"O for a physical layer broadcast packet,
268 .\"O .B PACKET_MULTICAST
269 .\"O for a packet sent to a physical layer multicast address,
270 .\"O .B PACKET_OTHERHOST
271 .\"O for a packet to some other host that has been caught by a device driver
272 .\"O in promiscuous mode, and
273 .\"O .B PACKET_OUTGOING
274 .\"O for a packet originated from the local host that is looped back to a packet
275 .\"O socket.
276 .\"O These types make only sense for receiving.
277 .I sll_pkttype
278 ¤Ï¥Ñ¥±¥Ã¥È¼ïÊ̤Ǥ¢¤ë¡£»ØÄê¤Ç¤­¤ë¼ïÊ̤ϰʲ¼¤Î¤¤¤º¤ì¤«¤Ç¤¢¤ë:
279 .B PACKET_HOST
280 (¥í¡¼¥«¥ë¥Û¥¹¥È¸þ¤±¤Î¥Ñ¥±¥Ã¥È)¡¢
281 .B PACKET_BORADCAST
282 (ʪÍýÁØ¤Î¥Ö¥í¡¼¥É¥­¥ã¥¹¥È¥Ñ¥±¥Ã¥È)¡¢
283 .B PACKET_MULTICAST
284 (ʪÍýÁؤΥޥë¥Á¥­¥ã¥¹¥È¥¢¥É¥ì¥¹¤ËÁ÷¤ë¥Ñ¥±¥Ã¥È)¡¢
285 .B PACKET_OTHERHOST
286 (¾¤Î¥Û¥¹¥È¤Ë¸þ¤±¤é¤ì¤¿¥Ñ¥±¥Ã¥È¤Î¤¦¤Á¡¢
287 ̵º¹Ê̥⡼¥É (promiscuous mode: ¸å½Ò) ¤Î¥Ç¥Ð¥¤¥¹¥É¥é¥¤¥Ð¤Ë¤è¤êÊä­¤µ¤ì¤¿¤â¤Î)¡¢
288 .B PACKET_OUTGOING
289 (¥í¡¼¥«¥ë¥Û¥¹¥È¤«¤éȯ¿®¤µ¤ì¡¢
290 packet ¥½¥±¥Ã¥È¤Ë¥ë¡¼¥×¥Ð¥Ã¥¯¤·¤Æ¤­¤¿¥Ñ¥±¥Ã¥È)¡£
291 ¤³¤ì¤é¤Î¼ïÊ̤¬°ÕÌ£¤ò»ý¤Ä¤Î¤Ï¼õ¿®»þ¤Î¤ß¤Ç¤¢¤ë¡£
292
293 .\"O .I sll_addr
294 .\"O and
295 .\"O .I sll_halen
296 .\"O contain the physical layer (e.g., IEEE 802.3) address and its length.
297 .\"O The exact interpretation depends on the device.
298 .I sll_addr
299 ¤È
300 .I sll_halen
301 ¤Ï¡¢ÊªÍýÁؤΠ(¤Ä¤Þ¤ê IEEE 802.3 ¤Î) ¥¢¥É¥ì¥¹¤È¤½¤ÎŤµ¤Ç¤¢¤ë¡£
302 ¸·Ì©¤Ê²ò¼á¤Ï¥Ç¥Ð¥¤¥¹¤Ë°Í¸¤¹¤ë¡£
303
304 .\"O When you send packets it is enough to specify
305 .\"O .IR sll_family ,
306 .\"O .IR sll_addr ,
307 .\"O .IR sll_halen ,
308 .\"O .IR sll_ifindex .
309 ¥Ñ¥±¥Ã¥È¤òÁ÷¤ë¾ì¹ç¤Ï¡¢
310 .IR sll_family ,
311 .IR sll_addr ,
312 .IR sll_halen ,
313 .I sll_ifindex
314 ¤ò»ØÄꤹ¤ì¤Ð½½Ê¬¤Ç¤¢¤ë¡£
315 .\"O The other fields should be 0.
316 ¤½¤Î¾¤Î¥Õ¥£¡¼¥ë¥É¤Ï 0 ¤Ë¤·¤Æ¤ª¤¯¤Ù¤­¤Ç¤¢¤ë¡£
317 .\"O .I sll_hatype
318 .\"O and
319 .\"O .I sll_pkttype
320 .\"O are set on received packets for your information.
321 .I sll_hatype
322 ¤È
323 .I sll_pkttype
324 ¤Ë¤Ï¼õ¿®¤·¤¿¥Ñ¥±¥Ã¥È¤Î¾ðÊó¤¬ÀßÄꤵ¤ì¤ë¡£
325 .\"O For bind only
326 .\"O .I sll_protocol
327 .\"O and
328 .\"O .I sll_ifindex
329 .\"O are used.
330 ¥Ð¥¤¥ó¥É¤ÎºÝ¤Ë¤Ï¡¢
331 .I sll_protocol
332 ¤È
333 .I sll_ifindex
334 ¤À¤±¤¬»ÈÍѤµ¤ì¤ë¡£
335 .\"O .SS Socket Options
336 .SS ¥½¥±¥Ã¥È¥ª¥×¥·¥ç¥ó
337 .\"O Packet sockets can be used to configure physical layer multicasting
338 .\"O and promiscuous mode.
339 .\"O It works by calling
340 .\"O .BR setsockopt (2)
341 .\"O on a packet socket for
342 .\"O .B SOL_PACKET
343 .\"O and one of the options
344 .\"O .B PACKET_ADD_MEMBERSHIP
345 .\"O to add a binding or
346 .\"O .B PACKET_DROP_MEMBERSHIP
347 .\"O to drop it.
348 .\"O They both expect a
349 .\"O .B packet_mreq
350 .\"O structure as argument:
351 packet ¥½¥±¥Ã¥È¤Ï¡¢ÊªÍýÁؤΥޥë¥Á¥­¥ã¥¹¥È¤ä
352 ̵º¹Ê̥⡼¥É (promiscuous mode) ¤òÀßÄꤷ¤Æ»È¤¦¤³¤È¤¬¤Ç¤­¤ë¡£
353 ¤³¤ì¤Ë¤Ï
354 .B SOL_PACKET
355 ¤È°Ê²¼¤Î¥ª¥×¥·¥ç¥ó¤Î¤¤¤º¤ì¤«¤ò»ØÄꤷ¤Æ
356 .BR setsockopt (2)
357 ¤ò¸Æ¤Ù¤Ð¤è¤¤¡£
358 ¥Ð¥¤¥ó¥É¤òÄɲ乤ë¾ì¹ç¤Ï
359 .B PACKET_ADD_MEMBERSHIP
360 ¤Ç¤¢¤ê¡¢¼è¤êµî¤ë¾ì¹ç¤Ï
361 .B PACKET_DROP_MEMBERSHIP
362 ¤Ç¤¢¤ë¡£¤³¤ì¤é¤Ï¤¤¤º¤ì¤â
363 .B packet_mreq
364 ¹½Â¤ÂΤò°ú¤­¿ô¤Ë¼è¤ë¡£
365
366 .in +4n
367 .nf
368 .\"O struct packet_mreq {
369 .\"O     int            mr_ifindex;    /* interface index */
370 .\"O     unsigned short mr_type;       /* action */
371 .\"O     unsigned short mr_alen;       /* address length */
372 .\"O     unsigned char  mr_address[8]; /* physical layer address */
373 .\"O };
374 struct packet_mreq {
375     int            mr_ifindex;    /* ¥¤¥ó¥¿¡¼¥Õ¥§¡¼¥¹ÈÖ¹æ */
376     unsigned short mr_type;       /* Æ°ºî */
377     unsigned short mr_alen;       /* ¥¢¥É¥ì¥¹¤ÎŤµ */
378     unsigned char  mr_address[8]; /* ÊªÍýÁؤΥ¢¥É¥ì¥¹ */
379 };
380 .fi
381 .in
382
383 .\"O .B mr_ifindex
384 .\"O contains the interface index for the interface whose status
385 .\"O should be changed.
386 .\"O The
387 .\"O .B mr_type
388 .\"O parameter specifies which action to perform.
389 .\"O .B PACKET_MR_PROMISC
390 .\"O enables receiving all packets on a shared medium (often known as
391 .\"O "promiscuous mode"),
392 .\"O .B PACKET_MR_MULTICAST
393 .\"O binds the socket to the physical layer multicast group specified in
394 .\"O .B mr_address
395 .\"O and
396 .\"O .BR mr_alen ,
397 .\"O and
398 .\"O .B PACKET_MR_ALLMULTI
399 .\"O sets the socket up to receive all multicast packets arriving at
400 .\"O the interface.
401 .I mr_ifindex
402 ¤Ï¡¢¥¹¥Æ¡¼¥¿¥¹¤òÊѹ¹¤·¤¿¤¤¥¤¥ó¥¿¡¼¥Õ¥§¡¼¥¹¤Î
403 ¥¤¥ó¥¿¡¼¥Õ¥§¡¼¥¹ÈÖ¹æ¤Ç¤¢¤ë¡£
404 .I mr_type
405 ¥Ñ¥é¥á¡¼¥¿¤Ï¼Â¹Ô¤¹¤ëÆ°ºî¤ò»ØÄꤹ¤ë:
406 .B PACKET_MR_PROMISC
407 ¤Ï¡¢¶¦Í­¤·¤Æ¤¤¤ëÇÞÂΤ«¤é¤ÎÁ´¤Æ¤Î¥Ñ¥±¥Ã¥È¤ò¼õ¿®¤Ç¤­¤ë¤è¤¦¤Ë¤¹¤ë
408 (¤·¤Ð¤·¤Ð "̵º¹Ê̥⡼¥É (promiscuous mode)" ¤È¸Æ¤Ð¤ì¤ë)¡£
409 .B PACKET_MR_MULTICAST
410 ¤Ï¡¢¤½¤Î¥½¥±¥Ã¥È¤ò¡¢
411 .I mr_address
412 ¤È
413 .I mr_alen
414 ¤Ç»ØÄꤵ¤ì¤ëʪÍýÁؤΥޥë¥Á¥­¥ã¥¹¥È¥Ö¥ë¡¼¥×¤Ë¥Ð¥¤¥ó¥É¤¹¤ë¡£
415 .B PACKET_MR_ALLMULTI
416 ¤Ï socket ¤ò up ¤Ë¤·¤Æ¡¢¤½¤Î¥¤¥ó¥¿¡¼¥Õ¥§¡¼¥¹¤ËÅþ㤷¤¿¤¹¤Ù¤Æ¤Î
417 ¥Þ¥ë¥Á¥­¥ã¥¹¥È¥Ñ¥±¥Ã¥È¤ò¼õ¿®¤Ç¤­¤ë¤è¤¦¤Ë¤¹¤ë¡£
418
419 .\"O In addition the traditional ioctls
420 .\"O .BR SIOCSIFFLAGS ,
421 .\"O .BR SIOCADDMULTI ,
422 .\"O .B SIOCDELMULTI
423 .\"O can be used for the same purpose.
424 ÀΤ«¤é¤¢¤ë ioctl ¤À¤±¤Ç¤Ê¤¯¡¢
425 .BR SIOCSIFFLAGS ,
426 .BR SIOCADDMULTI ,
427 .B SIOCDELMULTI
428 ¤òƱ¤¸ÌÜŪ¤ËÍѤ¤¤ë¤³¤È¤¬¤Ç¤­¤ë¡£
429 .\"O .SS Ioctls
430 .SS ioctl
431 .\"O .B SIOCGSTAMP
432 .\"O can be used to receive the timestamp of the last received packet.
433 .\"O Argument is a
434 .\"O .IR "struct timeval" .
435 .B SIOCGSTAMP
436 ¤òÍѤ¤¤ë¤È¡¢ºÇ¸å¤Ë¼õ¿®¤·¤¿¥Ñ¥±¥Ã¥È¤Î¥¿¥¤¥à¥¹¥¿¥ó¥×¤òÆÀ¤ë¤³¤È¤¬¤Ç¤­¤ë¡£
437 °ú¤­¿ô¤Ï
438 .I struct timeval
439 ¤Ç¤¢¤ë¡£
440
441 .\"O In addition all standard ioctls defined in
442 .\"O .BR netdevice (7)
443 .\"O and
444 .\"O .BR socket (7)
445 .\"O are valid on packet sockets.
446 ¤µ¤é¤Ë¡¢
447 .BR netdevice (7)
448 ¤ª¤è¤Ó
449 .BR socket (7)
450 ¤ÇÄêµÁ¤µ¤ì¤Æ¤¤¤ëɸ½à¤Î ioctl ¤Ï¤¤¤º¤ì¤â
451 packet ¥½¥±¥Ã¥È¤Ë»ØÄê²Äǽ¤Ç¤¢¤ë¡£
452 .\"O .SS Error Handling
453 .SS ¥¨¥é¡¼½èÍý
454 .\"O Packet sockets do no error handling other than errors occurred
455 .\"O while passing the packet to the device driver.
456 .\"O They don't have the concept of a pending error.
457 packet ¥½¥±¥Ã¥È¤Ï¡¢¥Ñ¥±¥Ã¥È¤ò¥Ç¥Ð¥¤¥¹¥É¥é¥¤¥Ð¤ËÅϤ¹¤È¤­¤Ë
458 µ¯¤­¤¿¥¨¥é¡¼¤·¤«½èÍý¤·¤Ê¤¤¡£Ãٱ䥨¥é¡¼ (pending error)
459 ¤Ë´Ø¤¹¤ë³µÇ°¤Ï»ý¤Ã¤Æ¤¤¤Ê¤¤¡£
460 .\"O .SH ERRORS
461 .SH ¥¨¥é¡¼
462 .TP
463 .B EADDRNOTAVAIL
464 .\"O Unknown multicast group address passed.
465 ÉÔÌÀ¤Ê¥Þ¥ë¥Á¥­¥ã¥¹¥È¥°¥ë¡¼¥×¥¢¥É¥ì¥¹¤¬ÅϤµ¤ì¤¿¡£
466 .TP
467 .B EFAULT
468 .\"O User passed invalid memory address.
469 ¥æ¡¼¥¶¤¬ÅϤ·¤¿¥á¥â¥ê¥¢¥É¥ì¥¹¤¬ÉÔÀµ¡£
470 .TP
471 .B EINVAL
472 .\"O Invalid argument.
473 °ú¤­¿ô¤¬ÉÔÀµ¡£
474 .TP
475 .B EMSGSIZE
476 .\"O Packet is bigger than interface MTU.
477 ¥Ñ¥±¥Ã¥È¤¬¥¤¥ó¥¿¡¼¥Õ¥§¡¼¥¹¤Î MTU ¤è¤êÂ礭¤¤¡£
478 .TP
479 .B ENETDOWN
480 .\"O Interface is not up.
481 ¥¤¥ó¥¿¡¼¥Õ¥§¡¼¥¹¤¬ up ¤Ç¤Ê¤¤¡£
482 .TP
483 .B ENOBUFS
484 .\"O Not enough memory to allocate the packet.
485 ¥Ñ¥±¥Ã¥È¤Ë³ä¤êÅö¤Æ¤ë¥á¥â¥ê¤¬Â­¤ê¤Ê¤¤¡£
486 .TP
487 .B ENODEV
488 .\"O Unknown device name or interface index specified in interface address.
489 ¥Ç¥Ð¥¤¥¹Ì¾¤¬ÉÔÌÀ¡£¤¢¤ë¤¤¤Ï¥¤¥ó¥¿¡¼¥Õ¥§¡¼¥¹¥¢¥É¥ì¥¹¤Ç»ØÄꤵ¤ì¤¿
490 ¥¤¥ó¥¿¡¼¥Õ¥§¡¼¥¹¥¤¥ó¥Ç¥Ã¥¯¥¹¤¬ÉÔÌÀ¡£
491 .TP
492 .B ENOENT
493 .\"O No packet received.
494 ¥Ñ¥±¥Ã¥È¤ò°ì¤Ä¤â¼õ¿®¤·¤Æ¤¤¤Ê¤¤¡£
495 .TP
496 .B ENOTCONN
497 .\"O No interface address passed.
498 ¥¤¥ó¥¿¡¼¥Õ¥§¡¼¥¹¥¢¥É¥ì¥¹¤¬ÅϤµ¤ì¤Ê¤«¤Ã¤¿¡£
499 .TP
500 .B ENXIO
501 .\"O Interface address contained an invalid interface index.
502 ¥¤¥ó¥¿¡¼¥Õ¥§¡¼¥¹¥¢¥É¥ì¥¹¤ËÉÔÀµ¤Ê¥¤¥ó¥¿¡¼¥Õ¥§¡¼¥¹¥¤¥ó¥Ç¥Ã¥¯¥¹¤¬´Þ¤Þ¤ì¤Æ¤¤¤ë¡£
503 .TP
504 .B EPERM
505 .\"O User has insufficient privileges to carry out this operation.
506 ¤³¤ÎÁàºî¤ò¹Ô¤¦¤Î¤ËɬÍפʸ¢¸Â¤ò¥æ¡¼¥¶¤¬»ý¤Ã¤Æ¤¤¤Ê¤¤¡£
507
508 .\"O In addition other errors may be generated by the low-level driver.
509 ¾åµ­°Ê³°¤Î¥¨¥é¡¼¤¬¡¢Äã¥ì¥Ù¥ë¤Î¥É¥é¥¤¥Ð¤ÇÀ¸À®¤µ¤ì¤ë¤³¤È¤¬¤¢¤ë¡£
510 .\"O .SH VERSIONS
511 .SH ¥Ð¡¼¥¸¥ç¥ó
512 .\"O .B AF_PACKET
513 .\"O is a new feature in Linux 2.2.
514 .\"O Earlier Linux versions supported only
515 .\"O .BR SOCK_PACKET .
516 .B AF_PACKET
517 ¤Ï Linux 2.2 ¤Î¿·µ¡Ç½¤Ç¤¢¤ë¡£¤³¤ì¤è¤ê¸Å¤¤¥Ð¡¼¥¸¥ç¥ó¤Î Linux ¤Ç¤Ï
518 .B SOCK_PACKET
519 ¤Î¤ß¤ò¥µ¥Ý¡¼¥È¤·¤Æ¤¤¤¿¡£
520 .PP
521 .\"O The include file
522 .\"O .I <netpacket/packet.h>
523 .\"O is present since glibc 2.1.
524 .\"O Older systems need:
525 ¥¤¥ó¥¯¥ë¡¼¥É¥Õ¥¡¥¤¥ë
526 .I <netpacket/packet.h>
527 ¤¬Â¸ºß¤¹¤ë¤Î¤Ï glibc 2.1 °Ê¹ß¤Ç¤¢¤ë¡£
528 ¤½¤ì°ÊÁ°¤Î¥·¥¹¥Æ¥à¤Ç¤Ï°Ê²¼¤Î¤è¤¦¤Ë¤¹¤ëɬÍפ¬¤¢¤ë:
529 .sp
530 .in +4n
531 .nf
532 #include <asm/types.h>
533 #include <linux/if_packet.h>
534 #include <linux/if_ether.h>  /* The L2 protocols */
535 .fi
536 .in
537 .\"O .SH NOTES
538 .SH Ãí°Õ
539 .\"O For portable programs it is suggested to use
540 .\"O .B AF_PACKET
541 .\"O via
542 .\"O .BR pcap (3);
543 .\"O although this only covers a subset of the
544 .\"O .B AF_PACKET
545 .\"O features.
546 °Ü¿¢À­¤ÎɬÍ×¤Ê¥×¥í¥°¥é¥à¤Ç¤Ï¡¢
547 .BR pcap (3)
548 ·Ðͳ¤Ç
549 .B AF_PACKET
550 ¤òÍѤ¤¤ë¤³¤È¤ò¤ªÁ¦¤á¤¹¤ë¡£¤¿¤À¤·¡¢¤³¤ÎÊýË¡¤Ç¤Ï
551 .B AF_PACKET
552 ¤Îµ¡Ç½¤¹¤Ù¤Æ¤òÍøÍѤ¹¤ë¤³¤È¤Ï¤Ç¤­¤Ê¤¤¡£
553
554 .\"O The
555 .\"O .B SOCK_DGRAM
556 .\"O packet sockets make no attempt to create or parse the IEEE 802.2 LLC
557 .\"O header for a IEEE 802.3 frame.
558 .\"O When
559 .\"O .B ETH_P_802_3
560 .\"O is specified as protocol for sending the kernel creates the
561 .\"O 802.3 frame and fills out the length field; the user has to supply the LLC
562 .\"O header to get a fully conforming packet.
563 .\"O Incoming 802.3 packets are not multiplexed on the DSAP/SSAP protocol
564 .\"O fields; instead they are supplied to the user as protocol
565 .\"O .B ETH_P_802_2
566 .\"O with the LLC header prepended.
567 .\"O It is thus not possible to bind to
568 .\"O .BR ETH_P_802_3 ;
569 .\"O bind to
570 .\"O .B ETH_P_802_2
571 .\"O instead and do the protocol multiplex yourself.
572 .\"O The default for sending is the standard Ethernet DIX
573 .\"O encapsulation with the protocol filled in.
574 .B SOCK_DGRAM
575 packet ¥½¥±¥Ã¥È¤Ï¡¢IEEE 802.3 ¥Õ¥ì¡¼¥à¤Î IEEE 802.2 LLC ¥Ø¥Ã¥À¤Î
576 À¸À®¤ä²òÀϤò¹Ô¤ª¤¦¤È¤·¤Ê¤¤¡£
577 .B ETH_P_802_3
578 ¤¬Á÷¿®¥×¥í¥È¥³¥ë¤Ë»ØÄꤵ¤ì¤ë¤È¡¢¥«¡¼¥Í¥ë¤Ï 802.3 ¥Õ¥ì¡¼¥à¤ò
579 À¸À®¤·¤Æ length ¥Õ¥£¡¼¥ë¥É¤Ë½ñ¤­¹þ¤à¡£
580 ´°Á´¤Ë½àµò¤·¤¿¥Ñ¥±¥Ã¥È¤òÆÀ¤ë¤¿¤á¤Ë¤Ï¥æ¡¼¥¶¡¼¤¬ LLC ¥Ø¥Ã¥À¤ò
581 Í¿¤¨¤ëɬÍפ¬¤¢¤ë¡£ÅþÃ夷¤¿ 802.3 ¥Ñ¥±¥Ã¥È¤Ç¤Ï¡¢
582 DSAP/SSAP protocol ¤Î³Æ¥Õ¥£¡¼¥ë¥É¤Ï¿½Å²½ (multiplex) ¤µ¤ì¤Æ¤¤¤Ê¤¤¡£
583 Âå¤ï¤ê¤Ë¤³¤ì¤é¤Ï LLC ¥Ø¥Ã¥À¤¬Á°ÃÖ¤µ¤ì¤¿
584 .B ETH_P_802_2
585 ¥×¥í¥È¥³¥ë¤È¤·¤ÆÍ¿¤¨¤é¤ì¤ë¡£¤·¤¿¤¬¤Ã¤Æ¡¢
586 .B ETH_P_802_3
587 ¤Ë¥Ð¥¤¥ó¥É¤¹¤ë¤³¤È¤Ï¤Ç¤­¤Ê¤¤¡£¤«¤ï¤ê¤Ë
588 .B ETH_P_802_2
589 ¤Ë¥Ð¥¤¥ó¥É¤·¡¢¼«Ê¬¼«¿È¤Ç¥×¥í¥È¥³¥ë¤Î¿½Å²½¤ò¹Ô¤¦¤³¤È¡£
590 Á÷¿®¤Î¥Ç¥Õ¥©¥ë¥È¤Ï¡¢¥×¥í¥È¥³¥ë¥Õ¥£¡¼¥ë¥É¤ò»ý¤Ä
591 ɸ½à¤Î Ethernet DIX encapsulation ¤Ç¤¢¤ë¡£
592
593 .\"O Packet sockets are not subject to the input or output firewall chains.
594 packet ¥½¥±¥Ã¥È¤ÏÆþ½ÐÎϤΠfirewall chain ¤Ë±Æ¶Á¤ò¤¦¤±¤Ê¤¤¡£
595 .\"O .SS Compatibility
596 .SS °Ü¿¢À­
597 .\"O In Linux 2.0, the only way to get a packet socket was by calling
598 .\"O .BI "socket(AF_INET, SOCK_PACKET, " protocol )\fR.
599 .\"O This is still supported but strongly deprecated.
600 .\"O The main difference between the two methods is that
601 .\"O .B SOCK_PACKET
602 .\"O uses the old
603 .\"O .I struct sockaddr_pkt
604 .\"O to specify an interface, which doesn't provide physical layer
605 .\"O independence.
606 Linux 2.0 ¤Ç¤Ï¡¢ packet ¥½¥±¥Ã¥È¤òÆÀ¤ëÊýË¡¤Ï
607 .BI "socket(AF_INET, SOCK_PACKET, " protocol )\fR
608 ¤ò¸Æ¤Ö¤ä¤êÊý¤·¤«¤Ê¤«¤Ã¤¿¡£¤³¤ÎÊýË¡¤Ï¤Þ¤À¥µ¥Ý¡¼¥È¤µ¤ì¤Æ¤¤¤ë¤¬¡¢
609 ÍѤ¤¤Ê¤¤¤³¤È¤ò¶¯¤¯¿ä¾©¤¹¤ë¡£¸½ºß¤ÎÊýË¡¤È¤Î¼ç¤Ê°ã¤¤¤Ï¡¢
610 .B SOCK_PACKET
611 ¤Ç¤Ï¥¤¥ó¥¿¡¼¥Õ¥§¡¼¥¹¤Î»ØÄê¤Ë¸Å¤¤
612 .I struct sockaddr_pkt
613 ¤òÍѤ¤¤ëÅÀ¤Ç¤¢¤ë¡£¤³¤ì¤Ë¤ÏʪÍýÁؤ«¤é¤ÎÆÈΩÀ­¤¬¤Ê¤¤¡£
614
615 .in +4n
616 .nf
617 struct sockaddr_pkt {
618     unsigned short spkt_family;
619     unsigned char  spkt_device[14];
620     unsigned short spkt_protocol;
621 };
622 .fi
623 .in
624
625 .\"O .I spkt_family
626 .\"O contains
627 .\"O the device type,
628 .\"O .I spkt_protocol
629 .\"O is the IEEE 802.3 protocol type as defined in
630 .\"O .I <sys/if_ether.h>
631 .\"O and
632 .\"O .I spkt_device
633 .\"O is the device name as a null-terminated string, for example, eth0.
634 .I spkt_family
635 ¤Ï¥Ç¥Ð¥¤¥¹¤Î¥¿¥¤¥×¡¢
636 .I spkt_protocol
637 ¤Ï
638 .I <sys/if_ether.h>
639 ¤ÇÄêµÁ¤µ¤ì¤Æ¤¤¤ë IEEE 802.3 ¥×¥í¥È¥³¥ë¥¿¥¤¥×¡¢
640 .I spkt_device
641 ¤Ï¥Ç¥Ð¥¤¥¹¤Î̾Á°¤ò NULL ½ªÃ¼¤µ¤ì¤¿Ê¸»úÎó¤ÇÍ¿¤¨¤¿¤â¤Î (Îã: eth0) ¤Ç¤¢¤ë¡£
642
643 .\"O This structure is obsolete and should not be used in new code.
644 ¤³¤Î¹½Â¤ÂΤϠobsolete ¤Ç¤¢¤ê¡¢
645 ¿·¤·¤¯¥³¡¼¥É¤ò½ñ¤¯»þ¤Ë¤ÏÍѤ¤¤ë¤Ù¤­¤Ç¤Ê¤¤¡£
646 .\"O .SH BUGS
647 .SH ¥Ð¥°
648 .\"O glibc 2.1 does not have a define for
649 .\"O .BR SOL_PACKET .
650 .\"O The suggested workaround is to use:
651 glibc 2.1 ¤Ë¤Ï
652 .B SOL_PACKET
653 ¤ÎÄêµÁ¤¬¤Ê¤¤¡£²óÈòºö¤È¤·¤Æ¤Ï¡¢°Ê²¼¤Î¤è¤¦¤Ë¤¹¤ë¤È¤è¤¤¡£
654 .in +4n
655 .nf
656
657 #ifndef SOL_PACKET
658 #define SOL_PACKET 263
659 #endif
660
661 .fi
662 .in
663 .\"O This is fixed in later glibc versions and also does not occur on
664 .\"O libc5 systems.
665 ¤³¤ÎÌäÂê¤Ï¿·¤·¤¤¥Ð¡¼¥¸¥ç¥ó¤Î glibc ¤Ç¤Ï½¤Àµ¤µ¤ì¤Æ¤¤¤ë¡£
666 libc5 ¤Î¥·¥¹¥Æ¥à¤Ë¤Ï¤³¤ÎÌäÂê¤Ï¤Ê¤¤¡£
667
668 .\"O The IEEE 802.2/803.3 LLC handling could be considered as a bug.
669 IEEE 802.2/803.3 ¤Î LLC ¤Î°·¤¤Êý¤Ï¡¢¥Ð¥°¤È¹Í¤¨¤Æ¤âÎɤ¤¤À¤í¤¦¡£
670
671 .\"O Socket filters are not documented.
672 ¥½¥±¥Ã¥È¥Õ¥£¥ë¥¿¡¼¤Ë¤Ä¤¤¤Æµ­ºÜ¤µ¤ì¤Æ¤¤¤Ê¤¤¡£
673
674 .\"O The
675 .\"O .B MSG_TRUNC
676 .\"O .BR recvmsg (2)
677 .\"O extension is an ugly hack and should be replaced by a control message.
678 .\"O There is currently no way to get the original destination address of
679 .\"O packets via
680 .\"O .BR SOCK_DGRAM .
681 .B MSG_TRUNC
682 .BR recvmsg (2)
683 ³ÈÄ¥¤ÏÈó¾ï¤Ë¤Þ¤º¤¤Âнè¤Ç¤¢¤ê¡¢À©¸æ¥á¥Ã¥»¡¼¥¸¤ÇÃÖ¤­´¹¤¨¤ë¤Ù¤­¤Ç¤¢¤ë¡£
684 º£¤Î¤È¤³¤í
685 .B SOCK_DGRAM
686 ·Ðͳ¤Ç¥Ñ¥±¥Ã¥È¤Ë¤Ä¤¤¤Æ¤¤¤¿°¸À襢¥É¥ì¥¹¤òÆÀ¤ëÊýË¡¤¬¤Ê¤¤¡£
687 .\"O .\" .SH CREDITS
688 .\" .SH Ãø¼Ô
689 .\"O .\" This man page was written by Andi Kleen with help from Matthew Wilcox.
690 .\"O .\" AF_PACKET in Linux 2.2 was implemented
691 .\"O .\" by Alexey Kuznetsov, based on code by Alan Cox and others.
692 .\" ¤³¤Î man ¥Ú¡¼¥¸¤Ï Matthew Wilcox ¤Î½õÎϤΤâ¤È¤Ë Andi Kleen ¤¬½ñ¤¤¤¿¡£
693 .\" Linux 2.2 ¤Î AF_PACKET ¤Ï¡¢
694 .\" Alan Cox ¤¿¤Á¤Î¥³¡¼¥É¤ò¤â¤È¤Ë¤·¤Æ Alexey Kuznetsov ¤¬¼ÂÁõ¤·¤¿¡£
695 .\"O .SH SEE ALSO
696 .SH ´ØÏ¢¹àÌÜ
697 .BR socket (2),
698 .BR pcap (3),
699 .BR capabilities (7),
700 .BR ip (7),
701 .BR raw (7),
702 .BR socket (7)
703
704 .\"O RFC\ 894 for the standard IP Ethernet encapsulation.
705 ɸ½à IP Ethernet encapsulation ¤Ë´Ø¤¹¤ë¾ðÊó¤Ï RFC\ 894 ¤Ë¤¢¤ë¡£
706
707 .\"O RFC\ 1700 for the IEEE 802.3 IP encapsulation.
708 IEEE 802.3 IP encapsulation ¤Ë´Ø¤¹¤ë¾ðÊó¤Ï RFC\ 1700 ¤Ë¤¢¤ë¡£
709
710 .\"O The
711 .\"O .I <linux/if_ether.h>
712 .\"O include file for physical layer protocols.
713 ʪÍýÁؤΥץí¥È¥³¥ë¤Ë´Ø¤¹¤ëµ­½Ò¤Ï
714 .I <linux/if_ether.h>
715 ¥¤¥ó¥¯¥ë¡¼¥É¥Õ¥¡¥¤¥ë¤Ë¤¢¤ë¡£