xref: /titanic_51/usr/src/uts/common/sys/sockio.h (revision 8393544efeffe8042bf5273c148010b32fa827e2)
1 /*
2  * CDDL HEADER START
3  *
4  * The contents of this file are subject to the terms of the
5  * Common Development and Distribution License (the "License").
6  * You may not use this file except in compliance with the License.
7  *
8  * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
9  * or http://www.opensolaris.org/os/licensing.
10  * See the License for the specific language governing permissions
11  * and limitations under the License.
12  *
13  * When distributing Covered Code, include this CDDL HEADER in each
14  * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
15  * If applicable, add the following below this CDDL HEADER, with the
16  * fields enclosed by brackets "[]" replaced with your own identifying
17  * information: Portions Copyright [yyyy] [name of copyright owner]
18  *
19  * CDDL HEADER END
20  */
21 /*
22  * Copyright (c) 1989, 2010, Oracle and/or its affiliates. All rights reserved.
23  */
24 
25 /*	Copyright (c) 1983, 1984, 1985, 1986, 1987, 1988, 1989 AT&T	*/
26 /*	  All Rights Reserved  	*/
27 
28 /*
29  * University Copyright- Copyright (c) 1982, 1986, 1988
30  * The Regents of the University of California
31  * All Rights Reserved
32  *
33  * University Acknowledgment- Portions of this document are derived from
34  * software developed by the University of California, Berkeley, and its
35  * contributors.
36  */
37 
38 #ifndef	_SYS_SOCKIO_H
39 #define	_SYS_SOCKIO_H
40 
41 /*
42  * General socket ioctl definitions.
43  */
44 
45 #include <sys/ioccom.h>
46 
47 #ifdef	__cplusplus
48 extern "C" {
49 #endif
50 
51 /* socket i/o controls */
52 #define	SIOCSHIWAT	_IOW('s',  0, int)		/* set high watermark */
53 #define	SIOCGHIWAT	_IOR('s',  1, int)		/* get high watermark */
54 #define	SIOCSLOWAT	_IOW('s',  2, int)		/* set low watermark */
55 #define	SIOCGLOWAT	_IOR('s',  3, int)		/* get low watermark */
56 #define	SIOCATMARK	_IOR('s',  7, int)		/* at oob mark? */
57 #define	SIOCSPGRP	_IOW('s',  8, int)		/* set process group */
58 #define	SIOCGPGRP	_IOR('s',  9, int)		/* get process group */
59 
60 /*
61  * SIOCADDRT and SIOCDELRT ioctls need to be defined using _IOWN macro to
62  * make them datamodel independent.
63  */
64 #define	SIOCADDRT	_IOWN('r', 10, 48)		/* add route */
65 #define	SIOCDELRT	_IOWN('r', 11, 48)		/* delete route */
66 
67 /* For multicast routing. These might change in future release */
68 #define	SIOCGETVIFCNT	_IOWR('r', 20, struct sioc_vif_req)
69 							/* get vif pkt count */
70 #define	SIOCGETSGCNT	_IOWR('r', 21, struct sioc_sg_req)
71 							/* get s,g pkt count */
72 #define	SIOCGETLSGCNT	_IOWR('r', 21, struct sioc_lsg_req)
73 							/* get s,g pkt count */
74 
75 /*
76  * Obsolete interface ioctls using struct ifreq that are supported
77  * for compatibility. New interface ioctls use struct lifreq.
78  */
79 #define	SIOCSIFADDR	_IOW('i',  12, struct ifreq)	/* set if address */
80 #define	SIOCGIFADDR	_IOWR('i', 13, struct ifreq)	/* get if address */
81 #define	SIOCSIFDSTADDR	_IOW('i',  14, struct ifreq)	/* set p-p address */
82 #define	SIOCGIFDSTADDR	_IOWR('i', 15, struct ifreq)	/* get p-p address */
83 #define	SIOCSIFFLAGS	_IOW('i',  16, struct ifreq)	/* set if flags */
84 #define	SIOCGIFFLAGS	_IOWR('i', 17, struct ifreq)	/* get if flags */
85 #define	SIOCSIFMEM	_IOW('i',  18, struct ifreq)	/* set interface mem */
86 #define	SIOCGIFMEM	_IOWR('i', 19, struct ifreq)	/* get interface mem */
87 
88 /*
89  * Needs to be defined using _IOWRN macro to make it datamodel independent.
90  * Argument is a struct ifconf.
91  */
92 #define	O_SIOCGIFCONF	_IOWRN('i', 20, 8)		/* old get if list */
93 
94 #define	SIOCSIFMTU	_IOW('i',  21, struct ifreq)	/* set if mtu */
95 #define	SIOCGIFMTU	_IOWR('i', 22, struct ifreq)	/* get if mtu */
96 
97 	/* from 4.3BSD */
98 #define	SIOCGIFBRDADDR	_IOWR('i', 23, struct ifreq)	/* get broadcast addr */
99 #define	SIOCSIFBRDADDR	_IOW('i',  24, struct ifreq)	/* set broadcast addr */
100 #define	SIOCGIFNETMASK	_IOWR('i', 25, struct ifreq)	/* get subnetmask */
101 #define	SIOCSIFNETMASK	_IOW('i',  26, struct ifreq)	/* set subnetmask */
102 #define	SIOCGIFMETRIC	_IOWR('i', 27, struct ifreq)	/* get if metric */
103 #define	SIOCSIFMETRIC	_IOW('i',  28, struct ifreq)	/* set if metric */
104 
105 #define	SIOCSARP	_IOW('i',  30, struct arpreq)	/* set arp entry */
106 #define	SIOCGARP	_IOWR('i', 31, struct arpreq)	/* get arp entry */
107 #define	SIOCDARP	_IOW('i',  32, struct arpreq)	/* delete arp entry */
108 #define	SIOCUPPER	_IOW('i',  40, struct ifreq)	/* attach upper layer */
109 #define	SIOCLOWER	_IOW('i',  41, struct ifreq)	/* attach lower layer */
110 #define	SIOCSETSYNC	_IOW('i',  44, struct ifreq)	/* set syncmode */
111 #define	SIOCGETSYNC	_IOWR('i', 45, struct ifreq)	/* get syncmode */
112 #define	SIOCSSDSTATS	_IOWR('i', 46, struct ifreq)	/* sync data stats */
113 #define	SIOCSSESTATS	_IOWR('i', 47, struct ifreq)	/* sync error stats */
114 
115 #define	SIOCSPROMISC	_IOW('i',  48, int)		/* request promisc */
116 							/* mode on/off */
117 #define	SIOCADDMULTI	_IOW('i',  49, struct ifreq)	/* set m/c address */
118 #define	SIOCDELMULTI	_IOW('i',  50, struct ifreq)	/* clr m/c address */
119 
120 /* STREAMS based socket emulation */
121 
122 #define	SIOCGETNAME	_IOR('s',  52, struct sockaddr)	/* getsockname */
123 #define	SIOCGETPEER	_IOR('s',  53, struct sockaddr)	/* getpeername */
124 #define	IF_UNITSEL	_IOW('s',  54, int)		/* set unit number */
125 #define	SIOCXPROTO	_IO('s',   55)			/* empty proto table */
126 
127 #define	SIOCIFDETACH	_IOW('i',  56, struct ifreq)	/* detach interface */
128 #define	SIOCGENPSTATS	_IOWR('i', 57, struct ifreq)	/* get ENP stats */
129 #define	SIOCX25XMT	_IOWR('i', 59, struct ifreq)	/* start a slp proc */
130 							/* in x25if */
131 #define	SIOCX25RCV	_IOWR('i', 60, struct ifreq)	/* start a slp proc */
132 							/* in x25if */
133 #define	SIOCX25TBL	_IOWR('i', 61, struct ifreq)	/* xfer lun table to */
134 							/* kernel */
135 #define	SIOCSLGETREQ	_IOWR('i', 71, struct ifreq)	/* wait for switched */
136 							/* SLIP request */
137 #define	SIOCSLSTAT	_IOW('i',  72, struct ifreq)	/* pass SLIP info to */
138 							/* kernel */
139 #define	SIOCSIFNAME	_IOW('i',  73, struct ifreq)	/* set interface name */
140 #define	SIOCGENADDR	_IOWR('i', 85, struct ifreq)	/* Get ethernet addr */
141 #define	SIOCGIFNUM	_IOR('i',  87, int)		/* get number of ifs */
142 
143 #define	SIOCGIFMUXID	_IOWR('i', 88, struct ifreq)	/* get if muxid */
144 #define	SIOCSIFMUXID	_IOW('i',  89, struct ifreq)	/* set if muxid */
145 
146 #define	SIOCGIFINDEX	_IOWR('i', 90, struct ifreq)	/* get if index */
147 #define	SIOCSIFINDEX	_IOW('i',  91, struct ifreq)	/* set if index */
148 #define	SIOCGIFCONF	_IOWRN('i', 92, 8)		/* get if list */
149 
150 /*
151  * New interface ioctls that use the struct lifreq. Can be used for
152  * both IPv4 and IPv6.
153  */
154 #define	SIOCLIFREMOVEIF	_IOW('i',  110, struct lifreq)	/* delete logical */
155 #define	SIOCLIFADDIF	_IOWR('i', 111, struct lifreq)	/* create logical */
156 
157 #define	SIOCSLIFADDR	_IOW('i',  112, struct lifreq)	/* set if address */
158 #define	SIOCGLIFADDR	_IOWR('i', 113, struct lifreq)	/* get if address */
159 #define	SIOCSLIFDSTADDR	_IOW('i',  114, struct lifreq)	/* set p-p address */
160 #define	SIOCGLIFDSTADDR	_IOWR('i', 115, struct lifreq)	/* get p-p address */
161 #define	SIOCSLIFFLAGS	_IOW('i',  116, struct lifreq)	/* set if flags */
162 #define	SIOCGLIFFLAGS	_IOWR('i', 117, struct lifreq)	/* get if flags */
163 
164 /*
165  * Needs to be defined using _IOWRN macro to make it datamodel independent.
166  * Argument is a struct lifconf.
167  */
168 #define	O_SIOCGLIFCONF	_IOWRN('i', 120, 16)		/* old get if list */
169 #define	SIOCSLIFMTU	_IOW('i',  121, struct lifreq)	/* set if mtu */
170 #define	SIOCGLIFMTU	_IOWR('i', 122, struct lifreq)	/* get if mtu */
171 #define	SIOCGLIFBRDADDR	_IOWR('i', 123, struct lifreq)	/* get broadcast addr */
172 #define	SIOCSLIFBRDADDR	_IOW('i',  124, struct lifreq)	/* set broadcast addr */
173 #define	SIOCGLIFNETMASK	_IOWR('i', 125, struct lifreq)	/* get subnetmask */
174 #define	SIOCSLIFNETMASK	_IOW('i',  126, struct lifreq)	/* set subnetmask */
175 #define	SIOCGLIFMETRIC	_IOWR('i', 127, struct lifreq)	/* get if metric */
176 #define	SIOCSLIFMETRIC	_IOW('i',  128, struct lifreq)	/* set if metric */
177 #define	SIOCSLIFNAME	_IOWR('i', 129, struct lifreq)	/* set interface name */
178 #define	SIOCGLIFNUM	_IOWR('i', 130, struct lifnum)	/* get number of ifs */
179 #define	SIOCGLIFMUXID	_IOWR('i', 131, struct lifreq)	/* get if muxid */
180 #define	SIOCSLIFMUXID	_IOW('i',  132, struct lifreq)	/* set if muxid */
181 
182 #define	SIOCGLIFINDEX	_IOWR('i', 133, struct lifreq)	/* get if index */
183 #define	SIOCSLIFINDEX	_IOW('i',  134, struct lifreq)	/* set if index */
184 
185 #define	SIOCSLIFTOKEN	_IOW('i',  135, struct lifreq)	/* Set token for link */
186 							/* local address and */
187 							/* autoconf */
188 #define	SIOCGLIFTOKEN	_IOWR('i', 136, struct lifreq)	/* Get token for link */
189 							/* local address and */
190 							/* autoconf */
191 
192 #define	SIOCSLIFSUBNET	_IOW('i',  137, struct lifreq)	/* set subnet prefix */
193 #define	SIOCGLIFSUBNET	_IOWR('i', 138, struct lifreq)	/* get subnet prefix */
194 
195 #define	SIOCSLIFLNKINFO _IOW('i',  139, struct lifreq)	/* set link info */
196 #define	SIOCGLIFLNKINFO _IOWR('i', 140, struct lifreq)	/* get link info */
197 
198 #define	SIOCLIFDELND	_IOW('i',  141, struct lifreq)	/* Delete ND entry */
199 #define	SIOCLIFGETND	_IOWR('i', 142, struct lifreq)	/* Get ND entry */
200 #define	SIOCLIFSETND	_IOW('i',  143, struct lifreq)	/* Set ND entry */
201 
202 /*
203  * Address querying ioctls.
204  */
205 #define	SIOCTMYADDR	_IOWR('i', 144, struct sioc_addrreq)
206 							/* My address? */
207 #define	SIOCTONLINK	_IOWR('i', 145, struct sioc_addrreq)
208 							/* Address on-link? */
209 #define	SIOCTMYSITE	_IOWR('i', 146, struct sioc_addrreq)
210 							/* In this site? */
211 
212 /* 147 and 148 were SIOC*TUNPARAM ioctls.  Feel free to re-use. */
213 
214 #define	SIOCFIPSECONFIG	_IOW('i',  149, 0)		/* Flush Policy  */
215 #define	SIOCSIPSECONFIG	_IOW('i',  150, 0)		/* Set Policy */
216 #define	SIOCDIPSECONFIG	_IOW('i',  151, 0)		/* Delete Policy */
217 #define	SIOCLIPSECONFIG	_IOW('i',  152, 0)		/* List Policy */
218 
219 /*
220  * 153 can be reused (was consolidation-private SIOCLIFFAILOVER).
221  */
222 
223 /*
224  * IP Multipathing ioctls.
225  */
226 #define	SIOCGLIFBINDING		_IOWR('i', 154, struct lifreq)
227 #define	SIOCSLIFGROUPNAME	_IOW('i',  155, struct lifreq)
228 #define	SIOCGLIFGROUPNAME	_IOWR('i', 156, struct lifreq)
229 #define	SIOCGLIFGROUPINFO	_IOWR('i', 157, struct lifgroupinfo)
230 
231 /*
232  * Leave 158 - 160 unused; used to be SIOC*IFARP ioctls.
233  * However, 161 can be reused (was consolidation-private SIOCSLIFOINDEX).
234  */
235 
236 /*
237  * IOCTLS which provide an interface to the IPv6 address selection policy.
238  */
239 #define	SIOCGIP6ADDRPOLICY	_IOWRN('i', 162, 0)
240 #define	SIOCSIP6ADDRPOLICY	_IOWN('i', 163, 0)
241 
242 /*
243  * IOCTL for retrieving sorting info for a list of destination addrs.
244  * Use the _IOWRN macro to make it datamodel independent.  Argument
245  * is a struct dstinfo.
246  */
247 #define	SIOCGDSTINFO	_IOWRN('i', 164, 0)
248 #define	SIOCGLIFCONF	_IOWRN('i', 165, 16)	/* get if list */
249 
250 /*
251  * Extended IOCTLS for manipulating ARP cache entries.
252  */
253 #define	SIOCSXARP	_IOW('i', 166, struct xarpreq)	/* set an ARP entry */
254 #define	SIOCGXARP	_IOWR('i', 167, struct xarpreq)	/* get an ARP entry */
255 #define	SIOCDXARP	_IOW('i', 168, struct xarpreq)	/* delete ARP entry */
256 
257 /*
258  * IOCTL private to sockfs.
259  */
260 #define	_SIOCSOCKFALLBACK _IOW('i', 169, 0)
261 
262 /*
263  * IOCTLs for getting and setting zone associated with an interface, and
264  * unplumbing interfaces associated with a given zone.
265  */
266 #define	SIOCGLIFZONE	_IOWR('i', 170, struct lifreq)	/* get zone id */
267 #define	SIOCSLIFZONE	_IOW('i', 171, struct lifreq)	/* set zone id */
268 
269 /*
270  * IOCTLS for handling SCTP options.
271  */
272 #define	SIOCSCTPSOPT	_IOWN('i', 172, 16)	/* Set SCTP option */
273 #define	SIOCSCTPGOPT	_IOWRN('i', 173, 16)	/* Get SCTP option */
274 #define	SIOCSCTPPEELOFF	_IOWR('i', 174, int)	/* SCTP peeloff */
275 
276 /*
277  * IOCTLs for getting and setting the source address that is used for packets
278  * going out on the given interface.
279  */
280 #define	SIOCGLIFUSESRC	_IOWR('i', 175, struct lifreq)	/* get src addr */
281 #define	SIOCSLIFUSESRC	_IOW('i', 176, struct lifreq)	/* set src addr */
282 
283 /*
284  * IOCTL used to get all the interfaces that use the the specified interfaces'
285  * source address
286  */
287 #define	SIOCGLIFSRCOF	_IOWRN('i', 177, 16)		/* source of */
288 
289 /*
290  * IOCTLs for source specific multicast; get or set a socket's
291  * source filter for a particular multicast group.  Argument is
292  * a struct group_filter.  Defined in RFC 3678.
293  */
294 #define	SIOCGMSFILTER	_IOWR('i', 178, 0)
295 #define	SIOCSMSFILTER	_IOW('i', 179, 0)
296 /*
297  * IPv4-specific versions of the above; get or set a socket's source
298  * filter for a particular multicast group, for PF_INET sockets only.
299  * Argument is a struct ip_msfilter.
300  */
301 #define	SIOCGIPMSFILTER	_IOWR('i', 180, 0)
302 #define	SIOCSIPMSFILTER	_IOW('i', 181, 0)
303 
304 /*
305  * 182 can be reused (was consolidation-private SIOCSIPMPFAILBACK).
306  */
307 
308 #define	SIOCSENABLESDP	_IOWR('i', 183, int)    /*  Enable SDP */
309 
310 #define	SIOCSQPTR	_IOWR('i', 184, int)    /* set q_ptr of stream */
311 
312 /*
313  * SIOCGIFHWADDR and SIOCGLIFHWADDR (below) are available for PF_PACKET,
314  * PF_INET and PF_INET6 sockets.
315  */
316 #define	SIOCGIFHWADDR	_IOWR('i', 185, struct ifreq)
317 
318 #define	SIOCGSTAMP	_IOWR('i', 186, struct timeval)	/* PF_PACKET */
319 
320 /*
321  * Private ioctl for Integrated Load Balancer.  The ioctl length varies.
322  */
323 #define	SIOCILB		_IOWR('i', 187, 0)
324 
325 /*
326  * IOCTL's to get/set module specific or interface specific properties.
327  * Argument is a struct mod_ioc_prop_s. These ioctls are Consolidation Private.
328  */
329 #define	SIOCGETPROP	_IOWRN('p', 188, 0)
330 #define	SIOCSETPROP	_IOW('p', 189, 0)
331 
332 /*
333  * IOCTL used to check for the given ipif, whether DAD is in progress or
334  * DAD has completed. This ioctl is Consolidation Private.
335  */
336 #define	SIOCGLIFDADSTATE	_IOWR('i', 190, struct lifreq)
337 
338 /*
339  * IOCTL used to generate an IPv6 address using the given prefix and the
340  * default token for the interface.
341  */
342 #define	SIOCSLIFPREFIX		_IOWR('i', 191, struct lifreq)
343 
344 #define	SIOCGLIFHWADDR	_IOWR('i', 192, struct lifreq)
345 
346 #ifdef	__cplusplus
347 }
348 #endif
349 
350 #endif	/* _SYS_SOCKIO_H */
351