History log of /freebsd-current/contrib/bsnmp/snmp_mibII/mibII.c
Revision Date Author Comments
# 32312513 08-Jan-2019 Gleb Smirnoff <glebius@FreeBSD.org>

Timer interval is correctly counted in ticks (1/100 s) in
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>


# 1a498d2e 18-Aug-2018 Eugene Grosbein <eugen@FreeBSD.org>

bsnmpd(8): fix and optimize interface description processing

* 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


# 8e9b3e70 03-Jul-2018 Hartmut Brandt <harti@FreeBSD.org>

Update bsnmp to version 1.13. This does not bring user-visible changes.
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.


# 3a4fc8a8 13-Apr-2018 Brooks Davis <brooks@FreeBSD.org>

Remove support for the Arcnet protocol.

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


# 0ab70469 08-Jan-2017 Enji Cooper <ngie@FreeBSD.org>

Use nitems(mib) instead of hardcoding mib's length when calling sysctl(3)

MFC after: 3 days


# a0e0e1ff 30-Dec-2016 Enji Cooper <ngie@FreeBSD.org>

MIB-II: use strlcpy instead of strcpy when copying {descr,name}

This is of course to avoid buffer overruns

The remaining strcpy instance in the module needs to be audited for
correctness

MFC after: 1 week
Reported by: Coverity
CID: 1006827, 1006828


# 02ff676c 31-Dec-2016 Enji Cooper <ngie@FreeBSD.org>

MIB-II: use strlcpy when copying interface names to .ifr_name

.ifra_name is assumed to be NUL terminated; using strlcpy(3)
ensures that it's indeed NUL terminated whereas strncpy does
not.

Tested and verified as follows with a combination of ifconfig,
snmpget, and snmpset:

% ifconfig create lo1 127.0.0.2/8
% SNMPARGS="-v 3 -n '' -u bsnmp -A bsnmptest -l authPriv -a sha -x des -X bsnmptest localhost"
% snmpget $SNMPARGS IF-MIB::ifAdminStatus.4
IF-MIB::ifAdminStatus.4 = INTEGER: up(1)
% snmpset $SNMPARGS IF-MIB::ifAdminStatus.4 i 2
IF-MIB::ifAdminStatus.4 = INTEGER: down(2)
% snmpget $SNMPARGS IF-MIB::ifAdminStatus.4
IF-MIB::ifAdminStatus.4 = INTEGER: down(2)
% snmpset $SNMPARGS IF-MIB::ifAdminStatus.4 i 1
IF-MIB::ifAdminStatus.4 = INTEGER: up(1)
% snmpget $SNMPARGS IF-MIB::ifAdminStatus.4
IF-MIB::ifAdminStatus.4 = INTEGER: up(1)

MFC after: 2 weeks
Reported by: Coverity
CID: 1009652-1009656, 1349850


# 83739935 30-Dec-2016 Enji Cooper <ngie@FreeBSD.org>

Guard against use-after-free after calling mibif_free(..)

Set variables to NULL after calling free.

Also, remove unnecessary if (x != NULL) checks before calling free(x)

MFC after: 1 week


# 2fd30e01 30-Dec-2016 Enji Cooper <ngie@FreeBSD.org>

Fix whitespace in a comment and fixing a spelling error in a comment

MFC after: 3 days


# e1d581b2 27-Dec-2016 Enji Cooper <ngie@FreeBSD.org>

style(9): clean up trailing whitespace

MFC after: 3 weeks


# ce42ce03 03-Feb-2016 Bjoern A. Zeeb <bz@FreeBSD.org>

Try to fix a bug introduced in r228623. We started to copy the ifa_msghdr
as otherwise platforms with strict alignment would break. It's unclear
to me if there's also a problem with access to the address list following
the structure. However we never copied the address list after the structure
and thus are pointing at random memory. For now just use a pointer to the
original memory for accessing the address list making it at least work on
platforms with weak memory access.

PR: 195445
Reported by: wolfgang lyxys.ka.sub.org
Tested by: wolfgang lyxys.ka.sub.org (x86)
MFC after: 3 days


# 5edd0d3a 21-Jan-2016 Hartmut Brandt <harti@FreeBSD.org>

Fill the ifAlias leaf of the ifXTable with the interface description
if there is one available and it fits into the maximum size (64 characters).


# 8cc5fb3d 25-Apr-2013 Gleb Smirnoff <glebius@FreeBSD.org>

Restore the ipNetToMedia MIB, that was broken with new ARP commit
in the r186119.

Submitted by: Konstantin Kukushkin <dark rambler-co.ru>


# 1e629ba9 17-Dec-2011 Bjoern A. Zeeb <bz@FreeBSD.org>

Adter r228571 unbreak architectures with strict alignment rules
by copying rather than casting.


# a7d5f7eb 19-Oct-2010 Jamie Gritton <jamie@FreeBSD.org>

A new jail(8) with a configuration file, to replace the work currently done
by /etc/rc.d/jail.


# 869ae66d 06-Aug-2010 Pyun YongHyeon <yongari@FreeBSD.org>

Fix a typo introduced in r210936 which broke build.


# d99d8e2e 06-Aug-2010 John Baldwin <jhb@FreeBSD.org>

Ethernet vlan(4) interfaces have valid Ethernet link layer addresses but
use a different interface type (IFT_L2VLAN vs IFT_ETHER). Treat IFT_L2VLAN
interfaces like IFT_ETHER interfaces when handling link layer addresses.

Reviewed by: syrinx (bsnmpd)
MFC after: 1 week


# fe0506d7 09-Mar-2010 Marcel Moolenaar <marcel@FreeBSD.org>

