Commit 2a4b5d23 authored by Baligh GUESMI's avatar Baligh GUESMI
Browse files

Add function name and line number into syslog.



This is a patch to add the function name and the line number into the
syslog messages, for debug purpose.
Not all messages are modified, and only messages with LOG_DEBUG severity.
Signed-off-by: default avatarBaligh GUESMI <gasmibal@gmail.com>
parent d2a119fa
This diff is collapsed.
......@@ -106,7 +106,7 @@ void cmdsock_shutdown(int s) {
if (s < 0) {
return;
}
syslog(LOG_DEBUG, "Shutting down cmdsocket");
syslog(LOG_DEBUG, "%s(%d): Shutting down cmdsocket", __FUNCTION__, __LINE__);
shutdown(s, 2);
close(s);
}
......@@ -110,7 +110,7 @@ void conn_finish(struct conn_t *conn) {
int conn_update_write(struct conn_t *conn) {
#if(_debug_)
syslog(LOG_DEBUG, "socket writeable!");
syslog(LOG_DEBUG, "%s(%d): socket writeable!", __FUNCTION__, __LINE__);
#endif
if (conn->write_pos == 0) {
......@@ -140,7 +140,7 @@ int conn_update_write(struct conn_t *conn) {
conn->write_pos += ret;
} else if (ret < 0 || errno != EWOULDBLOCK) {
#if(_debug_)
syslog(LOG_DEBUG, "socket closed!");
syslog(LOG_DEBUG, "%s(%d): socket closed!", __FUNCTION__, __LINE__);
#endif
conn_finish(conn);
return -1;
......@@ -154,7 +154,7 @@ int conn_select_update(struct conn_t *conn, select_ctx *sctx) {
if (conn->sock) {
switch (net_select_read_fd(sctx, conn->sock)) {
case -1:
syslog(LOG_DEBUG, "exception");
syslog(LOG_DEBUG, "%s(%d): exception", __FUNCTION__, __LINE__);
conn_finish(conn);
return -1;
......@@ -186,7 +186,7 @@ int conn_update(struct conn_t *conn, fd_set *r, fd_set *w, fd_set *e) {
if (FD_ISSET(conn->sock, e)) {
#if(_debug_)
syslog(LOG_DEBUG, "socket exception!");
syslog(LOG_DEBUG, "%s(%d): socket exception!", __FUNCTION__, __LINE__);
#endif
conn_finish(conn);
}
......@@ -207,13 +207,13 @@ _conn_bstring_readhandler(struct conn_t *conn, void *ctx) {
if (ret > 0) {
#if(_debug_)
syslog(LOG_DEBUG, "bstring_read: %d bytes", ret);
syslog(LOG_DEBUG, "%s(%d): bstring_read: %d bytes", __FUNCTION__, __LINE__, ret);
#endif
data->slen += ret;
} else {
#if(_debug_)
syslog(LOG_DEBUG, "socket closed!");
syslog(LOG_DEBUG, "<== [%s]", data->data);
syslog(LOG_DEBUG, "%s(%d): socket closed!", __FUNCTION__, __LINE__);
syslog(LOG_DEBUG, "%s(%d): <== [%s]", __FUNCTION__, __LINE__, data->data);
#endif
conn_finish(conn);
}
......
This diff is collapsed.
......@@ -36,7 +36,7 @@ dns_fullname(char *data, size_t dlen, /* buffer to store name */
#if(_debug_ > 1)
if (_options.debug)
syslog(LOG_DEBUG, "%s dlen=%zd reslen=%zd olen=%zd lvl=%d",
syslog(LOG_DEBUG, "%s(%d): %s dlen=%zd reslen=%zd olen=%zd lvl=%d", __FUNCTION__, __LINE__,
__FUNCTION__, dlen, reslen, olen, lvl);
#endif
......@@ -54,13 +54,13 @@ dns_fullname(char *data, size_t dlen, /* buffer to store name */
if (offset > olen) {
if (_options.debug)
syslog(LOG_DEBUG, "bad value");
syslog(LOG_DEBUG, "%s(%d): bad value", __FUNCTION__, __LINE__);
return -1;
}
#if(_debug_ > 1)
if (_options.debug)
syslog(LOG_DEBUG, "skip[%d] olen=%zd", offset, olen);
syslog(LOG_DEBUG, "%s(%d): skip[%d] olen=%zd", __FUNCTION__, __LINE__, offset, olen);
#endif
if (dns_fullname(d, dlen,
......@@ -74,13 +74,13 @@ dns_fullname(char *data, size_t dlen, /* buffer to store name */
if (l >= dlen || l >= olen) {
if (_options.debug)
syslog(LOG_DEBUG, "bad value %d/%zu/%zu", l, dlen, olen);
syslog(LOG_DEBUG, "%s(%d): bad value %d/%zu/%zu", __FUNCTION__, __LINE__, l, dlen, olen);
return -1;
}
#if(_debug_ > 1)
if (_options.debug)
syslog(LOG_DEBUG, "part[%.*s] reslen=%zd l=%d dlen=%zd",
syslog(LOG_DEBUG, "%s(%d): part[%.*s] reslen=%zd l=%d dlen=%zd", __FUNCTION__, __LINE__,
l, res, reslen, l, dlen);
#endif
......@@ -136,7 +136,7 @@ dns_copy_res(struct dhcp_conn_t *conn, int q,
int isReq, int *qmatch, int *modified, int mode) {
#define return_error { \
if (_options.debug) syslog(LOG_DEBUG, "failed parsing DNS packet"); return -1; }
if (_options.debug) syslog(LOG_DEBUG, "%s(%d): failed parsing DNS packet", __FUNCTION__, __LINE__); return -1; }
uint8_t *p_pkt = *pktp;
size_t len = *left;
......@@ -162,8 +162,8 @@ dns_copy_res(struct dhcp_conn_t *conn, int q,
#if(_debug_ > 1)
if (_options.debug)
syslog(LOG_DEBUG, "%s: left=%zd olen=%zd qsize=%zd",
__FUNCTION__, *left, olen, qsize);
syslog(LOG_DEBUG, "%s(%d): left=%zd olen=%zd qsize=%zd",
__FUNCTION__, __LINE__, *left, olen, qsize);
#endif
memset(name, 0, sizeof(name));
......@@ -198,7 +198,7 @@ dns_copy_res(struct dhcp_conn_t *conn, int q,
#if(_debug_)
if (_options.debug)
syslog(LOG_DEBUG, "It was a dns record type: %d class: %d", type, class);
syslog(LOG_DEBUG, "%s(%d): It was a dns record type: %d class: %d", __FUNCTION__, __LINE__, type, class);
#endif
if (q) {
......@@ -206,7 +206,7 @@ dns_copy_res(struct dhcp_conn_t *conn, int q,
return_error;
if (_options.debug)
syslog(LOG_DEBUG, "DNS: %s", question);
syslog(LOG_DEBUG, "%s(%d): DNS: %s", __FUNCTION__, __LINE__, question);
*pktp = p_pkt;
*left = len;
......@@ -221,7 +221,7 @@ dns_copy_res(struct dhcp_conn_t *conn, int q,
#if(_debug_)
if (_options.debug)
syslog(LOG_DEBUG, "checking %s [%s]",
syslog(LOG_DEBUG, "%s(%d): checking %s [%s]", __FUNCTION__, __LINE__,
_options.uamdomains[id], question);
#endif
......@@ -244,7 +244,7 @@ dns_copy_res(struct dhcp_conn_t *conn, int q,
) ) {
#if(_debug_)
if (_options.debug)
syslog(LOG_DEBUG, "matched %s [%s]", _options.uamdomains[id], question);
syslog(LOG_DEBUG, "%s(%d): matched %s [%s]", __FUNCTION__, __LINE__, _options.uamdomains[id], question);
#endif
*qmatch = 1;
break;
......@@ -262,14 +262,14 @@ dns_copy_res(struct dhcp_conn_t *conn, int q,
if (_options.ipv6) {
if (isReq && type == 28) {
if (_options.debug)
syslog(LOG_DEBUG, "changing AAAA to A request");
syslog(LOG_DEBUG, "%s(%d): changing AAAA to A request", __FUNCTION__, __LINE__);
us = 1;
us = htons(us);
memcpy(pkt_type, &us, sizeof(us));
*modified = 1;
} else if (!isReq && type == 1) {
if (_options.debug)
syslog(LOG_DEBUG, "changing A to AAAA response");
syslog(LOG_DEBUG, "%s(%d): changing A to AAAA response", __FUNCTION__, __LINE__);
us = 28;
us = htons(us);
memcpy(pkt_type, &us, sizeof(us));
......@@ -296,13 +296,13 @@ dns_copy_res(struct dhcp_conn_t *conn, int q,
#if(_debug_ > 1)
if (_options.debug)
syslog(LOG_DEBUG, "-> w ttl: %d rdlength: %d/%zd", ttl, rdlen, len);
syslog(LOG_DEBUG, "%s(%d): -> w ttl: %d rdlength: %d/%zd", __FUNCTION__, __LINE__, ttl, rdlen, len);
#endif
if (*qmatch == 1 && ttl > _options.uamdomain_ttl) {
#if(_debug_)
if (_options.debug)
syslog(LOG_DEBUG, "Rewriting DNS ttl from %d to %d",
syslog(LOG_DEBUG, "%s(%d): Rewriting DNS ttl from %d to %d", __FUNCTION__, __LINE__,
(int) ttl, _options.uamdomain_ttl);
#endif
ul = _options.uamdomain_ttl;
......@@ -321,14 +321,14 @@ dns_copy_res(struct dhcp_conn_t *conn, int q,
default:
if (_options.debug)
syslog(LOG_DEBUG, "Record type %d", type);
syslog(LOG_DEBUG, "%s(%d): Record type %d", __FUNCTION__, __LINE__, type);
return_error;
break;
case 1:
#if(_debug_ > 1)
if (_options.debug)
syslog(LOG_DEBUG, "A record");
syslog(LOG_DEBUG, "%s(%d): A record", __FUNCTION__, __LINE__);
#endif
required = 1;
......@@ -340,7 +340,7 @@ dns_copy_res(struct dhcp_conn_t *conn, int q,
memcpy(&reqaddr.s_addr, p_pkt+offset, 4);
#if(_debug_)
if (_options.debug)
syslog(LOG_DEBUG, "mDNS %s = %s", name, inet_ntoa(reqaddr));
syslog(LOG_DEBUG, "%s(%d): mDNS %s = %s", __FUNCTION__, __LINE__, name, inet_ntoa(reqaddr));
#endif
}
break;
......@@ -357,32 +357,32 @@ dns_copy_res(struct dhcp_conn_t *conn, int q,
case 2:
if (_options.debug)
syslog(LOG_DEBUG, "NS record");
syslog(LOG_DEBUG, "%s(%d): NS record", __FUNCTION__, __LINE__);
required = 1;
break;
case 5:
if (_options.debug)
syslog(LOG_DEBUG, "CNAME record %s", name);
syslog(LOG_DEBUG, "%s(%d): CNAME record %s", __FUNCTION__, __LINE__, name);
required = 1;
break;
case 6:
if (_options.debug)
syslog(LOG_DEBUG, "SOA record");
syslog(LOG_DEBUG, "%s(%d): SOA record", __FUNCTION__, __LINE__);
break;
case 12:
if (_options.debug)
syslog(LOG_DEBUG, "PTR record");
syslog(LOG_DEBUG, "%s(%d): PTR record", __FUNCTION__, __LINE__);
break;
case 15:
if (_options.debug)
syslog(LOG_DEBUG, "MX record");
syslog(LOG_DEBUG, "%s(%d): MX record", __FUNCTION__, __LINE__);
required = 1;
break;
case 16:/* TXT */
if (_options.debug)
syslog(LOG_DEBUG, "TXT record %d", rdlen);
syslog(LOG_DEBUG, "%s(%d): TXT record %d", __FUNCTION__, __LINE__, rdlen);
if (_options.debug) {
char *txt = (char *)p_pkt;
int txtlen = rdlen;
......@@ -390,7 +390,7 @@ dns_copy_res(struct dhcp_conn_t *conn, int q,
uint8_t l = *txt++;
if (l == 0) break;
if (_options.debug)
syslog(LOG_DEBUG, "Text: %.*s", (int) l, txt);
syslog(LOG_DEBUG, "%s(%d): Text: %.*s", __FUNCTION__, __LINE__, (int) l, txt);
txt += l;
txtlen -= l;
}
......@@ -399,24 +399,24 @@ dns_copy_res(struct dhcp_conn_t *conn, int q,
case 28:
if (_options.debug)
syslog(LOG_DEBUG, "AAAA record");
syslog(LOG_DEBUG, "%s(%d): AAAA record", __FUNCTION__, __LINE__);
required = 1;
break;
case 29:
if (_options.debug)
syslog(LOG_DEBUG, "LOC record");
syslog(LOG_DEBUG, "%s(%d): LOC record", __FUNCTION__, __LINE__);
break;
case 33:
if (_options.debug)
syslog(LOG_DEBUG, "SRV record");
syslog(LOG_DEBUG, "%s(%d): SRV record", __FUNCTION__, __LINE__);
break;
case 41:
if (_options.debug)
syslog(LOG_DEBUG, "EDNS OPT pseudorecord");
syslog(LOG_DEBUG, "%s(%d): EDNS OPT pseudorecord", __FUNCTION__, __LINE__);
break;
case 47:
if (_options.debug)
syslog(LOG_DEBUG, "NSEC record");
syslog(LOG_DEBUG, "%s(%d): NSEC record", __FUNCTION__, __LINE__);
break;
}
......
......@@ -48,11 +48,11 @@ int http_parse_input(char *src, int len, int is_cookie) {
/*bunescape(name);*/
if ((eq_pos + 1) == end_pos || (end_pos - eq_pos) <= 1) {
syslog(LOG_DEBUG, "%s = nil", name->data);
syslog(LOG_DEBUG, "%s(%d): %s = nil", __FUNCTION__, __LINE__, name->data);
} else {
bassignblk(value, src+eq_pos+1, end_pos-eq_pos-1);
/*bunescape(value);*/
syslog(LOG_DEBUG, "%s = %s", name->data, value->data);
syslog(LOG_DEBUG, "%s(%d): %s = %s", __FUNCTION__, __LINE__, name->data, value->data);
setenv((char *)name->data, (char *)value->data, 1);
}
start_pos = end_pos + 1;
......@@ -147,12 +147,12 @@ static void json_walk(bstring prefix, struct json_object *obj) {
case json_type_array:
bassign(tmp, prefix);
bcatcstr(tmp, key);
syslog(LOG_DEBUG, "a %s=%s", tmp->data, json_object_to_json_string(val));
syslog(LOG_DEBUG, "%s(%d): a %s=%s", __FUNCTION__, __LINE__, tmp->data, json_object_to_json_string(val));
break;
default:
bassign(tmp, prefix);
bcatcstr(tmp, key);
syslog(LOG_DEBUG, "%s=%s", tmp->data, json_object_to_json_string(val));
syslog(LOG_DEBUG, "%s(%d): %s=%s", __FUNCTION__, __LINE__, tmp->data, json_object_to_json_string(val));
break;
}
bdestroy(tmp);
......@@ -170,7 +170,7 @@ int ewtapi(struct redir_t *redir,
bstring res = bfromcstr("");
int i;
syslog(LOG_DEBUG, "EWT API Request");
syslog(LOG_DEBUG, "%s(%d): EWT API Request", __FUNCTION__, __LINE__);
redir_getparam(redir, httpreq->qs, "s", s);
redir_getparam(redir, httpreq->qs, "res", res);
......@@ -183,7 +183,7 @@ int ewtapi(struct redir_t *redir,
struct json_object *obj = 0;
bblk_fromfd(b, 0, httpreq->clen);
if ((obj = json_tokener_parse((char *)b->data))) {
syslog(LOG_DEBUG, "obj.to_string()=%s", json_object_to_json_string(obj));
syslog(LOG_DEBUG, "%s(%d): obj.to_string()=%s", __FUNCTION__, __LINE__, json_object_to_json_string(obj));
json_object_object_foreach(obj, key, val) {
if (!strcmp(key, (char *)s->data)) {
bstring tmp = bfromcstr("CAP_");
......@@ -214,7 +214,7 @@ int ewtapi(struct redir_t *redir,
bassigncstr(b, "");
if (!strcmp(ewt_services[i].name, (char *)s->data)) {
ewt_services[i].func(b);
syslog(LOG_DEBUG, "Internal EWT Service %s -> %s", ewt_services[i].name, b->data);
syslog(LOG_DEBUG, "%s(%d): Internal EWT Service %s -> %s", __FUNCTION__, __LINE__, ewt_services[i].name, b->data);
if (safe_write(1, b->data, b->slen) < 0) {
syslog(LOG_ERR, "%s: redir_write()", strerror(errno));
}
......@@ -226,7 +226,7 @@ int ewtapi(struct redir_t *redir,
}
setenv("EWTAPI", "1", 1);
syslog(LOG_DEBUG, "EWT API Running %s", *binqqargs);
syslog(LOG_DEBUG, "%s(%d): EWT API Running %s", __FUNCTION__, __LINE__, *binqqargs);
execv(*binqqargs, binqqargs);
syslog(LOG_ERR, "%s: count not exec %s", strerror(errno), *binqqargs);
......
......@@ -227,7 +227,7 @@ int garden_patricia_add(pass_through *pt, patricia_tree_t *ptree) {
for (i=0; i < nd->ptcnt; i++) {
if (pt_equal(&nd->ptlist[i], pt)) {
if (_options.debug)
syslog(LOG_DEBUG, "(Patricia)Uamallowed already exists #%d:%d: proto=%d host=%s port=%d",
syslog(LOG_DEBUG, "%s(%d): (Patricia)Uamallowed already exists #%d:%d: proto=%d host=%s port=%d", __FUNCTION__, __LINE__,
i, nd->ptcnt, pt->proto, inet_ntoa(pt->host), pt->port);
break;
}
......@@ -274,9 +274,9 @@ int garden_patricia_rem(pass_through *pt, patricia_tree_t *ptree) {
for (i=0; i < nd->ptcnt; i++) {
if (pt_equal(&nd->ptlist[i], pt)) {
if (_options.debug) {
syslog(LOG_DEBUG, "(Patricia)Uamallowed removing #%d:%d: proto=%d host=%s port=%d",
syslog(LOG_DEBUG, "%s(%d): (Patricia)Uamallowed removing #%d:%d: proto=%d host=%s port=%d", __FUNCTION__, __LINE__,
i, nd->ptcnt, pt->proto, inet_ntoa(pt->host), pt->port);
syslog(LOG_DEBUG, "Shifting uamallowed list %d to %d", i, nd->ptcnt);
syslog(LOG_DEBUG, "%s(%d): Shifting uamallowed list %d to %d", __FUNCTION__, __LINE__, i, nd->ptcnt);
}
for (; i < nd->ptcnt-1; i++)
......@@ -380,9 +380,9 @@ int pass_through_rem(pass_through *ptlist, uint32_t *ptcnt,
for (i=0; i < cnt; i++) {
if (pt_equal(&ptlist[i], pt)) {
if (_options.debug) {
syslog(LOG_DEBUG, "Uamallowed removing #%d: proto=%d host=%s port=%d",
syslog(LOG_DEBUG, "%s(%d): Uamallowed removing #%d: proto=%d host=%s port=%d", __FUNCTION__, __LINE__,
i, pt->proto, inet_ntoa(pt->host), pt->port);
syslog(LOG_DEBUG, "Shifting uamallowed list %d to %d", i, cnt);
syslog(LOG_DEBUG, "%s(%d): Shifting uamallowed list %d to %d", __FUNCTION__, __LINE__, i, cnt);
}
for (; i < cnt-1; i++)
memcpy(&ptlist[i], &ptlist[i+1], sizeof(pass_through));
......@@ -412,11 +412,11 @@ int pass_through_add(pass_through *ptlist, uint32_t ptlen,
for (i=0; i < cnt; i++) {
if (pt_equal(&ptlist[i], pt)) {
if (_options.debug)
syslog(LOG_DEBUG, "Uamallowed already exists #%d:%d: proto=%d host=%s port=%d",
syslog(LOG_DEBUG, "%s(%d): Uamallowed already exists #%d:%d: proto=%d host=%s port=%d", __FUNCTION__, __LINE__,
i, ptlen, pt->proto, inet_ntoa(pt->host), pt->port);
if (is_dyn) {
if (_options.debug)
syslog(LOG_DEBUG, "Shifting uamallowed list %d to %d", i, cnt);
syslog(LOG_DEBUG, "%s(%d): Shifting uamallowed list %d to %d", __FUNCTION__, __LINE__, i, cnt);
for (; i<cnt-1; i++)
memcpy(&ptlist[i], &ptlist[i+1], sizeof(pass_through));
cnt = *ptcnt = *ptcnt - 1;
......@@ -430,12 +430,12 @@ int pass_through_add(pass_through *ptlist, uint32_t ptlen,
if (cnt == ptlen) {
if (!is_dyn) {
if (_options.debug)
syslog(LOG_DEBUG, "No more room for walled garden entries");
syslog(LOG_DEBUG, "%s(%d): No more room for walled garden entries", __FUNCTION__, __LINE__);
return -1;
}
if (_options.debug)
syslog(LOG_DEBUG, "Shifting uamallowed list %d to %d", i, ptlen);
syslog(LOG_DEBUG, "%s(%d): Shifting uamallowed list %d to %d", __FUNCTION__, __LINE__, i, ptlen);
for (i=0; i<ptlen-1; i++)
memcpy(&ptlist[i], &ptlist[i+1], sizeof(pass_through));
......@@ -443,7 +443,7 @@ int pass_through_add(pass_through *ptlist, uint32_t ptlen,
}
if (_options.debug)
syslog(LOG_DEBUG, "Uamallowed IP address #%d:%d: proto=%d host=%s port=%d",
syslog(LOG_DEBUG, "%s(%d): Uamallowed IP address #%d:%d: proto=%d host=%s port=%d", __FUNCTION__, __LINE__,
cnt, ptlen, pt->proto, inet_ntoa(pt->host), pt->port);
memcpy(&ptlist[cnt], pt, sizeof(pass_through));
......@@ -482,7 +482,7 @@ int pass_throughs_from_string(pass_through *ptlist, uint32_t ptlen,
p1 = p3;
if (_options.debug)
syslog(LOG_DEBUG, "Uamallowed [%s]", s);
syslog(LOG_DEBUG, "%s(%d): Uamallowed [%s]", __FUNCTION__, __LINE__, s);
for ( ; p1; p1 = p2) {
......@@ -701,7 +701,7 @@ void garden_load_domainfile() {
}
if (_options.debug)
syslog(LOG_DEBUG, "compiling %s", pline);
syslog(LOG_DEBUG, "%s(%d): compiling %s", __FUNCTION__, __LINE__, pline);
if (regcomp(&uam_re->re, pline, REG_EXTENDED | REG_NOSUB)) {
syslog(LOG_ERR, "could not compile regex %s", line);
free(uam_re);
......@@ -733,7 +733,7 @@ int garden_check_domainfile(char *question) {
#if(_debug_)
if (match)
if (_options.debug)
syslog(LOG_DEBUG, "matched DNS name %s", question);
syslog(LOG_DEBUG, "%s(%d): matched DNS name %s", __FUNCTION__, __LINE__, question);
#endif
if (match) return uam_re->neg ? 0 : 1;
......
......@@ -28,7 +28,7 @@ static int location_count=0;
void location_close_conn(struct app_conn_t *conn, int close) {
syslog(LOG_DEBUG, "removing(%s) one of %d sessions from %s",
syslog(LOG_DEBUG, "%s(%d): removing(%s) one of %d sessions from %s", __FUNCTION__, __LINE__,
close ? "closing" : "roaming out",
(int)conn->loc_search_node->total_sess_count,
conn->loc_search_node->value);
......@@ -89,13 +89,13 @@ void location_close_conn(struct app_conn_t *conn, int close) {
static int
avl_comp(const void *k1, const void *k2) {
int result = strncmp(k1, k2, MAX_LOCATION_LENGTH);
syslog(LOG_DEBUG, "%s result %d",__FUNCTION__,result);
syslog(LOG_DEBUG, "%s(%d): result %d",__FUNCTION__, __LINE__, result);
/* log_dbg("k1: %s k2: %s",k1,k2); */
return result;
}
struct loc_search_t *location_find(char *loc) {
syslog(LOG_DEBUG, "looking for location: %s", loc);
syslog(LOG_DEBUG, "%s(%d): looking for location: %s", __FUNCTION__, __LINE__, loc);
return (struct loc_search_t *)avl_find(&loc_search_tree, loc);
}
......@@ -110,10 +110,10 @@ void location_add_conn(struct app_conn_t *appconn, char *loc) {
loc_search = (struct loc_search_t *)avl_find(&loc_search_tree, loc);
syslog(LOG_DEBUG, "checking location: %s", loc);
syslog(LOG_DEBUG, "%s(%d): checking location: %s", __FUNCTION__, __LINE__, loc);
if (loc_search == NULL) {
location_count++;
syslog(LOG_DEBUG, "creating tree entry %d for location: %s",
syslog(LOG_DEBUG, "%s(%d): creating tree entry %d for location: %s", __FUNCTION__, __LINE__,
location_count, loc);
loc_search=calloc(1, sizeof(*loc_search));
memcpy(loc_search->value,loc,sizeof(loc_search->value));
......@@ -135,7 +135,7 @@ void location_add_conn(struct app_conn_t *appconn, char *loc) {
else loc_search->new_sess_count++;
appconn->loc_search_node=loc_search;
syslog(LOG_DEBUG, "location '%s' now has %d sessions attached",
syslog(LOG_DEBUG, "%s(%d): location '%s' now has %d sessions attached", __FUNCTION__, __LINE__,
loc,(int)loc_search->total_sess_count);
}
......@@ -164,10 +164,10 @@ void location_printlist(bstring s, char *loc, int json, int list) {
if (timespan >= 1) {
syslog(LOG_DEBUG, "roamed_in_session_count %d, out %d",
syslog(LOG_DEBUG, "%s(%d): roamed_in_session_count %d, out %d", __FUNCTION__, __LINE__,
(int)loc_search->roamed_in_sess_count,
(int)loc_search->roamed_out_sess_count);
syslog(LOG_DEBUG, "new_session_count %d, closed %d",
syslog(LOG_DEBUG, "%s(%d): new_session_count %d, closed %d", __FUNCTION__, __LINE__,
(int)loc_search->new_sess_count,
(int)loc_search->closed_sess_count);
......@@ -196,8 +196,8 @@ void location_printlist(bstring s, char *loc, int json, int list) {
#endif
int last_sent;
syslog(LOG_DEBUG, "location has %d sessions attached! ",(int)loc_search->total_sess_count);
syslog(LOG_DEBUG, "(last queried %d seconds ago)\n",(int)(act_mainclock-loc_search->last_queried));
syslog(LOG_DEBUG, "%s(%d): location has %d sessions attached! ", __FUNCTION__, __LINE__, (int)loc_search->total_sess_count);
syslog(LOG_DEBUG, "%s(%d): (last queried %d seconds ago)\n", __FUNCTION__, __LINE__, (int)(act_mainclock-loc_search->last_queried));
bassignformat(tmp,json ?
",\"session_count\":%d,\"seconds_elapsed\":%d" :
......@@ -262,7 +262,7 @@ void location_printlist(bstring s, char *loc, int json, int list) {
} else last_sent=-1;
if (list) {
syslog(LOG_DEBUG, "mac: %.2X-%.2X-%.2X-%.2X-%.2X-%.2X up: %d down: %d\n",
syslog(LOG_DEBUG, "%s(%d): mac: %.2X-%.2X-%.2X-%.2X-%.2X-%.2X up: %d down: %d\n", __FUNCTION__, __LINE__,
appconn->hismac[0], appconn->hismac[1], appconn->hismac[2],
appconn->hismac[3], appconn->hismac[4], appconn->hismac[5],
bytes_up,bytes_down);
......@@ -463,14 +463,14 @@ void location_printlist(bstring s, char *loc, int json, int list) {
= loc_search->roamed_out_sess_count = 0;
} else { /*query too short after the last*/
syslog(LOG_DEBUG, "last query less than 1 second ago!!\n");
syslog(LOG_DEBUG, "%s(%d): last query less than 1 second ago!!\n", __FUNCTION__, __LINE__);
bassignformat(tmp,json
? ",\"session_count\":-2"
: "\n\tsession_count = -2");
bconcat(s,tmp);
}
} else {
syslog(LOG_DEBUG, "location (%s) not found!", loc);
syslog(LOG_DEBUG, "%s(%d): location (%s) not found!", __FUNCTION__, __LINE__, loc);
bassignformat(tmp,json ?
",\"session_count\":-1"
",\"location_count\":%d" :
......@@ -515,7 +515,7 @@ void location_init() {
memset(&loc_search_tree, 0, sizeof(loc_search_tree));
avl_init(&loc_search_tree, avl_comp, false);
while (conn) {
syslog(LOG_DEBUG, "restoring location (%s) of conn %X-%X-%X-%X-%X-%X\n",
syslog(LOG_DEBUG, "%s(%d): restoring location (%s) of conn %X-%X-%X-%X-%X-%X\n", __FUNCTION__, __LINE__,
conn->s_state.location,
conn->hismac[0],conn->hismac[1],conn->hismac[2],
conn->hismac[3],conn->hismac[4],conn->hismac[5]);
......
This diff is collapsed.
......@@ -42,7 +42,7 @@ openssl_env * initssl() {
OpenSSL_add_all_algorithms();
#else
matrixSslOpen();
syslog(LOG_DEBUG, "MatrixSslOpen()");
syslog(LOG_DEBUG, "%s(%d): MatrixSslOpen()", __FUNCTION__, __LINE__);
#endif
}
openssl_env_init(sslenv_svr = calloc(1, sizeof(openssl_env)), 0, 1);
......@@ -62,7 +62,7 @@ openssl_env * initssl_cli() {
OpenSSL_add_all_algorithms();
#else
matrixSslOpen();
syslog(LOG_DEBUG, "MatrixSslOpen()");
syslog(LOG_DEBUG, "%s(%d): MatrixSslOpen()", __FUNCTION__, __LINE__);
#endif
}
openssl_env_init(sslenv_cli = calloc(1, sizeof(openssl_env)), 0, 0);
......@@ -204,11 +204,11 @@ openssl_env_init(openssl_env *env, char *engine, int server) {
return err;
}
#else
syslog(LOG_DEBUG, "MatrixSSL Setup:");
syslog(LOG_DEBUG, "SSL cert: %s",_options.sslcertfile);
syslog(LOG_DEBUG, "SSL key: %s",_options.sslkeyfile);
syslog(LOG_DEBUG, "SSL pass: %s",_options.sslkeypass?_options.sslkeypass:"null");
syslog(LOG_DEBUG, "SSL ca: %s",_options.sslcafile?_options.sslcafile:"null");
syslog(LOG_DEBUG, "%s(%d): MatrixSSL Setup:", __FUNCTION__, __LINE__);
syslog(LOG_DEBUG, "%s(%d): SSL cert: %s", __FUNCTION__, __LINE__, _options.sslcertfile);
syslog(LOG_DEBUG, "%s(%d): SSL key: %s", __FUNCTION__, __LINE__, _options.sslkeyfile);
syslog(LOG_DEBUG, "%s(%d): SSL pass: %s", __FUNCTION__, __LINE__, _options.sslkeypass?_options.sslkeypass:"null");
syslog(LOG_DEBUG, "%s(%d): SSL ca: %s", __FUNCTION__, __LINE__, _options.sslcafile?_options.sslcafile:"null");
if ( matrixSslReadKeys( &env->keys,
_options.sslcertfile,
_options.sslkeyfile,
......@@ -225,7 +225,7 @@ openssl_env_init(openssl_env *env, char *engine, int server) {
#ifdef HAVE_MATRIXSSL
static int certValidator(sslCertInfo_t *t, void *arg) {
syslog(LOG_DEBUG, "MatrixSSL: certValidator()");
syslog(LOG_DEBUG, "%s(%d): MatrixSSL: certValidator()", __FUNCTION__, __LINE__);
return 1;
}
#endif
......@@ -257,7 +257,7 @@ openssl_connect_fd(openssl_env *env, int fd, int timeout) {
#if(_debug_)
unsigned long error;
while ((error = ERR_get_error())) {
syslog(LOG_DEBUG, "TLS: %s", ERR_error_string(error, NULL));
syslog(LOG_DEBUG, "%s(%d): TLS: %s", __FUNCTION__, __LINE__, ERR_error_string(error, NULL));
is_error = 1;
}
#endif
......@@ -300,10 +300,10 @@ openssl_check_accept(openssl_con *c, struct redir_conn_t *conn) {
if (errno != EINTR) {
#if(_debug_ > 1)
if (errno > 0) {
syslog(LOG_DEBUG, "SSL handshake interrupted by system [Hint: Stop button pressed in browser?!]");
syslog(LOG_DEBUG, "%s(%d): SSL handshake interrupted by system [Hint: Stop button pressed in browser?!]",