diff --git a/security/pfSense-pkg-tinc/files/usr/local/pkg/tinc.inc b/security/pfSense-pkg-tinc/files/usr/local/pkg/tinc.inc index 7b152b3e2fc0..8013e2f86c7d 100644 --- a/security/pfSense-pkg-tinc/files/usr/local/pkg/tinc.inc +++ b/security/pfSense-pkg-tinc/files/usr/local/pkg/tinc.inc @@ -25,6 +25,34 @@ require_once('service-utils.inc'); require_once('util.inc'); require_once('system.inc'); +function tinc_plugin_carp($pluginparams) { + // $pluginparams['type'] = 'carp'; + // $pluginparams['event'] = 'rc.carpmaster'; + // $pluginparams['interface'] = $argument; + log_error("[tinc] got carp event "); + if ($pluginparams['type'] == 'carp') { + if ($pluginparams['event'] == 'rc.carpmaster') { + // start + log_error("[tinc] got CARP:MASTER -> starting"); + if (is_service_running('tinc')) { + log_error("[tinc] already running"); + } else { + start_service("tinc"); + } + } + if ($pluginparams['event'] == 'rc.carpbackup') { + // stop + log_error("[tinc] got CARP:BACKUP -> stopping"); + if (!is_service_running('tinc')) { + log_error("[tinc] already stopped"); + } else { + stop_service("tinc"); + } + } + } +} + + function tinc_save() { global $config, $configpath; $configpath = '/usr/local/etc/tinc'; @@ -146,7 +174,7 @@ function tinc_save() { function tinc_write_rcfile() { $rc['file'] = 'tinc.sh'; $rc['start'] .= "/usr/local/sbin/tincd --config=/usr/local/etc/tinc\n\t"; - $rc['stop'] .= "/usr/local/sbin/tincd --kill \n\t"; + $rc['stop'] .= "/usr/local/sbin/tincd --kill && sleep 2\n\t"; write_rcfile($rc); } diff --git a/security/pfSense-pkg-tinc/files/usr/local/pkg/tinc.xml b/security/pfSense-pkg-tinc/files/usr/local/pkg/tinc.xml index 0f0cfc5b08a9..175ff5e3f34c 100644 --- a/security/pfSense-pkg-tinc/files/usr/local/pkg/tinc.xml +++ b/security/pfSense-pkg-tinc/files/usr/local/pkg/tinc.xml @@ -47,6 +47,11 @@ tincd Tinc Mesh VPN + + + plugin_carp + + Settings