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