Discriminate APP debugging

This commit is contained in:
Philip Prindeville 2024-01-04 15:40:53 -07:00 committed by Olof Hagsand
parent 063c8d664f
commit 0ec1e0a686
36 changed files with 366 additions and 365 deletions

View file

@ -131,7 +131,7 @@ api_http_data_err(clixon_handle h,
int retval = -1;
cbuf *cb = NULL;
clixon_debug(CLIXON_DBG_DEFAULT, "%s", __FUNCTION__);
clixon_debug(CLIXON_DBG_CLIENT, "%s", __FUNCTION__);
if ((cb = cbuf_new()) == NULL){
clixon_err(OE_UNIX, errno, "cbuf_new");
goto done;
@ -153,7 +153,7 @@ api_http_data_err(clixon_handle h,
// ok:
retval = 0;
done:
clixon_debug(CLIXON_DBG_DEFAULT, "%s retval:%d", __FUNCTION__, retval);
clixon_debug(CLIXON_DBG_CLIENT, "%s retval:%d", __FUNCTION__, retval);
if (cb)
cbuf_free(cb);
return retval;
@ -192,7 +192,7 @@ http_data_check_file_path(clixon_handle h,
goto done;
}
p = cbuf_get(cbpath);
clixon_debug(CLIXON_DBG_DEFAULT, "%s %s", __FUNCTION__, p);
clixon_debug(CLIXON_DBG_CLIENT, "%s %s", __FUNCTION__, p);
if (strncmp(prefix, p, strlen(prefix)) != 0){
clixon_err(OE_UNIX, EINVAL, "prefix is not prefix of cbpath");
goto done;
@ -202,31 +202,31 @@ http_data_check_file_path(clixon_handle h,
p[i] = '\0';
/* Ensure not soft link */
if (lstat(p, &fstat) < 0){
clixon_debug(CLIXON_DBG_DEFAULT, "%s Error lstat(%s):%s", __FUNCTION__, p, strerror(errno));
clixon_debug(CLIXON_DBG_CLIENT, "%s Error lstat(%s):%s", __FUNCTION__, p, strerror(errno));
code = 404;
goto invalid;
}
if (!S_ISDIR(fstat.st_mode)){
clixon_debug(CLIXON_DBG_DEFAULT, "%s Error lstat(%s): Not dir", __FUNCTION__, p);
clixon_debug(CLIXON_DBG_CLIENT, "%s Error lstat(%s): Not dir", __FUNCTION__, p);
code = 403;
goto invalid;
}
p[i] = '/';
}
else if (p[i] == '~'){
clixon_debug(CLIXON_DBG_DEFAULT, "%s Error lstat(%s): ~ not allowed in file path", __FUNCTION__, p);
clixon_debug(CLIXON_DBG_CLIENT, "%s Error lstat(%s): ~ not allowed in file path", __FUNCTION__, p);
code = 403;
goto invalid;
}
else if (p[i] == '.' && i>strlen(prefix) && p[i-1] == '.'){
clixon_debug(CLIXON_DBG_DEFAULT, "%s Error lstat(%s): .. not allowed in file path", __FUNCTION__, p);
clixon_debug(CLIXON_DBG_CLIENT, "%s Error lstat(%s): .. not allowed in file path", __FUNCTION__, p);
code = 403;
goto invalid;
}
}
/* Resulting file (ensure not soft link) */
if (lstat(p, &fstat) < 0){
clixon_debug(CLIXON_DBG_DEFAULT, "%s Error lstat(%s):%s", __FUNCTION__, p, strerror(errno));
clixon_debug(CLIXON_DBG_CLIENT, "%s Error lstat(%s):%s", __FUNCTION__, p, strerror(errno));
code = 404;
goto invalid;
}
@ -235,22 +235,22 @@ http_data_check_file_path(clixon_handle h,
if (S_ISDIR(fstat.st_mode)){
cprintf(cbpath, "/%s", HTTP_DATA_INTERNAL_REDIRECT);
p = cbuf_get(cbpath);
clixon_debug(CLIXON_DBG_DEFAULT, "%s internal redirect: %s", __FUNCTION__, p);
clixon_debug(CLIXON_DBG_CLIENT, "%s internal redirect: %s", __FUNCTION__, p);
if (lstat(p, &fstat) < 0){
clixon_debug(CLIXON_DBG_DEFAULT, "%s Error lstat(%s):%s", __FUNCTION__, p, strerror(errno));
clixon_debug(CLIXON_DBG_CLIENT, "%s Error lstat(%s):%s", __FUNCTION__, p, strerror(errno));
code = 404;
goto invalid;
}
}
#endif
if (!S_ISREG(fstat.st_mode)){
clixon_debug(CLIXON_DBG_DEFAULT, "%s Error lstat(%s): Not regular file", __FUNCTION__, p);
clixon_debug(CLIXON_DBG_CLIENT, "%s Error lstat(%s): Not regular file", __FUNCTION__, p);
code = 403;
goto invalid;
}
*fsz = fstat.st_size;
if ((f = fopen(p, "rb")) == NULL){
clixon_debug(CLIXON_DBG_DEFAULT, "%s Error fopen(%s) %s", __FUNCTION__, p, strerror(errno));
clixon_debug(CLIXON_DBG_CLIENT, "%s Error fopen(%s) %s", __FUNCTION__, p, strerror(errno));
code = 403;
goto invalid;
}
@ -296,7 +296,7 @@ api_http_data_file(clixon_handle h,
char *buf = NULL;
size_t sz;
clixon_debug(CLIXON_DBG_DEFAULT, "%s", __FUNCTION__);
clixon_debug(CLIXON_DBG_CLIENT, "%s", __FUNCTION__);
if ((cbfile = cbuf_new()) == NULL){
clixon_err(OE_UNIX, errno, "cbuf_new");
goto done;
@ -309,7 +309,7 @@ api_http_data_file(clixon_handle h,
cprintf(cbfile, "%s", www_data_root);
if (pathname){
if (strlen(pathname) && pathname[0] != '/'){
clixon_debug(CLIXON_DBG_DEFAULT, "%s Error fopen(%s) pathname not prefixed with /",
clixon_debug(CLIXON_DBG_CLIENT, "%s Error fopen(%s) pathname not prefixed with /",
__FUNCTION__, pathname);
if (api_http_data_err(h, req, 404) < 0)
goto done;
@ -338,7 +338,7 @@ api_http_data_file(clixon_handle h,
fsize = ftell(f);
/* Extra sanity check, had some problems with wrong file types */
if (fsz != fsize){
clixon_debug(CLIXON_DBG_DEFAULT, "%s Error file %s size mismatch sz:%zu vs %li",
clixon_debug(CLIXON_DBG_CLIENT, "%s Error file %s size mismatch sz:%zu vs %li",
__FUNCTION__, filename, (size_t)fsz, fsize);
if (api_http_data_err(h, req, 500) < 0) /* Internal error? */
goto done;
@ -362,7 +362,7 @@ api_http_data_file(clixon_handle h,
}
sz = (size_t)ret;
if (sz != 1){
clixon_debug(CLIXON_DBG_DEFAULT, "%s Error fread(%s) sz:%zu", __FUNCTION__, filename, sz);
clixon_debug(CLIXON_DBG_CLIENT, "%s Error fread(%s) sz:%zu", __FUNCTION__, filename, sz);
if (api_http_data_err(h, req, 500) < 0) /* Internal error? */
goto done;
goto ok;
@ -376,7 +376,7 @@ api_http_data_file(clixon_handle h,
if (restconf_reply_send(req, 200, cbdata, head) < 0)
goto done;
cbdata = NULL; /* consumed by reply-send */
clixon_debug(CLIXON_DBG_DEFAULT, "%s Read %s OK", __FUNCTION__, filename);
clixon_debug(CLIXON_DBG_CLIENT, "%s Read %s OK", __FUNCTION__, filename);
ok:
retval = 0;
done:
@ -423,7 +423,7 @@ api_http_data(clixon_handle h,
cbuf *indata = NULL;
char *path = NULL;
clixon_debug(CLIXON_DBG_DEFAULT, "%s", __FUNCTION__);
clixon_debug(CLIXON_DBG_CLIENT, "%s", __FUNCTION__);
if (req == NULL){
errno = EINVAL;
goto done;
@ -498,6 +498,6 @@ api_http_data(clixon_handle h,
done:
if (path)
free(path);
clixon_debug(CLIXON_DBG_DEFAULT, "%s %d", __FUNCTION__, retval);
clixon_debug(CLIXON_DBG_CLIENT, "%s %d", __FUNCTION__, retval);
return retval;
}

View file

@ -86,7 +86,7 @@ restconf_reply_header(void *req0,
char *value = NULL;
va_list ap;
clixon_debug(CLIXON_DBG_DEFAULT, "%s %s", __FUNCTION__, name);
clixon_debug(CLIXON_DBG_CLIENT, "%s %s", __FUNCTION__, name);
if (sd == NULL || name == NULL || vfmt == NULL){
clixon_err(OE_CFG, EINVAL, "sd, name or value is NULL");
goto done;
@ -142,7 +142,7 @@ restconf_reply_send(void *req0,
int retval = -1;
restconf_stream_data *sd = (restconf_stream_data *)req0;
clixon_debug(CLIXON_DBG_DEFAULT, "%s code:%d", __FUNCTION__, code);
clixon_debug(CLIXON_DBG_CLIENT, "%s code:%d", __FUNCTION__, code);
if (sd == NULL){
clixon_err(OE_CFG, EINVAL, "sd is NULL");
goto done;

View file

@ -218,7 +218,7 @@ api_return_err(clixon_handle h,
cxobj *xmsg;
char *mb;
clixon_debug(CLIXON_DBG_DEFAULT, "%s", __FUNCTION__);
clixon_debug(CLIXON_DBG_CLIENT, "%s", __FUNCTION__);
if ((cb = cbuf_new()) == NULL){
clixon_err(OE_UNIX, errno, "cbuf_new");
goto done;
@ -249,7 +249,7 @@ api_return_err(clixon_handle h,
}
}
#if 1
clixon_debug_xml(CLIXON_DBG_DEFAULT, xerr, "%s Send error:", __FUNCTION__);
clixon_debug_xml(CLIXON_DBG_CLIENT, xerr, "%s Send error:", __FUNCTION__);
#endif
if (xml_name_set(xerr, "error") < 0)
goto done;
@ -286,7 +286,7 @@ api_return_err(clixon_handle h,
case YANG_DATA_XML:
case YANG_PATCH_XML:
case YANG_PAGINATION_XML:
clixon_debug(CLIXON_DBG_DEFAULT, "%s code:%d", __FUNCTION__, code);
clixon_debug(CLIXON_DBG_CLIENT, "%s code:%d", __FUNCTION__, code);
if (pretty){
cprintf(cb, " <errors xmlns=\"urn:ietf:params:xml:ns:yang:ietf-restconf\">\n");
if (clixon_xml2cbuf(cb, xerr, 2, pretty, NULL, -1, 0) < 0)
@ -302,7 +302,7 @@ api_return_err(clixon_handle h,
break;
case YANG_DATA_JSON:
case YANG_PATCH_JSON:
clixon_debug(CLIXON_DBG_DEFAULT, "%s code:%d", __FUNCTION__, code);
clixon_debug(CLIXON_DBG_CLIENT, "%s code:%d", __FUNCTION__, code);
if (pretty){
cprintf(cb, "{\n\"ietf-restconf:errors\" : ");
if (clixon_json2cbuf(cb, xerr, pretty, 0, 0) < 0)
@ -329,7 +329,7 @@ api_return_err(clixon_handle h,
// ok:
retval = 0;
done:
clixon_debug(CLIXON_DBG_DEFAULT, "%s retval:%d", __FUNCTION__, retval);
clixon_debug(CLIXON_DBG_CLIENT, "%s retval:%d", __FUNCTION__, retval);
if (cb)
cbuf_free(cb);
if (cberr)

View file

@ -160,7 +160,7 @@ restconf_param_set(clixon_handle h,
{
struct restconf_handle *rh = handle(h);
clixon_debug(CLIXON_DBG_DEFAULT, "%s: %s=%s", __FUNCTION__, param, val);
clixon_debug(CLIXON_DBG_CLIENT, "%s: %s=%s", __FUNCTION__, param, val);
if (rh->rh_params == NULL)
if ((rh->rh_params = clicon_hash_init()) == NULL)
return -1;

View file

@ -90,7 +90,7 @@ _http1_parse(clixon_handle h,
clixon_http1_yacc hy = {0,};
int ret;
clixon_debug(CLIXON_DBG_DEFAULT, "%s:\n%s", __FUNCTION__, str);
clixon_debug(CLIXON_DBG_CLIENT, "%s:\n%s", __FUNCTION__, str);
if (strlen(str) == 0)
goto ok;
hy.hy_parse_string = str;
@ -119,7 +119,7 @@ _http1_parse(clixon_handle h,
ok:
retval = 0;
done:
clixon_debug(CLIXON_DBG_DEFAULT, "%s %d", __FUNCTION__, retval);
clixon_debug(CLIXON_DBG_CLIENT, "%s %d", __FUNCTION__, retval);
return retval;
}
@ -147,7 +147,7 @@ clixon_http1_parse_file(clixon_handle h,
int len = 0;
int oldbuflen;
clixon_debug(CLIXON_DBG_DEFAULT, "%s %s", __FUNCTION__, filename);
clixon_debug(CLIXON_DBG_CLIENT, "%s %s", __FUNCTION__, filename);
if (f == NULL){
clixon_err(OE_RESTCONF, EINVAL, "f is NULL");
goto done;
@ -302,7 +302,7 @@ restconf_http1_reply(restconf_conn *rc,
int retval = -1;
cg_var *cv;
clixon_debug(CLIXON_DBG_DEFAULT, "%s", __FUNCTION__);
clixon_debug(CLIXON_DBG_CLIENT, "%s", __FUNCTION__);
/* If body, add a content-length header
* A server MUST NOT send a Content-Length header field in any response
* with a status code of 1xx (Informational) or 204 (No Content). A
@ -365,7 +365,7 @@ restconf_http1_path_root(clixon_handle h,
int ret;
#endif
clixon_debug(CLIXON_DBG_DEFAULT, "------------");
clixon_debug(CLIXON_DBG_CLIENT, "------------");
pretty = restconf_pretty_get(h);
if ((sd = restconf_stream_find(rc, 0)) == NULL){
clixon_err(OE_RESTCONF, EINVAL, "No stream_data");
@ -463,7 +463,7 @@ restconf_http1_path_root(clixon_handle h,
goto done;
retval = 0;
done:
clixon_debug(CLIXON_DBG_DEFAULT, "%s %d", __FUNCTION__, retval);
clixon_debug(CLIXON_DBG_CLIENT, "%s %d", __FUNCTION__, retval);
if (subject)
free(subject);
if (xerr)

View file

@ -360,7 +360,7 @@ restconf_terminate(clixon_handle h)
cxobj *x;
int fs; /* fgcx socket */
clixon_debug(CLIXON_DBG_DEFAULT, "%s", __FUNCTION__);
clixon_debug(CLIXON_DBG_CLIENT, "%s", __FUNCTION__);
if ((fs = clicon_socket_get(h)) != -1)
close(fs);
/* Delete all plugins, and RPC callbacks */
@ -378,7 +378,7 @@ restconf_terminate(clixon_handle h)
xpath_optimize_exit();
restconf_handle_exit(h);
clixon_err_exit();
clixon_debug(CLIXON_DBG_DEFAULT, "%s pid:%u done", __FUNCTION__, getpid());
clixon_debug(CLIXON_DBG_CLIENT, "%s pid:%u done", __FUNCTION__, getpid());
clixon_log_exit(); /* Must be after last clixon_debug */
return 0;
}
@ -524,7 +524,7 @@ restconf_main_extension_cb(clixon_handle h,
extname = yang_argument_get(yext);
if (strcmp(modname, "ietf-restconf") != 0 || strcmp(extname, "yang-data") != 0)
goto ok;
clixon_debug(CLIXON_DBG_DEFAULT, "%s Enabled extension:%s:%s", __FUNCTION__, modname, extname);
clixon_debug(CLIXON_DBG_CLIENT, "%s Enabled extension:%s:%s", __FUNCTION__, modname, extname);
if ((yc = yang_find(ys, 0, NULL)) == NULL)
goto ok;
if ((yn = ys_dup(yc)) == NULL)
@ -584,7 +584,7 @@ restconf_drop_privileges(clixon_handle h)
char *user;
enum priv_mode_t priv_mode = PM_NONE;
clixon_debug(CLIXON_DBG_DEFAULT, "%s", __FUNCTION__);
clixon_debug(CLIXON_DBG_CLIENT, "%s", __FUNCTION__);
/* Sanity check: backend group exists */
if ((group = clicon_sock_group(h)) == NULL){
clixon_err(OE_FATAL, 0, "clicon_sock_group option not set");
@ -639,7 +639,7 @@ restconf_drop_privileges(clixon_handle h)
case PM_NONE:
break; /* catched above */
}
clixon_debug(CLIXON_DBG_DEFAULT, "%s dropped privileges from root to %s(%d)",
clixon_debug(CLIXON_DBG_CLIENT, "%s dropped privileges from root to %s(%d)",
__FUNCTION__, user, newuid);
ok:
retval = 0;
@ -673,7 +673,7 @@ restconf_authentication_cb(clixon_handle h,
char *anonymous = NULL;
auth_type = restconf_auth_type_get(h);
clixon_debug(CLIXON_DBG_DEFAULT, "%s auth-type:%s", __FUNCTION__, clixon_auth_type_int2str(auth_type));
clixon_debug(CLIXON_DBG_CLIENT, "%s auth-type:%s", __FUNCTION__, clixon_auth_type_int2str(auth_type));
ret = 0;
authenticated = 0;
/* ret: -1 Error, 0: Ignore/not handled, 1: OK see authenticated parameter */
@ -725,7 +725,7 @@ restconf_authentication_cb(clixon_handle h,
/* If set but no user, set a dummy user */
retval = 1;
done:
clixon_debug(CLIXON_DBG_DEFAULT, "%s retval:%d authenticated:%d user:%s",
clixon_debug(CLIXON_DBG_CLIENT, "%s retval:%d authenticated:%d user:%s",
__FUNCTION__, retval, authenticated, clicon_username_get(h));
if (username)
free(username);
@ -768,7 +768,7 @@ restconf_config_init(clixon_handle h,
if ((x = xpath_first(xrestconf, nsc, "enable")) != NULL &&
(enable = xml_body(x)) != NULL){
if (strcmp(enable, "false") == 0){
clixon_debug(CLIXON_DBG_DEFAULT, "%s restconf disabled", __FUNCTION__);
clixon_debug(CLIXON_DBG_CLIENT, "%s restconf disabled", __FUNCTION__);
goto disable;
}
}
@ -848,7 +848,7 @@ restconf_socket_init(const char *netns0,
size_t sa_len;
const char *netns;
clixon_debug(CLIXON_DBG_DEFAULT, "%s %s %s %s %hu", __FUNCTION__, netns0, addrtype, addrstr, port);
clixon_debug(CLIXON_DBG_CLIENT, "%s %s %s %s %hu", __FUNCTION__, netns0, addrtype, addrstr, port);
/* netns default -> NULL */
if (netns0 != NULL && strcmp(netns0, RESTCONF_NETNS_DEFAULT)==0)
netns = NULL;
@ -858,10 +858,10 @@ restconf_socket_init(const char *netns0,
goto done;
if (clixon_netns_socket(netns, sa, sa_len, backlog, flags, addrstr, ss) < 0)
goto done;
clixon_debug(CLIXON_DBG_DEFAULT, "%s ss=%d", __FUNCTION__, *ss);
clixon_debug(CLIXON_DBG_CLIENT, "%s ss=%d", __FUNCTION__, *ss);
retval = 0;
done:
clixon_debug(CLIXON_DBG_DEFAULT, "%s %d", __FUNCTION__, retval);
clixon_debug(CLIXON_DBG_CLIENT, "%s %d", __FUNCTION__, retval);
return retval;
}

View file

@ -107,7 +107,7 @@ fcgi_params_set(clixon_handle h,
char *param = NULL;
char *val = NULL;
clixon_debug(CLIXON_DBG_DEFAULT, "%s", __FUNCTION__);
clixon_debug(CLIXON_DBG_CLIENT, "%s", __FUNCTION__);
for (i = 0; envp[i] != NULL; i++){ /* on the form <param>=<value> */
if (clixon_strsplit(envp[i], '=', &param, &val) < 0)
goto done;
@ -124,7 +124,7 @@ fcgi_params_set(clixon_handle h,
}
retval = 0;
done:
clixon_debug(CLIXON_DBG_DEFAULT, "%s %d", __FUNCTION__, retval);
clixon_debug(CLIXON_DBG_CLIENT, "%s %d", __FUNCTION__, retval);
return retval;
}
@ -147,7 +147,7 @@ restconf_main_config(clixon_handle h,
/* 1. try inline configure option */
if (inline_config != NULL && strlen(inline_config)){
clixon_debug(CLIXON_DBG_DEFAULT, "restconf_main_fcgi using restconf inline config");
clixon_debug(CLIXON_DBG_CLIENT, "restconf_main_fcgi using restconf inline config");
if ((ret = clixon_xml_parse_string(inline_config, YB_MODULE, yspec, &xrestconf, &xerr)) < 0)
goto done;
if (ret == 0){
@ -228,12 +228,12 @@ restconf_sig_term(int arg)
{
static int i=0;
clixon_debug(CLIXON_DBG_DEFAULT, "%s", __FUNCTION__);
clixon_debug(CLIXON_DBG_CLIENT, "%s", __FUNCTION__);
if (i++ == 0)
clixon_log(NULL, LOG_NOTICE, "%s: %s: pid: %u Signal %d",
__PROGRAM__, __FUNCTION__, getpid(), arg);
else{
clixon_debug(CLIXON_DBG_DEFAULT, "%s done", __FUNCTION__);
clixon_debug(CLIXON_DBG_CLIENT, "%s done", __FUNCTION__);
exit(-1);
}
@ -582,7 +582,7 @@ main(int argc,
clixon_err(OE_CFG, errno, "FCGX_Init");
goto done;
}
clixon_debug(CLIXON_DBG_DEFAULT, "restconf_main: Opening FCGX socket: %s", sockpath);
clixon_debug(CLIXON_DBG_CLIENT, "restconf_main: Opening FCGX socket: %s", sockpath);
if ((sock = FCGX_OpenSocket(sockpath, 10)) < 0){
clixon_err(OE_CFG, errno, "FCGX_OpenSocket");
goto done;
@ -629,7 +629,7 @@ main(int argc,
clixon_err(OE_CFG, errno, "FCGX_Accept_r");
goto done;
}
clixon_debug(CLIXON_DBG_DEFAULT, "------------");
clixon_debug(CLIXON_DBG_CLIENT, "------------");
/* Translate from FCGI parameter form to Clixon runtime data
* XXX: potential name collision?
@ -637,7 +637,7 @@ main(int argc,
if (fcgi_params_set(h, req->envp) < 0)
goto done;
if ((path = restconf_param_get(h, "REQUEST_URI")) == NULL){
clixon_debug(CLIXON_DBG_DEFAULT, "NULL URI");
clixon_debug(CLIXON_DBG_CLIENT, "NULL URI");
}
else {
/* Matching algorithm:
@ -669,7 +669,7 @@ main(int argc,
(void)api_stream(h, req, qvec, &finish);
}
else{
clixon_debug(CLIXON_DBG_DEFAULT, "top-level %s not found", path);
clixon_debug(CLIXON_DBG_CLIENT, "top-level %s not found", path);
if (netconf_invalid_value_xml(&xerr, "protocol", "Top-level path not found") < 0)
goto done;
if (api_return_err0(h, req, xerr, 1, YANG_DATA_JSON, 0) < 0)

View file

@ -217,7 +217,7 @@ clixon_openssl_log_cb(void *handle,
int suberr,
cbuf *cb)
{
clixon_debug(CLIXON_DBG_DEFAULT, "%s", __FUNCTION__);
clixon_debug(CLIXON_DBG_CLIENT, "%s", __FUNCTION__);
ERR_print_errors_cb(print_cb, cb);
return 0;
}
@ -266,17 +266,17 @@ restconf_verify_certs(int preverify_ok,
depth = X509_STORE_CTX_get_error_depth(store);
// ssl = X509_STORE_CTX_get_ex_data(store, SSL_get_ex_data_X509_STORE_CTX_idx());
clixon_debug(CLIXON_DBG_DEFAULT, "%s preverify_ok:%d err:%d depth:%d", __FUNCTION__, preverify_ok, err, depth);
clixon_debug(CLIXON_DBG_CLIENT, "%s preverify_ok:%d err:%d depth:%d", __FUNCTION__, preverify_ok, err, depth);
X509_NAME_oneline(X509_get_subject_name(err_cert), buf, 256);
switch (err){
case X509_V_ERR_HOSTNAME_MISMATCH:
clixon_debug(CLIXON_DBG_DEFAULT, "%s X509_V_ERR_HOSTNAME_MISMATCH", __FUNCTION__);
clixon_debug(CLIXON_DBG_CLIENT, "%s X509_V_ERR_HOSTNAME_MISMATCH", __FUNCTION__);
break;
case X509_V_ERR_CERT_HAS_EXPIRED:
clixon_debug(CLIXON_DBG_DEFAULT, "%s X509_V_ERR_CERT_HAS_EXPIRED", __FUNCTION__);
clixon_debug(CLIXON_DBG_CLIENT, "%s X509_V_ERR_CERT_HAS_EXPIRED", __FUNCTION__);
break;
case X509_V_ERR_DEPTH_ZERO_SELF_SIGNED_CERT:
clixon_debug(CLIXON_DBG_DEFAULT, "%s X509_V_ERR_DEPTH_ZERO_SELF_SIGNED_CERT", __FUNCTION__);
clixon_debug(CLIXON_DBG_CLIENT, "%s X509_V_ERR_DEPTH_ZERO_SELF_SIGNED_CERT", __FUNCTION__);
break;
}
/* Catch a too long certificate chain. should be +1 in SSL_CTX_set_verify_depth() */
@ -305,7 +305,7 @@ alpn_proto_dump(const char *label,
const char *inp,
unsigned len)
{
clixon_debug(CLIXON_DBG_DEFAULT, "%s %.*s", label, (int)len, inp);
clixon_debug(CLIXON_DBG_CLIENT, "%s %.*s", label, (int)len, inp);
return 0;
}
@ -327,7 +327,7 @@ alpn_select_proto_cb(SSL *ssl,
unsigned char len;
int pref = 0;
clixon_debug(CLIXON_DBG_DEFAULT, "%s", __FUNCTION__);
clixon_debug(CLIXON_DBG_CLIENT, "%s", __FUNCTION__);
/* select http/1.1 */
inp = (unsigned char*)in;
while ((inp-in) < inlen) {
@ -456,18 +456,18 @@ restconf_listcerts(SSL *ssl)
X509 *cert;
char *line;
clixon_debug(CLIXON_DBG_DEFAULT, "%s get peer certificates:", __FUNCTION__);
clixon_debug(CLIXON_DBG_CLIENT, "%s get peer certificates:", __FUNCTION__);
if ((cert = SSL_get_peer_certificate(ssl)) != NULL) { /* Get certificates (if available) */
if ((line = X509_NAME_oneline(X509_get_subject_name(cert), 0, 0)) != NULL){
clixon_debug(CLIXON_DBG_DEFAULT, "Subject: %s", line);
clixon_debug(CLIXON_DBG_CLIENT, "Subject: %s", line);
free(line);
}
if ((line = X509_NAME_oneline(X509_get_issuer_name(cert), 0, 0)) != NULL){
clixon_debug(CLIXON_DBG_DEFAULT, "Issuer: %s", line);
clixon_debug(CLIXON_DBG_CLIENT, "Issuer: %s", line);
free(line);
}
if ((line = X509_NAME_oneline(X509_get_subject_name(cert), 0, 0)) != NULL){
clixon_debug(CLIXON_DBG_DEFAULT, "Subject: %s", line);
clixon_debug(CLIXON_DBG_CLIENT, "Subject: %s", line);
free(line);
}
X509_free(cert);
@ -534,7 +534,7 @@ restconf_accept_client(int fd,
char *name = NULL;
void *addr;
clixon_debug(CLIXON_DBG_DEFAULT, "%s %d", __FUNCTION__, fd);
clixon_debug(CLIXON_DBG_CLIENT, "%s %d", __FUNCTION__, fd);
if ((rsock = (restconf_socket *)arg) == NULL){
clixon_err(OE_YANG, EINVAL, "rsock is NULL");
goto done;
@ -570,7 +570,7 @@ restconf_accept_client(int fd,
}
if (inet_ntop(from.sa_family, addr, rsock->rs_from_addr, INET6_ADDRSTRLEN) < 0)
goto done;
clixon_debug(CLIXON_DBG_DEFAULT, "%s type:%s from:%s, dest:%s port:%hu", __FUNCTION__,
clixon_debug(CLIXON_DBG_CLIENT, "%s type:%s from:%s, dest:%s port:%hu", __FUNCTION__,
rsock->rs_addrtype,
rsock->rs_from_addr,
rsock->rs_addrstr,
@ -581,7 +581,7 @@ restconf_accept_client(int fd,
goto done;
retval = 0;
done:
clixon_debug(CLIXON_DBG_DEFAULT, "%s retval %d", __FUNCTION__, retval);
clixon_debug(CLIXON_DBG_CLIENT, "%s retval %d", __FUNCTION__, retval);
if (name)
free(name);
return retval;
@ -596,7 +596,7 @@ restconf_native_terminate(clixon_handle h)
restconf_socket *rsock;
restconf_conn *rc;
clixon_debug(CLIXON_DBG_DEFAULT, "%s", __FUNCTION__);
clixon_debug(CLIXON_DBG_CLIENT, "%s", __FUNCTION__);
if ((rn = restconf_native_handle_get(h)) != NULL){
while ((rsock = rn->rn_sockets) != NULL){
while ((rc = rsock->rs_conns) != NULL){
@ -728,7 +728,7 @@ openssl_init_socket(clixon_handle h,
restconf_socket *rsock = NULL; /* openssl per socket struct */
struct timeval now;
clixon_debug(CLIXON_DBG_DEFAULT, "%s", __FUNCTION__);
clixon_debug(CLIXON_DBG_CLIENT, "%s", __FUNCTION__);
/*
* Create per-socket openssl handle
* See restconf_native_terminate for freeing
@ -825,7 +825,7 @@ restconf_openssl_init(clixon_handle h,
size_t veclen;
int i;
clixon_debug(CLIXON_DBG_DEFAULT, "%s", __FUNCTION__);
clixon_debug(CLIXON_DBG_CLIENT, "%s", __FUNCTION__);
/* flag used for sanity of certs */
ssl_enable = xpath_first(xrestconf, nsc, "socket[ssl='true']") != NULL;
/* Auth type set in config */
@ -1022,7 +1022,7 @@ restconf_clixon_init(clixon_handle h,
if (clicon_nsctx_global_set(h, nsctx_global) < 0)
goto done;
if (inline_config != NULL && strlen(inline_config)){
clixon_debug(CLIXON_DBG_DEFAULT, "%s reading from inline config", __FUNCTION__);
clixon_debug(CLIXON_DBG_CLIENT, "%s reading from inline config", __FUNCTION__);
if ((ret = clixon_xml_parse_string(inline_config, YB_MODULE, yspec, &xrestconf, &xerr)) < 0)
goto done;
if (ret == 0){
@ -1044,7 +1044,7 @@ restconf_clixon_init(clixon_handle h,
goto done;
}
else if (clicon_option_bool(h, "CLICON_BACKEND_RESTCONF_PROCESS") == 0){
clixon_debug(CLIXON_DBG_DEFAULT, "%s reading from clixon config", __FUNCTION__);
clixon_debug(CLIXON_DBG_CLIENT, "%s reading from clixon config", __FUNCTION__);
/* If not read from backend, try to get restconf config from local config-file */
if ((xrestconf = clicon_conf_restconf(h)) != NULL){
/* Basic config init, set auth-type, pretty, etc ret 0 means disabled */
@ -1062,7 +1062,7 @@ restconf_clixon_init(clixon_handle h,
/* If no local config, or it is disabled, try to query backend of config.
*/
else {
clixon_debug(CLIXON_DBG_DEFAULT, "%s reading from backend datastore config", __FUNCTION__);
clixon_debug(CLIXON_DBG_CLIENT, "%s reading from backend datastore config", __FUNCTION__);
if ((ret = restconf_clixon_backend(h, xrestconfp)) < 0)
goto done;
if (ret == 0)
@ -1352,7 +1352,7 @@ main(int argc,
ok:
retval = 0;
done:
clixon_debug(CLIXON_DBG_DEFAULT, "restconf_main_openssl done");
clixon_debug(CLIXON_DBG_CLIENT, "restconf_main_openssl done");
if (xrestconf)
xml_free(xrestconf);
restconf_native_terminate(h);

View file

@ -98,7 +98,7 @@ api_data_options(clixon_handle h,
{
int retval = -1;
clixon_debug(CLIXON_DBG_DEFAULT, "%s", __FUNCTION__);
clixon_debug(CLIXON_DBG_CLIENT, "%s", __FUNCTION__);
if (restconf_reply_header(req, "Allow", "OPTIONS,HEAD,GET,POST,PUT,PATCH,DELETE") < 0)
goto done;
if (restconf_reply_header(req, "Accept-Patch", "application/yang-data+xml,application/yang-data+json") < 0)
@ -142,7 +142,7 @@ match_list_keys(yang_stmt *y,
char *key1;
char *key2;
clixon_debug(CLIXON_DBG_DEFAULT, "%s", __FUNCTION__);
clixon_debug(CLIXON_DBG_CLIENT, "%s", __FUNCTION__);
switch (yang_keyword_get(y)){
case Y_LIST:
if ((cvk = yang_cvec_get(y)) == NULL) /* Use Y_LIST cache, see ys_populate_list() */
@ -176,7 +176,7 @@ match_list_keys(yang_stmt *y,
ok:
retval = 0;
done:
clixon_debug(CLIXON_DBG_DEFAULT, "%s retval:%d", __FUNCTION__, retval);
clixon_debug(CLIXON_DBG_CLIENT, "%s retval:%d", __FUNCTION__, retval);
return retval;
}
@ -236,8 +236,8 @@ api_data_write(clixon_handle h,
char *xpath = NULL;
char *attr;
clixon_debug(CLIXON_DBG_DEFAULT, "%s api_path:\"%s\"", __FUNCTION__, api_path0);
clixon_debug(CLIXON_DBG_DEFAULT, "%s data:\"%s\"", __FUNCTION__, data);
clixon_debug(CLIXON_DBG_CLIENT, "%s api_path:\"%s\"", __FUNCTION__, api_path0);
clixon_debug(CLIXON_DBG_CLIENT, "%s data:\"%s\"", __FUNCTION__, data);
if ((yspec = clicon_dbspec_yang(h)) == NULL){
clixon_err(OE_FATAL, 0, "No DB_SPEC");
goto done;
@ -427,7 +427,7 @@ api_data_write(clixon_handle h,
/* There is an api-path that defines an element in the datastore tree.
* Not top-of-tree.
*/
clixon_debug(CLIXON_DBG_DEFAULT, "%s Comparing bottom-of api-path (%s) with top-of-data (%s)",__FUNCTION__, xml_name(xbot), dname);
clixon_debug(CLIXON_DBG_CLIENT, "%s Comparing bottom-of api-path (%s) with top-of-data (%s)",__FUNCTION__, xml_name(xbot), dname);
/* Check same symbol in api-path as data */
if (strcmp(dname, xml_name(xbot))){
@ -492,11 +492,11 @@ api_data_write(clixon_handle h,
/* If we already have that default namespace, remove it in child */
if ((xa = xml_find_type(xdata, NULL, "xmlns", CX_ATTR)) != NULL){
if (xml2ns(xparent, NULL, &namespace) < 0){
clixon_debug(CLIXON_DBG_DEFAULT, "%s G done", __FUNCTION__);
clixon_debug(CLIXON_DBG_CLIENT, "%s G done", __FUNCTION__);
goto done;
}
if (namespace == NULL){
clixon_debug_xml(CLIXON_DBG_DEFAULT, xparent, "%s xparent:", __FUNCTION__);
clixon_debug_xml(CLIXON_DBG_CLIENT, xparent, "%s xparent:", __FUNCTION__);
/* XXX */
}
/* Set xmlns="" default namespace attribute (if diff from default) */
@ -540,7 +540,7 @@ api_data_write(clixon_handle h,
if (clixon_xml2cbuf(cbx, xtop, 0, 0, NULL, -1, 0) < 0)
goto done;
cprintf(cbx, "</edit-config></rpc>");
clixon_debug(CLIXON_DBG_DEFAULT, "%s xml: %s api_path:%s",__FUNCTION__, cbuf_get(cbx), api_path);
clixon_debug(CLIXON_DBG_CLIENT, "%s xml: %s api_path:%s",__FUNCTION__, cbuf_get(cbx), api_path);
if (clicon_rpc_netconf(h, cbuf_get(cbx), &xret, NULL) < 0)
goto done;
if ((xe = xpath_first(xret, NULL, "//rpc-error")) != NULL){
@ -560,7 +560,7 @@ api_data_write(clixon_handle h,
ok:
retval = 0;
done:
clixon_debug(CLIXON_DBG_DEFAULT, "%s retval:%d", __FUNCTION__, retval);
clixon_debug(CLIXON_DBG_CLIENT, "%s retval:%d", __FUNCTION__, retval);
if (xpath)
free(xpath);
if (nsc)
@ -737,7 +737,7 @@ api_data_delete(clixon_handle h,
int ret;
cxobj *xe; /* xml error, no free */
clixon_debug(CLIXON_DBG_DEFAULT, "%s api_path:%s", __FUNCTION__, api_path);
clixon_debug(CLIXON_DBG_CLIENT, "%s api_path:%s", __FUNCTION__, api_path);
if ((yspec = clicon_dbspec_yang(h)) == NULL){
clixon_err(OE_FATAL, 0, "No DB_SPEC");
goto done;
@ -821,7 +821,7 @@ api_data_delete(clixon_handle h,
xml_free(xretdis);
if (xtop)
xml_free(xtop);
clixon_debug(CLIXON_DBG_DEFAULT, "%s retval:%d", __FUNCTION__, retval);
clixon_debug(CLIXON_DBG_CLIENT, "%s retval:%d", __FUNCTION__, retval);
return retval;
}

View file

@ -128,7 +128,7 @@ api_data_get2(clixon_handle h,
char *defaults = NULL;
cvec *nscd = NULL;
clixon_debug(CLIXON_DBG_DEFAULT, "%s", __FUNCTION__);
clixon_debug(CLIXON_DBG_CLIENT, "%s", __FUNCTION__);
if ((yspec = clicon_dbspec_yang(h)) == NULL){
clixon_err(OE_FATAL, 0, "No DB_SPEC");
goto done;
@ -168,7 +168,7 @@ api_data_get2(clixon_handle h,
}
/* Check for content attribute */
if ((attr = cvec_find_str(qvec, "content")) != NULL){
clixon_debug(CLIXON_DBG_DEFAULT, "%s content=%s", __FUNCTION__, attr);
clixon_debug(CLIXON_DBG_CLIENT, "%s content=%s", __FUNCTION__, attr);
if ((int)(content = netconf_content_str2int(attr)) == -1){
if (netconf_bad_attribute_xml(&xerr, "application",
"content", "Unrecognized value of content attribute") < 0)
@ -180,7 +180,7 @@ api_data_get2(clixon_handle h,
}
/* Check for depth attribute */
if ((attr = cvec_find_str(qvec, "depth")) != NULL){
clixon_debug(CLIXON_DBG_DEFAULT, "%s depth=%s", __FUNCTION__, attr);
clixon_debug(CLIXON_DBG_CLIENT, "%s depth=%s", __FUNCTION__, attr);
if (strcmp(attr, "unbounded") != 0){
char *reason = NULL;
if ((ret = parse_int32(attr, &depth, &reason)) < 0){
@ -198,11 +198,11 @@ api_data_get2(clixon_handle h,
}
}
if ((attr = cvec_find_str(qvec, "with-defaults")) != NULL){
clixon_debug(CLIXON_DBG_DEFAULT, "%s with_defaults=%s", __FUNCTION__, attr);
clixon_debug(CLIXON_DBG_CLIENT, "%s with_defaults=%s", __FUNCTION__, attr);
defaults = attr;
}
clixon_debug(CLIXON_DBG_DEFAULT, "%s path:%s", __FUNCTION__, xpath);
clixon_debug(CLIXON_DBG_CLIENT, "%s path:%s", __FUNCTION__, xpath);
ret = clicon_rpc_get(h, xpath, nsc, content, depth, defaults, &xret);
if (ret < 0){
@ -217,7 +217,7 @@ api_data_get2(clixon_handle h,
*/
#if 0 /* DEBUG */
if (clixon_debug_get())
clixon_debug_xml(CLIXON_DBG_DEFAULT, xret, "%s xret:", __FUNCTION__);
clixon_debug_xml(CLIXON_DBG_CLIENT, xret, "%s xret:", __FUNCTION__);
#endif
/* Check if error return */
if ((xe = xpath_first(xret, NULL, "//rpc-error")) != NULL){
@ -292,7 +292,7 @@ api_data_get2(clixon_handle h,
break;
}
}
clixon_debug(CLIXON_DBG_DEFAULT, "%s cbuf:%s", __FUNCTION__, cbuf_get(cbx));
clixon_debug(CLIXON_DBG_CLIENT, "%s cbuf:%s", __FUNCTION__, cbuf_get(cbx));
if (restconf_reply_header(req, "Content-Type", "%s", restconf_media_int2str(media_out)) < 0)
goto done;
if (restconf_reply_header(req, "Cache-Control", "no-cache") < 0)
@ -303,7 +303,7 @@ api_data_get2(clixon_handle h,
ok:
retval = 0;
done:
clixon_debug(CLIXON_DBG_DEFAULT, "%s retval:%d", __FUNCTION__, retval);
clixon_debug(CLIXON_DBG_CLIENT, "%s retval:%d", __FUNCTION__, retval);
if (xpath)
free(xpath);
if (nscd)
@ -380,7 +380,7 @@ api_data_pagination(clixon_handle h,
char *where;
char *ns;
clixon_debug(CLIXON_DBG_DEFAULT, "%s", __FUNCTION__);
clixon_debug(CLIXON_DBG_CLIENT, "%s", __FUNCTION__);
if ((yspec = clicon_dbspec_yang(h)) == NULL){
clixon_err(OE_FATAL, 0, "No DB_SPEC");
goto done;
@ -429,7 +429,7 @@ api_data_pagination(clixon_handle h,
/* Check for content attribute */
if ((attr = cvec_find_str(qvec, "content")) != NULL){
clixon_debug(CLIXON_DBG_DEFAULT, "%s content=%s", __FUNCTION__, attr);
clixon_debug(CLIXON_DBG_CLIENT, "%s content=%s", __FUNCTION__, attr);
if ((int)(content = netconf_content_str2int(attr)) == -1){
if (netconf_bad_attribute_xml(&xerr, "application",
"content", "Unrecognized value of content attribute") < 0)
@ -443,7 +443,7 @@ api_data_pagination(clixon_handle h,
goto ok;
}
}
clixon_debug(CLIXON_DBG_DEFAULT, "%s path:%s", __FUNCTION__, xpath);
clixon_debug(CLIXON_DBG_CLIENT, "%s path:%s", __FUNCTION__, xpath);
if (content != CONTENT_CONFIG && content != CONTENT_NONCONFIG && content != CONTENT_ALL){
clixon_err(OE_XML, EINVAL, "Invalid content attribute %d", content);
goto done;
@ -451,7 +451,7 @@ api_data_pagination(clixon_handle h,
/* Clixon extensions and collection attributes */
/* Check for depth attribute */
if ((attr = cvec_find_str(qvec, "depth")) != NULL){
clixon_debug(CLIXON_DBG_DEFAULT, "%s depth=%s", __FUNCTION__, attr);
clixon_debug(CLIXON_DBG_CLIENT, "%s depth=%s", __FUNCTION__, attr);
if (strcmp(attr, "unbounded") != 0){
char *reason = NULL;
if ((ret = parse_int32(attr, &depth, &reason)) < 0){
@ -506,7 +506,7 @@ api_data_pagination(clixon_handle h,
* We need to cut that tree to only the object.
*/
#if 0 /* DEBUG */
clixon_debug_xml(CLIXON_DBG_DEFAULT, xret, "%s xret:", __FUNCTION__);
clixon_debug_xml(CLIXON_DBG_CLIENT, xret, "%s xret:", __FUNCTION__);
#endif
/* Check if error return */
if ((xe = xpath_first(xret, NULL, "//rpc-error")) != NULL){
@ -555,7 +555,7 @@ api_data_pagination(clixon_handle h,
default:
break;
}
clixon_debug(CLIXON_DBG_DEFAULT, "%s cbuf:%s", __FUNCTION__, cbuf_get(cbx));
clixon_debug(CLIXON_DBG_CLIENT, "%s cbuf:%s", __FUNCTION__, cbuf_get(cbx));
if (restconf_reply_header(req, "Content-Type", "%s", restconf_media_int2str(media_out)) < 0)
goto done;
if (restconf_reply_header(req, "Cache-Control", "no-cache") < 0)
@ -566,7 +566,7 @@ api_data_pagination(clixon_handle h,
ok:
retval = 0;
done:
clixon_debug(CLIXON_DBG_DEFAULT, "%s retval:%d", __FUNCTION__, retval);
clixon_debug(CLIXON_DBG_CLIENT, "%s retval:%d", __FUNCTION__, retval);
if (xpath)
free(xpath);
if (nsc)
@ -718,7 +718,7 @@ api_operations_get(clixon_handle h,
cxobj *xt = NULL;
int i;
clixon_debug(CLIXON_DBG_DEFAULT, "%s", __FUNCTION__);
clixon_debug(CLIXON_DBG_CLIENT, "%s", __FUNCTION__);
yspec = clicon_dbspec_yang(h);
if ((cbx = cbuf_new()) == NULL)
goto done;
@ -786,7 +786,7 @@ api_operations_get(clixon_handle h,
// ok:
retval = 0;
done:
clixon_debug(CLIXON_DBG_DEFAULT, "%s retval:%d", __FUNCTION__, retval);
clixon_debug(CLIXON_DBG_CLIENT, "%s retval:%d", __FUNCTION__, retval);
if (cbx)
cbuf_free(cbx);
if (xt)

View file

@ -635,7 +635,7 @@ yang_patch_do_edit(clixon_handle h,
yang_stmt *ybot = NULL;
yang_stmt *ymod;
clixon_debug_xml(CLIXON_DBG_DEFAULT, xn, "%s %d xn:", __FUNCTION__, __LINE__);
clixon_debug_xml(CLIXON_DBG_CLIENT, xn, "%s %d xn:", __FUNCTION__, __LINE__);
/* Create cbufs:s */
if ((simple_patch_request_uri = cbuf_new()) == NULL){
clixon_err(OE_UNIX, errno, "cbuf_new");
@ -778,7 +778,7 @@ api_data_yang_patch(clixon_handle h,
size_t veclen;
cxobj **vec = NULL;
clixon_debug(CLIXON_DBG_DEFAULT, "%s api_path:\"%s\"", __FUNCTION__, api_path0);
clixon_debug(CLIXON_DBG_CLIENT, "%s api_path:\"%s\"", __FUNCTION__, api_path0);
if ((yspec = clicon_dbspec_yang(h)) == NULL){
clixon_err(OE_FATAL, 0, "No DB_SPEC");
goto done;

View file

@ -189,8 +189,8 @@ api_data_post(clixon_handle h,
int nrchildren0 = 0;
yang_bind yb;
clixon_debug(CLIXON_DBG_DEFAULT, "%s api_path:\"%s\"", __FUNCTION__, api_path);
clixon_debug(CLIXON_DBG_DEFAULT, "%s data:\"%s\"", __FUNCTION__, data);
clixon_debug(CLIXON_DBG_CLIENT, "%s api_path:\"%s\"", __FUNCTION__, api_path);
clixon_debug(CLIXON_DBG_CLIENT, "%s data:\"%s\"", __FUNCTION__, data);
if ((yspec = clicon_dbspec_yang(h)) == NULL){
clixon_err(OE_FATAL, 0, "No DB_SPEC");
goto done;
@ -276,7 +276,7 @@ api_data_post(clixon_handle h,
/* RFC 8040 4.4.1: The message-body MUST contain exactly one instance of the
* expected data resource.
*/
clixon_debug(CLIXON_DBG_DEFAULT, "%s nrchildren0: %d", __FUNCTION__, nrchildren0);
clixon_debug(CLIXON_DBG_CLIENT, "%s nrchildren0: %d", __FUNCTION__, nrchildren0);
if (xml_child_nr_type(xbot, CX_ELMNT) - nrchildren0 != 1){
if (netconf_malformed_message_xml(&xerr, "The message-body MUST contain exactly one instance of the expected data resource") < 0)
goto done;
@ -330,7 +330,7 @@ api_data_post(clixon_handle h,
if (restconf_insert_attributes(xdata, qvec) < 0)
goto done;
#if 1
clixon_debug_xml(CLIXON_DBG_DEFAULT, xdata, "%s xdata:", __FUNCTION__);
clixon_debug_xml(CLIXON_DBG_CLIENT, xdata, "%s xdata:", __FUNCTION__);
#endif
/* Create text buffer for transfer to backend */
@ -369,7 +369,7 @@ api_data_post(clixon_handle h,
if (clixon_xml2cbuf(cbx, xtop, 0, 0, NULL, -1, 0) < 0)
goto done;
cprintf(cbx, "</edit-config></rpc>");
clixon_debug(CLIXON_DBG_DEFAULT, "%s xml: %s api_path:%s",__FUNCTION__, cbuf_get(cbx), api_path);
clixon_debug(CLIXON_DBG_CLIENT, "%s xml: %s api_path:%s",__FUNCTION__, cbuf_get(cbx), api_path);
if (clicon_rpc_netconf(h, cbuf_get(cbx), &xret, NULL) < 0)
goto done;
if ((xe = xpath_first(xret, NULL, "//rpc-error")) != NULL){
@ -384,7 +384,7 @@ api_data_post(clixon_handle h,
ok:
retval = 0;
done:
clixon_debug(CLIXON_DBG_DEFAULT, "%s retval:%d", __FUNCTION__, retval);
clixon_debug(CLIXON_DBG_CLIENT, "%s retval:%d", __FUNCTION__, retval);
if (xret)
xml_free(xret);
if (xerr)
@ -441,7 +441,7 @@ api_operations_post_input(clixon_handle h,
int ret;
restconf_media media_in;
clixon_debug(CLIXON_DBG_DEFAULT, "%s %s", __FUNCTION__, data);
clixon_debug(CLIXON_DBG_CLIENT, "%s %s", __FUNCTION__, data);
if ((cbret = cbuf_new()) == NULL){
clixon_err(OE_UNIX, 0, "cbuf_new");
goto done;
@ -491,7 +491,7 @@ api_operations_post_input(clixon_handle h,
* <data><input xmlns="urn:example:clixon">...</input></data>
*/
#if 1
clixon_debug_xml(CLIXON_DBG_DEFAULT, xdata, "%s xdata:", __FUNCTION__);
clixon_debug_xml(CLIXON_DBG_CLIENT, xdata, "%s xdata:", __FUNCTION__);
#endif
/* Validate that exactly only <input> tag */
if ((xinput = xml_child_i_type(xdata, 0, CX_ELMNT)) == NULL ||
@ -509,7 +509,7 @@ api_operations_post_input(clixon_handle h,
goto done;
goto fail;
}
// clixon_debug(CLIXON_DBG_DEFAULT, "%s input validation passed", __FUNCTION__);
// clixon_debug(CLIXON_DBG_CLIENT, "%s input validation passed", __FUNCTION__);
/* Add all input under <rpc>path */
x = NULL;
while ((x = xml_child_i_type(xinput, 0, CX_ELMNT)) != NULL)
@ -520,7 +520,7 @@ api_operations_post_input(clixon_handle h,
// ok:
retval = 1;
done:
clixon_debug(CLIXON_DBG_DEFAULT, "%s retval: %d", __FUNCTION__, retval);
clixon_debug(CLIXON_DBG_CLIENT, "%s retval: %d", __FUNCTION__, retval);
if (cbret)
cbuf_free(cbret);
if (xerr)
@ -567,7 +567,7 @@ api_operations_post_output(clixon_handle h,
cxobj *xok;
int isempty;
clixon_debug(CLIXON_DBG_DEFAULT, "%s", __FUNCTION__);
clixon_debug(CLIXON_DBG_CLIENT, "%s", __FUNCTION__);
/* Validate that exactly only <rpc-reply> tag with exactly one element child */
if ((xoutput = xml_child_i_type(xret, 0, CX_ELMNT)) == NULL ||
strcmp(xml_name(xoutput),"rpc-reply") != 0
@ -588,7 +588,7 @@ api_operations_post_output(clixon_handle h,
xml_name_set(xoutput, "output");
/* xoutput should now look: <output><x xmlns="uri">0</x></output> */
#if 1
clixon_debug_xml(CLIXON_DBG_DEFAULT, xoutput, "%s xoutput:", __FUNCTION__);
clixon_debug_xml(CLIXON_DBG_CLIENT, xoutput, "%s xoutput:", __FUNCTION__);
#endif
/* Remove original netconf default namespace. Somewhat unsure what "output" belongs to? */
if ((xa = xml_find_type(xoutput, NULL, "xmlns", CX_ATTR)) != NULL)
@ -649,7 +649,7 @@ api_operations_post_output(clixon_handle h,
*xoutputp = xoutput;
retval = 1;
done:
clixon_debug(CLIXON_DBG_DEFAULT, "%s retval: %d", __FUNCTION__, retval);
clixon_debug(CLIXON_DBG_CLIENT, "%s retval: %d", __FUNCTION__, retval);
if (xerr)
xml_free(xerr);
return retval;
@ -722,7 +722,7 @@ api_operations_post(clixon_handle h,
char *namespace = NULL;
int nr = 0;
clixon_debug(CLIXON_DBG_DEFAULT, "%s json:\"%s\" path:\"%s\"", __FUNCTION__, data, api_path);
clixon_debug(CLIXON_DBG_CLIENT, "%s json:\"%s\" path:\"%s\"", __FUNCTION__, data, api_path);
/* 1. Initialize */
if ((yspec = clicon_dbspec_yang(h)) == NULL){
clixon_err(OE_FATAL, 0, "No DB_SPEC");
@ -792,7 +792,7 @@ api_operations_post(clixon_handle h,
* XML: <input xmlns="uri"><x>0</x></input>
*/
namespace = xml_find_type_value(xbot, NULL, "xmlns", CX_ATTR);
clixon_debug(CLIXON_DBG_DEFAULT, "%s : 4. Parse input data: %s", __FUNCTION__, data);
clixon_debug(CLIXON_DBG_CLIENT, "%s : 4. Parse input data: %s", __FUNCTION__, data);
if (data && strlen(data)){
if ((ret = api_operations_post_input(h, req, data, yspec, yrpc, xbot,
pretty, media_out)) < 0)
@ -803,7 +803,7 @@ api_operations_post(clixon_handle h,
/* Here xtop is:
<rpc username="foo"><myfn xmlns="uri"><x>42</x></myfn></rpc> */
#if 1
clixon_debug_xml(CLIXON_DBG_DEFAULT, xtop, "%s 5. Translate input args:", __FUNCTION__);
clixon_debug_xml(CLIXON_DBG_CLIENT, xtop, "%s 5. Translate input args:", __FUNCTION__);
#endif
/* 6. Validate outgoing RPC and fill in defaults */
if ((ret = xml_bind_yang_rpc(h, xtop, yspec, &xerr)) < 0) /* */
@ -824,7 +824,7 @@ api_operations_post(clixon_handle h,
* <rpc username="foo"><myfn xmlns="uri"><x>42</x><y>99</y></myfn></rpc>
*/
#if 0
clixon_debug_xml(CLIXON_DBG_DEFAULT, xtop, "%s 6. Validate and defaults:", __FUNCTION__);
clixon_debug_xml(CLIXON_DBG_CLIENT, xtop, "%s 6. Validate and defaults:", __FUNCTION__);
#endif
/* 7. Send to RPC handler, either local or backend
* Note (1) xtop is <rpc><method> xbot is <method>
@ -865,7 +865,7 @@ api_operations_post(clixon_handle h,
* <rpc-reply><x xmlns="uri">0</x></rpc-reply>
*/
#if 1
clixon_debug_xml(CLIXON_DBG_DEFAULT, xret, "%s Receive reply:", __FUNCTION__);
clixon_debug_xml(CLIXON_DBG_CLIENT, xret, "%s Receive reply:", __FUNCTION__);
#endif
youtput = yang_find(yrpc, Y_OUTPUT, NULL);
if ((ret = api_operations_post_output(h, req, xret, yspec, youtput, namespace,
@ -897,7 +897,7 @@ api_operations_post(clixon_handle h,
ok:
retval = 0;
done:
clixon_debug(CLIXON_DBG_DEFAULT, "%s retval:%d", __FUNCTION__, retval);
clixon_debug(CLIXON_DBG_CLIENT, "%s retval:%d", __FUNCTION__, retval);
if (prefix)
free(prefix);
if (id)

View file

@ -192,7 +192,7 @@ restconf_conn_new(clixon_handle h,
rc->rc_callhome = rsock->rs_callhome;
rc->rc_socket = rsock;
INSQ(rc, rsock->rs_conns);
clixon_debug(CLIXON_DBG_DEFAULT, "%s %p", __FUNCTION__, rc);
clixon_debug(CLIXON_DBG_CLIENT, "%s %p", __FUNCTION__, rc);
return rc;
}
@ -208,7 +208,7 @@ restconf_conn_free(restconf_conn *rc)
restconf_socket *rsock;
restconf_conn *rc1;
clixon_debug(CLIXON_DBG_DEFAULT, "%s", __FUNCTION__);
clixon_debug(CLIXON_DBG_CLIENT, "%s", __FUNCTION__);
if (rc == NULL){
clixon_err(OE_RESTCONF, EINVAL, "rc is NULL");
goto done;
@ -416,7 +416,7 @@ native_buf_write(clixon_handle h,
}
memcpy(dbgstr, buf, sz);
dbgstr[sz] = '\0';
clixon_debug(CLIXON_DBG_DEFAULT, "%s %s buflen:%zu buf:\n%s", __FUNCTION__, callfn, buflen, dbgstr);
clixon_debug(CLIXON_DBG_CLIENT, "%s %s buflen:%zu buf:\n%s", __FUNCTION__, callfn, buflen, dbgstr);
free(dbgstr);
}
while (totlen < buflen){
@ -430,7 +430,7 @@ native_buf_write(clixon_handle h,
goto closed; /* Close socket and ssl */
}
else if (er == EAGAIN){
clixon_debug(CLIXON_DBG_DEFAULT, "%s write EAGAIN", __FUNCTION__);
clixon_debug(CLIXON_DBG_CLIENT, "%s write EAGAIN", __FUNCTION__);
usleep(10000);
continue;
}
@ -451,7 +451,7 @@ native_buf_write(clixon_handle h,
if ((len = write(rc->rc_s, buf+totlen, buflen-totlen)) < 0){
switch (errno){
case EAGAIN: /* Operation would block */
clixon_debug(CLIXON_DBG_DEFAULT, "%s write EAGAIN", __FUNCTION__);
clixon_debug(CLIXON_DBG_CLIENT, "%s write EAGAIN", __FUNCTION__);
usleep(10000);
continue;
break;
@ -471,7 +471,7 @@ native_buf_write(clixon_handle h,
} /* while */
retval = 1;
done:
clixon_debug(CLIXON_DBG_DEFAULT, "%s retval:%d", __FUNCTION__, retval);
clixon_debug(CLIXON_DBG_CLIENT, "%s retval:%d", __FUNCTION__, retval);
return retval;
closed:
retval = 0;
@ -498,7 +498,7 @@ native_send_badrequest(clixon_handle h,
int retval = -1;
cbuf *cb = NULL;
clixon_debug(CLIXON_DBG_DEFAULT, "%s", __FUNCTION__);
clixon_debug(CLIXON_DBG_CLIENT, "%s", __FUNCTION__);
if ((cb = cbuf_new()) == NULL){
clixon_err(OE_UNIX, errno, "cbuf_new");
goto done;
@ -570,7 +570,7 @@ read_ssl(restconf_conn *rc,
if ((*np = SSL_read(rc->rc_ssl, buf, sz)) <= 0){
sslerr = SSL_get_error(rc->rc_ssl, *np);
clixon_debug(CLIXON_DBG_DEFAULT, "%s SSL_read() n:%zd errno:%d sslerr:%d", __FUNCTION__, *np, errno, sslerr);
clixon_debug(CLIXON_DBG_CLIENT, "%s SSL_read() n:%zd errno:%d sslerr:%d", __FUNCTION__, *np, errno, sslerr);
switch (sslerr){
case SSL_ERROR_WANT_READ: /* 2 */
/* SSL_ERROR_WANT_READ is returned when the last operation was a read operation
@ -578,7 +578,7 @@ read_ssl(restconf_conn *rc,
* That is, it can happen if restconf_socket_init() below is called
* with SOCK_NONBLOCK
*/
clixon_debug(CLIXON_DBG_DEFAULT, "%s SSL_read SSL_ERROR_WANT_READ", __FUNCTION__);
clixon_debug(CLIXON_DBG_CLIENT, "%s SSL_read SSL_ERROR_WANT_READ", __FUNCTION__);
usleep(1000);
*again = 1;
break;
@ -593,7 +593,7 @@ read_ssl(restconf_conn *rc,
}
retval = 0;
// done:
clixon_debug(CLIXON_DBG_DEFAULT, "%s %d", __FUNCTION__, retval);
clixon_debug(CLIXON_DBG_CLIENT, "%s %d", __FUNCTION__, retval);
return retval;
}
@ -623,14 +623,14 @@ read_regular(restconf_conn *rc,
if ((*np = read(rc->rc_s, buf, sz)) < 0){ /* XXX atomicio ? */
switch(errno){
case ECONNRESET:/* Connection reset by peer */
clixon_debug(CLIXON_DBG_DEFAULT, "%s %d Connection reset by peer", __FUNCTION__, rc->rc_s);
clixon_debug(CLIXON_DBG_CLIENT, "%s %d Connection reset by peer", __FUNCTION__, rc->rc_s);
if (restconf_close_ssl_socket(rc, __FUNCTION__, 0) < 0)
goto done;
retval = 0; /* Close socket and ssl */
goto done;
break;
case EAGAIN:
clixon_debug(CLIXON_DBG_DEFAULT, "%s read EAGAIN", __FUNCTION__);
clixon_debug(CLIXON_DBG_CLIENT, "%s read EAGAIN", __FUNCTION__);
usleep(1000);
*again = 1;
break;
@ -886,7 +886,7 @@ restconf_http2_process(restconf_conn *rc,
int ret;
nghttp2_error ngerr;
clixon_debug(CLIXON_DBG_DEFAULT, "%s", __FUNCTION__);
clixon_debug(CLIXON_DBG_CLIENT, "%s", __FUNCTION__);
if (rc->rc_exit){ /* Server-initiated exit for http/2 */
if ((ngerr = nghttp2_session_terminate_session(rc->rc_ngsession, 0)) < 0){
clixon_err(OE_NGHTTP2, ngerr, "nghttp2_session_terminate_session %d", ngerr);
@ -913,7 +913,7 @@ restconf_http2_process(restconf_conn *rc,
}
retval = 1;
done:
clixon_debug(CLIXON_DBG_DEFAULT, "%s %d", __FUNCTION__, retval);
clixon_debug(CLIXON_DBG_CLIENT, "%s %d", __FUNCTION__, retval);
return retval;
}
#endif /* HAVE_LIBNGHTTP2 */
@ -961,7 +961,7 @@ restconf_connection(int s,
int readmore = 1;
int ret;
clixon_debug(CLIXON_DBG_DEFAULT, "%s %d", __FUNCTION__, s);
clixon_debug(CLIXON_DBG_CLIENT, "%s %d", __FUNCTION__, s);
if ((rc = (restconf_conn*)arg) == NULL){
clixon_err(OE_RESTCONF, EINVAL, "arg is NULL");
goto done;
@ -972,7 +972,7 @@ restconf_connection(int s,
}
gettimeofday(&rc->rc_t, NULL); /* activity timer */
while (readmore) {
clixon_debug(CLIXON_DBG_DEFAULT, "%s readmore", __FUNCTION__);
clixon_debug(CLIXON_DBG_CLIENT, "%s readmore", __FUNCTION__);
readmore = 0;
/* Example: curl -Ssik -u wilma:bar -X GET https://localhost/restconf/data/example:x */
if (rc->rc_ssl){
@ -985,11 +985,11 @@ restconf_connection(int s,
if (ret == 0)
goto ok; /* abort here */
}
clixon_debug(CLIXON_DBG_DEFAULT, "%s read:%zd", __FUNCTION__, n);
clixon_debug(CLIXON_DBG_CLIENT, "%s read:%zd", __FUNCTION__, n);
if (readmore)
continue;
if (n == 0){
clixon_debug(CLIXON_DBG_DEFAULT, "%s n=0 closing socket", __FUNCTION__);
clixon_debug(CLIXON_DBG_CLIENT, "%s n=0 closing socket", __FUNCTION__);
if (restconf_close_ssl_socket(rc, __FUNCTION__, 0) < 0)
goto done;
rc = NULL;
@ -1029,7 +1029,7 @@ restconf_connection(int s,
ok:
retval = 0;
done:
clixon_debug(CLIXON_DBG_DEFAULT, "%s retval %d", __FUNCTION__, retval);
clixon_debug(CLIXON_DBG_CLIENT, "%s retval %d", __FUNCTION__, retval);
return retval;
} /* restconf_connection */
@ -1053,7 +1053,7 @@ restconf_connection_close1(restconf_conn *rc)
goto done;
}
rsock = rc->rc_socket;
clixon_debug(CLIXON_DBG_DEFAULT, "%s \"%s\"", __FUNCTION__, rsock->rs_description);
clixon_debug(CLIXON_DBG_CLIENT, "%s \"%s\"", __FUNCTION__, rsock->rs_description);
if (close(rc->rc_s) < 0){
clixon_err(OE_UNIX, errno, "close");
goto done;
@ -1068,7 +1068,7 @@ restconf_connection_close1(restconf_conn *rc)
}
retval = 0;
done:
clixon_debug(CLIXON_DBG_DEFAULT, "%s %d", __FUNCTION__, retval);
clixon_debug(CLIXON_DBG_CLIENT, "%s %d", __FUNCTION__, retval);
return retval;
}
@ -1092,13 +1092,13 @@ restconf_close_ssl_socket(restconf_conn *rc,
int sslerr;
int er;
clixon_debug(CLIXON_DBG_DEFAULT, "%s %s", __FUNCTION__, callfn);
clixon_debug(CLIXON_DBG_CLIENT, "%s %s", __FUNCTION__, callfn);
if (rc->rc_ssl != NULL){
if (!dontshutdown &&
(ret = SSL_shutdown(rc->rc_ssl)) < 0){
er = errno;
sslerr = SSL_get_error(rc->rc_ssl, ret);
clixon_debug(CLIXON_DBG_DEFAULT, "%s errno:%s(%d) sslerr:%d", __FUNCTION__, strerror(er), er, sslerr);
clixon_debug(CLIXON_DBG_CLIENT, "%s errno:%s(%d) sslerr:%d", __FUNCTION__, strerror(er), er, sslerr);
if (sslerr == SSL_ERROR_SSL || /* 1 */
sslerr == SSL_ERROR_ZERO_RETURN){ /* 6 */
}
@ -1126,7 +1126,7 @@ restconf_close_ssl_socket(restconf_conn *rc,
goto done;
retval = 0;
done:
clixon_debug(CLIXON_DBG_DEFAULT, "%s retval:%d", __FUNCTION__, retval);
clixon_debug(CLIXON_DBG_CLIENT, "%s retval:%d", __FUNCTION__, retval);
return retval;
}
@ -1150,7 +1150,7 @@ ssl_alpn_check(clixon_handle h,
int retval = -1;
cbuf *cberr = NULL;
clixon_debug(CLIXON_DBG_DEFAULT, "%s", __FUNCTION__);
clixon_debug(CLIXON_DBG_CLIENT, "%s", __FUNCTION__);
/* Alternatively, call restconf_str2proto but alpn is not a proper string */
if (alpn && alpnlen == 8 && memcmp("http/1.1", alpn, 8) == 0){
*proto = HTTP_11;
@ -1202,7 +1202,7 @@ ssl_alpn_check(clixon_handle h,
}
retval = 1;
done:
clixon_debug(CLIXON_DBG_DEFAULT, "%s retval:%d", __FUNCTION__, retval);
clixon_debug(CLIXON_DBG_CLIENT, "%s retval:%d", __FUNCTION__, retval);
if (cberr)
cbuf_free(cberr);
return retval;
@ -1240,7 +1240,7 @@ restconf_ssl_accept_client(clixon_handle h,
unsigned int alpnlen = 0;
restconf_http_proto proto = HTTP_11; /* Non-SSL negotiation NYI */
clixon_debug(CLIXON_DBG_DEFAULT, "%s", __FUNCTION__);
clixon_debug(CLIXON_DBG_CLIENT, "%s", __FUNCTION__);
#ifdef HAVE_LIBNGHTTP2
#ifndef HAVE_HTTP1
proto = HTTP_2; /* If nghttp2 only let default be 2.0 */
@ -1255,13 +1255,13 @@ restconf_ssl_accept_client(clixon_handle h,
*/
if ((rc = restconf_conn_new(h, s, rsock)) == NULL)
goto done;
clixon_debug(CLIXON_DBG_DEFAULT, "%s s:%d", __FUNCTION__, rc->rc_s);
clixon_debug(CLIXON_DBG_CLIENT, "%s s:%d", __FUNCTION__, rc->rc_s);
if (rsock->rs_ssl){
if ((rc->rc_ssl = SSL_new(rn->rn_ctx)) == NULL){
clixon_err(OE_SSL, 0, "SSL_new");
goto done;
}
clixon_debug(CLIXON_DBG_DEFAULT, "%s SSL_new(%p)", __FUNCTION__, rc->rc_ssl);
clixon_debug(CLIXON_DBG_CLIENT, "%s SSL_new(%p)", __FUNCTION__, rc->rc_ssl);
/* CCL_CTX_set_verify already set, need not call SSL_set_verify again for this server
*/
/* X509_CHECK_FLAG_NO_WILDCARDS disables wildcard expansion */
@ -1298,11 +1298,11 @@ restconf_ssl_accept_client(clixon_handle h,
* Both error cases: Call SSL_get_error() with the return value ret
*/
if ((ret = SSL_accept(rc->rc_ssl)) != 1) {
clixon_debug(CLIXON_DBG_DEFAULT, "%s SSL_accept() ret:%d errno:%d", __FUNCTION__, ret, er=errno);
clixon_debug(CLIXON_DBG_CLIENT, "%s SSL_accept() ret:%d errno:%d", __FUNCTION__, ret, er=errno);
e = SSL_get_error(rc->rc_ssl, ret);
switch (e){
case SSL_ERROR_SSL: /* 1 */
clixon_debug(CLIXON_DBG_DEFAULT, "%s SSL_ERROR_SSL (non-ssl message on ssl socket)", __FUNCTION__);
clixon_debug(CLIXON_DBG_CLIENT, "%s SSL_ERROR_SSL (non-ssl message on ssl socket)", __FUNCTION__);
#ifdef HTTP_ON_HTTPS_REPLY
SSL_free(rc->rc_ssl);
rc->rc_ssl = NULL;
@ -1320,7 +1320,7 @@ restconf_ssl_accept_client(clixon_handle h,
consult errno for details. If this error occurs then no further I/O
operations should be performed on the connection and SSL_shutdown() must
not be called.*/
clixon_debug(CLIXON_DBG_DEFAULT, "%s SSL_accept() SSL_ERROR_SYSCALL %d", __FUNCTION__, er);
clixon_debug(CLIXON_DBG_CLIENT, "%s SSL_accept() SSL_ERROR_SYSCALL %d", __FUNCTION__, er);
if (restconf_close_ssl_socket(rc, __FUNCTION__, 1) < 0)
goto done;
rc = NULL;
@ -1333,7 +1333,7 @@ restconf_ssl_accept_client(clixon_handle h,
* That is, it can happen if restconf_socket_init() below is called
* with SOCK_NONBLOCK
*/
clixon_debug(CLIXON_DBG_DEFAULT, "%s write SSL_ERROR_WANT_READ", __FUNCTION__);
clixon_debug(CLIXON_DBG_CLIENT, "%s write SSL_ERROR_WANT_READ", __FUNCTION__);
usleep(10000);
readmore = 1;
break;
@ -1367,7 +1367,7 @@ restconf_ssl_accept_client(clixon_handle h,
if (ret == 0){
goto closed;
}
clixon_debug(CLIXON_DBG_DEFAULT, "%s proto:%s", __FUNCTION__, restconf_proto2str(proto));
clixon_debug(CLIXON_DBG_CLIENT, "%s proto:%s", __FUNCTION__, restconf_proto2str(proto));
#if 0 /* Seems too early to fail here, instead let authentication callback deal with this */
/* For client-cert authentication, check if any certs are present,
@ -1404,7 +1404,7 @@ restconf_ssl_accept_client(clixon_handle h,
const char *peername = SSL_get0_peername(rc->rc_ssl);
if (peername != NULL) {
/* Name checks were in scope and matched the peername */
clixon_debug(CLIXON_DBG_DEFAULT, "%s peername:%s", __FUNCTION__, peername);
clixon_debug(CLIXON_DBG_CLIENT, "%s peername:%s", __FUNCTION__, peername);
}
}
#if 0
@ -1457,7 +1457,7 @@ restconf_ssl_accept_client(clixon_handle h,
*rcp = rc;
retval = 1; /* OK, up */
done:
clixon_debug(CLIXON_DBG_DEFAULT, "%s retval %d", __FUNCTION__, retval);
clixon_debug(CLIXON_DBG_CLIENT, "%s retval %d", __FUNCTION__, retval);
if (name)
free(name);
return retval;
@ -1528,7 +1528,7 @@ restconf_idle_cb(int fd,
clixon_err(OE_YANG, EINVAL, "rsock is NULL");
goto done;
}
clixon_debug(CLIXON_DBG_DEFAULT, "%s \"%s\"", __FUNCTION__, rsock->rs_description);
clixon_debug(CLIXON_DBG_CLIENT, "%s \"%s\"", __FUNCTION__, rsock->rs_description);
if (rc->rc_callhome && rsock->rs_periodic && rc->rc_s > 0 && rsock->rs_idle_timeout){
gettimeofday(&now, NULL);
timersub(&now, &rc->rc_t, &td); /* Last packet timestamp */
@ -1539,7 +1539,7 @@ restconf_idle_cb(int fd,
else{
to.tv_sec = rsock->rs_idle_timeout;
timeradd(&now, &to, &tn);
clixon_debug(CLIXON_DBG_DEFAULT, "%s now:%lu timeout:%lu.%lu", __FUNCTION__,
clixon_debug(CLIXON_DBG_CLIENT, "%s now:%lu timeout:%lu.%lu", __FUNCTION__,
now.tv_sec, tn.tv_sec, tn.tv_usec);
if (restconf_idle_timer_set(tn, rc, rsock->rs_description) < 0)
goto done;
@ -1585,7 +1585,7 @@ restconf_idle_timer(restconf_conn *rc)
clixon_err(OE_YANG, EINVAL, "rsock is NULL or not periodic");
goto done;
}
clixon_debug(CLIXON_DBG_DEFAULT, "%s \"%s\" register", __FUNCTION__, rsock->rs_description);
clixon_debug(CLIXON_DBG_CLIENT, "%s \"%s\" register", __FUNCTION__, rsock->rs_description);
gettimeofday(&now, NULL);
to.tv_sec = rsock->rs_idle_timeout;
timeradd(&now, &to, &t);
@ -1623,7 +1623,7 @@ restconf_callhome_cb(int fd,
clixon_err(OE_YANG, EINVAL, "rsock is NULL");
goto done;
}
clixon_debug(CLIXON_DBG_DEFAULT, "%s \"%s\"", __FUNCTION__, rsock->rs_description);
clixon_debug(CLIXON_DBG_CLIENT, "%s \"%s\"", __FUNCTION__, rsock->rs_description);
h = rsock->rs_h;
/* Already computed in restconf_socket_init, could be saved in rsock? */
if (clixon_inet2sin(rsock->rs_addrtype, rsock->rs_addrstr, rsock->rs_port, sa, &sa_len) < 0)
@ -1633,7 +1633,7 @@ restconf_callhome_cb(int fd,
goto done;
}
if (connect(s, sa, sa_len) < 0){
clixon_debug(CLIXON_DBG_DEFAULT, "%s connect %hu fail:%d %s", __FUNCTION__, rsock->rs_port, errno, strerror(errno));
clixon_debug(CLIXON_DBG_CLIENT, "%s connect %hu fail:%d %s", __FUNCTION__, rsock->rs_port, errno, strerror(errno));
close(s);
rsock->rs_attempts++;
/* Fail: Initiate new timer */
@ -1641,7 +1641,7 @@ restconf_callhome_cb(int fd,
goto done;
}
else {
clixon_debug(CLIXON_DBG_DEFAULT, "%s connect %hu OK", __FUNCTION__, rsock->rs_port);
clixon_debug(CLIXON_DBG_CLIENT, "%s connect %hu OK", __FUNCTION__, rsock->rs_port);
rsock->rs_attempts = 0;
if ((ret = restconf_ssl_accept_client(h, s, rsock, &rc)) < 0)
goto done;
@ -1686,7 +1686,7 @@ restconf_callhome_timer(restconf_socket *rsock,
clixon_err(OE_YANG, EINVAL, "rsock is NULL or not callhome");
goto done;
}
clixon_debug(CLIXON_DBG_DEFAULT, "%s \"%s\"", __FUNCTION__, rsock->rs_description);
clixon_debug(CLIXON_DBG_CLIENT, "%s \"%s\"", __FUNCTION__, rsock->rs_description);
if (!rsock->rs_callhome)
goto ok; /* shouldnt happen */
gettimeofday(&now, NULL);
@ -1714,9 +1714,9 @@ restconf_callhome_timer(restconf_socket *rsock,
}
cprintf(cb, "restconf callhome timer %s", rsock->rs_description);
if (rsock->rs_description)
clixon_debug(CLIXON_DBG_DEFAULT, "%s registering \"%s\": +%lu", __FUNCTION__, rsock->rs_description, t.tv_sec-now.tv_sec);
clixon_debug(CLIXON_DBG_CLIENT, "%s registering \"%s\": +%lu", __FUNCTION__, rsock->rs_description, t.tv_sec-now.tv_sec);
else
clixon_debug(CLIXON_DBG_DEFAULT, "%s: %lu", __FUNCTION__, t.tv_sec);
clixon_debug(CLIXON_DBG_CLIENT, "%s: %lu", __FUNCTION__, t.tv_sec);
/* Should be only place restconf_callhome_cb is registered */
if (clixon_event_reg_timeout(t,
restconf_callhome_cb,

View file

@ -120,7 +120,7 @@ clixon_nghttp2_log_cb(void *handle,
int suberr,
cbuf *cb)
{
clixon_debug(CLIXON_DBG_DEFAULT, "%s", __FUNCTION__);
clixon_debug(CLIXON_DBG_CLIENT, "%s", __FUNCTION__);
cprintf(cb, "Fatal error: %s", nghttp2_strerror(suberr));
return 0;
}
@ -132,7 +132,7 @@ nghttp2_print_header(const uint8_t *name,
const uint8_t *value,
size_t valuelen)
{
clixon_debug(CLIXON_DBG_DEFAULT, "%s %s", name, value);
clixon_debug(CLIXON_DBG_CLIENT, "%s %s", name, value);
}
/*! Print HTTP headers to |f|.
@ -178,20 +178,20 @@ session_send_callback(nghttp2_session *session,
int s;
int sslerr;
clixon_debug(CLIXON_DBG_DEFAULT, "%s buflen:%zu", __FUNCTION__, buflen);
clixon_debug(CLIXON_DBG_CLIENT, "%s buflen:%zu", __FUNCTION__, buflen);
s = rc->rc_s;
while (totlen < buflen){
if (rc->rc_ssl){
if ((len = SSL_write(rc->rc_ssl, buf+totlen, buflen-totlen)) <= 0){
er = errno;
sslerr = SSL_get_error(rc->rc_ssl, len);
clixon_debug(CLIXON_DBG_DEFAULT, "%s SSL_write: errno:%s(%d) sslerr:%d", __FUNCTION__,
clixon_debug(CLIXON_DBG_CLIENT, "%s SSL_write: errno:%s(%d) sslerr:%d", __FUNCTION__,
strerror(er),
er,
sslerr);
switch (sslerr){
case SSL_ERROR_WANT_WRITE: /* 3 */
clixon_debug(CLIXON_DBG_DEFAULT, "%s write SSL_ERROR_WANT_WRITE", __FUNCTION__);
clixon_debug(CLIXON_DBG_CLIENT, "%s write SSL_ERROR_WANT_WRITE", __FUNCTION__);
usleep(1000);
continue;
break;
@ -205,7 +205,7 @@ session_send_callback(nghttp2_session *session,
* platforms, linux here, freebsd want_write, or possibly differnt
* ssl lib versions?
*/
clixon_debug(CLIXON_DBG_DEFAULT, "%s write EAGAIN", __FUNCTION__);
clixon_debug(CLIXON_DBG_CLIENT, "%s write EAGAIN", __FUNCTION__);
usleep(1000);
continue;
}
@ -225,7 +225,7 @@ session_send_callback(nghttp2_session *session,
else{
if ((len = write(s, buf+totlen, buflen-totlen)) < 0){
if (errno == EAGAIN){
clixon_debug(CLIXON_DBG_DEFAULT, "%s write EAGAIN", __FUNCTION__);
clixon_debug(CLIXON_DBG_CLIENT, "%s write EAGAIN", __FUNCTION__);
usleep(10000);
continue;
}
@ -252,10 +252,10 @@ session_send_callback(nghttp2_session *session,
retval = 0;
done:
if (retval < 0){
clixon_debug(CLIXON_DBG_DEFAULT, "%s retval:%d", __FUNCTION__, retval);
clixon_debug(CLIXON_DBG_CLIENT, "%s retval:%d", __FUNCTION__, retval);
return retval;
}
clixon_debug(CLIXON_DBG_DEFAULT, "%s retval:%zd", __FUNCTION__, totlen);
clixon_debug(CLIXON_DBG_CLIENT, "%s retval:%zd", __FUNCTION__, totlen);
return retval == 0 ? totlen : retval;
}
@ -269,7 +269,7 @@ recv_callback(nghttp2_session *session,
void *user_data)
{
// restconf_conn *rc = (restconf_conn *)user_data;
clixon_debug(CLIXON_DBG_DEFAULT, "%s", __FUNCTION__);
clixon_debug(CLIXON_DBG_CLIENT, "%s", __FUNCTION__);
return 0;
}
@ -294,7 +294,7 @@ restconf_nghttp2_path(restconf_stream_data *sd)
cvec *cvv = NULL;
char *cn;
clixon_debug(CLIXON_DBG_DEFAULT, "------------");
clixon_debug(CLIXON_DBG_CLIENT, "------------");
rc = sd->sd_conn;
if ((h = rc->rc_h) == NULL){
clixon_err(OE_RESTCONF, EINVAL, "arg is NULL");
@ -346,7 +346,7 @@ restconf_nghttp2_path(restconf_stream_data *sd)
goto done;
retval = 0;
done:
clixon_debug(CLIXON_DBG_DEFAULT, "%s %d", __FUNCTION__, retval);
clixon_debug(CLIXON_DBG_CLIENT, "%s %d", __FUNCTION__, retval);
if (cvv)
cvec_free(cvv);
if (oneline)
@ -390,7 +390,7 @@ restconf_sd_read(nghttp2_session *session,
#endif
assert(cbuf_len(cb) > sd->sd_body_offset);
remain = cbuf_len(cb) - sd->sd_body_offset;
clixon_debug(CLIXON_DBG_DEFAULT, "%s length:%zu totlen:%zu, offset:%zu remain:%zu",
clixon_debug(CLIXON_DBG_CLIENT, "%s length:%zu totlen:%zu, offset:%zu remain:%zu",
__FUNCTION__,
length,
cbuf_len(cb),
@ -406,7 +406,7 @@ restconf_sd_read(nghttp2_session *session,
}
memcpy(buf, cbuf_get(cb) + sd->sd_body_offset, len);
sd->sd_body_offset += len;
clixon_debug(CLIXON_DBG_DEFAULT, "%s retval:%zu", __FUNCTION__, len);
clixon_debug(CLIXON_DBG_CLIENT, "%s retval:%zu", __FUNCTION__, len);
return len;
}
@ -434,7 +434,7 @@ restconf_submit_response(nghttp2_session *session,
hdr = &hdrs[i++];
hdr->name = (uint8_t*)":status";
snprintf(valstr, 15, "%u", sd->sd_code);
clixon_debug(CLIXON_DBG_DEFAULT, "%s status %d", __FUNCTION__, sd->sd_code);
clixon_debug(CLIXON_DBG_CLIENT, "%s status %d", __FUNCTION__, sd->sd_code);
hdr->value = (uint8_t*)valstr;
hdr->namelen = strlen(":status");
hdr->valuelen = strlen(valstr);
@ -444,7 +444,7 @@ restconf_submit_response(nghttp2_session *session,
while ((cv = cvec_each(sd->sd_outp_hdrs, cv)) != NULL){
hdr = &hdrs[i++];
hdr->name = (uint8_t*)cv_name_get(cv);
clixon_debug(CLIXON_DBG_DEFAULT, "%s hdr: %s", __FUNCTION__, hdr->name);
clixon_debug(CLIXON_DBG_CLIENT, "%s hdr: %s", __FUNCTION__, hdr->name);
hdr->value = (uint8_t*)cv_string_get(cv);
hdr->namelen = strlen(cv_name_get(cv));
hdr->valuelen = strlen(cv_string_get(cv));
@ -459,7 +459,7 @@ restconf_submit_response(nghttp2_session *session,
}
retval = 0;
done:
clixon_debug(CLIXON_DBG_DEFAULT, "%s retval:%d", __FUNCTION__, retval);
clixon_debug(CLIXON_DBG_CLIENT, "%s retval:%d", __FUNCTION__, retval);
if (hdrs)
free(hdrs);
return retval;
@ -475,7 +475,7 @@ http2_exec(restconf_conn *rc,
{
int retval = -1;
clixon_debug(CLIXON_DBG_DEFAULT, "%s", __FUNCTION__);
clixon_debug(CLIXON_DBG_CLIENT, "%s", __FUNCTION__);
if (sd->sd_path){
free(sd->sd_path);
sd->sd_path = NULL;
@ -514,7 +514,7 @@ http2_exec(restconf_conn *rc,
}
retval = 0;
done:
clixon_debug(CLIXON_DBG_DEFAULT, "%s retval:%d", __FUNCTION__, retval);
clixon_debug(CLIXON_DBG_CLIENT, "%s retval:%d", __FUNCTION__, retval);
return retval;
}
@ -530,7 +530,7 @@ on_frame_recv_callback(nghttp2_session *session,
restconf_stream_data *sd = NULL;
char *query;
clixon_debug(CLIXON_DBG_DEFAULT, "%s %s %d", __FUNCTION__,
clixon_debug(CLIXON_DBG_CLIENT, "%s %s %d", __FUNCTION__,
clicon_int2str(nghttp2_frame_type_map, frame->hd.type),
frame->hd.stream_id);
switch (frame->hd.type) {
@ -572,7 +572,7 @@ on_invalid_frame_recv_callback(nghttp2_session *session,
void *user_data)
{
// restconf_conn *rc = (restconf_conn *)user_data;
clixon_debug(CLIXON_DBG_DEFAULT, "%s", __FUNCTION__);
clixon_debug(CLIXON_DBG_CLIENT, "%s", __FUNCTION__);
return 0;
}
@ -594,7 +594,7 @@ on_data_chunk_recv_callback(nghttp2_session *session,
restconf_conn *rc = (restconf_conn *)user_data;
restconf_stream_data *sd;
clixon_debug(CLIXON_DBG_DEFAULT, "%s %d", __FUNCTION__, stream_id);
clixon_debug(CLIXON_DBG_CLIENT, "%s %d", __FUNCTION__, stream_id);
if ((sd = restconf_stream_find(rc, stream_id)) != NULL){
cbuf_append_buf(sd->sd_indata, (void*)data, len);
}
@ -609,7 +609,7 @@ before_frame_send_callback(nghttp2_session *session,
void *user_data)
{
// restconf_conn *rc = (restconf_conn *)user_data;
clixon_debug(CLIXON_DBG_DEFAULT, "%s", __FUNCTION__);
clixon_debug(CLIXON_DBG_CLIENT, "%s", __FUNCTION__);
return 0;
}
@ -621,7 +621,7 @@ on_frame_send_callback(nghttp2_session *session,
void *user_data)
{
// restconf_conn *rc = (restconf_conn *)user_data;
clixon_debug(CLIXON_DBG_DEFAULT, "%s", __FUNCTION__);
clixon_debug(CLIXON_DBG_CLIENT, "%s", __FUNCTION__);
return 0;
}
@ -634,7 +634,7 @@ on_frame_not_send_callback(nghttp2_session *session,
void *user_data)
{
// restconf_conn *rc = (restconf_conn *)user_data;
clixon_debug(CLIXON_DBG_DEFAULT, "%s", __FUNCTION__);
clixon_debug(CLIXON_DBG_CLIENT, "%s", __FUNCTION__);
return 0;
}
@ -648,7 +648,7 @@ on_stream_close_callback(nghttp2_session *session,
{
// restconf_conn *rc = (restconf_conn *)user_data;
clixon_debug(CLIXON_DBG_DEFAULT, "%s %d %s", __FUNCTION__, error_code, nghttp2_strerror(error_code));
clixon_debug(CLIXON_DBG_CLIENT, "%s %d %s", __FUNCTION__, error_code, nghttp2_strerror(error_code));
#if 0 // NOTNEEDED /* XXX think this is not necessary? */
if (error_code){
if (restconf_close_ssl_socket(rc, __FUNCTION__, 0) < 0)
@ -668,7 +668,7 @@ on_begin_headers_callback(nghttp2_session *session,
restconf_conn *rc = (restconf_conn *)user_data;
restconf_stream_data *sd;
clixon_debug(CLIXON_DBG_DEFAULT, "%s %s", __FUNCTION__, clicon_int2str(nghttp2_frame_type_map, frame->hd.type));
clixon_debug(CLIXON_DBG_CLIENT, "%s %s", __FUNCTION__, clicon_int2str(nghttp2_frame_type_map, frame->hd.type));
if (frame->hd.type == NGHTTP2_HEADERS &&
frame->headers.cat == NGHTTP2_HCAT_REQUEST) {
sd = restconf_stream_data_new(rc, frame->hd.stream_id);
@ -736,12 +736,12 @@ on_header_callback(nghttp2_session *session,
switch (frame->hd.type){
case NGHTTP2_HEADERS:
assert (frame->headers.cat == NGHTTP2_HCAT_REQUEST);
clixon_debug(CLIXON_DBG_DEFAULT, "%s HEADERS %s %s", __FUNCTION__, name, value);
clixon_debug(CLIXON_DBG_CLIENT, "%s HEADERS %s %s", __FUNCTION__, name, value);
if (nghttp2_hdr2clixon(rc->rc_h, (char*)name, (char*)value) < 0)
goto done;
break;
default:
clixon_debug(CLIXON_DBG_DEFAULT, "%s %s %s", __FUNCTION__, clicon_int2str(nghttp2_frame_type_map, frame->hd.type), name);
clixon_debug(CLIXON_DBG_CLIENT, "%s %s %s", __FUNCTION__, clicon_int2str(nghttp2_frame_type_map, frame->hd.type), name);
break;
}
retval = 0;
@ -759,7 +759,7 @@ select_padding_callback(nghttp2_session *session,
void *user_data)
{
// restconf_conn *rc = (restconf_conn *)user_data;
clixon_debug(CLIXON_DBG_DEFAULT, "%s", __FUNCTION__);
clixon_debug(CLIXON_DBG_CLIENT, "%s", __FUNCTION__);
return frame->hd.length;
}
@ -775,7 +775,7 @@ data_source_read_length_callback(nghttp2_session *session,
void *user_data)
{
// restconf_conn *rc = (restconf_conn *)user_data;
clixon_debug(CLIXON_DBG_DEFAULT, "%s", __FUNCTION__);
clixon_debug(CLIXON_DBG_CLIENT, "%s", __FUNCTION__);
return 0;
}
#endif /* NOTUSED */
@ -791,7 +791,7 @@ on_begin_frame_callback(nghttp2_session *session,
void *user_data)
{
// restconf_conn *rc = (restconf_conn *)user_data;
clixon_debug(CLIXON_DBG_DEFAULT, "%s %s", __FUNCTION__, clicon_int2str(nghttp2_frame_type_map, hd->type));
clixon_debug(CLIXON_DBG_CLIENT, "%s %s", __FUNCTION__, clicon_int2str(nghttp2_frame_type_map, hd->type));
if (hd->type == NGHTTP2_CONTINUATION)
assert(0);
return 0;
@ -811,7 +811,7 @@ send_data_callback(nghttp2_session *session,
void *user_data)
{
// restconf_conn *rc = (restconf_conn *)user_data;
clixon_debug(CLIXON_DBG_DEFAULT, "%s", __FUNCTION__);
clixon_debug(CLIXON_DBG_CLIENT, "%s", __FUNCTION__);
return 0;
}
@ -825,7 +825,7 @@ pack_extension_callback(nghttp2_session *session,
void *user_data)
{
// restconf_conn *rc = (restconf_conn *)user_data;
clixon_debug(CLIXON_DBG_DEFAULT, "%s", __FUNCTION__);
clixon_debug(CLIXON_DBG_CLIENT, "%s", __FUNCTION__);
return 0;
}
@ -838,7 +838,7 @@ unpack_extension_callback(nghttp2_session *session,
void *user_data)
{
// restconf_conn *rc = (restconf_conn *)user_data;
clixon_debug(CLIXON_DBG_DEFAULT, "%s", __FUNCTION__);
clixon_debug(CLIXON_DBG_CLIENT, "%s", __FUNCTION__);
return 0;
}
#endif /* NOTUSED */
@ -853,7 +853,7 @@ on_extension_chunk_recv_callback(nghttp2_session *session,
void *user_data)
{
// restconf_conn *rc = (restconf_conn *)user_data;
clixon_debug(CLIXON_DBG_DEFAULT, "%s", __FUNCTION__);
clixon_debug(CLIXON_DBG_CLIENT, "%s", __FUNCTION__);
return 0;
}
@ -866,7 +866,7 @@ error_callback(nghttp2_session *session,
void *user_data)
{
// restconf_conn *rc = (restconf_conn *)user_data;
clixon_debug(CLIXON_DBG_DEFAULT, "%s", __FUNCTION__);
clixon_debug(CLIXON_DBG_CLIENT, "%s", __FUNCTION__);
return 0;
}
@ -881,7 +881,7 @@ error_callback2(nghttp2_session *session,
void *user_data)
{
// restconf_conn *rc = (restconf_conn *)user_data;
clixon_debug(CLIXON_DBG_DEFAULT, "%s", __FUNCTION__);
clixon_debug(CLIXON_DBG_CLIENT, "%s", __FUNCTION__);
clixon_err(OE_NGHTTP2, lib_error_code, "%s", msg);
return 0;
}
@ -904,7 +904,7 @@ http2_recv(restconf_conn *rc,
int retval = -1;
nghttp2_error ngerr;
clixon_debug(CLIXON_DBG_DEFAULT, "%s", __FUNCTION__);
clixon_debug(CLIXON_DBG_CLIENT, "%s", __FUNCTION__);
if (rc->rc_ngsession == NULL){
/* http2_session_init not called */
clixon_err(OE_RESTCONF, EINVAL, "No nghttp2 session");
@ -941,7 +941,7 @@ http2_recv(restconf_conn *rc,
}
retval = 1; /* OK */
done:
clixon_debug(CLIXON_DBG_DEFAULT, "%s retval:%d", __FUNCTION__, retval);
clixon_debug(CLIXON_DBG_CLIENT, "%s retval:%d", __FUNCTION__, retval);
return retval;
fail:
retval = 0;
@ -958,7 +958,7 @@ http2_send_server_connection(restconf_conn *rc)
,{NGHTTP2_SETTINGS_ENABLE_PUSH, 0}};
nghttp2_error ngerr;
clixon_debug(CLIXON_DBG_DEFAULT, "%s", __FUNCTION__);
clixon_debug(CLIXON_DBG_CLIENT, "%s", __FUNCTION__);
if ((ngerr = nghttp2_submit_settings(rc->rc_ngsession,
NGHTTP2_FLAG_NONE,
iv,
@ -972,7 +972,7 @@ http2_send_server_connection(restconf_conn *rc)
}
retval = 0;
done:
clixon_debug(CLIXON_DBG_DEFAULT, "%s %d", __FUNCTION__, retval);
clixon_debug(CLIXON_DBG_CLIENT, "%s %d", __FUNCTION__, retval);
return retval;
}

View file

@ -116,7 +116,7 @@ api_well_known(clixon_handle h,
cbuf *cb = NULL;
int head;
clixon_debug(CLIXON_DBG_DEFAULT, "%s", __FUNCTION__);
clixon_debug(CLIXON_DBG_CLIENT, "%s", __FUNCTION__);
if (req == NULL){
errno = EINVAL;
goto done;
@ -179,7 +179,7 @@ api_root_restconf_exact(clixon_handle h,
cbuf *cb = NULL;
int head;
clixon_debug(CLIXON_DBG_DEFAULT, "%s", __FUNCTION__);
clixon_debug(CLIXON_DBG_CLIENT, "%s", __FUNCTION__);
head = strcmp(request_method, "HEAD") == 0;
if (!head && strcmp(request_method, "GET") != 0){
if (restconf_method_notallowed(h, req, "GET", pretty, media_out) < 0)
@ -248,7 +248,7 @@ api_operational_state(clixon_handle h,
restconf_media media_out)
{
clixon_debug(CLIXON_DBG_DEFAULT, "%s request method:%s", __FUNCTION__, request_method);
clixon_debug(CLIXON_DBG_CLIENT, "%s request method:%s", __FUNCTION__, request_method);
/* We are not implementing this method at this time, 20201105 despite it
* being mandatory https://tools.ietf.org/html/rfc8527#section-3.1 */
@ -274,7 +274,7 @@ api_yang_library_version(clixon_handle h,
cbuf *cb = NULL;
yang_stmt *yspec;
clixon_debug(CLIXON_DBG_DEFAULT, "%s", __FUNCTION__);
clixon_debug(CLIXON_DBG_CLIENT, "%s", __FUNCTION__);
if (restconf_reply_header(req, "Content-Type", "%s", restconf_media_int2str(media_out)) < 0)
goto done;
if (restconf_reply_header(req, "Cache-Control", "no-cache") < 0)
@ -349,9 +349,9 @@ api_data(clixon_handle h,
char *request_method;
cxobj *xerr = NULL;
clixon_debug(CLIXON_DBG_DEFAULT, "%s", __FUNCTION__);
clixon_debug(CLIXON_DBG_CLIENT, "%s", __FUNCTION__);
request_method = restconf_param_get(h, "REQUEST_METHOD");
clixon_debug(CLIXON_DBG_DEFAULT, "%s method:%s", __FUNCTION__, request_method);
clixon_debug(CLIXON_DBG_CLIENT, "%s method:%s", __FUNCTION__, request_method);
/* https://tools.ietf.org/html/rfc8527#section-3.2 */
/* We assume that dynamic datastores are read only at this time 20201105 */
@ -399,7 +399,7 @@ api_data(clixon_handle h,
goto done;
retval = api_return_err0(h, req, xerr, pretty, media_out, 0);
}
clixon_debug(CLIXON_DBG_DEFAULT, "%s retval:%d", __FUNCTION__, retval);
clixon_debug(CLIXON_DBG_CLIENT, "%s retval:%d", __FUNCTION__, retval);
done:
if (xerr)
xml_free(xerr);
@ -435,7 +435,7 @@ api_operations(clixon_handle h,
int retval = -1;
cxobj *xerr = NULL;
clixon_debug(CLIXON_DBG_DEFAULT, "%s", __FUNCTION__);
clixon_debug(CLIXON_DBG_CLIENT, "%s", __FUNCTION__);
if (strcmp(request_method, "GET")==0)
retval = api_operations_get(h, req, path, pi, qvec, data, pretty, media_out);
else if (strcmp(request_method, "POST")==0)
@ -482,7 +482,7 @@ api_root_restconf(clixon_handle h,
int ret;
cxobj *xerr = NULL;
clixon_debug(CLIXON_DBG_DEFAULT, "%s", __FUNCTION__);
clixon_debug(CLIXON_DBG_CLIENT, "%s", __FUNCTION__);
if (req == NULL){
errno = EINVAL;
goto done;
@ -512,7 +512,7 @@ api_root_restconf(clixon_handle h,
goto ok;
}
}
clixon_debug(CLIXON_DBG_DEFAULT, "%s ACCEPT: %s %s", __FUNCTION__, media_str, restconf_media_int2str(media_out));
clixon_debug(CLIXON_DBG_CLIENT, "%s ACCEPT: %s %s", __FUNCTION__, media_str, restconf_media_int2str(media_out));
if ((pvec = clicon_strsep(path, "/", &pn)) == NULL)
goto done;
@ -543,14 +543,14 @@ api_root_restconf(clixon_handle h,
goto done;
goto ok;
}
clixon_debug(CLIXON_DBG_DEFAULT, "%s: api_resource=%s", __FUNCTION__, api_resource);
clixon_debug(CLIXON_DBG_CLIENT, "%s: api_resource=%s", __FUNCTION__, api_resource);
if (uri_str2cvec(path, '/', '=', 1, &pcvec) < 0) /* rest url eg /album=ricky/foo */
goto done;
/* data */
if ((cb = restconf_get_indata(req)) == NULL) /* XXX NYI ACTUALLY not always needed, do this later? */
goto done;
indata = cbuf_get(cb);
clixon_debug(CLIXON_DBG_DEFAULT, "%s DATA=%s", __FUNCTION__, indata);
clixon_debug(CLIXON_DBG_CLIENT, "%s DATA=%s", __FUNCTION__, indata);
/* If present, check credentials. See "plugin_credentials" in plugin
* retvals:
@ -627,7 +627,7 @@ api_root_restconf(clixon_handle h,
ok:
retval = 0;
done:
clixon_debug(CLIXON_DBG_DEFAULT, "%s retval:%d", __FUNCTION__, retval);
clixon_debug(CLIXON_DBG_CLIENT, "%s retval:%d", __FUNCTION__, retval);
#ifdef WITH_RESTCONF_FCGI
if (cb)
cbuf_free(cb);

View file

@ -215,16 +215,16 @@ restconf_stream_cb(int s,
int pretty = 0; /* XXX should be via arg */
int ret;
clixon_debug(CLIXON_DBG_DEFAULT, "%s", __FUNCTION__);
clixon_debug(CLIXON_DBG_CLIENT, "%s", __FUNCTION__);
/* get msg (this is the reason this function is called) */
if (clicon_msg_rcv(s, NULL, 0, &reply, &eof) < 0){
clixon_debug(CLIXON_DBG_DEFAULT, "%s msg_rcv error", __FUNCTION__);
clixon_debug(CLIXON_DBG_CLIENT, "%s msg_rcv error", __FUNCTION__);
goto done;
}
clixon_debug(CLIXON_DBG_DEFAULT, "%s msg: %s", __FUNCTION__, reply?reply->op_body:"null");
clixon_debug(CLIXON_DBG_CLIENT, "%s msg: %s", __FUNCTION__, reply?reply->op_body:"null");
/* handle close from remote end: this will exit the client */
if (eof){
clixon_debug(CLIXON_DBG_DEFAULT, "%s eof", __FUNCTION__);
clixon_debug(CLIXON_DBG_CLIENT, "%s eof", __FUNCTION__);
clixon_err(OE_PROTO, ESHUTDOWN, "Socket unexpected close");
errno = ESHUTDOWN;
FCGX_FPrintF(r->out, "SHUTDOWN\r\n");
@ -266,7 +266,7 @@ restconf_stream_cb(int s,
ok:
retval = 0;
done:
clixon_debug(CLIXON_DBG_DEFAULT, "%s retval: %d", __FUNCTION__, retval);
clixon_debug(CLIXON_DBG_CLIENT, "%s retval: %d", __FUNCTION__, retval);
if (xtop != NULL)
xml_free(xtop);
if (reply)
@ -306,7 +306,7 @@ restconf_stream(clixon_handle h,
cg_var *cv;
char *vname;
clixon_debug(CLIXON_DBG_DEFAULT, "%s", __FUNCTION__);
clixon_debug(CLIXON_DBG_CLIENT, "%s", __FUNCTION__);
*sp = -1;
if ((cb = cbuf_new()) == NULL){
clixon_err(OE_XML, errno, "cbuf_new");
@ -353,7 +353,7 @@ restconf_stream(clixon_handle h,
ok:
retval = 0;
done:
clixon_debug(CLIXON_DBG_DEFAULT, "%s retval: %d", __FUNCTION__, retval);
clixon_debug(CLIXON_DBG_CLIENT, "%s retval: %d", __FUNCTION__, retval);
if (xret)
xml_free(xret);
if (cb)
@ -376,9 +376,9 @@ stream_checkuplink(int s,
{
FCGX_Request *r = (FCGX_Request *)arg;
clixon_debug(CLIXON_DBG_DEFAULT, "%s", __FUNCTION__);
clixon_debug(CLIXON_DBG_CLIENT, "%s", __FUNCTION__);
if (FCGX_GetError(r->out) != 0){ /* break loop */
clixon_debug(CLIXON_DBG_DEFAULT, "%s FCGX_GetError upstream", __FUNCTION__);
clixon_debug(CLIXON_DBG_CLIENT, "%s FCGX_GetError upstream", __FUNCTION__);
clixon_exit_set(1);
}
return 0;
@ -392,9 +392,9 @@ stream_timeout(int s,
struct timeval t1;
FCGX_Request *r = (FCGX_Request *)arg;
clixon_debug(CLIXON_DBG_DEFAULT, "%s", __FUNCTION__);
clixon_debug(CLIXON_DBG_CLIENT, "%s", __FUNCTION__);
if (FCGX_GetError(r->out) != 0){ /* break loop */
clixon_debug(CLIXON_DBG_DEFAULT, "%s FCGX_GetError upstream", __FUNCTION__);
clixon_debug(CLIXON_DBG_CLIENT, "%s FCGX_GetError upstream", __FUNCTION__);
clixon_exit_set(1);
}
else{
@ -442,7 +442,7 @@ api_stream(clixon_handle h,
struct stream_child *sc;
#endif
clixon_debug(CLIXON_DBG_DEFAULT, "%s", __FUNCTION__);
clixon_debug(CLIXON_DBG_CLIENT, "%s", __FUNCTION__);
streampath = clicon_option_str(h, "CLICON_STREAM_PATH");
if ((path = restconf_uripath(h)) == NULL)
goto done;
@ -478,7 +478,7 @@ api_stream(clixon_handle h,
goto done;
goto ok;
}
clixon_debug(CLIXON_DBG_DEFAULT, "%s: method=%s", __FUNCTION__, method);
clixon_debug(CLIXON_DBG_CLIENT, "%s: method=%s", __FUNCTION__, method);
if (uri_str2cvec(path, '/', '=', 1, &pcvec) < 0) /* rest url eg /album=ricky/foo */
goto done;
@ -486,7 +486,7 @@ api_stream(clixon_handle h,
if ((cb = restconf_get_indata(req)) == NULL)
goto done;
indata = cbuf_get(cb);
clixon_debug(CLIXON_DBG_DEFAULT, "%s DATA=%s", __FUNCTION__, indata);
clixon_debug(CLIXON_DBG_CLIENT, "%s DATA=%s", __FUNCTION__, indata);
/* If present, check credentials. See "plugin_credentials" in plugin
* See RFC 8040 section 2.5
@ -522,12 +522,12 @@ api_stream(clixon_handle h,
req,
"stream socket") < 0)
goto done;
clixon_debug(CLIXON_DBG_DEFAULT, "%s before loop", __FUNCTION__);
clixon_debug(CLIXON_DBG_CLIENT, "%s before loop", __FUNCTION__);
/* Poll upstream errors */
stream_timeout(0, req);
/* Start loop */
clixon_event_loop(h);
clixon_debug(CLIXON_DBG_DEFAULT, "%s after loop", __FUNCTION__);
clixon_debug(CLIXON_DBG_CLIENT, "%s after loop", __FUNCTION__);
clicon_rpc_close_session(h);
clixon_event_unreg_fd(s, restconf_stream_cb);
close(s);
@ -562,7 +562,7 @@ api_stream(clixon_handle h,
ok:
retval = 0;
done:
clixon_debug(CLIXON_DBG_DEFAULT, "%s retval:%d", __FUNCTION__, retval);
clixon_debug(CLIXON_DBG_CLIENT, "%s retval:%d", __FUNCTION__, retval);
if (xerr)
xml_free(xerr);
if (pvec)