Create the altix project branch. The altix project will add support
for the SGI Altix 350 to FreeBSD/ia64. The hardware used for porting
is a two-module system, consisting of a base compute module and a
CPU expansion module. SGI's NUMAFlex architecture can be an excellent
platform to test CPU affinity and NUMA-aware features in FreeBSD.


# 08f0b3c5 10-Dec-2009 Shteryana Shopova <syrinx@FreeBSD.org>

MFC r200063

Fix a problem with high CPU consumption (up to 30%) by bsnmpd on a loaded system.
Instead of constantly calling the mibII_idle function when the server is not busy
call the function only once every 10 seconds to avoid bsnmpd constantly doing
gettimeofday syscalls. Make the idle polling interval confugurable via
begemotIfDataPoll.


# bd96183d 03-Dec-2009 Shteryana Shopova <syrinx@FreeBSD.org>

Fix a problem with high CPU consumption (up to 30%) by bsnmpd on a loaded system.
Instead of constantly calling the mibII_idle function when the server is not busy
call the function only once every 10 seconds to avoid bsnmpd constantly doing
gettimeofday syscalls. Make the idle polling interval confugurable via
begemotIfDataPoll.

Reported and tested by: misho (at) aitbg (dot) com
Oked by: harti
MFC after: 1 week


# 26ea3468 18-Feb-2009 Warner Losh <imp@FreeBSD.org>

Add an extra (void *) cast. The struct if_msghdr has an 8 byte
alignment requirement, while rt_msghdr has a 4 byte alignment
requirement. The root cause is that if_msghdr has an struct if_data
which has an 8-byte alignment requirement due to a time_t that's
embedded in it. On MIPS, time_t is a 64-bit number, so must be 64-bit
aligned.

Since we don't access ifm_data.ifi_epoch, a simple cast is all that's
necessary here. It is likely the case that ifi_epoch should *NOT* be
a time_t because it is an uptime (time delta) an not an absolute time
since 1970. u_long is likely sufficient there since that gives an
uptime of 136 years will suffice for the foreseeable future.


# 6e6b3f7c 14-Dec-2008 Qing Li <qingli@FreeBSD.org>

This main goals of this project are:
1. separating L2 tables (ARP, NDP) from the L3 routing tables
2. removing as much locking dependencies among these layers as
possible to allow for some parallelism in the search operations
3. simplify the logic in the routing code,

The most notable end result is the obsolescent of the route
cloning (RTF_CLONING) concept, which translated into code reduction
in both IPv4 ARP and IPv6 NDP related modules, and size reduction in
struct rtentry{}. The change in design obsoletes the semantics of
RTF_CLONING, RTF_WASCLONE and RTF_LLINFO routing flags. The userland
applications such as "arp" and "ndp" have been modified to reflect
those changes. The output from "netstat -r" shows only the routing
entries.

Quite a few developers have contributed to this project in the
past: Glebius Smirnoff, Luigi Rizzo, Alessandro Cerri, and
Andre Oppermann. And most recently:

- Kip Macy revised the locking code completely, thus completing
the last piece of the puzzle, Kip has also been conducting
active functional testing
- Sam Leffler has helped me improving/refactoring the code, and
provided valuable reviews
- Julian Elischer setup the perforce tree for me and has helped
me maintaining that branch before the svn conversion


# d7f03759 19-Oct-2008 Ulf Lilleengen <lulf@FreeBSD.org>

- Import the HEAD csup code which is the basis for the cvsmode work.


# f929683d 30-Oct-2006 Hartmut Brandt <harti@FreeBSD.org>

Vendor patch: improve readability by using the IF_Mbps macro.

Submitted by: glebius


# 748b5b1e 27-Feb-2006 Hartmut Brandt <harti@FreeBSD.org>

Virgin import of bsnmpd 1.12


# c6a4e658 13-Feb-2006 Hartmut Brandt <harti@FreeBSD.org>

Vendor fix: make mibII HC counters really 64-bit on 32-bit platforms by polling
the kernel periodically.

Submitted by: glebius (partly)


# e6ef6163 10-Feb-2006 Hartmut Brandt <harti@FreeBSD.org>

Vendor patch: Make the link traps more RFC-conform.

Submitted by: glebius


# 9d165d9f 10-Jan-2006 Hartmut Brandt <harti@FreeBSD.org>

Vendor fix: the routing table can change while we are fetching it from
the kernel. Instead of complaining if we get an ENOMEM (meaning it got
larger than our buffer is) reallocate the buffer and loop.

Submitted by: maxim


# 165c5d31 04-Oct-2005 Hartmut Brandt <harti@FreeBSD.org>

Virgin import of bsnmpd 1.11


# 9ed6112d 24-May-2005 Hartmut Brandt <harti@FreeBSD.org>

Apply a vendor patch: silence gcc on arm (alignent when casting pointer).

Submitted by: Olivier Houchard <cognet@ci0.org>


# 69292ced 23-May-2005 Hartmut Brandt <harti@FreeBSD.org>

Virgin import of bsnmpd 1.10


# 94caccb3 28-Feb-2005 Hartmut Brandt <harti@FreeBSD.org>

Virgin import of bsnmpd 1.8


# 896052c1 06-Aug-2004 Hartmut Brandt <harti@FreeBSD.org>

Virgin import of bsnmpd 1.7


# 8eecd77a 14-Apr-2004 Hartmut Brandt <harti@FreeBSD.org>

Import of bsnmpd 1.6


# 70af00a1 23-Jan-2004 Hartmut Brandt <harti@FreeBSD.org>

Virgin import of bsnmpd 1.5a


# f06ca4af 10-Nov-2003 Hartmut Brandt <harti@FreeBSD.org>

Virgin import of bsnmp 1.4