Project

General

Profile

« Previous | Next » 

Revision 7149c4e7

Added by Seth Mos about 14 years ago

Add backend support for the dhcp v6 client

View differences:

etc/inc/interfaces.inc
37 37

  
38 38
	pfSense_BUILDER_BINARIES:	/sbin/dhclient	/bin/sh	/usr/bin/grep	/usr/bin/xargs	/usr/bin/awk	/usr/local/sbin/choparp
39 39
	pfSense_BUILDER_BINARIES:	/sbin/ifconfig	/sbin/route	/usr/sbin/ngctl	/usr/sbin/arp	/bin/kill	/usr/local/sbin/mpd5
40
	pfSense_BUILDER_BINARIES:	/usr/local/sbin/dhcp6c
40 41
	pfSense_MODULE:	interfaces
41 42

  
42 43
*/
......
2543 2544

  
2544 2545
function find_dhcp6c_process($interface) {
2545 2546
	if ($interface)
2546
		$pid = `/bin/pgrep -axf "dhcp6c {$interface}"`;
2547
		$pid = `/bin/pgrep -axf "[d]hcp6c"|grep -e "{$interface}"`;
2547 2548
	else
2548 2549
		$pid = 0;
2549 2550

  
......
2861 2862
	
2862 2863
	$dhcp6cconf .= <<<EOD
2863 2864
interface {$wanif} {
2864
        information-only;
2865
        # request stateful address
2866
        send ia-na 0;
2867
        send ia-pd 0;
2868
	request prefix-delegation;
2869
	request domain-name-servers,domain-name;
2870
	send domain-name-servers,domain-name;
2871
};
2872
id-assoc pd {
2873
        prefix-interface {$wanif} {
2874
        sla-id 1;
2875
        };
2876
};
2877
id-assoc na 0 {
2878
};
2865
	send ia-na 0;	# request stateful address
2866
	send ia-pd 0;	# request prefix delegation
2867
	request domain-name-servers;
2868
	request domain-name;
2869
	script "/etc/rc.newwanipv6";	# we'd like some nameservers please
2879 2870

  
2871
};
2872
id-assoc na 0 { };
2873
id-assoc pd 0 {
2880 2874

  
2881 2875
EOD;
2876
	
2877
	/* Setup the prefix delegation */
2878
	foreach($IfList as $pdinterface => $friendly) {
2879
		if(is_numeric($interface['ia-pd'])) {
2880
			$realif = get_real_interface($friendly);
2881
			$dhcp6cconf .= "	prefix-interface {$realif} {\n";
2882
			$dhcp6cconf .= "		sla-id {$interface['ia-pd']};\n";
2883
			$dhcp6cconf .= "		sla-len {$config['interface'][$interface]['dhcp-ia-pd-len']};\n";
2884
			$dhcp6cconf .= "	};\n";
2885
		}
2886
	}
2887

  
2888
	$dhcp6cconf .= "};\n";
2882 2889

  
2883 2890
	fwrite($fd, $dhcp6cconf);
2884 2891
	fclose($fd);
......
2889 2896
	else 
2890 2897
		log_error("Could not bring up {$wanif} interface in interface_dhcp_configure()");
2891 2898

  
2892
	/* fire up dhclient */
2893
	mwexec("/sbin/dhclient -c {$g['varetc_path']}/dhclient_{$interface}.conf {$wanif} > {$g['tmp_path']}/{$wanif}_output > {$g['tmp_path']}/{$wanif}_error_output");
2894
	/* fire up dhcp6c for IPv6 */
2899
	/* fire up dhcp6c for IPv6 first, this backgrounds immediately */
2895 2900
	mwexec("/usr/local/sbin/dhcp6c -c {$g['varetc_path']}/dhcp6c_{$interface}.conf {$wanif}");
2901
	/* fire up dhclient */
2902
	// mwexec("/sbin/dhclient -c {$g['varetc_path']}/dhclient_{$interface}.conf {$wanif} > {$g['tmp_path']}/{$wanif}_output > {$g['tmp_path']}/{$wanif}_error_output");
2896 2903

  
2897 2904
	return 0;
2898 2905
}

Also available in: Unified diff