log_dst_by_name() returns a destination from the list of destinations
parsed from the config, which then gets cloned for appending to a
request's list.
Therefore when matching in the request's list we need to know what the
original destination was that was cloned.
last = &request->log.dst;
while (*last) {
dst = *last;
- if (dst->uctx == log_dst) {
+ if (((fr_log_t *)dst->uctx)->parent == log_dst) {
*last = dst->next;
talloc_free(dst);
if (!request->log.dst) request->log.lvl = L_DBG_LVL_OFF;
* Change the debug level of an existing destination.
*/
for (dst = request->log.dst; dst != NULL; dst = dst->next) {
- if (dst->uctx == log_dst) {
+ if (((fr_log_t *)dst->uctx)->parent == log_dst) {
dst->lvl = lvl;
if (lvl > request->log.lvl) request->log.lvl = lvl;
return;
* Clone it.
*/
MEM(dbg = talloc_memdup(request, log, sizeof(*log)));
+ dbg->parent = log;
/*
* Open the new filename.
L_TIMESTAMP_OFF //!< Never log timestamps.
} fr_log_timestamp_t;
-typedef struct {
+typedef struct fr_log_s fr_log_t;
+
+struct fr_log_s {
fr_log_dst_t dst; //!< Log destination.
bool line_number; //!< Log src file and line number.
ssize_t (*cookie_write)(void *, char const *, size_t); //!< write function
void *uctx; //!< User data associated with the fr_log_t.
-} fr_log_t;
+
+ fr_log_t *parent; //!< Log destination this was cloned from.
+};
typedef struct {
char const *first_prefix; //!< Prefix for the first line printed.