History log of /freebsd-10-stable/contrib/bsnmp/snmp_mibII/mibII_interfaces.c
Revision Date Author Comments
(<<< Hide modified files)
(Show modified files >>>)
# 338311 25-Aug-2018 eugen

MFC 338013: 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
Differential Revision: https://reviews.freebsd.org/D16459


# 312089 14-Jan-2017 ngie

MFC r310950:

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)

CID: 1009652-1009656, 1349850


# 310903 31-Dec-2016 ngie

MFstable/11 r310901:

MFC r310648:

style(9): clean up trailing whitespace


# 301663 08-Jun-2016 ngie

MFC r294507,r294567,r299466:

r294507 (by harti):

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).

r294567 (by bz):

Change the variable to a #define in order to make gcc happy which
otherwise will complain about "variably modified 'alias' at file scope".
Unbreaks the build on gcc platforms.

r299466 (by cem):

bsnmpd: Fix size of trapsink::comm to match other community arrays

This fixes a number of possible strcpy() buffer overruns between the various
community strings in trap.c.

CIDs: 1006820, 1006821, 1006822


# 299638 13-May-2016 ngie

MFC r298462:

Return `ret` in op_ifentry(..) to mute a -Wunused-but-set-variable warning

This will also now detect error conditions with
value->var.subs[sub - 1] == LEAF_ifPhysAddress where `string_get(..)`
could fail if iifp->physaddr and/or iifp->physaddrlen were deemed
invalid.

CID: 1006551


# 256281 10-Oct-2013 gjb

Copy head (r256279) to stable/10 as part of the 10.0-RELEASE cycle.

Approved by: re (implicit)
Sponsored by: The FreeBSD Foundation

# 221373 03-May-2011 ru

Properly detect interface's state in the LINK_STATE_UNKNOWN case.

MFC after: 1 week


# 156067 27-Feb-2006 harti

This commit was generated by cvs2svn to compensate for changes in r156066,
which included commits to RCS files with non-trunk default branches.


# 156066 27-Feb-2006 harti

Virgin import of bsnmpd 1.12


# 155602 13-Feb-2006 harti

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

Submitted by: glebius (partly)


# 151970 02-Nov-2005 harti

Vendor patch: fix the reporting of ifOperStatus. We now consider an
interface up when it is running AND the link is not down (that is, it is
up or unknown). If the interface is running but the link is down, we return
state 'dormant', because we're waiting for an external event. Otherwise
the interface is 'down'.

Submitted by: csjp
Reviewed by: glebius


# 146525 23-May-2005 harti

Virgin import of bsnmpd 1.10


# 142810 28-Feb-2005 harti

Virgin import of bsnmpd 1.8


# 133211 06-Aug-2004 harti

Virgin import of bsnmpd 1.7


# 128237 14-Apr-2004 harti

Import of bsnmpd 1.6


# 124861 23-Jan-2004 harti

Virgin import of bsnmpd 1.5a


# 122394 10-Nov-2003 harti

Virgin import of bsnmp 1.4