From ea940381fad58bc3de95c552a251f1c10cc2b924 Mon Sep 17 00:00:00 2001 From: Chris Buechler Date: Fri, 13 May 2016 00:34:15 -0500 Subject: Handle link local IPv6 gateways and default gateway switching correctly. Ticket #6258 --- src/etc/inc/gwlb.inc | 11 +++++++++++ 1 file changed, 11 insertions(+) (limited to 'src/etc/inc/gwlb.inc') diff --git a/src/etc/inc/gwlb.inc b/src/etc/inc/gwlb.inc index 415eed5..4070c9d 100644 --- a/src/etc/inc/gwlb.inc +++ b/src/etc/inc/gwlb.inc @@ -861,6 +861,9 @@ function fixup_default_gateway($ipprotocol, $gateways_status, $gateways_arr) { log_error("Default gateway down setting {$upgw} as default!"); if (is_ipaddrv6($gateways_arr[$upgw]['gateway'])) { $inetfamily = "-inet6"; + if (is_linklocal($gateways_arr[$upgw]['gateway']) && get_ll_scope($gateways_arr[$upgw]['gateway']) == '') { + $gateways_arr[$upgw]['gateway'] .= "%" . $gateways_arr[$upgw]['interface']; + } } else { $inetfamily = "-inet"; } @@ -874,6 +877,14 @@ function fixup_default_gateway($ipprotocol, $gateways_status, $gateways_arr) { if ($ipprotocol == 'inet' && !is_ipaddrv4($gateways_arr[$dfltgwname]['gateway'])) { return; } + if ($ipprotocol == 'inet6') { + if (is_linklocal($gateways_arr[$upgw]['gateway']) && get_ll_scope($gateways_arr[$upgw]['gateway']) == '') { + $gateways_arr[$upgw]['gateway'] .= "%" . $gateways_arr[$upgw]['interface']; + } + if (is_linklocal($gateways_arr[$dfltgwname]['gateway']) && get_ll_scope($gateways_arr[$dfltgwname]['gateway']) == '') { + $gateways_arr[$dfltgwname]['gateway'] .= "%" . $gateways_arr[$dfltgwname]['interface']; + } + } if ($defaultgw != $gateways_arr[$dfltgwname]['gateway']) { mwexec("/sbin/route change -{$ipprotocol} default {$gateways_arr[$dfltgwname]['gateway']}"); } -- cgit v1.1