NETWAYS / check_interfaces

Icinga check plugin for network hardware interfaces
GNU General Public License v2.0
11 stars 14 forks source link

Alias string gets truncated #2

Closed McBane87 closed 5 years ago

McBane87 commented 5 years ago

Alias should have more chars in my opinion:

--- snmp_bulkget.h 2018-12-05 13:10:04.756811933 +0100
+++ snmp_bulkget.h      2018-12-05 13:05:51.000000000 +0100
@@ -17,6 +17,7 @@
  */
 #define MAX_STRING 65536
 #define MAX_DESCR_LEN 60
+#define MAX_ALIAS_LEN 250
 #define UPTIME_TOLERANCE_IN_SECS 30
 #define OFLO32 4294967295ULL
 #define OFLO64 18446744073709551615ULL
@@ -48,7 +49,7 @@
     int     status;
     int     err_disable;
     char    descr[MAX_DESCR_LEN];
-    char    alias[MAX_DESCR_LEN];
+    char    alias[MAX_ALIAS_LEN];
     char    name[MAX_DESCR_LEN];
     u64     inOctets;
     u64     outOctets;
mxhash commented 5 years ago

Hi,

I think this makes totally sense to me. What is the 250 based on?

Cheers, Marius

McBane87 commented 5 years ago

Was randomly chosen. I only wanted to make sure the vlaue is big enough :-)

My example value, when I relized this kind of bug, was 85 chars long. So I guess something smaller would also be okay.

mxhash commented 5 years ago

Check, I looks like the ifDescr and ifAlias are both using DisplayString from SNMPv2-TC which says: "Any object defined using this syntax may not exceed 255 characters in length". So 250 was a good shot ;-)

It looks like you have the changes ready. Do you want to provide a PR for that?

Cheers, Marius

https://tools.ietf.org/html/draft-ietf-snmpv2-tc-02 (DisplayName) https://www.ietf.org/rfc/rfc1213.txt (ifDescr) https://www.ietf.org/rfc/rfc2233.txt (IfXEntry, ifAlias)

McBane87 commented 5 years ago

He, lucky guess^^

No, Thanks. You can add those small changes using my patch from above, if want to :-)

mxhash commented 5 years ago

Cause name is the same, I just increase the constant. Still works? I have no environment to test ;-)

McBane87 commented 5 years ago

Yes, thank you. Looks like it is working :-)