diff options
author | Chris Buechler <cmb@pfsense.org> | 2016-05-13 00:34:15 -0500 |
---|---|---|
committer | Chris Buechler <cmb@pfsense.org> | 2016-05-13 00:34:41 -0500 |
commit | ea940381fad58bc3de95c552a251f1c10cc2b924 (patch) | |
tree | 44d1763216f0002ac337289943df5d7038b5d80a /src/etc/inc/gwlb.inc | |
parent | e02a27561766ad8a3ba39eb18fd622228adf5363 (diff) | |
download | pfsense-ea940381fad58bc3de95c552a251f1c10cc2b924.zip pfsense-ea940381fad58bc3de95c552a251f1c10cc2b924.tar.gz |
Handle link local IPv6 gateways and default gateway switching correctly. Ticket #6258
Diffstat (limited to 'src/etc/inc/gwlb.inc')
-rw-r--r-- | src/etc/inc/gwlb.inc | 11 |
1 files changed, 11 insertions, 0 deletions
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']}"); } |