Navigation


Changeset 1387:d70f5f6cb306 in freeDiameter for extensions/rt_ereg/rtereg_conf.y


Ignore:
Timestamp:
Oct 15, 2019, 11:25:47 PM (5 years ago)
Author:
Thomas Klausner <tk@giga.or.at>
Branch:
default
Phase:
public
Message:

rt_ereg: improve logging and locking

File:
1 edited

Legend:

Unmodified
Added
Removed
  • extensions/rt_ereg/rtereg_conf.y

    r1342 r1387  
    6262        int ret;
    6363
    64         TRACE_ENTRY("%p", conffile);
    65 
    66         TRACE_DEBUG (FULL, "Parsing configuration file: %s...", conffile);
     64        LOG_D("[rt_ereg] parsing configuration file '%s'", conffile);
    6765
    6866        rtereg_confin = fopen(conffile, "r");
     
    7068                ret = errno;
    7169                fd_log_debug("Unable to open extension configuration file %s for reading: %s", conffile, strerror(ret));
    72                 TRACE_DEBUG (INFO, "rt_ereg: error occurred, message logged -- configuration file.");
     70                LOG_E("[rt_ereg] error occurred, message logged -- configuration file.");
    7371                return ret;
    7472        }
     
    8078
    8179        if (rtereg_conf[rtereg_conf_size-1].finished == 0) {
    82                 TRACE_DEBUG(INFO, "rt_ereg: configuration invalid, AVP ended without OCTETSTRING AVP");
     80                LOG_E("[rt_ereg] configuration invalid, AVP ended without OCTETSTRING AVP");
    8381                return EINVAL;
    8482        }
    8583
    8684        if (ret != 0) {
    87                 TRACE_DEBUG(INFO, "rt_ereg: unable to parse the configuration file.");
     85                LOG_E("[rt_ereg] unable to parse the configuration file.");
    8886                return EINVAL;
    8987        } else {
     
    9290                        sum += rtereg_conf[i].rules_nb;
    9391                }
    94                 TRACE_DEBUG(FULL, "[rt-ereg] Added %d rules successfully.", sum);
     92                LOG_D("[rt-ereg] Added %d rules successfully.", sum);
    9593        }
    9694
     
    105103        if (rtereg_conf[rtereg_conf_size-1].finished) {
    106104                if ((ret = realloc(rtereg_conf, sizeof(*rtereg_conf)*(rtereg_conf_size+1))) == NULL) {
    107                         TRACE_DEBUG(INFO, "rt_ereg: realloc failed");
     105                        LOG_E("[rt_ereg] realloc failed");
    108106                        return -1;
    109107                }
     
    111109                rtereg_conf = ret;
    112110                memset(&rtereg_conf[rtereg_conf_size-1], 0, sizeof(*rtereg_conf));
    113                 TRACE_DEBUG(INFO, "rt_ereg: New AVP group found starting with %s", name);
     111                LOG_D("[rt_ereg] New AVP group found starting with %s", name);
    114112        }
    115113        level = rtereg_conf[rtereg_conf_size-1].level + 1;
    116114
    117115        if ((ret = realloc(rtereg_conf[rtereg_conf_size-1].avps, sizeof(*rtereg_conf[rtereg_conf_size-1].avps)*level)) == NULL) {
    118                 TRACE_DEBUG(INFO, "rt_ereg: realloc failed");
     116                LOG_E("[rt_ereg] realloc failed");
    119117                return -1;
    120118        }
     
    123121        CHECK_FCT_DO( fd_dict_search ( fd_g_config->cnf_dict, DICT_AVP, AVP_BY_NAME_ALL_VENDORS, name, &rtereg_conf[rtereg_conf_size-1].avps[level-1], ENOENT ),
    124122                      {
    125                               TRACE_DEBUG(INFO, "rt_ereg: Unable to find '%s' AVP in the loaded dictionaries.", name);
     123                              LOG_E("[rt_ereg] Unable to find '%s' AVP in the loaded dictionaries.", name);
    126124                              return -1;
    127125                      } );
     
    134132                        rtereg_conf[rtereg_conf_size-1].finished = 1;
    135133                } else if (data.avp_basetype != AVP_TYPE_GROUPED) {
    136                         TRACE_DEBUG(INFO, "rt_ereg: '%s' AVP is not an OCTETSTRING nor GROUPED AVP (%d).", name, data.avp_basetype);
     134                        LOG_E("[rt_ereg] '%s' AVP is not an OCTETSTRING nor GROUPED AVP (%d).", name, data.avp_basetype);
    137135                        return -1;
    138136                }
     
    148146void yyerror (YYLTYPE *ploc, char * conffile, char const *s)
    149147{
    150         TRACE_DEBUG(INFO, "rt_ereg: error in configuration parsing");
     148        LOG_E("[rt_ereg] error in configuration parsing");
    151149
    152150        if (ploc->first_line != ploc->last_line)
     
    223221
    224222                                                /* Error while compiling the regex */
    225                                                 TRACE_DEBUG(INFO, "rt_ereg: error while compiling the regular expression '%s':", new->pattern);
     223                                                LOG_E("[rt_ereg] error while compiling the regular expression '%s':", new->pattern);
    226224
    227225                                                /* Get the error message size */
     
    233231                                                /* Get the error message content */
    234232                                                regerror(err, &new->preg, buf, bl);
    235                                                 TRACE_DEBUG(INFO, "\t%s", buf);
     233                                                LOG_E("\t%s", buf);
    236234
    237235                                                /* Free the buffer, return the error */
Note: See TracChangeset for help on using the changeset viewer.