Skip to content

Commit

Permalink
interfaces: figure out point-to-point or subnet setup
Browse files Browse the repository at this point in the history
  • Loading branch information
fichtner committed Aug 4, 2022
1 parent e1e8abc commit d69ff4a
Showing 1 changed file with 14 additions and 6 deletions.
20 changes: 14 additions & 6 deletions src/etc/inc/interfaces.inc
Expand Up @@ -590,12 +590,20 @@ function _interfaces_gre_configure($gre)
mwexecf('/sbin/ifconfig %s tunnel %s %s', [$gre['greif'], get_interface_ip($gre['if']), $gre['remote-addr']]);
}
if (is_ipaddrv6($gre['tunnel-local-addr']) || is_ipaddrv6($gre['tunnel-remote-addr'])) {
mwexecf('/sbin/ifconfig %s inet6 %s %s prefixlen %s', [
$gre['greif'],
$gre['tunnel-local-addr'],
$gre['tunnel-remote-addr'],
'128',
]);
/* check if destination is local to source and if not we need the traditional point-to-point setup */
if (ip_in_subnet($gre['tunnel-remote-addr'], "{$gre['tunnel-local-addr']}/{$gre['tunnel-remote-net']}")) {
mwexecf('/sbin/ifconfig %s inet6 %s prefixlen %s', [
$gre['greif'],
$gre['tunnel-local-addr'],
$gre['tunnel-remote-net'],
]);
} else {
mwexecf('/sbin/ifconfig %s inet6 %s %s prefixlen 128', [
$gre['greif'],
$gre['tunnel-local-addr'],
$gre['tunnel-remote-addr'],
]);
}
} else {
mwexecf('/sbin/ifconfig %s inet6 ifdisabled', [$gre['greif']]);
mwexecf('/sbin/ifconfig %s %s %s netmask %s', [
Expand Down

0 comments on commit d69ff4a

Please sign in to comment.