diff --git a/CHANGELOG.md b/CHANGELOG.md index d7379f90..c2075914 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -60,6 +60,7 @@ Developers may need to change their code ### Corrected Bugs +* Fixed: [unneeded trailing zero character on SNMP strings](https://github.com/clicon/clixon/issues/367) * Fixed: [message-id present on netconf app "hello"](https://github.com/clicon/clixon/issues/369) * Fixed: [SNMP "smiv2" yang extension doesn't work on augmented nodes](https://github.com/clicon/clixon/issues/366) diff --git a/apps/snmp/snmp_lib.c b/apps/snmp/snmp_lib.c index cbd2eabc..21aa107c 100644 --- a/apps/snmp/snmp_lib.c +++ b/apps/snmp/snmp_lib.c @@ -457,7 +457,9 @@ type_yang2asn1(yang_stmt *ys, if (yang_extension_value(yrp, "display-hint", IETF_YANG_SMIV2_NS, NULL, &display_hint) < 0) goto done; /* RFC2578/2579 but maybe all strings with display-hint should use this, eg exist>0? */ - if (display_hint && strcmp(display_hint, "255t")==0) + if (display_hint && + (strcmp(display_hint, "255a")==0 || + strcmp(display_hint, "255t")==0)) at = CLIXON_ASN_FIXED_STRING; } if (asn1_type) diff --git a/test/test_snmp_ifmib.sh b/test/test_snmp_ifmib.sh index 98ba9890..ee703589 100755 --- a/test/test_snmp_ifmib.sh +++ b/test/test_snmp_ifmib.sh @@ -370,8 +370,8 @@ expectpart "$($snmptable IF-MIB::ifTable)" 0 "Test 2" "1400" "1000" "11:22:33:44 new "Walk the walk..." expectpart "$($snmpwalk IF-MIB::ifTable)" 0 "IF-MIB::ifIndex.1 = INTEGER: 1" \ "IF-MIB::ifIndex.2 = INTEGER: 2" \ - "IF-MIB::ifDescr.1 = STRING: Test." \ - "IF-MIB::ifDescr.2 = STRING: Test 2." \ + "IF-MIB::ifDescr.1 = STRING: Test" \ + "IF-MIB::ifDescr.2 = STRING: Test 2" \ "IF-MIB::ifType.1 = INTEGER: ethernetCsmacd(6)" \ "IF-MIB::ifType.2 = INTEGER: ethernetCsmacd(6)" \ "IF-MIB::ifMtu.1 = INTEGER: 1500" \ diff --git a/test/test_snmp_system.sh b/test/test_snmp_system.sh index 922dbaf6..fdfdf440 100755 --- a/test/test_snmp_system.sh +++ b/test/test_snmp_system.sh @@ -217,19 +217,19 @@ expectpart "$($snmptable $OID_ORTABLE)" 0 ".*Entry 2 description.*" "IF-MIB::ifT expectpart "$($snmptable $NAME_ORTABLE)" 0 ".*Entry 1 description.*" "IP-MIB::ip" "1:7:10:33.44" expectpart "$($snmptable $NAME_ORTABLE)" 0 ".*Entry 2 description.*" "IF-MIB::ifTable" "129:20:58:31.11" -new "Walk the tabbles..." -expectpart "$($snmpwalkstr system)" 0 "SNMPv2-MIB::sysDescr = STRING: System description." \ +new "Walk the tables..." +expectpart "$($snmpwalkstr system)" 0 "SNMPv2-MIB::sysDescr = STRING: System description" \ "SNMPv2-MIB::sysUpTime = Timeticks: (11223344) 1 day, 7:10:33.44" \ - "SNMPv2-MIB::sysContact = STRING: clixon@clicon.com." \ - "SNMPv2-MIB::sysName = STRING: Test." \ - "SNMPv2-MIB::sysLocation = STRING: Clixon HQ." \ + "SNMPv2-MIB::sysContact = STRING: clixon@clicon.com" \ + "SNMPv2-MIB::sysName = STRING: Test" \ + "SNMPv2-MIB::sysLocation = STRING: Clixon HQ" \ "SNMPv2-MIB::sysServices = INTEGER: 72" \ "SNMPv2-MIB::sysORIndex.1 = INTEGER: 1" \ "SNMPv2-MIB::sysORIndex.2 = INTEGER: 2" \ "SNMPv2-MIB::sysORID.1 = OID: IP-MIB::ip" \ "SNMPv2-MIB::sysORID.2 = OID: IF-MIB::ifTable" \ - "SNMPv2-MIB::sysORDescr.1 = STRING: Entry 1 description." \ - "SNMPv2-MIB::sysORDescr.2 = STRING: Entry 2 description." \ + "SNMPv2-MIB::sysORDescr.1 = STRING: Entry 1 description" \ + "SNMPv2-MIB::sysORDescr.2 = STRING: Entry 2 description" \ "SNMPv2-MIB::sysORUpTime.1 = Timeticks: (11223344) 1 day, 7:10:33.44" \ "SNMPv2-MIB::sysORUpTime.2 = Timeticks: (1122111111) 129 days, 20:58:31.11"