17c478bd9Sstevel@tonic-gate /*
27c478bd9Sstevel@tonic-gate * CDDL HEADER START
37c478bd9Sstevel@tonic-gate *
47c478bd9Sstevel@tonic-gate * The contents of this file are subject to the terms of the
5f4b3ec61Sdh155122 * Common Development and Distribution License (the "License").
6f4b3ec61Sdh155122 * You may not use this file except in compliance with the License.
77c478bd9Sstevel@tonic-gate *
87c478bd9Sstevel@tonic-gate * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
97c478bd9Sstevel@tonic-gate * or http://www.opensolaris.org/os/licensing.
107c478bd9Sstevel@tonic-gate * See the License for the specific language governing permissions
117c478bd9Sstevel@tonic-gate * and limitations under the License.
127c478bd9Sstevel@tonic-gate *
137c478bd9Sstevel@tonic-gate * When distributing Covered Code, include this CDDL HEADER in each
147c478bd9Sstevel@tonic-gate * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
157c478bd9Sstevel@tonic-gate * If applicable, add the following below this CDDL HEADER, with the
167c478bd9Sstevel@tonic-gate * fields enclosed by brackets "[]" replaced with your own identifying
177c478bd9Sstevel@tonic-gate * information: Portions Copyright [yyyy] [name of copyright owner]
187c478bd9Sstevel@tonic-gate *
197c478bd9Sstevel@tonic-gate * CDDL HEADER END
207c478bd9Sstevel@tonic-gate */
217c478bd9Sstevel@tonic-gate /*
22*6f773e29SBaban Kenkre * Copyright (c) 1991, 2010, Oracle and/or its affiliates. All rights reserved.
237c478bd9Sstevel@tonic-gate */
247c478bd9Sstevel@tonic-gate /* Copyright (c) 1990 Mentat Inc. */
257c478bd9Sstevel@tonic-gate
267c478bd9Sstevel@tonic-gate /*
277c478bd9Sstevel@tonic-gate * This file contains common code for handling Options Management requests
287c478bd9Sstevel@tonic-gate * for SNMP/MIB.
297c478bd9Sstevel@tonic-gate */
307c478bd9Sstevel@tonic-gate
317c478bd9Sstevel@tonic-gate #include <sys/types.h>
327c478bd9Sstevel@tonic-gate #include <sys/stream.h>
337c478bd9Sstevel@tonic-gate #include <sys/stropts.h>
347c478bd9Sstevel@tonic-gate #include <sys/errno.h>
357c478bd9Sstevel@tonic-gate #define _SUN_TPI_VERSION 2
367c478bd9Sstevel@tonic-gate #include <sys/tihdr.h>
377c478bd9Sstevel@tonic-gate #include <sys/ddi.h>
387c478bd9Sstevel@tonic-gate #include <sys/cmn_err.h>
397c478bd9Sstevel@tonic-gate #include <sys/policy.h>
407c478bd9Sstevel@tonic-gate
417c478bd9Sstevel@tonic-gate #include <sys/socket.h>
427c478bd9Sstevel@tonic-gate #include <netinet/in.h>
437c478bd9Sstevel@tonic-gate
447c478bd9Sstevel@tonic-gate #include <inet/common.h>
457c478bd9Sstevel@tonic-gate #include <inet/mi.h>
467c478bd9Sstevel@tonic-gate #include <inet/mib2.h>
477c478bd9Sstevel@tonic-gate #include <inet/optcom.h>
487c478bd9Sstevel@tonic-gate #include <inet/snmpcom.h>
497c478bd9Sstevel@tonic-gate
50ff550d0eSmasputra #include <inet/ip.h>
51*6f773e29SBaban Kenkre #include <sys/brand.h>
52ff550d0eSmasputra
537c478bd9Sstevel@tonic-gate #define DEFAULT_LENGTH sizeof (long)
547c478bd9Sstevel@tonic-gate #define DATA_MBLK_SIZE 1024
557c478bd9Sstevel@tonic-gate #define TOAHDR_SIZE (sizeof (struct T_optmgmt_ack) +\
567c478bd9Sstevel@tonic-gate sizeof (struct opthdr))
577c478bd9Sstevel@tonic-gate
587c478bd9Sstevel@tonic-gate /* SNMP Option Request Structure */
597c478bd9Sstevel@tonic-gate typedef struct sor_s {
607c478bd9Sstevel@tonic-gate int sor_group;
617c478bd9Sstevel@tonic-gate int sor_code; /* MIB2 index value */
627c478bd9Sstevel@tonic-gate int sor_size;
637c478bd9Sstevel@tonic-gate } sor_t;
647c478bd9Sstevel@tonic-gate
657c478bd9Sstevel@tonic-gate /*
667c478bd9Sstevel@tonic-gate * Validation Table for set requests.
677c478bd9Sstevel@tonic-gate */
687c478bd9Sstevel@tonic-gate static sor_t req_arr[] = {
697c478bd9Sstevel@tonic-gate { MIB2_IP, 1, sizeof (int) },
707c478bd9Sstevel@tonic-gate { MIB2_IP, 2, sizeof (int) },
717c478bd9Sstevel@tonic-gate { MIB2_IP, 21, sizeof (mib2_ipRouteEntry_t) },
727c478bd9Sstevel@tonic-gate { MIB2_IP, 22, sizeof (mib2_ipNetToMediaEntry_t)},
737c478bd9Sstevel@tonic-gate { MIB2_TCP, 13, sizeof (mib2_tcpConnEntry_t) }
747c478bd9Sstevel@tonic-gate };
757c478bd9Sstevel@tonic-gate
767c478bd9Sstevel@tonic-gate /*
777c478bd9Sstevel@tonic-gate * Binary compatibility to what used to be T_CURRENT in older releases.
787c478bd9Sstevel@tonic-gate * Unfortunately, the binary chosen for it was different and used by
797c478bd9Sstevel@tonic-gate * T_PARTSUCCESS in the new name space. However T_PARTSUCESS is only
807c478bd9Sstevel@tonic-gate * anticiapted in new T_OPTMGM_REQ (and not O_T_OPTMGMT_REQ messages).
817c478bd9Sstevel@tonic-gate * Only a test for TBADFLAG which uses one of the MIB option levels
827c478bd9Sstevel@tonic-gate * may have trouble with this provision for binary compatibility.
837c478bd9Sstevel@tonic-gate */
847c478bd9Sstevel@tonic-gate #define OLD_T_CURRENT 0x100 /* same value as T_PARTSUCCESS */
857c478bd9Sstevel@tonic-gate
867c478bd9Sstevel@tonic-gate /*
877c478bd9Sstevel@tonic-gate * MIB info returned in data part of M_PROTO msg. All info for a single
887c478bd9Sstevel@tonic-gate * request is appended in a chain of mblk's off of the M_PROTO T_OPTMGMT_ACK
897c478bd9Sstevel@tonic-gate * ctl buffer.
907c478bd9Sstevel@tonic-gate */
917c478bd9Sstevel@tonic-gate int
snmp_append_data(mblk_t * mpdata,char * blob,int len)92ff550d0eSmasputra snmp_append_data(mblk_t *mpdata, char *blob, int len)
937c478bd9Sstevel@tonic-gate {
947c478bd9Sstevel@tonic-gate
957c478bd9Sstevel@tonic-gate if (!mpdata)
967c478bd9Sstevel@tonic-gate return (0);
977c478bd9Sstevel@tonic-gate while (mpdata->b_cont)
987c478bd9Sstevel@tonic-gate mpdata = mpdata->b_cont;
997c478bd9Sstevel@tonic-gate if (mpdata->b_wptr + len >= mpdata->b_datap->db_lim) {
1007c478bd9Sstevel@tonic-gate mpdata->b_cont = allocb(DATA_MBLK_SIZE, BPRI_HI);
1017c478bd9Sstevel@tonic-gate mpdata = mpdata->b_cont;
1027c478bd9Sstevel@tonic-gate if (!mpdata)
1037c478bd9Sstevel@tonic-gate return (0);
1047c478bd9Sstevel@tonic-gate }
1057c478bd9Sstevel@tonic-gate bcopy(blob, (char *)mpdata->b_wptr, len);
1067c478bd9Sstevel@tonic-gate mpdata->b_wptr += len;
1077c478bd9Sstevel@tonic-gate return (1);
1087c478bd9Sstevel@tonic-gate }
1097c478bd9Sstevel@tonic-gate
1107c478bd9Sstevel@tonic-gate /*
1117c478bd9Sstevel@tonic-gate * Need a form which avoids O(n^2) behavior locating the end of the
1127c478bd9Sstevel@tonic-gate * chain every time. This is it.
1137c478bd9Sstevel@tonic-gate */
1147c478bd9Sstevel@tonic-gate int
snmp_append_data2(mblk_t * mpdata,mblk_t ** last_mpp,char * blob,int len)1157c478bd9Sstevel@tonic-gate snmp_append_data2(mblk_t *mpdata, mblk_t **last_mpp, char *blob, int len)
1167c478bd9Sstevel@tonic-gate {
1177c478bd9Sstevel@tonic-gate
1187c478bd9Sstevel@tonic-gate if (!mpdata)
1197c478bd9Sstevel@tonic-gate return (0);
1207c478bd9Sstevel@tonic-gate if (*last_mpp == NULL) {
1217c478bd9Sstevel@tonic-gate while (mpdata->b_cont)
1227c478bd9Sstevel@tonic-gate mpdata = mpdata->b_cont;
1237c478bd9Sstevel@tonic-gate *last_mpp = mpdata;
1247c478bd9Sstevel@tonic-gate }
1257c478bd9Sstevel@tonic-gate if ((*last_mpp)->b_wptr + len >= (*last_mpp)->b_datap->db_lim) {
1267c478bd9Sstevel@tonic-gate (*last_mpp)->b_cont = allocb(DATA_MBLK_SIZE, BPRI_HI);
1277c478bd9Sstevel@tonic-gate *last_mpp = (*last_mpp)->b_cont;
1287c478bd9Sstevel@tonic-gate if (!*last_mpp)
1297c478bd9Sstevel@tonic-gate return (0);
1307c478bd9Sstevel@tonic-gate }
1317c478bd9Sstevel@tonic-gate bcopy(blob, (char *)(*last_mpp)->b_wptr, len);
1327c478bd9Sstevel@tonic-gate (*last_mpp)->b_wptr += len;
1337c478bd9Sstevel@tonic-gate return (1);
1347c478bd9Sstevel@tonic-gate }
1357c478bd9Sstevel@tonic-gate
1367c478bd9Sstevel@tonic-gate /*
1377c478bd9Sstevel@tonic-gate * SNMP requests are issued using putmsg() on a stream containing all
1387c478bd9Sstevel@tonic-gate * relevant modules. The ctl part contains a O_T_OPTMGMT_REQ message,
1397c478bd9Sstevel@tonic-gate * and the data part is NULL
1407c478bd9Sstevel@tonic-gate * to process this msg. If snmpcom_req() returns FALSE, then the module
1417c478bd9Sstevel@tonic-gate * will try optcom_req to see if its some sort of SOCKET or IP option.
1427c478bd9Sstevel@tonic-gate * snmpcom_req returns TRUE whenever the first option is recognized as
1437c478bd9Sstevel@tonic-gate * an SNMP request, even if a bad one.
1447c478bd9Sstevel@tonic-gate *
1457c478bd9Sstevel@tonic-gate * "get" is done by a single O_T_OPTMGMT_REQ with MGMT_flags set to T_CURRENT.
1467c478bd9Sstevel@tonic-gate * All modules respond with one or msg's about what they know. Responses
1477c478bd9Sstevel@tonic-gate * are in T_OPTMGMT_ACK format. The opthdr level/name fields identify what
1487c478bd9Sstevel@tonic-gate * is begin returned, the len field how big it is (in bytes). The info
1497c478bd9Sstevel@tonic-gate * itself is in the data portion of the msg. Fixed length info returned
1507c478bd9Sstevel@tonic-gate * in one msg; each table in a separate msg.
1517c478bd9Sstevel@tonic-gate *
1527c478bd9Sstevel@tonic-gate * setfn() returns 1 if things ok, 0 if set request invalid or otherwise
1537c478bd9Sstevel@tonic-gate * messed up.
1547c478bd9Sstevel@tonic-gate *
1557c478bd9Sstevel@tonic-gate * If the passed q is at the bottom of the module chain (q_next == NULL,
1567c478bd9Sstevel@tonic-gate * a ctl msg with req->name, level, len all zero is sent upstream. This
1577c478bd9Sstevel@tonic-gate * is and EOD flag to the caller.
1587c478bd9Sstevel@tonic-gate *
1597c478bd9Sstevel@tonic-gate * IMPORTANT:
1607c478bd9Sstevel@tonic-gate * - The msg type is M_PROTO, not M_PCPROTO!!! This is by design,
1617c478bd9Sstevel@tonic-gate * since multiple messages will be sent to stream head and we want
1627c478bd9Sstevel@tonic-gate * them queued for reading, not discarded.
1637c478bd9Sstevel@tonic-gate * - All requests which match a table entry are sent to all get/set functions
1647c478bd9Sstevel@tonic-gate * of each module. The functions must simply ignore requests not meant
1657c478bd9Sstevel@tonic-gate * for them: getfn() returns 0, setfn() returns 1.
1667c478bd9Sstevel@tonic-gate */
1677c478bd9Sstevel@tonic-gate boolean_t
snmpcom_req(queue_t * q,mblk_t * mp,pfi_t setfn,pfi_t getfn,cred_t * credp)168ff550d0eSmasputra snmpcom_req(queue_t *q, mblk_t *mp, pfi_t setfn, pfi_t getfn, cred_t *credp)
1697c478bd9Sstevel@tonic-gate {
1707c478bd9Sstevel@tonic-gate mblk_t *mpctl;
1717c478bd9Sstevel@tonic-gate struct opthdr *req;
1727c478bd9Sstevel@tonic-gate struct opthdr *next_req;
1737c478bd9Sstevel@tonic-gate struct opthdr *req_end;
1747c478bd9Sstevel@tonic-gate struct opthdr *req_start;
1757c478bd9Sstevel@tonic-gate sor_t *sreq;
1767c478bd9Sstevel@tonic-gate struct T_optmgmt_req *tor = (struct T_optmgmt_req *)mp->b_rptr;
1777c478bd9Sstevel@tonic-gate struct T_optmgmt_ack *toa;
178*6f773e29SBaban Kenkre boolean_t legacy_req;
1797c478bd9Sstevel@tonic-gate
1807c478bd9Sstevel@tonic-gate if (mp->b_cont) { /* don't deal with multiple mblk's */
1817c478bd9Sstevel@tonic-gate freemsg(mp->b_cont);
1827c478bd9Sstevel@tonic-gate mp->b_cont = (mblk_t *)0;
1837c478bd9Sstevel@tonic-gate optcom_err_ack(q, mp, TSYSERR, EBADMSG);
1847c478bd9Sstevel@tonic-gate return (B_TRUE);
1857c478bd9Sstevel@tonic-gate }
1867c478bd9Sstevel@tonic-gate if ((mp->b_wptr - mp->b_rptr) < sizeof (struct T_optmgmt_req) ||
1877c478bd9Sstevel@tonic-gate !(req_start = (struct opthdr *)mi_offset_param(mp,
1887c478bd9Sstevel@tonic-gate tor->OPT_offset, tor->OPT_length)))
1897c478bd9Sstevel@tonic-gate goto bad_req1;
1907c478bd9Sstevel@tonic-gate if (! __TPI_OPT_ISALIGNED(req_start))
1917c478bd9Sstevel@tonic-gate goto bad_req1;
1927c478bd9Sstevel@tonic-gate
1937c478bd9Sstevel@tonic-gate /*
1947c478bd9Sstevel@tonic-gate * if first option not in the MIB2 or EXPER range, return false so
1957c478bd9Sstevel@tonic-gate * optcom_req can scope things out. Otherwise it's passed to each
1967c478bd9Sstevel@tonic-gate * calling module to process or ignore as it sees fit.
1977c478bd9Sstevel@tonic-gate */
1987c478bd9Sstevel@tonic-gate if ((!(req_start->level >= MIB2_RANGE_START &&
1997c478bd9Sstevel@tonic-gate req_start->level <= MIB2_RANGE_END)) &&
2007c478bd9Sstevel@tonic-gate (!(req_start->level >= EXPER_RANGE_START &&
2017c478bd9Sstevel@tonic-gate req_start->level <= EXPER_RANGE_END)))
2027c478bd9Sstevel@tonic-gate return (B_FALSE);
2037c478bd9Sstevel@tonic-gate
2047c478bd9Sstevel@tonic-gate switch (tor->MGMT_flags) {
2057c478bd9Sstevel@tonic-gate
2067c478bd9Sstevel@tonic-gate case T_NEGOTIATE:
207f4b3ec61Sdh155122 if (secpolicy_ip_config(credp, B_FALSE) != 0) {
2087c478bd9Sstevel@tonic-gate optcom_err_ack(q, mp, TACCES, 0);
2097c478bd9Sstevel@tonic-gate return (B_TRUE);
2107c478bd9Sstevel@tonic-gate }
2117c478bd9Sstevel@tonic-gate req_end = (struct opthdr *)((uchar_t *)req_start +
2127c478bd9Sstevel@tonic-gate tor->OPT_length);
2137c478bd9Sstevel@tonic-gate for (req = req_start; req < req_end; req = next_req) {
2147c478bd9Sstevel@tonic-gate next_req =
2157c478bd9Sstevel@tonic-gate (struct opthdr *)((uchar_t *)&req[1] +
2167c478bd9Sstevel@tonic-gate _TPI_ALIGN_OPT(req->len));
2177c478bd9Sstevel@tonic-gate if (next_req > req_end)
2187c478bd9Sstevel@tonic-gate goto bad_req2;
2197c478bd9Sstevel@tonic-gate for (sreq = req_arr; sreq < A_END(req_arr); sreq++) {
2207c478bd9Sstevel@tonic-gate if (req->level == sreq->sor_group &&
2217c478bd9Sstevel@tonic-gate req->name == sreq->sor_code)
2227c478bd9Sstevel@tonic-gate break;
2237c478bd9Sstevel@tonic-gate }
2247c478bd9Sstevel@tonic-gate if (sreq >= A_END(req_arr))
2257c478bd9Sstevel@tonic-gate goto bad_req3;
2267c478bd9Sstevel@tonic-gate if (!(*setfn)(q, req->level, req->name,
2277c478bd9Sstevel@tonic-gate (uchar_t *)&req[1], req->len))
2287c478bd9Sstevel@tonic-gate goto bad_req4;
2297c478bd9Sstevel@tonic-gate }
230ff550d0eSmasputra if (q->q_next != NULL)
2317c478bd9Sstevel@tonic-gate putnext(q, mp);
2327c478bd9Sstevel@tonic-gate else
2337c478bd9Sstevel@tonic-gate freemsg(mp);
2347c478bd9Sstevel@tonic-gate return (B_TRUE);
2357c478bd9Sstevel@tonic-gate
2367c478bd9Sstevel@tonic-gate case OLD_T_CURRENT:
2377c478bd9Sstevel@tonic-gate case T_CURRENT:
2387c478bd9Sstevel@tonic-gate mpctl = allocb(TOAHDR_SIZE, BPRI_MED);
2397c478bd9Sstevel@tonic-gate if (!mpctl) {
2407c478bd9Sstevel@tonic-gate optcom_err_ack(q, mp, TSYSERR, ENOMEM);
2417c478bd9Sstevel@tonic-gate return (B_TRUE);
2427c478bd9Sstevel@tonic-gate }
2437c478bd9Sstevel@tonic-gate mpctl->b_cont = allocb(DATA_MBLK_SIZE, BPRI_MED);
2447c478bd9Sstevel@tonic-gate if (!mpctl->b_cont) {
2457c478bd9Sstevel@tonic-gate freemsg(mpctl);
2467c478bd9Sstevel@tonic-gate optcom_err_ack(q, mp, TSYSERR, ENOMEM);
2477c478bd9Sstevel@tonic-gate return (B_TRUE);
2487c478bd9Sstevel@tonic-gate }
2497c478bd9Sstevel@tonic-gate mpctl->b_datap->db_type = M_PROTO;
2507c478bd9Sstevel@tonic-gate mpctl->b_wptr += TOAHDR_SIZE;
2517c478bd9Sstevel@tonic-gate toa = (struct T_optmgmt_ack *)mpctl->b_rptr;
2527c478bd9Sstevel@tonic-gate toa->PRIM_type = T_OPTMGMT_ACK;
2537c478bd9Sstevel@tonic-gate toa->OPT_offset = sizeof (struct T_optmgmt_ack);
2547c478bd9Sstevel@tonic-gate toa->OPT_length = sizeof (struct opthdr);
2557c478bd9Sstevel@tonic-gate toa->MGMT_flags = T_SUCCESS;
256*6f773e29SBaban Kenkre /*
257*6f773e29SBaban Kenkre * If the current process is running inside a solaris10-
258*6f773e29SBaban Kenkre * branded zone and len is 0 then it's a request for
259*6f773e29SBaban Kenkre * legacy data.
260*6f773e29SBaban Kenkre */
261*6f773e29SBaban Kenkre if (PROC_IS_BRANDED(curproc) &&
262*6f773e29SBaban Kenkre (strcmp(curproc->p_brand->b_name, "solaris10") == 0) &&
263*6f773e29SBaban Kenkre (req_start->len == 0))
264*6f773e29SBaban Kenkre legacy_req = B_TRUE;
265*6f773e29SBaban Kenkre else
266*6f773e29SBaban Kenkre legacy_req = B_FALSE;
267*6f773e29SBaban Kenkre if (!(*getfn)(q, mpctl, req_start->level, legacy_req))
2687c478bd9Sstevel@tonic-gate freemsg(mpctl);
2697c478bd9Sstevel@tonic-gate /*
2707c478bd9Sstevel@tonic-gate * all data for this module has now been sent upstream. If
2717c478bd9Sstevel@tonic-gate * this is bottom module of stream, send up an EOD ctl msg,
2727c478bd9Sstevel@tonic-gate * otherwise pass onto the next guy for processing.
2737c478bd9Sstevel@tonic-gate */
274ff550d0eSmasputra if (q->q_next != NULL) {
2757c478bd9Sstevel@tonic-gate putnext(q, mp);
2767c478bd9Sstevel@tonic-gate return (B_TRUE);
2777c478bd9Sstevel@tonic-gate }
2787c478bd9Sstevel@tonic-gate if (mp->b_cont) {
2797c478bd9Sstevel@tonic-gate freemsg(mp->b_cont);
2807c478bd9Sstevel@tonic-gate mp->b_cont = NULL;
2817c478bd9Sstevel@tonic-gate }
2827c478bd9Sstevel@tonic-gate mpctl = reallocb(mp, TOAHDR_SIZE, 1);
2837c478bd9Sstevel@tonic-gate if (!mpctl) {
2847c478bd9Sstevel@tonic-gate optcom_err_ack(q, mp, TSYSERR, ENOMEM);
2857c478bd9Sstevel@tonic-gate return (B_TRUE);
2867c478bd9Sstevel@tonic-gate }
2877c478bd9Sstevel@tonic-gate mpctl->b_datap->db_type = M_PROTO;
2887c478bd9Sstevel@tonic-gate mpctl->b_wptr = mpctl->b_rptr + TOAHDR_SIZE;
2897c478bd9Sstevel@tonic-gate toa = (struct T_optmgmt_ack *)mpctl->b_rptr;
2907c478bd9Sstevel@tonic-gate toa->PRIM_type = T_OPTMGMT_ACK;
2917c478bd9Sstevel@tonic-gate toa->OPT_offset = sizeof (struct T_optmgmt_ack);
2927c478bd9Sstevel@tonic-gate toa->OPT_length = sizeof (struct opthdr);
2937c478bd9Sstevel@tonic-gate toa->MGMT_flags = T_SUCCESS;
2947c478bd9Sstevel@tonic-gate req = (struct opthdr *)&toa[1];
2957c478bd9Sstevel@tonic-gate req->level = 0;
2967c478bd9Sstevel@tonic-gate req->name = 0;
2977c478bd9Sstevel@tonic-gate req->len = 0;
2987c478bd9Sstevel@tonic-gate qreply(q, mpctl);
2997c478bd9Sstevel@tonic-gate return (B_TRUE);
3007c478bd9Sstevel@tonic-gate
3017c478bd9Sstevel@tonic-gate default:
3027c478bd9Sstevel@tonic-gate optcom_err_ack(q, mp, TBADFLAG, 0);
3037c478bd9Sstevel@tonic-gate return (B_TRUE);
3047c478bd9Sstevel@tonic-gate }
3057c478bd9Sstevel@tonic-gate
3067c478bd9Sstevel@tonic-gate bad_req1:;
3077c478bd9Sstevel@tonic-gate printf("snmpcom bad_req1\n");
3087c478bd9Sstevel@tonic-gate goto bad_req;
3097c478bd9Sstevel@tonic-gate bad_req2:;
3107c478bd9Sstevel@tonic-gate printf("snmpcom bad_req2\n");
3117c478bd9Sstevel@tonic-gate goto bad_req;
3127c478bd9Sstevel@tonic-gate bad_req3:;
3137c478bd9Sstevel@tonic-gate printf("snmpcom bad_req3\n");
3147c478bd9Sstevel@tonic-gate goto bad_req;
3157c478bd9Sstevel@tonic-gate bad_req4:;
3167c478bd9Sstevel@tonic-gate printf("snmpcom bad_req4\n");
3177c478bd9Sstevel@tonic-gate /* FALLTHRU */
3187c478bd9Sstevel@tonic-gate bad_req:;
3197c478bd9Sstevel@tonic-gate optcom_err_ack(q, mp, TBADOPT, 0);
3207c478bd9Sstevel@tonic-gate return (B_TRUE);
3217c478bd9Sstevel@tonic-gate
3227c478bd9Sstevel@tonic-gate }
323