netconf client was limited to 8K byte messages. Now limit is 2^32
This commit is contained in:
parent
4d82d4f6ea
commit
624b949b3f
11 changed files with 157 additions and 68 deletions
|
|
@ -188,35 +188,37 @@ netconf_input_cb(int s,
|
|||
return retval;
|
||||
}
|
||||
memset(buf, 0, sizeof(buf));
|
||||
if ((len = read(s, buf, sizeof(buf))) < 0){
|
||||
if (errno == ECONNRESET)
|
||||
len = 0; /* emulate EOF */
|
||||
else{
|
||||
clicon_log(LOG_ERR, "%s: read: %s", __FUNCTION__, strerror(errno));
|
||||
goto done;
|
||||
}
|
||||
} /* read */
|
||||
if (len == 0){ /* EOF */
|
||||
cc_closed++;
|
||||
close(s);
|
||||
retval = 0;
|
||||
goto done;
|
||||
}
|
||||
|
||||
for (i=0; i<len; i++){
|
||||
if (buf[i] == 0)
|
||||
continue; /* Skip NULL chars (eg from terminals) */
|
||||
cprintf(cb, "%c", buf[i]);
|
||||
if (detect_endtag("]]>]]>",
|
||||
buf[i],
|
||||
&xml_state)) {
|
||||
/* OK, we have an xml string from a client */
|
||||
if (process_incoming_packet(h, cb) < 0){
|
||||
while (1){
|
||||
if ((len = read(s, buf, sizeof(buf))) < 0){
|
||||
if (errno == ECONNRESET)
|
||||
len = 0; /* emulate EOF */
|
||||
else{
|
||||
clicon_log(LOG_ERR, "%s: read: %s", __FUNCTION__, strerror(errno));
|
||||
goto done;
|
||||
}
|
||||
if (cc_closed)
|
||||
break;
|
||||
cbuf_reset(cb);
|
||||
} /* read */
|
||||
if (len == 0){ /* EOF */
|
||||
cc_closed++;
|
||||
close(s);
|
||||
retval = 0;
|
||||
goto done;
|
||||
}
|
||||
|
||||
for (i=0; i<len; i++){
|
||||
if (buf[i] == 0)
|
||||
continue; /* Skip NULL chars (eg from terminals) */
|
||||
cprintf(cb, "%c", buf[i]);
|
||||
if (detect_endtag("]]>]]>",
|
||||
buf[i],
|
||||
&xml_state)) {
|
||||
/* OK, we have an xml string from a client */
|
||||
if (process_incoming_packet(h, cb) < 0){
|
||||
goto done;
|
||||
}
|
||||
if (cc_closed)
|
||||
break;
|
||||
cbuf_reset(cb);
|
||||
}
|
||||
}
|
||||
}
|
||||
retval = 0;
|
||||
|
|
|
|||
|
|
@ -312,9 +312,7 @@ netconf_edit_config(clicon_handle h,
|
|||
cxobj *x;
|
||||
cxobj *xfilter;
|
||||
char *ftype = NULL;
|
||||
cxobj *xcc; /* child of config */
|
||||
char *target; /* db */
|
||||
cbuf *cbxml = NULL;
|
||||
|
||||
/* must have target, and it should be candidate */
|
||||
if ((target = netconf_get_target(xn, "target")) == NULL ||
|
||||
|
|
@ -371,19 +369,12 @@ netconf_edit_config(clicon_handle h,
|
|||
goto ok;
|
||||
}
|
||||
#endif
|
||||
if ((cbxml = cbuf_new()) == NULL)
|
||||
goto done;
|
||||
if ((xcc = xml_child_i(xc, 0)) != NULL)
|
||||
if (clicon_xml2cbuf(cbxml, xcc, 0, 0) < 0)
|
||||
goto done;
|
||||
if (clicon_rpc_netconf_xml(h, xml_parent(xn), xret, NULL) < 0)
|
||||
goto done;
|
||||
}
|
||||
ok:
|
||||
retval = 0;
|
||||
done:
|
||||
if (cbxml)
|
||||
cbuf_free(cbxml);
|
||||
return retval;
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue