File: netdevice.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 (251 lines) | stat: -rw-r--r-- 5,033 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
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
'\" t
.\" Don't change the first line, it tells man that tbl is needed.
.\" This man page is Copyright (C) 1999 Andi Kleen <ak@muc.de>.
.\" 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.
.\" $Id: netdevice.7,v 1.1.1.1 2000/12/27 12:24:43 BitBIRD Exp $
.TH NETDEVICE  7 "2 May 1999" "Linux Man Page" "Linux Programmer's Manual" 
.SH NAME
netdevice \- ײ Linux 豸.
.SH 
.B "#include <sys/ioctl.h>"
.B "#include <net/if.h>"

.SH 
ֲ豸׽ֽӿ.

Linux ֧һЩ豸ı׼ ioctl.
׽,˽ͻ.Ǵһ
.B ifreq 
ṹ:

.nf
.ta 4 20 42
struct ifreq
{
char    ifr_name[IFNAMSIZ];     /* ӿ */
union {
struct sockaddr ifr_addr;
struct sockaddr ifr_dstaddr;
struct sockaddr ifr_broadaddr;
struct sockaddr ifr_netmask;
struct sockaddr ifr_hwaddr;
short   ifr_flags;
int     ifr_ifindex;
int     ifr_metric;
int     ifr_mtu;
struct ifmap    ifr_map;
char    ifr_slave[IFNAMSIZ];
char    ifr_newname[IFNAMSIZ];
char *  ifr_data;
};
}

struct ifconf 
{ 
int ifc_len;            /* ߴ */
union {            
char *  ifc_buf; /* ַ */ 
struct ifreq *ifc_req; /* ṹ */
};  
};         
.ta
.fi

һ˵,ûҪѡ豸,ͨ
.B ifr_name
Ϊӿڵʵ. ṹԱԹڴ.

.SH IOCTLS
һ ioctl ΪҪȨ, ôʹҪЧûΪ0, ӵ
.B CAP_NET_ADMIN
. 

.B EPERM
.

.TP
.B SIOCGIFNAME

.BR ifr_ifindex,
򷵻ش
.BR ifr_name 
еĽӿ.Ψһܹش
.BR ifr_name 
ݵ ioctl.

.TP
.B SIOCGIFINDEX
ѽӿڵĽӿ
ŵ
.BR ifr_ifindex 
.

.TP
.BR SIOCGIFFLAGS ", " SIOCSIFFLAGS
ȡû豸Ļ־.
.B ifr_flags
ֵλ:

.TS
tab(:);
c s
l l.
豸־
IFF_UP: ӿ.
IFF_BROADCAST: ЧĹ㲥ַ.
IFF_DEBUG: ڲԱ־.
IFF_LOOPBACK: Իӿ.
IFF_POINTOPOINT: ǵ㵽·ӿ.
IFF_RUNNING: Դѷ.
IFF_NOARP:  arp Э, ڶĿַû.
IFF_PROMISC: ӿΪ(promiscuous)ģʽ.
IFF_NOTRAILERS: ʹtrailer .
IFF_ALLMULTI: 鲥(multicast).
IFF_MASTER: ƽȺ(bundle).
IFF_SLAVE: ӸƽȺ(bundle).
IFF_MULTICAST: ֧鲥(multicast).
IFF_PORTSEL: ͨifmapѡ.
IFF_AUTOMEDIA: Զѡ.
IFF_DYNAMIC:T{
ӿڹرʱַ.
T}
.TE 

û־Ȩ, Ƕκν̿ɶ.

.TP
.BR SIOCGIFMETRIC ", " SIOCSIFMETRIC
ʹ
.BR ifr_metric 
ȡû豸 metric ֵ.Ŀǰûʵһ.ʹ
.B ifr_metric
 0, ᷵
.B EOPNOTSUPP.

.TP
.BR SIOCGIFMTU ", " SIOCSIFMTU
ʹ
.BR ifr_mtu 
ȡû豸 MTU (䵥Ԫ).
 MTU Ȩ. MTU ĹСܵں˱.

.TP
.BR SIOCGIFHWADDR ", " SIOCSIFHWADDR
ʹ
.BR ifr_hwaddr 
ȡû豸Ӳַ.ӲַȨ.

.TP
.B SIOCSIFHWBROADCAST
ʹ
.BR ifr_hwaddr 
ȡû豸Ӳ㲥ַ.ǸȨ.

.TP
.BR SIOCGIFMAP ", " SIOCSIFMAP
ʹ
.BR ifr_map 
ȡûýӿڵӲ.Ȩ.

.nf
.ta 4 20 42
struct ifmap 
{
unsigned long   mem_start;
unsigned long   mem_end;
unsigned short  base_addr; 
unsigned char   irq;    
unsigned char   dma; 
unsigned char   port; 
};
.ta
.fi

 ifmap ṹڹȡ豸ϵṹ.

.TP
.BR SIOCADDMULTI ", " SIOCDELMULTI
ʹ
.BR ifr_hwaddr 
豸·鲥 (multicase filter) ӻɾַ.
ЩȨ.ο
.BR packet (7)
滻Ʒ.

.TP
.BR SIOCGIFTXQLEN ", " SIOCSIFTXQLEN
ʹ
.BR ifr_qlen 
ȡû豸Ĵг.
ôгȨ.

.TP
.B SIOCSIFNAME

.BR ifr_ifindex
ڵƸij
.BR ifr_newname
ڵ. ǸȨ.

.TP
.B SIOCGIFCONF
һϵнӿڵַ(). ĿǰΪ˼, ָ AF_INET ַ.
ûһ
.B ifconf
ṹΪ ioctl IJ.
.B ifc_req
кһָ
.I ifreq
ṹָ,䳤ֽΪλ
.B ifc_len.
ںʹõĵַ ifreqs:
.I ifr_name 
װнӿڵ(eth0:1),
.I ifr_addr
ǵַ. ں
.I ifc_len
зʵʳ;
ڳʼ, ûΪ, ӦûһЩĻ.
ûдʱ ioctl  0, 򷵻 -1, .

\" XXX Slaving isn't supported in 2.2
.\" .TP
.\" .BR SIOCGIFSLAVE ", " SIOCSIFSLAVE
.\" Get or set the slave device using
.\" .BR ifr_slave .
.\" Setting the slave device is a privileged operation.

.PP

.\" XXX add amateur radio stuff.
.PP
Э֧Լ ioctl ЭضĽӿڲ.
οЩЭİֲ.Ҫ IP ַο
.BR ip (7).
.PP
һЩ豸֧ר ioctl, û.

.SH ע
.B SIOCGIFCONF 
ר IP , 
.BR ip (7).

.SH ע
еַû
.B IFF_RUNNING 
־ĽӿƿԾ
.I /proc/net/dev
.

.SH 
.BR ip "(7), " proc "(7)"

.SH "[İά]"
 E-mail: xuming@bigfoot.com
.SH "[ݸ]"
2000/10/15
.br
.B й Linux ̳ man ֲҳƻ: www.cmpp.net/