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:15 -0500 |
commit | 857f3490862be98a23e0ae151ca2619f52cbf729 (patch) | |
tree | 3716af438fc41955a99c5a6ff3910c9f3f61b5f7 /src | |
parent | 35a19ca0acc3dfede3f54d00a586d1799622868a (diff) | |
download | pfsense-857f3490862be98a23e0ae151ca2619f52cbf729.zip pfsense-857f3490862be98a23e0ae151ca2619f52cbf729.tar.gz |
Handle link local IPv6 gateways and default gateway switching correctly. Ticket #6258
Diffstat (limited to 'src')
-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']}"); } |