Skip to content

Commit

Permalink
Shorten gwifip if whole socket path exceeds 100 chars
Browse files Browse the repository at this point in the history
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
  • Loading branch information
dhoffend committed Jun 28, 2016
1 parent b225d00 commit 9efc66a
Showing 1 changed file with 11 additions and 0 deletions.
11 changes: 11 additions & 0 deletions src/etc/inc/gwlb.inc
Original file line number Diff line number Diff line change
Expand Up @@ -130,8 +130,19 @@ function start_dpinger($gateway) {

$pidfile = "{$g['varrun_path']}/dpinger_{$gateway['name']}~" .
"{$gateway['gwifip']}~{$gateway['monitor']}.pid";
# dpinger socket path should not be longer then uaddr.sun_path
if (strlen($pidfile) > 100) {
$pidfile = "{$g['varrun_path']}/dpinger_{$gateway['name']}~" .
substr(md5($gateway['gwifip']),0,8) . "~" .
$gateway['monitor'] . ".pid";
}
$socket = "{$g['varrun_path']}/dpinger_{$gateway['name']}~" .
"{$gateway['gwifip']}~{$gateway['monitor']}.sock";
if (strlen($socket) > 100) {
$socket = "{$g['varrun_path']}/dpinger_{$gateway['name']}~" .
substr(md5($gateway['gwifip']),0,8) . "~" .
$gateway['monitor'] . ".sock";
}
$alarm_cmd = "{$g['etc_path']}/rc.gateway_alarm";

$params = "-S "; /* Log warnings via syslog */
Expand Down

0 comments on commit 9efc66a

Please sign in to comment.