-
Notifications
You must be signed in to change notification settings - Fork 318
Open
Description
Summary
I have tried to root cause this. As far as I have understood it, when augmenting IETF standard modules (ietf-interfaces, ietf-ip) with enumerations that have:
- Values declared out of ascending order
- Values ≥32 being set
- Active sysrepo subscriptions (running & candidate), it is sysrepo-plugind that crashes.
In the log i get Failed to find matching hash for a top-level node from "sysrepo-notifications".
Environment
- libyang version: 4.2.x (master with all commits on devel marked BUGFIX)
- sysrepo version: 4.2.10
- System: Infix Linux embedded system
Minimal YANG Reproducer
module test-augment-enum-order {
yang-version 1.1;
namespace "urn:test:augment-enum-order";
prefix test;
import ietf-interfaces { prefix if; }
import ietf-ip { prefix ip; }
description "Reproducer for LYB hash bug with out-of-order enums";
augment "/if:interfaces/if:interface/ip:ipv6" {
container test-order {
presence "Test out-of-order enums";
leaf test-value {
type enumeration {
enum value-1 { value 1; }
enum value-56 { value 56; }
enum value-25 { value 25; }
enum value-39 { value 39; }
enum value-32 { value 32; }
enum value-31 { value 31; }
}
}
}
}
}
Note: Enums are declared out of order: 1, 56, 25, 39, 32, 31
1,25,31 will pass, the rest fail.
It is also possible to reproduce in infix (virtual x86_64), commit c56a9f2c0ea2873329d9eb75e3a44d320a1287af, by setting admin@bpi-26-60-00:/config/interface/e1/ipv6/> set dhcp option ntp-server
(value 56)
Trigger the bug via netopeer2 (2.7.0)
# Connect to NETCONF server
netopeer2-cli
> connect --host localhost --login admin
# Edit candidate with high enum value (≥32)
> edit-config --target candidate --config=/tmp/test.xml
> commit
test.xml:
<interfaces xmlns="urn:ietf:params:xml:ns:yang:ietf-interfaces">
<interface>
<name>eth0</name>
<ipv6 xmlns="urn:ietf:params:xml:ns:yang:ietf-ip">
<test-order xmlns="urn:test:augment-enum-order">
<test-value>value-56</test-value>
</test-order>
</ipv6>
</interface>
</interfaces>
Workaround
Reorder enumeration declarations to ascending order by value:
type enumeration {
enum value-1 { value 1; }
enum value-25 { value 25; }
enum value-31 { value 31; }
enum value-32 { value 32; }
enum value-39 { value 39; }
enum value-56 { value 56; }
}
After reordering, all values work correctly, but it feels a little shaky.
Metadata
Metadata
Assignees
Labels
No labels