--- gvpe/src/conf.C 2009/03/23 15:22:00 1.50 +++ gvpe/src/conf.C 2011/02/08 23:13:48 1.53 @@ -59,7 +59,8 @@ struct configuration conf; -u8 best_protocol (u8 protset) +u8 +best_protocol (u8 protset) { if (protset & PROT_IPv4 ) return PROT_IPv4; if (protset & PROT_ICMPv4) return PROT_ICMPv4; @@ -70,7 +71,8 @@ return 0; } -const char *strprotocol (u8 protocol) +const char * +strprotocol (u8 protocol) { if (protocol & PROT_IPv4 ) return "rawip"; if (protocol & PROT_ICMPv4) return "icmp"; @@ -142,7 +144,8 @@ #endif } -void configuration::init () +void +configuration::init () { memset (this, 0, sizeof (*this)); @@ -180,22 +183,27 @@ conf.pidfilename = strdup (LOCALSTATEDIR "/run/gvpe.pid"); } -void configuration::cleanup() +void +configuration::cleanup () { if (rsa_key) RSA_free (rsa_key); rsa_key = 0; - free (pidfilename); pidfilename = 0; - free (ifname); ifname = 0; + free (pidfilename); pidfilename = 0; + free (ifname); ifname = 0; #if ENABLE_HTTP_PROXY - free (proxy_host); proxy_host = 0; - free (proxy_auth); proxy_auth = 0; + free (proxy_host); proxy_host = 0; + free (proxy_auth); proxy_auth = 0; #endif #if ENABLE_DNS - free (dns_forw_host); dns_forw_host = 0; + free (dns_forw_host); dns_forw_host = 0; #endif + free (script_if_up); script_if_up = 0; + free (script_node_up); script_node_up = 0; + free (script_node_change); script_node_change = 0; + free (script_node_down); script_node_down = 0; } void @@ -339,6 +347,8 @@ free (conf.script_if_up), conf.script_if_up = strdup (val); else if (!strcmp (var, "node-up")) free (conf.script_node_up), conf.script_node_up = strdup (val); + else if (!strcmp (var, "node-change")) + free (conf.script_node_change), conf.script_node_change = strdup (val); else if (!strcmp (var, "node-down")) free (conf.script_node_down), conf.script_node_down = strdup (val); else if (!strcmp (var, "pid-file")) @@ -491,7 +501,8 @@ return 0; } -void conf_node::finalise () +void +conf_node::finalise () { if (max_queue < 1) { @@ -506,7 +517,8 @@ } } -void configuration_parser::parse_argv () +void +configuration_parser::parse_argv () { for (int i = 0; i < argc; ++i) { @@ -623,7 +635,8 @@ (*i)->finalise (); } -char *configuration::config_filename (const char *name, const char *dflt) +char * +configuration::config_filename (const char *name, const char *dflt) { char *fname; @@ -674,4 +687,3 @@ cleanup (); } -