[strongSwan] How to avoid the parsing of strongswan.conf file and set the configuration options programmatically?

2015-04-22 Thread Chinmaya Dwibedy
  Hi,I want toget rid of strongswan.conf file (which is installed /etc 
directory). Instead I wantto set the values programmatically. I have removed 
the /etc/strongswan.conf ,which is read by libstrongswan during library 
initialization. Furthermore Ihave written set_strongswan_conf_options() 
function to set the few strongswanconfiguration options and then invoking the 
Charon. The library is getting initializedand Charon is getting started up. But 
there is no charon.log file created at/var/log/. Can anyone please suggest what 
might be the wrong?  Thank you in advance for your support andhelp. #define  
IPSEC_DEBUG_LEVEL 3void set_strongswan_conf_options(char*logfile){    if 
(!library_init(NULL, cli))    {   library_deinit();   
    return FALSE;    }    
lib-settings-set_str(lib-settings,charon.filelog.%s,logfile);   
lib-settings-set_str(lib-settings,charon.filelog.%s.time_format,%b %e 
%T, logfile);    
lib-settings-set_bool(lib-settings,charon.filelog.%s.append,FALSE, 
logfile);   
lib-settings-set_bool(lib-settings,charon.filelog.%s.flush_line,TRUE, 
logfile);   
lib-settings-set_int(lib-settings,charon.filelog.%s.default,IPSEC_DEBUG_LEVEL,
 logfile);} StartCharon(){ bool ret = TRUE;        
char*lfile=/var/log/charon.log;    set_strongswan_conf_options(lfile);
 system(starter --daemoncharon);     usleep(50); return 
ret;}Regards,Chinmaya___
Users mailing list
Users@lists.strongswan.org
https://lists.strongswan.org/mailman/listinfo/users

Re: [strongSwan] How to avoid the parsing of strongswan.conf file and set the configuration options programmatically?

2015-04-22 Thread Martin Willi
Hi,

   set_strongswan_conf_options(lfile);
   system(starter --daemon charon);

You can't set options in the current process, and then expect that these
options get inherited to a child process spawned using system() or any
exec*() function.

If you want to set strongswan.conf options programatically, you'll have
to do that early in the process you want to control, for example in
charons main(). Some libcharon based programs already do that, for
example charon-xpc under src/frontends/osx.

Regards
Martin


___
Users mailing list
Users@lists.strongswan.org
https://lists.strongswan.org/mailman/listinfo/users


Re: [strongSwan] How to avoid the parsing of strongswan.conf file and set the configuration options programmatically?

2015-04-22 Thread Chinmaya Dwibedy

Thank you Martin for your valuable response. Let me go thru the charon-xpc 
under src/frontends/osx.   


 On Wednesday, April 22, 2015 7:28 PM, Martin Willi mar...@strongswan.org 
wrote:
   

 Hi,

  set_strongswan_conf_options(lfile);
  system(starter --daemon charon);

You can't set options in the current process, and then expect that these
options get inherited to a child process spawned using system() or any
exec*() function.

If you want to set strongswan.conf options programatically, you'll have
to do that early in the process you want to control, for example in
charons main(). Some libcharon based programs already do that, for
example charon-xpc under src/frontends/osx.

Regards
Martin




  ___
Users mailing list
Users@lists.strongswan.org
https://lists.strongswan.org/mailman/listinfo/users