Fixed: [unneeded trailing zero character on SNMP strings](https://github.com/clicon/clixon/issues/367)

This commit is contained in:
Olof hagsand 2022-10-03 18:39:30 +02:00
parent 4a5e0c1832
commit 954e5d56fd
4 changed files with 13 additions and 10 deletions

View file

@ -60,6 +60,7 @@ Developers may need to change their code
### Corrected Bugs ### 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: [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) * Fixed: [SNMP "smiv2" yang extension doesn't work on augmented nodes](https://github.com/clicon/clixon/issues/366)

View file

@ -457,7 +457,9 @@ type_yang2asn1(yang_stmt *ys,
if (yang_extension_value(yrp, "display-hint", IETF_YANG_SMIV2_NS, NULL, &display_hint) < 0) if (yang_extension_value(yrp, "display-hint", IETF_YANG_SMIV2_NS, NULL, &display_hint) < 0)
goto done; goto done;
/* RFC2578/2579 but maybe all strings with display-hint should use this, eg exist>0? */ /* 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; at = CLIXON_ASN_FIXED_STRING;
} }
if (asn1_type) if (asn1_type)

View file

@ -370,8 +370,8 @@ expectpart "$($snmptable IF-MIB::ifTable)" 0 "Test 2" "1400" "1000" "11:22:33:44
new "Walk the walk..." new "Walk the walk..."
expectpart "$($snmpwalk IF-MIB::ifTable)" 0 "IF-MIB::ifIndex.1 = INTEGER: 1" \ expectpart "$($snmpwalk IF-MIB::ifTable)" 0 "IF-MIB::ifIndex.1 = INTEGER: 1" \
"IF-MIB::ifIndex.2 = INTEGER: 2" \ "IF-MIB::ifIndex.2 = INTEGER: 2" \
"IF-MIB::ifDescr.1 = STRING: Test." \ "IF-MIB::ifDescr.1 = STRING: Test" \
"IF-MIB::ifDescr.2 = STRING: Test 2." \ "IF-MIB::ifDescr.2 = STRING: Test 2" \
"IF-MIB::ifType.1 = INTEGER: ethernetCsmacd(6)" \ "IF-MIB::ifType.1 = INTEGER: ethernetCsmacd(6)" \
"IF-MIB::ifType.2 = INTEGER: ethernetCsmacd(6)" \ "IF-MIB::ifType.2 = INTEGER: ethernetCsmacd(6)" \
"IF-MIB::ifMtu.1 = INTEGER: 1500" \ "IF-MIB::ifMtu.1 = INTEGER: 1500" \

View file

@ -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 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" expectpart "$($snmptable $NAME_ORTABLE)" 0 ".*Entry 2 description.*" "IF-MIB::ifTable" "129:20:58:31.11"
new "Walk the tabbles..." new "Walk the tables..."
expectpart "$($snmpwalkstr system)" 0 "SNMPv2-MIB::sysDescr = STRING: System description." \ expectpart "$($snmpwalkstr system)" 0 "SNMPv2-MIB::sysDescr = STRING: System description" \
"SNMPv2-MIB::sysUpTime = Timeticks: (11223344) 1 day, 7:10:33.44" \ "SNMPv2-MIB::sysUpTime = Timeticks: (11223344) 1 day, 7:10:33.44" \
"SNMPv2-MIB::sysContact = STRING: clixon@clicon.com." \ "SNMPv2-MIB::sysContact = STRING: clixon@clicon.com" \
"SNMPv2-MIB::sysName = STRING: Test." \ "SNMPv2-MIB::sysName = STRING: Test" \
"SNMPv2-MIB::sysLocation = STRING: Clixon HQ." \ "SNMPv2-MIB::sysLocation = STRING: Clixon HQ" \
"SNMPv2-MIB::sysServices = INTEGER: 72" \ "SNMPv2-MIB::sysServices = INTEGER: 72" \
"SNMPv2-MIB::sysORIndex.1 = INTEGER: 1" \ "SNMPv2-MIB::sysORIndex.1 = INTEGER: 1" \
"SNMPv2-MIB::sysORIndex.2 = INTEGER: 2" \ "SNMPv2-MIB::sysORIndex.2 = INTEGER: 2" \
"SNMPv2-MIB::sysORID.1 = OID: IP-MIB::ip" \ "SNMPv2-MIB::sysORID.1 = OID: IP-MIB::ip" \
"SNMPv2-MIB::sysORID.2 = OID: IF-MIB::ifTable" \ "SNMPv2-MIB::sysORID.2 = OID: IF-MIB::ifTable" \
"SNMPv2-MIB::sysORDescr.1 = STRING: Entry 1 description." \ "SNMPv2-MIB::sysORDescr.1 = STRING: Entry 1 description" \
"SNMPv2-MIB::sysORDescr.2 = STRING: Entry 2 description." \ "SNMPv2-MIB::sysORDescr.2 = STRING: Entry 2 description" \
"SNMPv2-MIB::sysORUpTime.1 = Timeticks: (11223344) 1 day, 7:10:33.44" \ "SNMPv2-MIB::sysORUpTime.1 = Timeticks: (11223344) 1 day, 7:10:33.44" \
"SNMPv2-MIB::sysORUpTime.2 = Timeticks: (1122111111) 129 days, 20:58:31.11" "SNMPv2-MIB::sysORUpTime.2 = Timeticks: (1122111111) 129 days, 20:58:31.11"