aboutsummaryrefslogtreecommitdiff
path: root/contrib/bsnmp
Commit message (Collapse)AuthorAgeFilesLines
* contrib: Remove various $FreeBSD$ tags not upstreamWarner Losh2024-05-312-3/+0
| | | | Sponsored by: Netflix
* bsnmp: make single bit bitfields unsigned to avoid clang 16 warningDimitry Andric2023-04-171-3/+3
| | | | | | | | | | | | | | Clang 16 introduced a warning about single bit bitfields in structs, which is triggered by a declaration in bsnmp's snmpd.h: contrib/bsnmp/snmpd/trans_lsock.c:271:21: error: implicit truncation from 'int' to a one-bit wide bit-field changes value from 1 to -1 [-Werror,-Wsingle-bit-bitfield-constant-conversion] peer->input.stream = 1; ^ ~ Signed one-bit bitfields can only have values -1 and 0, but the intent here is to use the field as a boolean, so make it unsigned. MFC after: 3 days
* SNMP: Update the fokus MIB with a new contact info.Hartmut Brandt2023-04-141-9/+12
| | | | Bring the contact info in sync with the contact info at IANA.
* bsnmp: Remove "All Rights Reserved" from FreeBSD Foundation copyrightsEd Maste2023-03-0311-11/+0
|
* Follow the standard object definition from RFC2578Shteryana Shopova2022-12-293-3/+3
| | | | | | | | Use mib-2 throughout the files where applicable PR: 254231 Reported by: Michael Proto Reviewed by: bz (at) FreeBSD (dot) org
* snmp_mibII: use net.inet.ip.fragttl sysctl for ipReasmTimeoutGleb Smirnoff2022-08-211-1/+13
| | | | | | Using IPFRAGTTL define was never correct, as it was measured in PR_SLOWTIMO intervals. The sysctl returns seconds, just what ipReasmTimeout is.
* bsnmp: Use mkstemp when creating clients local socketTom Jones2022-03-151-1/+1
| | | | | | | | Reviewed by: harti, rew Sponsored by: NetApp, Inc. Sponsored by: Klara, Inc. X-NetApp-PR: #72 Differential Revision: https://reviews.freebsd.org/D34550
* bsnmp: Fix two typos in error messagesGordon Bergling2022-01-261-2/+2
| | | | | | - s/responce/response/ MFC after: 1 week
* Fix bsnmpd(1) crash with ill-formed Discovery messageShteryana Shopova2021-10-011-1/+1
| | | | | | | | | RFC 3414 Section 4. Discovery specifies that a discovery request message has a varBindList left empty. Nonetheless, bsnmpd(1) should not crash when receiving a non-zero var-bindings list in a Discovery Request message. PR: 255214 MFC after: 2 weeks
* Revert "bsnmpclient(3): make it thread-safe"Edward Tomasz Napierala2020-12-293-4/+4
| | | | | | | | | | | | This reverts commit 89e3d5671ba13dceca272d5b159c9bd805f3f504. As pointed out, there are several problems with that commit: 1. The new semantics, while useful for clients where multiple threads use separate contexts, breaks clients which correctly share a single one 2. Change in semantics would require a library version bump 3. It doesn't build with GCC
* bsnmpclient(3): make it thread-safeEdward Tomasz Napierala2020-12-293-4/+4
| | | | | | | Reviewed By: harti Sponsored by: NetApp, Inc. Sponsored by: Klara, Inc. Differential Revision: https://reviews.freebsd.org/D27336
* snmpmod(3): fix typo under the COMMUNITIES sectionEnji Cooper2020-11-051-1/+1
| | | | | | | | | | | | "recipte" should be spelled like "receipt". .Dd is intentionally not being bumped for the change. MFC after: 1 week Sponsored by: DellEMC Notes: svn path=/head/; revision=367399
* Fix immediate crash when snmpd is bound to a specific IP address.Gleb Smirnoff2020-04-201-14/+17
| | | | | | | | | | The code that sets up msghdr must first fully fill in the msghdr itself, and only then use CMSG_xxx() macros. Silence from: harti, one week Notes: svn path=/head/; revision=360138
* Merge release 1.14 of bsnmp.Hartmut Brandt2020-04-0115-89/+19719
|\ | | | | | | Notes: svn path=/head/; revision=359512
| * Flatten bsnmp vendor area.Hartmut Brandt2008-12-2085-65540/+0
| | | | | | | | Notes: svn path=/vendor/bsnmp/dist/; revision=186357
* | bsnmpd(1): Replace dubious srandomdev+random(3) with arc4random(3)Conrad Meyer2019-12-131-3/+1
| | | | | | | | Notes: svn path=/head/; revision=355697
* | Fix the byte order of IPv4 address parsed from begemotSnmpdTransInetStatusAndrey V. Elsukov2019-11-191-3/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | config option. An address is already in network byte order, there is no need to do htonl(). PR: 242056 MFC after: 1 week Notes: svn path=/head/; revision=354858
* | bsnmp: Fix operator precedence in error check in table_check_responseJustin Hibbits2019-11-181-1/+1
| | | | | | | | | | | | | | | | | | | | | | | | Summary: The ?: operator has a lower precedence than == and &&, so the result will always be recorded as true. Found by gcc8. Reviewed by: ngie, ae Differential Revision: https://reviews.freebsd.org/D22427 Notes: svn path=/head/; revision=354834
* | bsnmp: add asn1 message length validationEd Maste2019-08-061-0/+5
| | | | | | | | | | | | | | | | | | | | admbugs: 780 Submitted by: Guido Vranken, bz Reported by: Guido Vranken Security: CVE-2019-5610 Notes: svn path=/head/; revision=350635
* | Follow the declared behaviour that specifies server string format inAndrey V. Elsukov2019-04-031-63/+65
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | bsnmpclient(3). snmp_parse_server() function accepts string where some fields can be omitted: [trans::][community@][server][:port] "trans" field can be "udp", "udp6", "dgram" and "stream". "community" can be empty string, if it is omitted, the default value will be used. For read_community it is "public", for write_comminity it is "private". "server" field can be hostname, IPv4 address or IPv6 address. IPv6 address should be specified in brackets "[]". If port is omitted, the default value "snmp" will be used for "udp" and "udp6" transports. So, now for bsnmpget(1) and bsnmwalk(1) it is not required to specify all fields in argument of '-s' option. E.g. # bsnmpget -s 127.1 sysName.0 # bsnmpget -s "udp::127.1" sysName.0 # bsnmpget -s "udp::public@127.1" sysName.0 # bsnmpget -s "udp::public@127.1:161" sysName.0 # bsnmpget -s "udp::[::1]" sysName.0 # bsnmpget -s "udp6::[::1]" sysName.0 # bsnmpget -s "[fe80::1%lo0]" sysName.0 PR: 236664 Reported by: olivier MFC after: 1 month Notes: svn path=/head/; revision=345843
* | Create 64bit mibII counters for all interfaces.Andrey V. Elsukov2019-04-021-21/+0
| | | | | | | | | | | | | | | | | | PR: 157015 Obtained from: Yandex LLC MFC after: 1 month Notes: svn path=/head/; revision=345798
* | Add IPv6 transport for bsnmp.Andrey V. Elsukov2019-04-0215-288/+2252
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | This patch adds a new table begemotSnmpdTransInetTable that uses the InetAddressType textual convention and can be used to create listening ports for IPv4, IPv6, zoned IPv6 and based on DNS names. It also supports future extension beyond UDP by adding a protocol identifier to the table index. In order to support this gensnmptree had to be modified. Submitted by: harti MFC after: 1 month Relnotes: yes Differential Revision: https://reviews.freebsd.org/D16654 Notes: svn path=/head/; revision=345797
* | Correct a port number assignment.Andrey V. Elsukov2019-04-011-2/+1
| | | | | | | | | | | | | | | | PR: 236930 MFC after: 1 week Notes: svn path=/head/; revision=345763
* | Timer interval is correctly counted in ticks (1/100 s) inGleb Smirnoff2019-01-091-1/+1
| | | | | | | | | | | | | | | | | | | | | | mibif_reset_hc_timer(). Multiplication by 10 is erroneous and is probably a blind copy and paste from next function. PR: 132993 Submitted by: Vitezslav Novy <vnovy vnovy.net> Notes: svn path=/head/; revision=342877
* | Make libbsnmp buildable.Jung-uk Kim2018-09-191-48/+81
| | | | | | | | Notes: svn path=/projects/openssl111/; revision=338769
* | bsnmpd(8): fix and optimize interface description processingEugene Grosbein2018-08-184-8/+69
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | * correctly prepare a buffer to obtain interface description from a kernel and truncate long description instead of dropping it altogether and spamming logs; * skip calling strlen() for each description and each SNMP request for MIB-II/ifXTable's ifAlias. * teach bsnmpd to allocate memory dynamically for interface descriptions to decrease memory usage for common case and not to break if long description occurs; PR: 217763 Reviewed by: harti and others MFC after: 1 week Differential Revision: https://reviews.freebsd.org/D16459 Notes: svn path=/head/; revision=338013
* | Update bsnmp to version 1.13. This does not bring user-visible changes.Hartmut Brandt2018-07-0318-102/+300
| | | | | | | | | | | | | | | | | | | | For developers gensnmptree can now generate functions for enums to convert between enums and strings and to check the validity of a value. The sources in FreeBSD are now in sync with the upstream which allows to bring in IPv6 modifications. Notes: svn path=/head/; revision=335885
* | Don't put multiple names on a single .Nm line. This fixes apropos(1)Edward Tomasz Napierala2018-04-171-29/+29
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | output, from this: strnlen, strlen, strlen,(3) - find length of string │······· ... to this: strlen, strnlen(3) - find length of string PR: 223525 MFC after: 2 weeks Notes: svn path=/head/; revision=332642
* | Remove support for the Arcnet protocol.Brooks Davis2018-04-131-7/+0
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | While Arcnet has some continued deployment in industrial controls, the lack of drivers for any of the PCI, USB, or PCIe NICs on the market suggests such users aren't running FreeBSD. Evidence in the PR database suggests that the cm(4) driver (our sole Arcnet NIC) was broken in 5.0 and has not worked since. PR: 182297 Reviewed by: jhibbits, vangyzen Relnotes: yes Sponsored by: DARPA, AFRL Differential Revision: https://reviews.freebsd.org/D15057 Notes: svn path=/head/; revision=332490
* | Rename "index" variable to "idx" since gcc complains that it shadowsAndrey V. Elsukov2018-01-192-11/+11
| | | | | | | | | | | | | | | | | | | | index(3) function declaration. Reported by: lwhsu MFC after: 2 weeks Notes: svn path=/head/; revision=328171
* | Add to bsnmpd(1) ability to specify multiple community strings withAndrey V. Elsukov2018-01-196-36/+116
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | different access rights. By default there are two community strings with index 1 and 2, one for read-only access and second for read-write access: begemotSnmpdCommunityString.0.1 = $(read) begemotSnmpdCommunityString.0.2 = $(write) Now it is possible to define additional community strings using different indexes: begemotSnmpdCommunityString.0.3 = "SomeString1" begemotSnmpdCommunityPermission.0.3 = 1 begemotSnmpdCommunityString.0.4 = "SomeString2" begemotSnmpdCommunityPermission.0.4 = 2 begemotSnmpdCommunityString.0.5 = "SomeString3" begemotSnmpdCommunityString.0.6 = "SomeString4" New attribute begemotSnmpdCommunityPermission can be used to specify access rights: 1 means "read-only" access, 2 means "read-write" access. If attribute is not specified for some index this means "read-only" rights. Community strings must be unique, i.e. must not be the same for different indexes. Obtained from: Yandex LLC MFC after: 2 weeks Sponsored by: Yandex LLC Differential Revision: https://reviews.freebsd.org/D13785 Notes: svn path=/head/; revision=328160
* | Fix format string warning with enabled DEBUGGING.Andrey V. Elsukov2017-12-041-1/+1
| | | | | | | | | | | | | | MFC after: 1 week Notes: svn path=/head/; revision=326510
* | Hide struct inpcb, struct tcpcb from the userland.Gleb Smirnoff2017-03-212-7/+7
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | This is a painful change, but it is needed. On the one hand, we avoid modifying them, and this slows down some ideas, on the other hand we still eventually modify them and tools like netstat(1) never work on next version of FreeBSD. We maintain a ton of spares in them, and we already got some ifdef hell at the end of tcpcb. Details: - Hide struct inpcb, struct tcpcb under _KERNEL || _WANT_FOO. - Make struct xinpcb, struct xtcpcb pure API structures, not including kernel structures inpcb and tcpcb inside. Export into these structures the fields from inpcb and tcpcb that are known to be used, and put there a ton of spare space. - Make kernel and userland utilities compilable after these changes. - Bump __FreeBSD_version. Reviewed by: rrs, gnn Differential Revision: D10018 Notes: svn path=/head/; revision=315662
* | bsnmp: explicitly test the return value for open_client_{local,udp} in ↵Enji Cooper2017-03-201-2/+2
| | | | | | | | | | | | | | | | | | | | | | | | | | snmp_open(..) open_client_* returns -1 on failure; 0 on success. Ensure that the return value is 0 -- otherwise exit snmp_open(..). MFC after: 1 week Sponsored by: Dell EMC Isilon Notes: svn path=/head/; revision=315642
* | bsnmp: don't leak snmp_client.fd in open_client_udp(..) on connect(2) failureEnji Cooper2017-03-201-0/+2
| | | | | | | | | | | | | | | | MFC after: 1 week Sponsored by: Dell EMC Isilon Notes: svn path=/head/; revision=315641
* | bsnmpd: fix segfault when trans_insert_port(..) is called with multipleEnji Cooper2017-03-131-1/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | out of order addresses Move `port->transport` initialization before the TAILQ_FOREACH(..) loop to ensure that the value is properly initialized before it's inserted into the TAILQ. MFC after: 1 week PR: 217760 Submitted by: eugen Sponsored by: Dell EMC Isilon Notes: svn path=/head/; revision=315206
* | Fix regression from r310655, which broke operation of bsnmpd if it is boundGleb Smirnoff2017-01-172-55/+30
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | to a non-wildcard address. As documented in ip(4), doing sendmsg(2) with IP_SENDSRCADDR on a socket that is bound to non-wildcard address is completely different to using this control message on a wildcard one. A fix is to add a bool to mark whether we did setsockopt(IP_RECVDSTADDR) on the socket, and use IP_SENDSRCADDR control message only if we did. While here, garbage collect absolutely useless udp_recv() function that establishes some structures on stack to never use them later. Notes: svn path=/head/; revision=312331
* | Add a REVISION section to track changes for the BEGEMOT-MIB MIB fileEnji Cooper2017-01-091-0/+3
| | | | | | | | | | | | | | | | | | | | There haven't been any changes to the MIB definition, so the REVISION remains static at the version it was imported at MFC after: 1 week Notes: svn path=/head/; revision=311760
* | Add a REVISION section to track changes for the FOKUS-MIB MIB fileEnji Cooper2017-01-091-0/+3
| | | | | | | | | | | | | | | | | | | | There haven't been any changes to the MIB definition, so the REVISION remains static at the version it was imported at MFC after: 1 week Notes: svn path=/head/; revision=311759
* | Similar to r311750, check for the result from smiGetModule to avoid a segfaultEnji Cooper2017-01-091-0/+2
| | | | | | | | | | | | | | | | | | | | | | | | | | | | when dereferencing a NULL pointer later on. Choose to just check for the NULL pointer in the next for-loop for now to fix the issue with a minimal amount of code churn sys/queue.h use here would make more sense than using a static table MFC after: 5 days Notes: svn path=/head/; revision=311757
* | Use calloc instead of malloc + memset(.., 0, ..)Enji Cooper2017-01-091-2/+1
| | | | | | | | | | | | | | MFC after: 5 days Notes: svn path=/head/; revision=311754
* | Check result from smiGetFirstNode and smiGetNodeByOIDEnji Cooper2017-01-091-1/+5
| | | | | | | | | | | | | | | | | | | | | | This avoids a segfault with malformed or unanticipated files, like IPV6-TC.txt (a file containing just TEXTUAL-CONVENTIONS). MFC after: 5 days Found with: gensnmpdef /usr/local/share/snmp/mibs/IPV6-TC.txt Notes: svn path=/head/; revision=311750
* | Add a REVISION section to track changes for the BEGEMOT-IP-MIB MIB fileEnji Cooper2017-01-091-0/+3
| | | | | | | | | | | | | | | | | | | | There haven't been any changes to the MIB definition, so the REVISION remains static at the version it was imported at MFC after: 1 week Notes: svn path=/head/; revision=311742
* | Use nitems(mib) instead of hardcoding mib's length when calling sysctl(3)Enji Cooper2017-01-091-6/+6
| | | | | | | | | | | | | | MFC after: 3 days Notes: svn path=/head/; revision=311733
* | Remove unnecessary __unused attribute attached to `ctx` in op_begemot_mibII(..)Enji Cooper2017-01-061-1/+1
| | | | | | | | | | | | | | MFC after: 3 days Notes: svn path=/head/; revision=311505
* | op_usm_users: don't deref uusers if it's NULL when SETting the valueEnji Cooper2017-01-051-1/+5
| | | | | | | | | | | | | | | | | | | | | | | | Add an XXX comment to note that the conditional seems suspect given how it's handled elsewhere in the SNMP_OP_SET case. MFC after: 2 weeks Reported by: Coverity CID: 1008573 Notes: svn path=/head/; revision=311394
* | snmp_table_fetch_async: don't leak `work` if snmp_pdu_send(..) failsEnji Cooper2017-01-051-1/+4
| | | | | | | | | | | | | | | | | | MFC after: 1 week Reported by: Coverity CID: 1017276 Notes: svn path=/head/; revision=311390
* | op_usm_users: fix indentation in SNMP_OP_SET blockEnji Cooper2017-01-051-1/+1
| | | | | | | | | | | | | | MFC after: 3 days Notes: svn path=/head/; revision=311384
* | Use calloc instead of malloc + memset(.., 0, ..)Enji Cooper2017-01-051-6/+3
| | | | | | | | | | | | | | MFC after: 3 days Notes: svn path=/head/; revision=311382
* | lsock_init_port: address issues with initializing sockaddr_un objectEnji Cooper2017-01-051-6/+4
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | - Use strlcpy to ensure p->name doesn't overflow sa.sun_path [*]. - Use SUN_LEN(..) instead of spelling out calculation longhand (inspired by comment by jmallett). Tested with: dgram and stream support with both bsnmpwalk and snmpwalk MFC after: 1 week Reported by: Coverity CID: 1006825 Notes: svn path=/head/; revision=311381