Commit Graph

34 Commits

Author SHA1 Message Date
Enji Cooper
e9f8d18ebe 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.

MFC after: 2 weeks
CID: 1006551
Reported by: Coverity, gcc
Sponsored by: EMC / Isilon Storage Division
2016-04-22 07:51:38 +00:00
Gleb Smirnoff
bf840a1707 Redo r294869. The array of counters for TCP states doesn't belong to
struct tcpstat, because the structure can be zeroed out by netstat(1) -z,
and of course running connection counts shouldn't be touched.

Place running connection counts into separate array, and provide
separate read-only sysctl oid for it.
2016-03-15 00:15:10 +00:00
Bjoern A. Zeeb
ce42ce038e 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
2016-02-03 11:03:44 +00:00
Gleb Smirnoff
a781766836 Grab value for LEAF_tcpCurrEstab from net.inet.tcp.stats instead of
net.inet.tcp.pcblist, which is much cheaper.
2016-01-27 00:50:27 +00:00
Bjoern A. Zeeb
54902c0a6a 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.
2016-01-22 15:03:22 +00:00
Hartmut Brandt
5edd0d3a4d 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).
2016-01-21 16:11:20 +00:00
Marcelo Araujo
fa77157916 Fix variable 'old' is used uninitialized whenever '&&' condition is false.
Spotted by clang.

Differential Revision:	D2721
Reviewed by:		rodrigc, bapt
2015-08-07 06:15:01 +00:00
Gleb Smirnoff
8cc5fb3d91 Restore the ipNetToMedia MIB, that was broken with new ARP commit
in the r186119.

Submitted by:	Konstantin Kukushkin <dark rambler-co.ru>
2013-04-25 16:23:22 +00:00
Gleb Smirnoff
bc17db9558 Looks like support.h is really not needed here. 2012-10-18 13:46:26 +00:00
Maksim Yevmenkin
8651c115b8 put another bandaid on the build until i figure out bsnmp headers 2012-10-18 00:20:02 +00:00
Maksim Yevmenkin
aa21cf7851 fix build
MFC after:	1 week
2012-10-17 21:53:38 +00:00
Maksim Yevmenkin
6c9707c3b2 Count both IPv4 and IPv6 TCP connections in tcpCurrEstab
Timeout from:	current, syrinx
MFC after:	1 week
2012-06-06 18:00:38 +00:00
Bjoern A. Zeeb
1e629ba90f Adter r228571 unbreak architectures with strict alignment rules
by copying rather than casting.
2011-12-17 11:06:22 +00:00
Ruslan Ermilov
87a5818245 Properly detect interface's state in the LINK_STATE_UNKNOWN case.
MFC after:	1 week
2011-05-03 10:11:44 +00:00
Pyun YongHyeon
869ae66dfc Fix a typo introduced in r210936 which broke build. 2010-08-06 18:44:07 +00:00
John Baldwin
d99d8e2e38 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
2010-08-06 15:09:21 +00:00
Ulrich Spörlein
4f13bbb691 mdoc: consistently spell our email addresses <foo@FreeBSD.org>
Reviewed by:	ru
Approved by:	harti
2010-05-24 06:26:38 +00:00
Shteryana Shopova
bd96183d5e 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
2009-12-03 16:08:00 +00:00
Warner Losh
26ea346865 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.
2009-02-18 19:59:27 +00:00
Qing Li
6e6b3f7cbc 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
2008-12-15 06:10:57 +00:00
Hartmut Brandt
f929683df1 Vendor patch: improve readability by using the IF_Mbps macro.
Submitted by:	glebius
2006-10-30 16:56:38 +00:00
Hartmut Brandt
748b5b1ebd Virgin import of bsnmpd 1.12 2006-02-27 16:16:18 +00:00
Hartmut Brandt
c6a4e65805 Vendor fix: make mibII HC counters really 64-bit on 32-bit platforms by polling
the kernel periodically.

Submitted by:	glebius (partly)
2006-02-13 14:11:18 +00:00
Hartmut Brandt
e6ef6163fd Vendor patch: Make the link traps more RFC-conform.
Submitted by:	glebius
2006-02-10 16:49:49 +00:00
Hartmut Brandt
9d165d9f13 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
2006-01-10 11:59:31 +00:00
Hartmut Brandt
361b40a30d 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
2005-11-02 14:05:49 +00:00
Hartmut Brandt
165c5d31cb Virgin import of bsnmpd 1.11 2005-10-04 14:41:06 +00:00
Hartmut Brandt
9ed6112d51 Apply a vendor patch: silence gcc on arm (alignent when casting pointer).
Submitted by:	Olivier Houchard <cognet@ci0.org>
2005-05-25 12:00:03 +00:00
Hartmut Brandt
69292ced51 Virgin import of bsnmpd 1.10 2005-05-23 11:19:11 +00:00
Hartmut Brandt
94caccb357 Virgin import of bsnmpd 1.8 2005-02-28 17:27:11 +00:00
Hartmut Brandt
896052c10f Virgin import of bsnmpd 1.7 2004-08-06 13:38:30 +00:00
Hartmut Brandt
8eecd77ad5 Import of bsnmpd 1.6 2004-04-14 16:20:14 +00:00
Hartmut Brandt
70af00a124 Virgin import of bsnmpd 1.5a 2004-01-23 10:44:47 +00:00
Hartmut Brandt
f06ca4af18 Virgin import of bsnmp 1.4 2003-11-10 08:53:38 +00:00