Revision e9ab2ddb
Added by Seth Mos over 12 years ago
etc/inc/services.inc | ||
---|---|---|
57 | 57 |
|
58 | 58 |
$dhcpdv6cfg = $config['dhcpdv6']; |
59 | 59 |
$Iflist = get_configured_interface_list(); |
60 |
$Iflist = array_merge($Iflist, get_configured_pppoe_server_interfaces()); |
|
60 | 61 |
|
61 | 62 |
$radvdconf = "# Automatically Generated, do not edit\n"; |
62 | 63 |
|
... | ... | |
801 | 802 |
killbypid("{$g['varrun_path']}/dhcpleases6.pid"); |
802 | 803 |
} |
803 | 804 |
|
805 |
|
|
804 | 806 |
/* DHCP enabled on any interfaces? */ |
805 | 807 |
if (!is_dhcpv6_server_enabled()) |
806 | 808 |
return 0; |
... | ... | |
825 | 827 |
$config['dhcpdv6'] = array(); |
826 | 828 |
$dhcpdv6cfg = $config['dhcpdv6']; |
827 | 829 |
$Iflist = get_configured_interface_list(); |
830 |
$Iflist = array_merge($Iflist, get_configured_pppoe_server_interfaces()); |
|
831 |
|
|
828 | 832 |
|
829 | 833 |
if ($g['booting']) |
830 | 834 |
echo "Starting DHCPv6 service..."; |
... | ... | |
911 | 915 |
|
912 | 916 |
$dhcpdv6ifs = array(); |
913 | 917 |
|
914 |
/* loop through and determine if we need to setup |
|
915 |
* failover peer "bleh" entries |
|
916 |
*/ |
|
917 |
$dhcpv6num = 0; |
|
918 |
foreach ($dhcpdv6cfg as $dhcpv6if => $dhcpv6ifconf) { |
|
919 |
|
|
920 |
if (!isset($dhcpv6ifconf['enable'])) |
|
921 |
continue; |
|
922 |
|
|
923 |
if($dhcpv6ifconf['failover_peerip'] <> "") { |
|
924 |
$intv6 = guess_interface_from_ip($dhcpv6ifconf['failover_peerip']); |
|
925 |
$intipv6 = find_interface_ipv6($intv6); |
|
926 |
$real_dhcpv6if = convert_friendly_interface_to_real_interface_name($dhcpv6if); |
|
927 |
/* |
|
928 |
* yep, failover peer is defined. |
|
929 |
* does it match up to a defined vip? |
|
930 |
*/ |
|
931 |
$skew = 110; |
|
932 |
$a_vip = &$config['virtualip']['vip']; |
|
933 |
if(is_array($a_vip)) { |
|
934 |
foreach ($a_vip as $vipent) { |
|
935 |
if($intv6 == $real_dhcpv6if) { |
|
936 |
/* this is the interface! */ |
|
937 |
if(is_numeric($vipent['advskew']) && ($vipent['advskew'] < "20")) |
|
938 |
$skew = 0; |
|
939 |
} |
|
940 |
} |
|
941 |
} else { |
|
942 |
log_error("Warning! DHCPv6 Failover setup and no CARP virtual IPv6's defined!"); |
|
943 |
} |
|
944 |
if($skew > 10) { |
|
945 |
$typev6 = "secondary"; |
|
946 |
$dhcpdv6conf_pri = "mclt 600;\n"; |
|
947 |
$my_portv6 = "520"; |
|
948 |
$peer_portv6 = "519"; |
|
949 |
} else { |
|
950 |
$my_portv6 = "519"; |
|
951 |
$peer_portv6 = "520"; |
|
952 |
$typev6 = "primary"; |
|
953 |
$dhcpdv6conf_pri = "split 128;\n"; |
|
954 |
$dhcpdv6conf_pri .= " mclt 600;\n"; |
|
955 |
} |
|
956 |
$dhcpdv6conf .= <<<EOPP |
|
957 |
failover peer "dhcpv6{$dhcpv6num}" { |
|
958 |
{$typev6}; |
|
959 |
address {$intipv6}; |
|
960 |
port {$my_portv6}; |
|
961 |
peer address {$dhcpv6ifconf['failover_peerip']}; |
|
962 |
peer port {$peer_portv6}; |
|
963 |
max-response-delay 10; |
|
964 |
max-unacked-updates 10; |
|
965 |
{$dhcpdv6conf_pri} |
|
966 |
load balance max seconds 3; |
|
967 |
} |
|
968 |
|
|
969 |
EOPP; |
|
970 |
$dhcpv6num++; |
|
971 |
} |
|
972 |
} |
|
973 |
|
|
974 | 918 |
$dhcpv6num = 0; |
975 | 919 |
foreach ($dhcpdv6cfg as $dhcpv6if => $dhcpv6ifconf) { |
976 | 920 |
|
... | ... | |
1006 | 950 |
|
1007 | 951 |
if (is_array($dhcpv6ifconf['dnsserver']) && ($dhcpv6ifconf['dnsserver'][0])) { |
1008 | 952 |
$dnscfgv6 .= " option dhcp6.name-servers " . join(",", $dhcpv6ifconf['dnsserver']) . ";"; |
1009 |
} else if (isset($config['dnsmasq']['enable'])) {
|
|
953 |
} else if ((isset($config['dnsmasq']['enable'])) && (is_ipaddrv6($ifcfgipv6))) {
|
|
1010 | 954 |
$dnscfgv6 .= " option dhcp6.name-servers {$ifcfgipv6};"; |
1011 | 955 |
} else if (is_array($syscfg['dnsserver']) && ($syscfg['dnsserver'][0])) { |
1012 | 956 |
$dns_arrv6 = array(); |
... | ... | |
1019 | 963 |
$dnscfgv6 .= " option dhcp6.name-servers " . join(",", $dns_arrv6) . ";"; |
1020 | 964 |
} |
1021 | 965 |
|
1022 |
$subnet6 = Net_IPv6::compress(gen_subnetv6($ifcfgipv6, $ifcfgsnv6)); |
|
1023 |
$dhcpdv6conf .= "subnet6 {$subnet6}/{$ifcfgsnv6} {\n"; |
|
966 |
if(is_ipaddrv6(ifcfgipv6)) { |
|
967 |
$subnet6 = Net_IPv6::compress(gen_subnetv6($ifcfgipv6, $ifcfgsnv6)); |
|
968 |
$dhcpdv6conf .= "subnet6 {$subnet6}/{$ifcfgsnv6} {\n"; |
|
969 |
} else { |
|
970 |
$subnet6 = Net_IPv6::compress(gen_subnetv6($dhcpv6ifconf['range']['from'], "64")); |
|
971 |
$dhcpdv6conf .= "subnet6 {$subnet6}/64 {\n"; |
|
972 |
} |
|
1024 | 973 |
|
1025 | 974 |
if($dhcpv6ifconf['failover_peerip'] <> "") |
1026 | 975 |
$dhcpdv6conf .= " deny dynamic bootp clients;\n"; |
... | ... | |
1028 | 977 |
if (isset($dhcpv6ifconf['denyunknown'])) |
1029 | 978 |
$dhcpdv6conf .= " deny unknown-clients;\n"; |
1030 | 979 |
|
1031 |
if($dhcpv6ifconf['failover_peerip'] <> "") { |
|
1032 |
$dhcpdv6conf .= " failover peer \"dhcpv6{$dhcpv6num}\";\n"; |
|
1033 |
$dhcpv6num++; |
|
1034 |
} |
|
1035 |
|
|
1036 | 980 |
$dhcpdv6conf .= <<<EOD |
1037 | 981 |
range6 {$dhcpv6ifconf['range']['from']} {$dhcpv6ifconf['range']['to']}; |
1038 | 982 |
$dnscfgv6 |
... | ... | |
1128 | 1072 |
} |
1129 | 1073 |
|
1130 | 1074 |
if($config['dhcpdv6'][$dhcpv6if]['ramode'] <> "unmanaged") { |
1131 |
$realif = escapeshellcmd(get_real_interface($dhcpv6if)); |
|
1132 |
$dhcpdv6ifs[] = $realif; |
|
1133 |
exec("/sbin/ifconfig {$realif} |awk '/ether/ {print $2}'", $mac); |
|
1134 |
$v6address = generate_ipv6_from_mac($mac[0]); |
|
1135 |
/* Create link local address for bridges */ |
|
1136 |
if(stristr("$realif", "bridge")) { |
|
1137 |
mwexec("/sbin/ifconfig {$realif} inet6 {$v6address}"); |
|
1075 |
if(preg_match("/poes/si", $dhcpv6if)) { |
|
1076 |
/* magic here */ |
|
1077 |
$dhcpdv6ifs = array_merge($dhcpdv6ifs, get_pppoes_child_interfaces($dhcpv6if)); |
|
1078 |
} else { |
|
1079 |
$realif = escapeshellcmd(get_real_interface($dhcpv6if)); |
|
1080 |
$dhcpdv6ifs[] = $realif; |
|
1081 |
exec("/sbin/ifconfig {$realif} |awk '/ether/ {print $2}'", $mac); |
|
1082 |
$v6address = generate_ipv6_from_mac($mac[0]); |
|
1083 |
/* Create link local address for bridges */ |
|
1084 |
if(stristr("$realif", "bridge")) { |
|
1085 |
mwexec("/sbin/ifconfig {$realif} inet6 {$v6address}"); |
|
1086 |
} |
|
1138 | 1087 |
} |
1139 | 1088 |
} |
1140 | 1089 |
} |
... | ... | |
1152 | 1101 |
join(" ", $dhcpdv6ifs)); |
1153 | 1102 |
mwexec("/usr/local/sbin/dhcpleases6 -c \"/usr/local/bin/php -f /usr/local/sbin/prefixes.php|/bin/sh\" -l {$g['dhcpd_chroot_path']}/var/db/dhcpd6.leases"); |
1154 | 1103 |
} |
1155 |
|
|
1156 | 1104 |
if ($g['booting']) { |
1157 | 1105 |
print gettext("done.") . "\n"; |
1158 | 1106 |
} |
Also available in: Unified diff
Add some backend support for writing out a config so that the dhcp6 server can listen on the required MPD pppoe server interfaces.
Also nuke the failover entries, these don't exist for IPv6, this is handled by 2 servers and differing priorities