diff options
author | Daniel Hoffend <dh@dotlan.net> | 2016-06-29 01:21:39 +0200 |
---|---|---|
committer | Chris Buechler <cmb@pfsense.org> | 2016-06-28 21:13:47 -0500 |
commit | 69eca02c01dfaa4e2312e71868f8b02d60557c0f (patch) | |
tree | c2c1ff5e1e43cebbaddac1a095df58b99834a9ad | |
parent | dca9eafb0eec2bc2c21522183b01217ad969d6cf (diff) | |
download | pfsense-69eca02c01dfaa4e2312e71868f8b02d60557c0f.zip pfsense-69eca02c01dfaa4e2312e71868f8b02d60557c0f.tar.gz |
Shorten gwifip if whole socket path exceeds 100 chars
dpinger stopps with an error when the socketname exceeds over
(around) 100 characters. The dpinger will not start and not deliver
monitoring results to the WebUI.
These long socket names can get created when using link-local addresses
and long gateway names / interface scopes.
See Ticket 6505
-rw-r--r-- | src/etc/inc/gwlb.inc | 14 |
1 files changed, 10 insertions, 4 deletions
diff --git a/src/etc/inc/gwlb.inc b/src/etc/inc/gwlb.inc index 998319d..823d243 100644 --- a/src/etc/inc/gwlb.inc +++ b/src/etc/inc/gwlb.inc @@ -128,10 +128,16 @@ function start_dpinger($gateway) { $dpinger_defaults = return_dpinger_defaults(); - $pidfile = "{$g['varrun_path']}/dpinger_{$gateway['name']}~" . - "{$gateway['gwifip']}~{$gateway['monitor']}.pid"; - $socket = "{$g['varrun_path']}/dpinger_{$gateway['name']}~" . - "{$gateway['gwifip']}~{$gateway['monitor']}.sock"; + $prefix = "{$g['varrun_path']}/dpinger_{$gateway['name']}~" . + "{$gateway['gwifip']}~{$gateway['monitor']}"; + # dpinger socket path should not be longer then uaddr.sun_path + if (strlen($pidfile) > 95) { + $prefix = "{$g['varrun_path']}/dpinger_{$gateway['name']}~" . + substr(md5($gateway['gwifip']),0,8) . "~" . + $gateway['monitor']; + } + $pidfile = $prefix . ".pid"; + $socket = $prefix . ".sock"; $alarm_cmd = "{$g['etc_path']}/rc.gateway_alarm"; $params = "-S "; /* Log warnings via syslog */ |