Comments (8)
👍
from gosnmp.
After a quick review of the source code, I was unable to locate a likely
source for this problem.
Do you think you could pin point where in the call graph this is blowing up?
On Mon, Apr 4, 2016 at 6:33 AM, Sonia Hamilton [email protected]
wrote:
[image: 👍]
—
You are receiving this because you are subscribed to this thread.
Reply to this email directly or view it on GitHub
#61 (comment)
Whitham D. Reeve II
907-764-5263
from gosnmp.
Hi @wdreeveii ,@sonia. I've done all the test again , And the problem happens only with security level "NoAuthNoPriv" and"AuthNoPriv" .
With security level "AuthPriv" the code works ok.
You can see current code here:
https://github.com/toni-moreno/influxsnmp/tree/added_snmpv3_support
Here one example of snmpwalk with 2 host snmp version 2c and other with snmpv3 with security mode AuthPriv.
[snmp.hostsnmpv3c]
#conection parameters
host = "hostsnmpv3c"
port = 161
timeout = 20
retries = 5
repeat = 0
#snmp version /auth params
snmpversion = "3"
v3seclevel = "AuthPriv"
#only needed if Auth v3 enabled
v3authuser = "v3userpriv"
v3authpass = "v3passpriv"
v3authprot = "MD5"
#only needed if Privacy v3 enabled
v3privpass = "v3passenc"
v3privprot = "DES"
[root@lab01 influxsnmp]# ./influxsnmp -names
SNMP host: 127.0.0.1
=========================================
lo .1.3.6.1.2.1.31.1.1.1.1.1
eth0 .1.3.6.1.2.1.31.1.1.1.1.2
SNMP host: hostsnmpv2_2
=========================================
lo .1.3.6.1.2.1.31.1.1.1.1.1
eth0 .1.3.6.1.2.1.31.1.1.1.1.2
SNMP host: hostsnmpv3c
=========================================
2016/04/04 22:54:19 Selected SI Auth - Priv
lo .1.3.6.1.2.1.31.1.1.1.1.1
eth0 .1.3.6.1.2.1.31.1.1.1.1.2
sit0 .1.3.6.1.2.1.31.1.1.1.1.3
Here with AuthNoPriv example config
[snmp.hostsnmpv3b]
#conection parameters
host = "hostsnmpv3b"
port = 161
timeout = 20
retries = 5
repeat = 0
#snmp version /auth params
snmpversion = "3"
v3seclevel = "AuthNoPriv"
#only needed if Auth v3 enabled
v3authuser = "v3userauth"
v3authpass = "v3passauth"
v3authprot = "MD5"
Here the output.
[root@grafanalab01 influxsnmp]# ./influxsnmp -names -verbose
Looking up column names for: 127.0.0.1 NAMES 1.3.6.1.2.1.31.1.1.1.1
COLUMNS [ifHCInOctets ifHCInUcastPkts ifHCOutOctets ifHCOutUcastPkts]
[1.3.6.1.2.1.31.1.1.1.6 1.3.6.1.2.1.31.1.1.1.7 1.3.6.1.2.1.31.1.1.1.10 1.3.6.1.2.1.31.1.1.1.11]
Looking up column names for: hostsnmpv2_2 NAMES 1.3.6.1.2.1.31.1.1.1.1
COLUMNS [ifHCInOctets ifHCInUcastPkts ifHCOutOctets ifHCOutUcastPkts]
[1.3.6.1.2.1.31.1.1.1.6 1.3.6.1.2.1.31.1.1.1.7 1.3.6.1.2.1.31.1.1.1.10 1.3.6.1.2.1.31.1.1.1.11]
2016/04/04 23:02:51 Selected SI Auth - No Priv
Looking up column names for: hostsnmpv3b NAMES 1.3.6.1.2.1.31.1.1.1.1
2016/04/04 23:02:51 SNMP bulkwalk error recover: runtime error: integer divide by zero
I don't know any better way to debug the exact point where code does "divide by zero", I'm still a beginner in the goland world.
But snmpbulkwalk command is working with these parameters.
[root@grafanalab01 influxsnmp]# snmpwalk -v 3 -u v3userauth -l authNoPriv -a MD5 -A v3passauth 192.168.1.99 ifName
IF-MIB::ifName.1 = STRING: lo
IF-MIB::ifName.2 = STRING: eth0
IF-MIB::ifName.3 = STRING: sit0
What can I do? There is any way to get a stacktrace in a easy way? I have tested unsuccessfully with this lib https://github.com/go-errors/errors .
Do you know any other way?
from gosnmp.
I nailed down that the divide by zero error is caused by a mod on a password field that is only dealt with when the security level is set to authpriv. I couldn't figure out why that code was enabled when you were doing auth only requests until I looked at your code.
https://github.com/toni-moreno/influxsnmp/blob/added_snmpv3_support/snmp.go#L302
You only ever pass the security mode as AuthPriv. Naturally all communication will then get performed in the AuthPriv security level, even if you don't provide a password.
I think the real failure here on gosnmp's part is that these params were not validated for sanity up front. A situation I will soon remedy.
from gosnmp.
@wdreeveii Thank you very much !!! And sorry for this terrible mistake
I've solved it and , tested successfully with snmpv2 and snmpv3 with the 3 security Levels.
[root@lab01 influxsnmp]# ./influxsnmp -names
SNMP host: 127.0.0.1
=========================================
lo .1.3.6.1.2.1.31.1.1.1.1.1
eth0 .1.3.6.1.2.1.31.1.1.1.1.2
SNMP host: hostsnmpv2_2
=========================================
lo .1.3.6.1.2.1.31.1.1.1.1.1
eth0 .1.3.6.1.2.1.31.1.1.1.1.2
SNMP host: hostsnmpv3a
=========================================
lo .1.3.6.1.2.1.31.1.1.1.1.1
eth0 .1.3.6.1.2.1.31.1.1.1.1.2
sit0 .1.3.6.1.2.1.31.1.1.1.1.3
SNMP host: hostsnmpv3b
=========================================
lo .1.3.6.1.2.1.31.1.1.1.1.1
eth0 .1.3.6.1.2.1.31.1.1.1.1.2
sit0 .1.3.6.1.2.1.31.1.1.1.1.3
SNMP host: hostsnmpv3c
=========================================
lo .1.3.6.1.2.1.31.1.1.1.1.1
eth0 .1.3.6.1.2.1.31.1.1.1.1.2
sit0 .1.3.6.1.2.1.31.1.1.1.1.3
from gosnmp.
Thanks @toni-moreno
Reopened, as I imagine @wdreeveii is going to submit a patch :-)
from gosnmp.
@wdreeveii poke :-)
from gosnmp.
I have committed code to validate parameters so this cannot happen any more.
from gosnmp.
Related Issues (20)
- usmStatsUnknownUserNames as terminating error? HOT 3
- Chinese coding is garbled HOT 2
- How to configure read/write community? HOT 1
- marshal: marshalPDU: unable to marshal varbind list: unable to marshal OID: Value out of range HOT 2
- Should cancelling a context interrupt an ongoing operation?
- out of bounds error when parsing AuthNoPriv packet HOT 4
- msgMaxSize to be supported in SNMP v3 bulkwalk requests
- V3 feat needed: Load keys manually if the passphrases are not allowed be saved locally HOT 1
- Connect function in gosnmp always returns nil even if the credentials are not valid HOT 1
- Panic in unmarshalV3Header
- Compatibility with GoSNMPServer HOT 7
- `net-snmp` based validation testing HOT 5
- Request ID size too large
- Not handling `0` values correctly for `OpaqueDouble` or `OpaqueFloat`
- Using SnmpDecodePacket for Encrypted/Authenticated Packets in GoSNMP HOT 5
- Retry netConnect() on resolution failure HOT 2
- bulkwalk can omit OIDs that snmpwalk does show HOT 1
- Unable to receive SNMP response message, but the other party confirmed that it has been sent.
- SNMP-V3 trap-send not work
- OID index in tabular oid result 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 gosnmp.