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) 1991, 2010, Oracle and/or its affiliates. All rights reserved.
23 * Copyright (c) 1990 Mentat Inc.
24 * Copyright (c) 2013 by Delphix. All rights reserved.
25 */
26
27 /*
28 * This file contains the interface control functions for IP.
29 */
30
31 #include <sys/types.h>
32 #include <sys/stream.h>
33 #include <sys/dlpi.h>
34 #include <sys/stropts.h>
35 #include <sys/strsun.h>
36 #include <sys/sysmacros.h>
37 #include <sys/strsubr.h>
38 #include <sys/strlog.h>
39 #include <sys/ddi.h>
40 #include <sys/sunddi.h>
41 #include <sys/cmn_err.h>
42 #include <sys/kstat.h>
43 #include <sys/debug.h>
44 #include <sys/zone.h>
9172 if (CONN_Q(q)) {
9173 CONN_INC_REF(Q_TO_CONN(q));
9174 CONN_INC_IOCTLREF(Q_TO_CONN(q))
9175 }
9176 ip_sioctl_plink(NULL, q, mp, NULL);
9177 return;
9178
9179 case IP_IOCTL:
9180 ip_wput_ioctl(q, mp);
9181 return;
9182
9183 case SIOCILB:
9184 /* The ioctl length varies depending on the ILB command. */
9185 copyin_size = iocp->ioc_count;
9186 if (copyin_size < sizeof (ilb_cmd_t))
9187 goto nak;
9188 mi_copyin(q, mp, NULL, copyin_size);
9189 return;
9190
9191 default:
9192 cmn_err(CE_PANIC, "should not happen ");
9193 }
9194 nak:
9195 if (mp->b_cont != NULL) {
9196 freemsg(mp->b_cont);
9197 mp->b_cont = NULL;
9198 }
9199 iocp->ioc_error = EINVAL;
9200 mp->b_datap->db_type = M_IOCNAK;
9201 iocp->ioc_count = 0;
9202 qreply(q, mp);
9203 }
9204
9205 static void
9206 ip_sioctl_garp_reply(mblk_t *mp, ill_t *ill, void *hwaddr, int flags)
9207 {
9208 struct arpreq *ar;
9209 struct xarpreq *xar;
9210 mblk_t *tmp;
9211 struct iocblk *iocp;
9212 int x_arp_ioctl = B_FALSE;
|
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) 1991, 2010, Oracle and/or its affiliates. All rights reserved.
23 * Copyright (c) 1990 Mentat Inc.
24 * Copyright (c) 2013 by Delphix. All rights reserved.
25 * Copyright (c) 2014, OmniTI Computer Consulting, Inc. All rights reserved.
26 */
27
28 /*
29 * This file contains the interface control functions for IP.
30 */
31
32 #include <sys/types.h>
33 #include <sys/stream.h>
34 #include <sys/dlpi.h>
35 #include <sys/stropts.h>
36 #include <sys/strsun.h>
37 #include <sys/sysmacros.h>
38 #include <sys/strsubr.h>
39 #include <sys/strlog.h>
40 #include <sys/ddi.h>
41 #include <sys/sunddi.h>
42 #include <sys/cmn_err.h>
43 #include <sys/kstat.h>
44 #include <sys/debug.h>
45 #include <sys/zone.h>
9173 if (CONN_Q(q)) {
9174 CONN_INC_REF(Q_TO_CONN(q));
9175 CONN_INC_IOCTLREF(Q_TO_CONN(q))
9176 }
9177 ip_sioctl_plink(NULL, q, mp, NULL);
9178 return;
9179
9180 case IP_IOCTL:
9181 ip_wput_ioctl(q, mp);
9182 return;
9183
9184 case SIOCILB:
9185 /* The ioctl length varies depending on the ILB command. */
9186 copyin_size = iocp->ioc_count;
9187 if (copyin_size < sizeof (ilb_cmd_t))
9188 goto nak;
9189 mi_copyin(q, mp, NULL, copyin_size);
9190 return;
9191
9192 default:
9193 cmn_err(CE_WARN, "Unknown ioctl %d/0x%x slipped through.",
9194 iocp->ioc_cmd, iocp->ioc_cmd);
9195 /* FALLTHRU */
9196 }
9197 nak:
9198 if (mp->b_cont != NULL) {
9199 freemsg(mp->b_cont);
9200 mp->b_cont = NULL;
9201 }
9202 iocp->ioc_error = EINVAL;
9203 mp->b_datap->db_type = M_IOCNAK;
9204 iocp->ioc_count = 0;
9205 qreply(q, mp);
9206 }
9207
9208 static void
9209 ip_sioctl_garp_reply(mblk_t *mp, ill_t *ill, void *hwaddr, int flags)
9210 {
9211 struct arpreq *ar;
9212 struct xarpreq *xar;
9213 mblk_t *tmp;
9214 struct iocblk *iocp;
9215 int x_arp_ioctl = B_FALSE;
|