Filter duplicate NETCONF requests on the same object causing memory fault
This commit is contained in:
parent
1904805103
commit
1412b416f6
2 changed files with 30 additions and 1 deletions
|
|
@ -495,6 +495,7 @@ text_modify(clixon_handle h,
|
|||
yang_stmt *yc; /* yang child */
|
||||
cxobj **x0vec = NULL;
|
||||
int i;
|
||||
int j;
|
||||
int ret;
|
||||
char *instr = NULL;
|
||||
char *keystr = NULL;
|
||||
|
|
@ -921,7 +922,15 @@ text_modify(clixon_handle h,
|
|||
x0c = NULL;
|
||||
if (match_base_child(x0, x1c, yc, &x0c) < 0)
|
||||
goto done;
|
||||
x0vec[i++] = x0c; /* != NULL if x0c is matching x1c */
|
||||
if (x0c) {
|
||||
/* Duplicate check can happen if multiple operations on same object, whihc should be filtered, just silently drop */
|
||||
for (j=0; j<i; j++)
|
||||
if (x0vec[j] == x0c)
|
||||
break;
|
||||
if (j==i)
|
||||
x0vec[i++] = x0c; /* != NULL if x0c is matching x1c */
|
||||
}
|
||||
|
||||
}
|
||||
/* Second pass: Loop through children of the x1 modification tree again
|
||||
* Now potentially modify x0:s children
|
||||
|
|
|
|||
|
|
@ -66,6 +66,26 @@ fi
|
|||
new "wait backend"
|
||||
wait_backend
|
||||
|
||||
new "Add list entry"
|
||||
expecteof_netconf "$clixon_netconf -qf $cfg" 0 "$DEFAULTHELLO" "<rpc $DEFAULTNS><edit-config><target><candidate/></target><default-operation>merge</default-operation><config><c xmlns=\"urn:example:clixon\" xmlns:nc=\"${BASENS}\">
|
||||
<server>
|
||||
<name>one</name>
|
||||
<value>foo</value>
|
||||
</server>
|
||||
</c></config></edit-config></rpc>" "" "<rpc-reply $DEFAULTNS><ok/></rpc-reply>"
|
||||
|
||||
new "Add duplicate list entries"
|
||||
expecteof_netconf "$clixon_netconf -qf $cfg" 0 "$DEFAULTHELLO" "<rpc $DEFAULTNS><edit-config><target><candidate/></target><default-operation>none</default-operation><config><c xmlns=\"urn:example:clixon\" xmlns:nc=\"${BASENS}\">
|
||||
<server nc:operation=\"replace\">
|
||||
<name>one</name>
|
||||
<value>bar</value>
|
||||
</server>
|
||||
<server nc:operation=\"replace\">
|
||||
<name>one</name>
|
||||
<value>fie</value>
|
||||
</server>
|
||||
</c></config></edit-config></rpc>" "" "<rpc-reply $DEFAULTNS><rpc-error><error-type>application</error-type><error-tag>operation-failed</error-tag><error-app-tag>data-not-unique</error-app-tag><error-severity>error</error-severity><error-info><non-unique xmlns=\"urn:ietf:params:xml:ns:yang:1\">/rpc/edit-config/config/c/server[name=\"one\"]/name</non-unique></error-info></rpc-error></rpc-reply>"
|
||||
|
||||
new "Add list with duplicate"
|
||||
expecteof_netconf "$clixon_netconf -qf $cfg" 0 "$DEFAULTHELLO" "<rpc $DEFAULTNS><edit-config><target><candidate/></target><default-operation>replace</default-operation><config><c xmlns=\"urn:example:clixon\">
|
||||
<server>
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue