[hipl-dev] Re: libconfig

  • From: Diego Biurrun <diego@xxxxxxxxxx>
  • To: hipl-dev@xxxxxxxxxxxxx
  • Date: Tue, 30 Nov 2010 16:13:06 +0100

On Fri, Nov 26, 2010 at 03:02:22PM +0100, René Hummen wrote:
> On 26.11.2010, at 14:50, Diego Biurrun wrote:
> > On Wed, Nov 24, 2010 at 08:40:56AM +0200, Miika Komu wrote:
> >> 
> >> On 23/11/10 22:18, Diego Biurrun wrote:
> >>> I think we need to decide what to do about the libconfig dependency in
> >>> the firewall.  I'm not sure why only the firewall needs it to parse
> >>> configuration files, but hipd and hipfw should be unified in this
> >>> regard.
> >>> 
> >>> The dependency on libconfig is also not completely enforced.  We claim
> >>> it to be necessary in INSTALL, but not in the spec files.  So the packages
> >>> that get built (and we distribute) behave differently depending on whether
> >>> or not libconfig was available on the system at build time or not.
> >>> 
> >>> Since the dependency is not recorded, this might result in a package that
> >>> contains binaries that are linked against libconfig without declaring a
> >>> dependency on libconfig in its metadata.  The result will be breakage.
> >>> 
> >>> Thoughts?
> >> 
> >> as a simple solution, what about just mandating libconfig in the spec 
> >> files?
> > 
> > I'm fine with that, but then we should fail in configure if libconfig is
> > not available and get rid of the #ifdefs that suggest that a configuration
> > without libconfig is supported.
>
> libconfig is currently only required for esp_token config. I would
> therefore like to keep things as they are (-> optional).

Maybe you can shed some light on the following function and its FIXME
comment from firewall/esp_prot_config.c then, we already merged the
tiny branch, so what about it?

  /**
   * parses the config-file and stores the parameters in memory
   *
   * @return  configuration parameters
   */
  config_t *esp_prot_read_config(void)
  {
      config_t *cfg = NULL;

  /* WORKAROUND in order to not introduce a new dependency for HIPL
   *
   * FIXME this should be removed once we go tiny */
  #ifdef HAVE_LIBCONFIG
      int err       = 0;

      HIP_IFEL(!(cfg = malloc(sizeof(config_t))), -1,
               "Unable to allocate memory!\n");

      // init context and read file
      config_init(cfg);
      HIP_DEBUG("reading config file: %s\n", config_file);
      HIP_IFEL(!config_read_file(cfg, config_file), -1,
               "unable to read config file, please ensure that 
esp_prot_config.cfg is located in " HIPL_SYSCONFDIR "\n");

  out_err:
      if (err) {
          esp_prot_release_config(cfg);
          cfg = NULL;
      }
  #endif

      return cfg;
  }

Diego

Other related posts: