Comments (6)
Wouldn't what has been suggested above confuse all source code editors that support automatic indentation?
The patch has been applied on the v5.8 and master branches. The first release in which this patch will be included will have version number v5.8.1.
from net-snmp.
This is due to the code at https://github.com/net-snmp/net-snmp/blob/master/agent/netsnmp_close_fds.c#L35 and the fact that your system supports 1886130 file descriptors - net-snmp is trying to close all of the ones it doesn't need. Does FreeBSD support a way to enumerate the file descriptors a process has open, like Linux's /proc/self/fd
?
from net-snmp.
Maybe you can use fstat -p <pid>
or procstat -f <pid>
.
fstat Example:
USER CMD PID FD MOUNT INUM MODE SZ|DV R/W
root snmpd 84096 text / 2491114 -rwxr-xr-x 28400 r
root snmpd 84096 wd / 2 drwxr-xr-x 1024 r
root snmpd 84096 root / 2 drwxr-xr-x 1024 r
root snmpd 84096 0 /dev 23 crw-rw-rw- null rw
root snmpd 84096 1 /dev 23 crw-rw-rw- null rw
root snmpd 84096 2 /dev 23 crw-rw-rw- null rw
root snmpd 84096 3 - 1364737 -rw------- 187 w
root snmpd 84096 4 /dev 19 crw-r----- mem r
root snmpd 84096 5 /dev 20 crw-r----- kmem r
root snmpd 84096 6* pipe fffff80010c055f0 <-> fffff80010c05758 0 rw
root snmpd 84096 7* pipe fffff80010c05758 <-> fffff80010c055f0 0 rw
root snmpd 84096 8* internet dgram udp fffff800a1d3f570
root snmpd 84096 11* pipe fffff8001099b2f8 <-> fffff8001099b460 0 rw
procstat Example:
PID COMM FD T V FLAGS REF OFFSET PRO NAME
84096 snmpd text v r r------- - - - /usr/local/sbin/snmpd
84096 snmpd cwd v d r------- - - - /
84096 snmpd root v d r------- - - - /
84096 snmpd 0 v c rw------ 3 0 - /dev/null
84096 snmpd 1 v c rw------ 3 0 - /dev/null
84096 snmpd 2 v c rw------ 3 0 - /dev/null
84096 snmpd 3 v r -w------ 1 105 - -
84096 snmpd 4 v c r------- 1 0 - /dev/mem
84096 snmpd 5 v c r------- 1 0 - /dev/kmem
84096 snmpd 6 p - rw------ 1 0 - -
84096 snmpd 7 p - rw------ 1 0 - -
84096 snmpd 8 s - rw------ 1 0 UDP 0.0.0.0:161 0.0.0.0:0
from net-snmp.
Well, I also found this:
https://www.freebsd.org/cgi/man.cgi?query=fdescfs&sektion=5&manpath=freebsd-release-ports
So, in the source code, you could change if ((dir = opendir("/proc/self/fd"))) {
to if ((dir = opendir("/dev/fd"))) {
if the system is freeBSD....
I really don't know how to get the OS using the sources from net-snmp, but found this piece of code the gives me hint: http://net-snmp.sourceforge.net/dev/agent/acconfig_8h_source.html
Or just make it more easy, like this:
(...)
dir = opendir("/proc/self/fd");
if (! dir)
dir = opendir("/dev/fd");
if (dir) {
(...)
Can I make a pull request?
from net-snmp.
I'd like to keep the Linux and BSD code separate in case /dev/fd would ever be introduced on Linux or /proc/self/fd on BSD. Can you have a look at what I just checked in?
from net-snmp.
I think that will solve the issue. On which version will this be applied?
Just for suggestion, I would make the code a little cleaner, but off course, its up to you.
#ifdef __linux__
dir = opendir("/proc/self/fd");
#elif defined(__FreeBSD__) || defined(__OpenBSD__)
dir = opendir("/dev/fd");
#endif
while ((ent = readdir(dir))) {
if (sscanf(ent->d_name, "%d", &i) == 1) {
if (i > largest_fd)
largest_fd = i;
}
}
closedir(dir);
if (largest_fd < 0)
largest_fd = getdtablesize() - 1;
for (i = largest_fd; i > fd && i >= 0; i--)
close(i);
from net-snmp.
Related Issues (20)
- Authentication protocol comparison uses the passphrase rather than the protocol HOT 4
- snmpv3: Unsupported SecLevel not reported when "auth" is configured, but "noAuthNoPriv" is requested
- SIGPIPE crash in linux HOT 1
- Timeout upon unknown context name
- Linux MemAvailable value not available. HOT 6
- Snmpwalk from OL8 to AIX 5.3 timeout
- High cpu usage stuck on 100% after snmpwalk HOT 8
- SNMP 5.8: SNMPv3 user created with authNoPriv could not poll data
- SNMP 5.8: Still could poll data with SNMPv3 user even though SNMPv2 enabled HOT 1
- Net-snmp 5.9.4 does not support the Linux kernel 6.7 /proc/net/snmp file HOT 15
- Any plans to release 5.9.5? HOT 15
- 5.9.4: test suite fails HOT 4
- What is config file path for net-snmp 5.9.4? HOT 4
- LOOKING FOR FIX: snmptrapd: race in snmp_call_callbacks() vs handle_agentx_packet() causes crash on shutdown HOT 1
- The vulnerability is a memory leak bug located at line 320 of the file /net-snmp/apps/snmpvacm.c HOT 2
- Occasional crash when terminating snmpd_agent version 5.9.1
- SNMPv3 not working for these combinations auth_proto SHA224/SHA256/SHA384/SHA512 with priv_proto AES192orAES256
- Get credentials in pass_persist script
- snmpd: Windows, hanging / crashing
- Agent Behaviour - agentaddress HOT 2
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from net-snmp.