From 69eca02c01dfaa4e2312e71868f8b02d60557c0f Mon Sep 17 00:00:00 2001 From: Daniel Hoffend Date: Wed, 29 Jun 2016 01:21:39 +0200 Subject: [PATCH] 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 --- src/etc/inc/gwlb.inc | 14 ++++++++++---- 1 file changed, 10 insertions(+), 4 deletions(-) diff --git a/src/etc/inc/gwlb.inc b/src/etc/inc/gwlb.inc index 998319d12a..823d243caf 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 */