Date: Fri, 6 Jan 2017 07:53:50 +0000 (UTC) From: Ngie Cooper <ngie@FreeBSD.org> To: src-committers@freebsd.org, svn-src-projects@freebsd.org Subject: svn commit: r311502 - projects/bsnmp-ipv6-mib/usr.sbin/bsnmpd/modules/snmp_ipv6 Message-ID: <201701060753.v067roof055341@repo.freebsd.org>
next in thread | raw e-mail | index | archive | help
Author: ngie Date: Fri Jan 6 07:53:50 2017 New Revision: 311502 URL: https://svnweb.freebsd.org/changeset/base/311502 Log: Fill in the OID state machine stubs Modified: projects/bsnmp-ipv6-mib/usr.sbin/bsnmpd/modules/snmp_ipv6/ipv6.c projects/bsnmp-ipv6-mib/usr.sbin/bsnmpd/modules/snmp_ipv6/ipv6_addrPrefixTable.c projects/bsnmp-ipv6-mib/usr.sbin/bsnmpd/modules/snmp_ipv6/ipv6_addrTable.c projects/bsnmp-ipv6-mib/usr.sbin/bsnmpd/modules/snmp_ipv6/ipv6_ifStatsTable.c projects/bsnmp-ipv6-mib/usr.sbin/bsnmpd/modules/snmp_ipv6/ipv6_ifTable.c projects/bsnmp-ipv6-mib/usr.sbin/bsnmpd/modules/snmp_ipv6/ipv6_netToMediaTable.c projects/bsnmp-ipv6-mib/usr.sbin/bsnmpd/modules/snmp_ipv6/ipv6_routeTable.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 Fri Jan 6 07:53:07 2017 (r311501) +++ projects/bsnmp-ipv6-mib/usr.sbin/bsnmpd/modules/snmp_ipv6/ipv6.c Fri Jan 6 07:53:50 2017 (r311502) @@ -42,8 +42,8 @@ static const struct asn_oid oid_ipv6MIB static u_int ipv6_reg; int -op_ipv6MIBObjects(struct snmp_context *ctx, struct snmp_value *value, - u_int sub, u_int iidx, enum snmp_op op) +op_ipv6MIBObjects(struct snmp_context *ctx __unused, struct snmp_value *value, + u_int sub, u_int iidx __unused, enum snmp_op op) { const char *namestr = NULL; int name[] = { CTL_NET, PF_INET6, IPPROTO_IPV6, 0 }; @@ -55,7 +55,6 @@ op_ipv6MIBObjects(struct snmp_context *c case SNMP_OP_GET: break; case SNMP_OP_SET: - /* XXX (ngie): this is a lie. It's not implemented. */ return (SNMP_ERR_NOT_WRITEABLE); case SNMP_OP_ROLLBACK: case SNMP_OP_COMMIT: Modified: projects/bsnmp-ipv6-mib/usr.sbin/bsnmpd/modules/snmp_ipv6/ipv6_addrPrefixTable.c ============================================================================== --- projects/bsnmp-ipv6-mib/usr.sbin/bsnmpd/modules/snmp_ipv6/ipv6_addrPrefixTable.c Fri Jan 6 07:53:07 2017 (r311501) +++ projects/bsnmp-ipv6-mib/usr.sbin/bsnmpd/modules/snmp_ipv6/ipv6_addrPrefixTable.c Fri Jan 6 07:53:50 2017 (r311502) @@ -35,9 +35,34 @@ __FBSDID("$FreeBSD$"); #include "ipv6_addrPrefixTable.h" int -op_ipv6AddrPrefixTable(struct snmp_context *ctx, struct snmp_value *value, - u_int sub, u_int iidx, enum snmp_op op) +op_ipv6AddrPrefixTable(struct snmp_context *ctx __unused, + struct snmp_value *value, u_int sub, u_int iidx __unused, enum snmp_op op) { + asn_subid_t which; - return (SNMP_ERR_NOSUCHNAME); + switch (op) { + case SNMP_OP_GETNEXT: + case SNMP_OP_GET: + break; + case SNMP_OP_SET: + return (SNMP_ERR_NOT_WRITEABLE); + case SNMP_OP_ROLLBACK: + case SNMP_OP_COMMIT: + return (SNMP_ERR_NOERROR); + } + + which = value->var.subs[sub - 1]; + + switch (which) { + case LEAF_ipv6AddrPrefix: + case LEAF_ipv6AddrPrefixLength: + case LEAF_ipv6AddrPrefixOnLinkFlag: + case LEAF_ipv6AddrPrefixAutonomousFlag: + case LEAF_ipv6AddrPrefixAdvPreferredLifetime: + case LEAF_ipv6AddrPrefixPrefixAdvValidLifetime: + default: + return (SNMP_ERR_RES_UNAVAIL); + } + + return (SNMP_ERR_NOERROR); } Modified: projects/bsnmp-ipv6-mib/usr.sbin/bsnmpd/modules/snmp_ipv6/ipv6_addrTable.c ============================================================================== --- projects/bsnmp-ipv6-mib/usr.sbin/bsnmpd/modules/snmp_ipv6/ipv6_addrTable.c Fri Jan 6 07:53:07 2017 (r311501) +++ projects/bsnmp-ipv6-mib/usr.sbin/bsnmpd/modules/snmp_ipv6/ipv6_addrTable.c Fri Jan 6 07:53:50 2017 (r311502) @@ -34,9 +34,33 @@ __FBSDID("$FreeBSD$"); #include "ipv6_addrTable.h" int -op_ipv6AddrTable(struct snmp_context *ctx, struct snmp_value *value, - u_int sub, u_int iidx, enum snmp_op op) +op_ipv6AddrTable(struct snmp_context *ctx __unused, struct snmp_value *value, + u_int sub, u_int iidx __unused, enum snmp_op op) { + asn_subid_t which; - return (SNMP_ERR_NOSUCHNAME); + switch (op) { + case SNMP_OP_GETNEXT: + case SNMP_OP_GET: + break; + case SNMP_OP_SET: + return (SNMP_ERR_NOT_WRITEABLE); + case SNMP_OP_ROLLBACK: + case SNMP_OP_COMMIT: + return (SNMP_ERR_NOERROR); + } + + which = value->var.subs[sub - 1]; + + switch (which) { + case LEAF_ipv6AddrAddress: + case LEAF_ipv6AddrPfxLength: + case LEAF_ipv6AddrType: + case LEAF_ipv6AddrAnycastFlag: + case LEAF_ipv6AddrStatus: + default: + return (SNMP_ERR_RES_UNAVAIL); + } + + return (SNMP_ERR_NOERROR); } Modified: projects/bsnmp-ipv6-mib/usr.sbin/bsnmpd/modules/snmp_ipv6/ipv6_ifStatsTable.c ============================================================================== --- projects/bsnmp-ipv6-mib/usr.sbin/bsnmpd/modules/snmp_ipv6/ipv6_ifStatsTable.c Fri Jan 6 07:53:07 2017 (r311501) +++ projects/bsnmp-ipv6-mib/usr.sbin/bsnmpd/modules/snmp_ipv6/ipv6_ifStatsTable.c Fri Jan 6 07:53:50 2017 (r311502) @@ -34,10 +34,48 @@ __FBSDID("$FreeBSD$"); #include "ipv6.h" int -op_ipv6IfStatsTable(struct snmp_context *ctx, struct snmp_value *value, - u_int sub, u_int iidx, enum snmp_op op) +op_ipv6IfStatsTable(struct snmp_context *ctx __unused, struct snmp_value *value, + u_int sub, u_int iidx __unused, enum snmp_op op) { + asn_subid_t which; - /* Not yet implemented */ - return (SNMP_ERR_NOSUCHNAME); + switch (op) { + case SNMP_OP_GETNEXT: + case SNMP_OP_GET: + break; + case SNMP_OP_SET: + return (SNMP_ERR_NOT_WRITEABLE); + case SNMP_OP_ROLLBACK: + case SNMP_OP_COMMIT: + return (SNMP_ERR_NOERROR); + } + + which = value->var.subs[sub - 1]; + + switch (which) { + case LEAF_ipv6IfStatsInReceives: + case LEAF_ipv6IfStatsInHdrErrors: + case LEAF_ipv6IfStatsInTooBigErrors: + case LEAF_ipv6IfStatsInNoRoutes: + case LEAF_ipv6IfStatsInAddrErrors: + case LEAF_ipv6IfStatsInUnknownProtos: + case LEAF_ipv6IfStatsInTruncatedPkts: + case LEAF_ipv6IfStatsInDiscards: + case LEAF_ipv6IfStatsInDelievers: + case LEAF_ipv6IfStatsOutForwDatagrams: + case LEAF_ipv6IfStatsOutRequests: + case LEAF_ipv6IfStatsOutDiscards: + case LEAF_ipv6IfStatsOutFragOKs: + case LEAF_ipv6IfStatsOutFragFails: + case LEAF_ipv6IfStatsOutFragCreates: + case LEAF_ipv6IfStatsReasmReqds: + case LEAF_ipv6IfStatsReasmOKs: + case LEAF_ipv6IfStatsReasmFails: + case LEAF_ipv6IfStatsInMcastPkts: + case LEAF_ipv6IfStatsOutMcastPkts: + default: + return (SNMP_ERR_RES_UNAVAIL); + } + + return (SNMP_ERR_NOERROR); } Modified: projects/bsnmp-ipv6-mib/usr.sbin/bsnmpd/modules/snmp_ipv6/ipv6_ifTable.c ============================================================================== --- projects/bsnmp-ipv6-mib/usr.sbin/bsnmpd/modules/snmp_ipv6/ipv6_ifTable.c Fri Jan 6 07:53:07 2017 (r311501) +++ projects/bsnmp-ipv6-mib/usr.sbin/bsnmpd/modules/snmp_ipv6/ipv6_ifTable.c Fri Jan 6 07:53:50 2017 (r311502) @@ -40,8 +40,8 @@ __FBSDID("$FreeBSD$"); #include "ipv6.h" int -op_ipv6IfTable(struct snmp_context *ctx, struct snmp_value *value, - u_int sub, u_int iidx, enum snmp_op op) +op_ipv6IfTable(struct snmp_context *ctx __unused, struct snmp_value *value, + u_int sub, u_int iidx __unused, enum snmp_op op) { asn_subid_t which; Modified: projects/bsnmp-ipv6-mib/usr.sbin/bsnmpd/modules/snmp_ipv6/ipv6_netToMediaTable.c ============================================================================== --- projects/bsnmp-ipv6-mib/usr.sbin/bsnmpd/modules/snmp_ipv6/ipv6_netToMediaTable.c Fri Jan 6 07:53:07 2017 (r311501) +++ projects/bsnmp-ipv6-mib/usr.sbin/bsnmpd/modules/snmp_ipv6/ipv6_netToMediaTable.c Fri Jan 6 07:53:50 2017 (r311502) @@ -34,9 +34,34 @@ __FBSDID("$FreeBSD$"); #include "ipv6.h" int -op_ipv6NetToMediaTable(struct snmp_context *ctx, struct snmp_value *value, - u_int sub, u_int iidx, enum snmp_op op) +op_ipv6NetToMediaTable(struct snmp_context *ctx __unused, + struct snmp_value *value, u_int sub, u_int iidx __unused, enum snmp_op op) { + asn_subid_t which; - return (SNMP_ERR_NOSUCHNAME); + switch (op) { + case SNMP_OP_GETNEXT: + case SNMP_OP_GET: + break; + case SNMP_OP_SET: + return (SNMP_ERR_NOT_WRITEABLE); + case SNMP_OP_ROLLBACK: + case SNMP_OP_COMMIT: + return (SNMP_ERR_NOERROR); + } + + which = value->var.subs[sub - 1]; + + switch (which) { + case LEAF_ipv6NetToMediaAddress: + case LEAF_ipv6NetToMediaPhysAddress: + case LEAF_ipv6NetToMediaType: + case LEAF_ipv6NetToMediaState: + case LEAF_ipv6NetToMediaLastUpdated: + case LEAF_ipv6NetToMediaValid: + default: + return (SNMP_ERR_RES_UNAVAIL); + } + + return (SNMP_ERR_NOERROR); } Modified: projects/bsnmp-ipv6-mib/usr.sbin/bsnmpd/modules/snmp_ipv6/ipv6_routeTable.c ============================================================================== --- projects/bsnmp-ipv6-mib/usr.sbin/bsnmpd/modules/snmp_ipv6/ipv6_routeTable.c Fri Jan 6 07:53:07 2017 (r311501) +++ projects/bsnmp-ipv6-mib/usr.sbin/bsnmpd/modules/snmp_ipv6/ipv6_routeTable.c Fri Jan 6 07:53:50 2017 (r311502) @@ -34,9 +34,42 @@ __FBSDID("$FreeBSD$"); #include "ipv6_routeTable.h" int -op_ipv6RouteTable(struct snmp_context *ctx, struct snmp_value *value, - u_int sub, u_int iidx, enum snmp_op op) +op_ipv6RouteTable(struct snmp_context *ctx __unused, struct snmp_value *value, + u_int sub, u_int iidx __unused, enum snmp_op op) { + asn_subid_t which; - return (SNMP_ERR_NOSUCHNAME); + switch (op) { + case SNMP_OP_GETNEXT: + case SNMP_OP_GET: + break; + case SNMP_OP_SET: + return (SNMP_ERR_NOT_WRITEABLE); + case SNMP_OP_ROLLBACK: + case SNMP_OP_COMMIT: + return (SNMP_ERR_NOERROR); + } + + which = value->var.subs[sub - 1]; + + switch (which) { + case LEAF_ipv6RouteDest: + case LEAF_ipv6RoutePfxLength: + case LEAF_ipv6RouteIndex: + case LEAF_ipv6RouteIfIndex: + case LEAF_ipv6RouteNextHop: + case LEAF_ipv6RouteType: + case LEAF_ipv6RouteProtocol: + case LEAF_ipv6RoutePolicy: + case LEAF_ipv6RouteAge: + case LEAF_ipv6RouteNextHopRDI: + case LEAF_ipv6RouteMetric: + case LEAF_ipv6RouteWeight: + case LEAF_ipv6RouteInfo: + case LEAF_ipv6RouteValid: + default: + return (SNMP_ERR_RES_UNAVAIL); + } + + return (SNMP_ERR_NOERROR); }
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?201701060753.v067roof055341>