* Fixed: Netconf diff callback did not work with choice and same value replace

* Eg if YANG is `choice c { leaf x; leaf y }` and XML changed from `<x>42</x>` to `<y>42</y>` the datastrore changed, but was not detected by diff algorithms and provided to validate callbacks.
  * Thanks: Alexander Skorichenko, Netgate
This commit is contained in:
Olof hagsand 2021-08-17 16:51:08 +02:00
parent 8352e25860
commit c35ca82083
3 changed files with 47 additions and 1 deletions

View file

@ -608,7 +608,10 @@ xml_diff1(cxobj *x0,
b2 = xml_body(x1c);
if (b1 == NULL && b2 == NULL)
;
else if (b1 == NULL || b2 == NULL || strcmp(b1, b2) != 0){
else if (b1 == NULL || b2 == NULL
|| strcmp(b1, b2) != 0
|| strcmp(xml_name(x0c), xml_name(x1c)) != 0 /* Ex: choice { a:bool; b:bool } */
){
if (cxvec_append(x0c, changed_x0, changedlen) < 0)
goto done;
(*changedlen)--; /* append two vectors */