Project

General

Profile

« Previous | Next » 

Revision ada3eeb3

Added by Renato Botelho over 9 years ago

Fix #3029

Teach system_hosts_generate() to deal with PD length != 64

View differences:

src/etc/inc/system.inc
421 421
			foreach ($config['dhcpdv6'] as $dhcpif => $dhcpifconf) {
422 422
				if (is_array($dhcpifconf['staticmap']) && isset($dhcpifconf['enable'])) {
423 423
					$isdelegated = $config['interfaces'][$dhcpif]['ipaddrv6'] == 'track6';
424
					if ($isdelegated) {
425
						$prefix = array_slice(explode(':', Net_IPv6::uncompress(get_interface_ipv6($dhcpif))), 0, 4);
426
					}
427 424
					foreach ($dhcpifconf['staticmap'] as $host) {
428 425
						$ipaddrv6 = $host['ipaddrv6'];
429 426
						if ($ipaddrv6 && $host['hostname']) {
430 427
							if ($isdelegated) {
431
								$suffix = array_slice(explode(':', Net_IPv6::uncompress($ipaddrv6)), 4);
432
								$ipaddrv6 = Net_IPv6::compress(implode(':', array_merge($prefix, $suffix)));
428
								$trackifname = $config['interfaces'][$dhcpif]['track6-interface'];
429
								$trackcfg = $config['interfaces'][$trackifname];
430
								$pdlen = 64 - $trackcfg['dhcp6-ia-pd-len'];
431
								$ipaddrv6 = merge_ipv6_delegated_prefix(get_interface_ipv6($dhcpif), $ipaddrv6, $pdlen);
433 432
							}
434 433
							if ($host['domain']) {
435 434
								$dhosts .= "{$ipaddrv6}	{$host['hostname']}.{$host['domain']} {$host['hostname']}\n";

Also available in: Unified diff