mirror of
https://github.com/lucaspalomodevelop/core.git
synced 2026-03-15 09:04:39 +00:00
Interfaces inc changes for multiwan dhcp6 - Part 1
The additions and changes to these files are the first part needed to add multiwan dhcp6.
This commit is contained in:
parent
1b264e8192
commit
d0fba889a5
@ -2948,53 +2948,7 @@ function interface_dhcpv6_prepare($interface = 'wan', $wancfg)
|
||||
|
||||
$wanif = get_real_interface($interface, 'inet6');
|
||||
|
||||
$dhcp6cconf = "interface {$wanif} {\n";
|
||||
|
||||
/* for SLAAC interfaces we do fire off a dhcp6 client for just our name servers */
|
||||
if ($wancfg['ipaddrv6'] == "slaac") {
|
||||
$dhcp6cconf .= " information-only;\n";
|
||||
$dhcp6cconf .= " request domain-name-servers;\n";
|
||||
$dhcp6cconf .= " request domain-name;\n";
|
||||
$dhcp6cconf .= " script \"/var/etc/dhcp6c_{$interface}_script.sh\"; # we'd like some nameservers please\n";
|
||||
$dhcp6cconf .= "};\n";
|
||||
} else {
|
||||
/* skip address request if this is set */
|
||||
if (!isset($wancfg['dhcp6prefixonly'])) {
|
||||
$dhcp6cconf .= " send ia-na 0; # request stateful address\n";
|
||||
}
|
||||
if (is_numeric($wancfg['dhcp6-ia-pd-len'])) {
|
||||
$dhcp6cconf .= " send ia-pd 0; # request prefix delegation\n";
|
||||
}
|
||||
|
||||
$dhcp6cconf .= " request domain-name-servers;\n";
|
||||
$dhcp6cconf .= " request domain-name;\n";
|
||||
$dhcp6cconf .= " script \"/var/etc/dhcp6c_{$interface}_script.sh\"; # we'd like some nameservers please\n";
|
||||
|
||||
$dhcp6cconf .= "};\n";
|
||||
|
||||
if (!isset($wancfg['dhcp6prefixonly'])) {
|
||||
$dhcp6cconf .= "id-assoc na 0 { };\n";
|
||||
}
|
||||
|
||||
if (is_numeric($wancfg['dhcp6-ia-pd-len'])) {
|
||||
/* Setup the prefix delegation */
|
||||
$dhcp6cconf .= "id-assoc pd 0 {\n";
|
||||
if (isset($wancfg['dhcp6-ia-pd-send-hint'])) {
|
||||
$preflen = 64 - $wancfg['dhcp6-ia-pd-len'];
|
||||
$dhcp6cconf .= " prefix ::/{$preflen} infinity;\n";
|
||||
}
|
||||
foreach (link_interface_to_track6($interface) as $friendly => $ifcfg) {
|
||||
if (is_numeric($ifcfg['track6-prefix-id'])) {
|
||||
$trackifv6 = get_real_interface($friendly, 'inet6');
|
||||
$dhcp6cconf .= " prefix-interface {$trackifv6} {\n";
|
||||
$dhcp6cconf .= " sla-id {$ifcfg['track6-prefix-id']};\n";
|
||||
$dhcp6cconf .= " sla-len {$wancfg['dhcp6-ia-pd-len']};\n";
|
||||
$dhcp6cconf .= " };\n";
|
||||
}
|
||||
}
|
||||
$dhcp6cconf .= "};\n";
|
||||
}
|
||||
}
|
||||
$dhcp6cconf = DHCP6_Config_File_Basic($interface, $wancfg, $wanif);
|
||||
|
||||
// DHCP6 Config File Advanced
|
||||
if ($wancfg['adv_dhcp6_config_advanced']) {
|
||||
@ -3064,7 +3018,60 @@ function interface_dhcpv6_prepare($interface = 'wan', $wancfg)
|
||||
@chmod("/var/etc/rtsold_{$wanif}_script.sh", 0755);
|
||||
}
|
||||
|
||||
function DHCP6_Config_File_Advanced($interface, $wancfg, $wanif)
|
||||
function DHCP6_Config_File_Basic($interface, $wancfg, $wanif, $count = 0)
|
||||
{
|
||||
$dhcp6cconf = "interface {$wanif} {\n";
|
||||
|
||||
/* for SLAAC interfaces we do fire off a dhcp6 client for just our name servers */
|
||||
if ($wancfg['ipaddrv6'] == "slaac") {
|
||||
$dhcp6cconf .= " information-only;\n";
|
||||
$dhcp6cconf .= " request domain-name-servers;\n";
|
||||
$dhcp6cconf .= " request domain-name;\n";
|
||||
$dhcp6cconf .= " script \"/var/etc/dhcp6c_{$interface}_script.sh\"; # we'd like some nameservers please\n";
|
||||
$dhcp6cconf .= "};\n";
|
||||
} else {
|
||||
/* skip address request if this is set */
|
||||
if (!isset($wancfg['dhcp6prefixonly'])) {
|
||||
$dhcp6cconf .= " send ia-na {$count}; # request stateful address\n";
|
||||
}
|
||||
if (is_numeric($wancfg['dhcp6-ia-pd-len'])) {
|
||||
$dhcp6cconf .= " send ia-pd {$count}; # request prefix delegation\n";
|
||||
}
|
||||
|
||||
$dhcp6cconf .= " request domain-name-servers;\n";
|
||||
$dhcp6cconf .= " request domain-name;\n";
|
||||
$dhcp6cconf .= " script \"/var/etc/dhcp6c_{$interface}_script.sh\"; # we'd like some nameservers please\n";
|
||||
|
||||
$dhcp6cconf .= "};\n";
|
||||
|
||||
if (!isset($wancfg['dhcp6prefixonly'])) {
|
||||
$dhcp6cconf .= "id-assoc na {$count} { };\n";
|
||||
}
|
||||
|
||||
if (is_numeric($wancfg['dhcp6-ia-pd-len'])) {
|
||||
/* Setup the prefix delegation */
|
||||
$dhcp6cconf .= "id-assoc pd {$count} {\n";
|
||||
if (isset($wancfg['dhcp6-ia-pd-send-hint'])) {
|
||||
$preflen = 64 - $wancfg['dhcp6-ia-pd-len'];
|
||||
$dhcp6cconf .= " prefix ::/{$preflen} infinity;\n";
|
||||
}
|
||||
foreach (link_interface_to_track6($interface) as $friendly => $ifcfg) {
|
||||
if (is_numeric($ifcfg['track6-prefix-id'])) {
|
||||
$trackifv6 = get_real_interface($friendly, 'inet6');
|
||||
$dhcp6cconf .= " prefix-interface {$trackifv6} {\n";
|
||||
$dhcp6cconf .= " sla-id {$ifcfg['track6-prefix-id']};\n";
|
||||
$dhcp6cconf .= " sla-len {$wancfg['dhcp6-ia-pd-len']};\n";
|
||||
$dhcp6cconf .= " };\n";
|
||||
}
|
||||
}
|
||||
$dhcp6cconf .= "};\n";
|
||||
}
|
||||
}
|
||||
|
||||
return $dhcp6cconf;
|
||||
}
|
||||
|
||||
function DHCP6_Config_File_Advanced($interface, $wancfg, $wanif, $count = 0)
|
||||
{
|
||||
$send_options = "";
|
||||
if ($wancfg['adv_dhcp6_interface_statement_send_options'] != '') {
|
||||
@ -3105,7 +3112,7 @@ function DHCP6_Config_File_Advanced($interface, $wancfg, $wanif)
|
||||
if (is_numeric($wancfg['adv_dhcp6_id_assoc_statement_address_id'])) {
|
||||
$id_assoc_statement_address .= "{$wancfg['adv_dhcp6_id_assoc_statement_address_id']}";
|
||||
} else {
|
||||
$id_assoc_statement_address .= '0';
|
||||
$id_assoc_statement_address .= $count;
|
||||
}
|
||||
$id_assoc_statement_address .= " {\n";
|
||||
|
||||
@ -3135,7 +3142,7 @@ function DHCP6_Config_File_Advanced($interface, $wancfg, $wanif)
|
||||
if (is_numeric($wancfg['adv_dhcp6_id_assoc_statement_prefix_id'])) {
|
||||
$id_assoc_statement_prefix .= "{$wancfg['adv_dhcp6_id_assoc_statement_prefix_id']}";
|
||||
} else {
|
||||
$id_assoc_statement_prefix .= '0';
|
||||
$id_assoc_statement_prefix .= $count;
|
||||
}
|
||||
$id_assoc_statement_prefix .= " {\n";
|
||||
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user