Loosened strict RFC6022 session transport requirement due to race condition in clixon_snmp
This commit is contained in:
parent
000cb866c2
commit
0324135043
4 changed files with 22 additions and 3 deletions
|
|
@ -193,12 +193,18 @@ backend_monitoring_state_get(clicon_handle h,
|
|||
cprintf(cb, "<session>");
|
||||
cprintf(cb, "<session-id>%u</session-id>", ce->ce_id);
|
||||
if (ce->ce_transport == NULL){
|
||||
#ifdef NOTYET // XXX: too strict, race conditions in clixon_snmp
|
||||
clicon_err(OE_XML, 0, "Mandatory element transport missing");
|
||||
goto done;
|
||||
#else
|
||||
cprintf(cb, "<transport xmlns:%s=\"%s\">cl:netconf</transport>",
|
||||
CLIXON_LIB_PREFIX, CLIXON_LIB_NS);
|
||||
#endif
|
||||
}
|
||||
cprintf(cb, "<transport xmlns:%s=\"%s\">%s</transport>",
|
||||
CLIXON_LIB_PREFIX, CLIXON_LIB_NS,
|
||||
ce->ce_transport);
|
||||
else
|
||||
cprintf(cb, "<transport xmlns:%s=\"%s\">%s</transport>",
|
||||
CLIXON_LIB_PREFIX, CLIXON_LIB_NS,
|
||||
ce->ce_transport);
|
||||
cprintf(cb, "<username>%s</username>", ce->ce_username);
|
||||
if (ce->ce_source_host)
|
||||
cprintf(cb, "<source-host>%s</source-host>", ce->ce_source_host);
|
||||
|
|
|
|||
|
|
@ -135,6 +135,7 @@ int clicon_argv_set(clicon_handle h, char *argv0, int argc, char **argv);
|
|||
/*! Set and get (client/backend) session id */
|
||||
int clicon_session_id_set(clicon_handle h, uint32_t id);
|
||||
int clicon_session_id_get(clicon_handle h, uint32_t *id);
|
||||
int clicon_session_id_del(clicon_handle h);
|
||||
|
||||
/* If set, quit startup directly after upgrade */
|
||||
int clicon_quit_upgrade_get(clicon_handle h);
|
||||
|
|
|
|||
|
|
@ -828,6 +828,16 @@ clicon_session_id_get(clicon_handle h,
|
|||
return 0;
|
||||
}
|
||||
|
||||
/*! Delete session id
|
||||
*/
|
||||
int
|
||||
clicon_session_id_del(clicon_handle h)
|
||||
{
|
||||
clicon_hash_t *cdat = clicon_data(h);
|
||||
|
||||
return clicon_hash_del(cdat, (char*)"session-id");
|
||||
}
|
||||
|
||||
/*! Set session id
|
||||
* @param[in] h Clicon handle
|
||||
* @param[in] id Session id
|
||||
|
|
|
|||
|
|
@ -223,7 +223,9 @@ clicon_rpc_msg(clicon_handle h,
|
|||
goto done;
|
||||
}
|
||||
/* To disable this restart, unset PROTO_RESTART_RECONNECT */
|
||||
clicon_session_id_del(h);
|
||||
clicon_log(LOG_WARNING, "The backend was probably restarted and the client has reconnected to the backend. Any locks or candidate edits are lost.");
|
||||
|
||||
}
|
||||
#else
|
||||
clicon_err(OE_PROTO, ESHUTDOWN, "Unexpected close of CLICON_SOCK. Clixon backend daemon may have crashed.");
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue