summaryrefslogtreecommitdiffstats
path: root/usr.sbin/bsnmpd
Commit message (Collapse)AuthorAgeFilesLines
* MFC r314659,r314676:ngie2017-05-293-5/+5
| | | | | | | | | | | | | | | | | | | | | | | | | r314659: usr.sbin: normalize paths using SRCTOP-relative paths or :H when possible This simplifies make logic/output r314676: Fix build after r314656 Some of the changes I introduced to use .ALLSRC were correct in spirit, but incorrect in reality -- in particular, ../Makefile.inc hadn't been pulled in via bsd.init.mk (via bsd.lib.mk, bsd.prog.mk), so the value of .ALLSRC (evaluated immediately) was empty. .include bsd.init.mk explicitly so we can be certain that the values used as dependencies in the targets are defined when the target recipe has been evaluated. Reminder: thou shalt separate out separate functional changes before committing them. (YUGE) Pointyhat to: ngie In collaboration with: bdrewery
* DIRDEPS_BUILD: Update dependencies.bdrewery2017-05-091-5/+0
| | | | | | This is a direct commit since MFCing these changes is impractical. Sponsored by: Dell EMC Isilon
* MFC r314987-r314989, r314993-r314994, r315046-r315049, r315102araujo2017-04-171-1/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | r314987: Use nitems() from sys/param.h. Reviewed by: asomers MFC after: 3 weeks. Differential Revision: https://reviews.freebsd.org/D9944 r314988: Use nitems() from sys/param.h. Reviewed by: ume MFC after: 3 weeks. Differential Revision: https://reviews.freebsd.org/D9938 r314989: Use nitems() from sys/param.h and also remove the cast. Reviewed by: markj MFC after: 3 weeks. Differential Revision: https://reviews.freebsd.org/D9937 r314993: Use nitems() from sys/param.h. Reviewed by: ngie MFC after: 3 weeks. Differential Revision: https://reviews.freebsd.org/D9936 r314994: Use nitems() from sys/param.h. Reviewed by: ngie MFC after: 3 weeks. Differential Revision: https://reviews.freebsd.org/D9940 r315046: Use nitems() from sys/param.h Reviewed by: jhb MFC after: 3 weeks. Differential Revision: https://reviews.freebsd.org/D9941 r315047: Use nitems() from sys/param.h. Reviewed by: np MFC after: 3 weeks. Differential Revision: https://reviews.freebsd.org/D9945 r315048: Use nitems() from sys/param.h. MFC after: 3 weeks. r315049: Bring back the cast removed in my previous commit to allow us build vmstat with WARNS 2. This cast was first introduced at r87690. Reported by: bde, pfg and ngie MFC after: 3 weeks. r315102: Use nitems() from sys/param.h. Reviewed by: ngie Differential Revision: https://reviews.freebsd.org/D9943
* MFC r311174:ngie2017-02-043-3/+9
| | | | | | | | | | | | | Make /usr/lib/libbsnmptools.so.0 into an INTERRNALLIB Although it increases the size of the bsnmp{get,set,walk} binaries by four on my [amd64] system, it removes the need for producing .debug files, profiled libraries, and for installing the library itself, reducing the overall size use on disk by the utilities noted previously. Plus, it guards against ABI/API compatibility issues with the library as it's only used internal to the tools themselves.
* MFC r311744,r312328,r312329,r312330:ngie2017-02-043-11/+3
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | r311744: Document bsd.snmpmod.mk from a high-level r312328: Add a make target (smilint) for running smilint tool against BMIBS Running smilint against MIB definitions is useful in finding functional problems with MIB definitions/descriptions. This is inspired by the smilint targets defined in usr.sbin/bsnmpd/modules/{snmp_hostres,snmp_mibII}/Makefile Document all of the variables that are involved in running the smilint target, as well as all of the prerequisites to running it. r312329: Remove ad hoc smilint targets made standard in bsd.snmpmod.mk in r312328 r312330: Add smilint target to subdir targets so "make smilint" here will run the smilint target in subdirs While here, convert a path that's .CURDIR relative to SRCTOP
* MFC r311740:ngie2017-01-162-4/+6
| | | | | | | | Improve the smilint target in the hostres and mibII modules - Mark the smilint target .PHONY so it's always executed when requested - Leverage .PATH for BMIBS instead of spelling the path out longhand for them
* MFC r311758:ngie2017-01-161-1/+3
| | | | | | | Add a REVISION section to track changes for the BEGEMOT-ATM-FREEBSD-MIB MIB file There haven't been any changes to the MIB definition, so the REVISION remains static at the version it was imported at
* MFC r311741,r311761:ngie2017-01-162-0/+16
| | | | | | | | | | | | | | | | | r311741: Add a REVISION section to track changes for the hostres module There haven't been any changes to the MIB definition, so the REVISION remains static at the version it was imported at r311761: Add a REVISION section to track changes for the BEGEMOT-NETGRAPH MIB file This change also documents the modification harti made to a handful of objects in r122758 (the max OCTET STRING width was increased from 15 to 31 octets)
* MFC r311739:ngie2017-01-137-8/+8
| | | | | | Use SRCTOP instead of spelling out the full path with .CURDIR This helps condense the output for CFLAGS and .PATH
* MFC r310892,r310894,r310989:ngie2017-01-131-12/+26
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | r310892: Don't call snmp_pdu_free(..) until finished with the pdu and when ready to allocate a new one via snmp_pdu_create(..) This fixes bsnmpwalk, so it no longer crashes after r310729 r310894: snmp_pdu_free the right object at the right time in snmptool_walk r310892 was on the right track, but unfortunately it was resolving the problem incorrectly and accidentally leaking memory in the process. - Call snmp_pdu_free on req before calling snmp_pdu_create on it at the bottom of the outer while loop - Call snmp_pdu_free on resp after calling snmpwalk_nextpdu_create in the inner loop r310989: Call snmp_pdu_free on req/resp with a consistent, correct pattern - snmp_pdu_free should be called before snmp_pdu_create is called again - snmp_pdu_free should be called on the resp to snmp_dialog when successful Tested with the following bsnmp commands: % export SNMPUSER=bsnmp SNMPPASSWD=bsnmptest % SNMP_ARGS="-A proto=sha -C context='' -K -P proto=des -v 3 -r 0" % bsnmpset $SNMP_ARGS sysLocation="MyAgent" % bsnmpget $SNMP_ARGS sysLocation % bsnmpwalk $SNMP_ARGS
* MFC r311290,r311293,r311294:ngie2017-01-131-13/+17
| | | | | | | | | | | | | | | | | | | | | | | | | | r311290: Use strlcpy instead of strcpy when copying the bridge name to ifr.ifr_name to avoid buffer overflows CID: 1006735, 1006737, 1006738 r311293: bridge_do_pfctl: allocate mib_name dynamically using asprintf This is being done to reduce wasted space, simplify complexity in the code, and to quell a Coverity warning about buffer overruns. warning about buffer overruns. CID: 1006736 r311294: style cleanup - bridge_pf_dump: use nitems instead of spelling it out longhand - bridge_do_pfctl: sort variables by alignment for type
* MFC r311393:ngie2017-01-091-2/+2
| | | | | OS_getSystemUptime: use nitems for calculating the number of elements in a sysctl mib instead of hardcoding the number 2
* MFC r311291:ngie2017-01-071-2/+2
| | | | bridge_get_pfval: use nitems instead of spelling it out longhand
* MFC r310497:ngie2017-01-073-42/+36
| | | | | | | | Warning message cleanup - Use warn instead of warnx + strerror(errno) - Remove unnecessary trailing newline from a warnx call - Add missing spaces following "," in syslog and warn* calls
* MFC r310954,r310987,r311222:ngie2017-01-072-11/+26
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | r310954: Set value->v.octetstring.len to a correct value on malloc success/failure The previous code always set value->v.octetstring.len to len, regardless of the result from the malloc call. This misleads the caller on malloc failure. Set .len to len on success and 0 on failure. CID: 1007590 r310987: snmp_output_err_resp, snmp_output_resp: allocate `object` using calloc, not on the stack Some of the callers try to determine whether or not `object` is valid by testing the value for NULL, which will never be true if it's a stack value, so in order to be clear and correct down the call stack, use a heap allocated object. This also addresses a Coverity issue by initializing all of `object` via calloc CID: 1006392 r311222: Fix logical inversion when checking result from calloc in snmp_output_err_resp(..) CID: 1368195
* MFC r311175:ngie2017-01-061-4/+3
| | | | | | | Swap parameters around with parse_syntax_strval(..) for consistency with other parse_* APIs in bsnmp* Noted by: bz
* MFC r310711:ngie2017-01-041-2/+6
| | | | | | | | Don't explicitly build tcp wrappers support into bsnmpd; make it conditional on MK_TCP_WRAPPERS != "no" This likely fixes an issue seen where some of the USE_TCPWRAPPERS code didn't work as advertised
* MFC r310665:ngie2017-01-041-1/+4
| | | | Only build/install usr.sbin/bsnmpd/modules/snmp_hast if MK_HAST != no
* MFC r310664:ngie2017-01-041-1/+4
| | | | Only build/install usr.sbin/bsnmpd/modules/snmp_wlan if MK_WIRELESS != no
* MFC r310986:ngie2017-01-031-2/+2
| | | | snmp_output_resp: style(9): sort variables by alignment
* MFC r310668:ngie2016-12-311-0/+1
| | | | style(9) fixes: clean up leading whitespace
* MFC r310667:ngie2016-12-311-1/+1
| | | | style(9) fixes: clean up leading whitespace
* MFC r310669:ngie2016-12-311-8/+8
| | | | style(9): clean up whitespace
* MFC r310648:ngie2016-12-3124-70/+70
| | | | style(9): clean up trailing whitespace
* MFC r310666,r310675:ngie2016-12-317-20/+23
| | | | | | | | | | | | | | | | r310666: style(9) fixes - Clean up trailing whitespace - Fix variable type alignment in storage_OS_get_swap(..) r310675: Fix the build by moving the initializers for len/nswapdev down below the declarations Pointyhat to: ngie
* MFC r310654:ngie2016-12-311-0/+99
| | | | Install snmpmod.3 as all of the bsnmpd APIs it documents
* MFC r310196:ngie2016-12-261-3/+6
| | | | | | | Fix some minor typos with begemotBridgeTpLearnedEntryDiscards and begemotBridgeTpMaxAddresses Bump LAST-UPDATED for the MIB, per the change
* MFC r310203:ngie2016-12-261-3/+3
| | | | | | | Clean up parse_ip(..) - Clean up trailing whitespace - Fix variable alignment
* MFC r305855, r306297, r306300, r306312-r306313marcel2016-12-111-1/+1
| | | | | | | | | | | | | | When MAKEOBJDIRPREFIX points to a case-insensitive file system, the build can break when different source files create the same object files (case-insensitivity speaking). This is the case for object files compiled with -fpic and shared libraries. The former uses an extension of ".So", and the latter an extension ".so". Rename shared object files from *.So to *.pico to match what NetBSD does. Also: o Compile _Exit.c as C99_Exit.c, as it conflicts with _exit.s o Add entry to UPDATING o Document .pico extension
* WITH_META_MODE: Don't expect meta files for side-effect generated files.bdrewery2016-06-031-0/+1
| | | | | | | | | The first file in these lists will generate everything else so only it should be getting a .meta file. With bmake's missing=yes meta feature these would otherwise cause a rebuild without the .NOMETA hint. Sponsored by: EMC / Isilon Storage Division
* Revert r299830, it has couple of fatal errors.glebius2016-05-181-0/+1
| | | | | | | The CMSG_ family of macros take care of alignment, so we don't need r299830 at all, even if it was correct. Put NO_WCAST_ALIGN into Makefile. Together with: peter
* Remove NO_WERROR and add WARNS?= 6ngie2016-05-151-1/+2
| | | | | | | | This now compiles cleanly on all architectures MFC after: 1 month Tested with: clang 3.8, gcc 4.2.1, gcc 4.5, make tinderbox Sponsored by: EMC / Isilon Storage Division
* Remove NO_WERROR.clang from this Makefilengie2016-05-151-2/+0
| | | | | | | This compiles with clang without warnings MFC after: 1 month Sponsored by: EMC / Isilon Storage Division
* Replace malloc + memset(.., 0, ..) with calloc callsngie2016-05-151-5/+2
| | | | | MFC after: 1 week Sponsored by: EMC / Isilon Storage Division
* Use strdup instead of malloc + strlcpyngie2016-05-151-4/+3
| | | | | | | Fix error messages on failure for calloc/strdup MFC after: 3 weeks Sponsored by: EMC / Isilon Storage Division
* Correct function names that failed in error messagesngie2016-05-152-4/+4
| | | | | | | It should be calloc/strdup, not malloc MFC after: 3 weeks Sponsored by: EMC / Isilon Storage Division
* Replace QUADFMT with %ju and QUADXFMT with %jx and cast values with uintmax_tngie2016-05-151-1/+1
| | | | | | | | This will cure some -Wformat warnings MFC after: 1 week Reported by: clang, gcc Sponsored by: EMC / Isilon Storage Division
* Bump WARNS to 6ngie2016-05-151-0/+2
| | | | | MFC after: 1 month Sponsored by: EMC / Isilon Storage Division
* Fix up r299769ngie2016-05-151-4/+2
| | | | | | | | | | | | Similar to r299802, it was noted that using nitems on scalar pointers is invalid. Use strdup instead of malloc + strlcpy (which is what the old code was doing anyhow). MFC after: 1 week Pointyhat to: ngie Sponsored by: EMC / Isilon Storage Division
* Replace malloc + memset(.., 0, ..) with calloc callsngie2016-05-151-5/+2
| | | | | MFC after: 1 week Sponsored by: EMC / Isilon Storage Division
* Fix up both r299764 and r299770ngie2016-05-151-2/+1
| | | | | | | | | | | | | | nitems was wrong too, as it was being tested against a pointer instead of a buffer on the stack. Since the old code was just doing malloc, then strlcpy'ing the contents of the source buffer into the destination buffer, replace it all with a call to strdup.. Reported by: bde MFC after: 1 week X-MFC with: r299764, r299770 Supersized Duncecap to: ngie Sponsored by: EMC / Isilon Storage Division
* Convert tok from enum tok to int32_t in function callsngie2016-05-141-10/+9
| | | | | | | | | get_token(..) returns int32_t, not enum tok, and in many cases tests for items not in enum tok (e.g. '('). Make the typing consistent with get_token, which includes a domino effect of changing enum tok to int32_t. MFC after: 2 weeks Sponsored by: EMC / Isilon Storage Division
* Use a consistent errno save/restore pattern before running strtoulngie2016-05-141-4/+17
| | | | | | | | | | | | | | | | - Save errno - Set errno to 0 - Call strtoul - Test errno (optional, but many calls to strtoul did this afterwards) Some of the code was setting errno = 0 after calling strtoul, not setting errno = 0, or setting errno to saved_errno after the call, but before the test. These all have unwanted behavioral side-effects, depending on the initial value of errno and whether or not the input to strtoul was correct or incorrect. MFC after: 3 weeks Sponsored by: EMC / Isilon Storage Division
* Do minimal work necessary to cure a -Wunused-but-set-variable warning from gccngie2016-05-141-4/+4
| | | | | | | | How errno is saved before and restored after strtoul calls needs a rethink MFC after: 1 week Reported by: gcc 5.x Sponsored by: EMC / Isilon Storage Division
* Fix up r299764ngie2016-05-141-1/+1
| | | | | | | | | | I meant to use nitems, not sizeof(..) with the destination buffer. Using sizeof(..) on a pointer will always truncate the output in the destination buffer incorrectly Pointyhat to: ngie MFC after: 1 week X-MFC with: r299764 Sponsored by: EMC / Isilon Storage Division
* Use the size of the destination buffer instead of the malloc size, repeated, ↵ngie2016-05-141-2/+2
| | | | | | | | | | in order to mute a -Wstrlcpy-strlcat-size warning MFC after: 1 week Reported by: clang Sponsored by: EMC / Isilon Storage Division
* Mute sign compare warning by casting rc to u_int to match nbindings' typengie2016-05-141-1/+1
| | | | | | | | | rc cannot be negative -- that was already tested for earlier on in the function MFC after: 1 week Reported by: clang, gcc Sponsored by: EMC / Isilon Storage Division
* Fix logically dead code pointed out by clang/Coverityngie2016-05-141-3/+3
| | | | | | | | | | | parse_context, parse_user_security: test for validity of results from parse_ascii(..) with by casting to int32_t and comparing to -1; comparing unsigned types to negative values will always be false. Reported by: clang, Coverity CID: 1011432, 1011433 MFC after: 3 weeks Sponsored by: EMC / Isilon Storage Division
* Fix theoretical buffer overflow issues in snmp_oid2asn_oidngie2016-05-141-2/+1
| | | | | | | | | | | | Increase the size of `string` by 1 to account for the '\0' terminator. In the event that `str` doesn't contain any non-alpha chars, i would be set to MAXSTR, and the subsequent strlcpy call would overflow by a character. Remove unnecessary `string[i] = '\0'` -- this is already handled by strlcpy. MFC after: 1 week Reported by: clang Sponsored by: EMC / Isilon Storage Division
* Use the size of the destination buffer, not the source buffer.ngie2016-05-141-1/+1
| | | | | | | | | Technically this is a no-op, but mute the clang warning in case the malloc call above for fstring ever changes in the future Reported by: clang MFC after: 1 week Sponsored by: EMC / Isilon Storage Division
OpenPOWER on IntegriCloud