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