From owner-svn-src-projects@freebsd.org Mon Jan 9 05:26:02 2017 Return-Path: Delivered-To: svn-src-projects@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 3F3AECA6ED8 for ; Mon, 9 Jan 2017 05:26:02 +0000 (UTC) (envelope-from ngie@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id E6A86110B; Mon, 9 Jan 2017 05:26:01 +0000 (UTC) (envelope-from ngie@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id v095Q1fK091517; Mon, 9 Jan 2017 05:26:01 GMT (envelope-from ngie@FreeBSD.org) Received: (from ngie@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id v095Q1tP091516; Mon, 9 Jan 2017 05:26:01 GMT (envelope-from ngie@FreeBSD.org) Message-Id: <201701090526.v095Q1tP091516@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: ngie set sender to ngie@FreeBSD.org using -f From: Ngie Cooper Date: Mon, 9 Jan 2017 05:26:01 +0000 (UTC) To: src-committers@freebsd.org, svn-src-projects@freebsd.org Subject: svn commit: r311745 - projects/bsnmp-ipv6-mib/usr.sbin/bsnmpd/modules/snmp_ipv6 X-SVN-Group: projects MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-projects@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: "SVN commit messages for the src " projects" tree" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 09 Jan 2017 05:26:02 -0000 Author: ngie Date: Mon Jan 9 05:26:00 2017 New Revision: 311745 URL: https://svnweb.freebsd.org/changeset/base/311745 Log: Stash more minor work-in-progress bits (deleting braces, added `which` for consistency with other modules, adding XXX comments, etc). Modified: projects/bsnmp-ipv6-mib/usr.sbin/bsnmpd/modules/snmp_ipv6/ipv6.c Modified: projects/bsnmp-ipv6-mib/usr.sbin/bsnmpd/modules/snmp_ipv6/ipv6.c ============================================================================== --- projects/bsnmp-ipv6-mib/usr.sbin/bsnmpd/modules/snmp_ipv6/ipv6.c Mon Jan 9 04:35:55 2017 (r311744) +++ projects/bsnmp-ipv6-mib/usr.sbin/bsnmpd/modules/snmp_ipv6/ipv6.c Mon Jan 9 05:26:00 2017 (r311745) @@ -52,8 +52,12 @@ op_ipv6MIBObjects(struct snmp_context *c { const char *namestr = NULL; int name[] = { CTL_NET, PF_INET6, IPPROTO_IPV6, 0 }; - int result = 0; - size_t resultsiz = sizeof(result); + asn_subid_t which; + size_t resultsz; + int result; + + result = 0; + resultsz = sizeof(result); switch (op) { case SNMP_OP_GETNEXT: @@ -66,11 +70,13 @@ op_ipv6MIBObjects(struct snmp_context *c return (SNMP_ERR_NOERROR); } - switch (value->var.subs[sub - 1]) { + which = value->var.subs[sub - 1]; + + switch (which) { case LEAF_ipv6Forwarding: name[3] = IPV6CTL_FORWARDING; namestr = "IPV6CTL_FORWARDING"; - if (sysctl(name, nitems(name), &result, &resultsiz, NULL, + if (sysctl(name, nitems(name), &result, &resultsz, NULL, 0) < 0) return (SNMP_ERR_GENERR); if (result == 0) @@ -81,13 +87,12 @@ op_ipv6MIBObjects(struct snmp_context *c case LEAF_ipv6DefaultHopLimit: name[3] = IPV6CTL_DEFHLIM; namestr = "IPV6CTL_DEFHLIM"; - if (sysctl(name, nitems(name), &result, &resultsiz, NULL, + if (sysctl(name, nitems(name), &result, &resultsz, NULL, 0) < 0) return (SNMP_ERR_GENERR); value->v.integer = result; break; case LEAF_ipv6IfTableLastChange: - { mib_ipv6_refresh_interfaces(); if (mib_ipv6_ipv6IfTableLastChange > start_tick) value->v.uint32 = @@ -95,7 +100,6 @@ op_ipv6MIBObjects(struct snmp_context *c else value->v.uint32 = 0; break; - } case LEAF_ipv6Interfaces: mib_ipv6_refresh_interfaces(); value->v.integer = mib_ipv6_ipv6Interfaces; @@ -103,6 +107,7 @@ op_ipv6MIBObjects(struct snmp_context *c default: return (SNMP_ERR_NOSUCHNAME); } + return (SNMP_ERR_NOERROR); }