Project

General

Profile

« Previous | Next » 

Revision baf9fdca

Added by Seth Mos almost 14 years ago

Further fix up the DHCPv6 client support, launch rtsol to figure out our gateway and add this into the interface router file in /tmp.
This will then be picked up by the rest of the system. My testlab happens to block ping showing it down but should otherwise work.

View differences:

etc/inc/interfaces.inc
2934 2934
	}
2935 2935
	$dhcp6cconf .= "request domain-name-servers;\n";
2936 2936
	$dhcp6cconf .= "request domain-name;\n";
2937
	$dhcp6cconf .= "script \"/etc/rc.newwanipv6\";	# we'd like some nameservers please\n";
2937
	$dhcp6cconf .= "script \"{$g['varetc_path']}/dhcp6c_{$interface}_script.sh\"; # we'd like some nameservers please\n";
2938 2938

  
2939 2939
	$dhcp6cconf .= "};\n";
2940 2940
	$dhcp6cconf .= "id-assoc na 0 { };\n";
......
2957 2957
	fwrite($fd, $dhcp6cconf);
2958 2958
	fclose($fd);
2959 2959

  
2960
	/* Add wide-dhcp6c shell script here. Because we can not pass a argument to it. */
2961
	$fds = fopen("{$g['varetc_path']}/dhcp6c_{$interface}_script.sh", "w");
2962
	if (!$fds) {
2963
		printf("Error: cannot open dhcp6c_{$interface}_script.sh in interfaces_wan_dhcpv6_configure() for writing.\n");
2964
		return 1;
2965
	}
2966
	$dhcp6cscript = "#!/bin/sh\n";
2967
	$dhcp6cscript .= "# This shell script launches /etc/rc.newwanipv6 with a interface argument.\n";
2968
	$dhcp6cscript .= "/etc/rc.newwanipv6 $interface \n";
2969

  
2970
	fwrite($fds, $dhcp6cscript);
2971
	fclose($fds);
2972
	chmod("{$g['varetc_path']}/dhcp6c_{$interface}_script.sh", 0755);
2973

  
2974

  
2960 2975
	/* accept router advertisements for this interface */
2961 2976
	mwexec("/sbin/sysctl -w net.inet6.ip6.accept_rtadv=1");
2962 2977
	log_error("Accept router advertisements on interface {$wanif} ");
......
2966 2981
	/* fire up dhcp6c for IPv6 first, this backgrounds immediately */
2967 2982
	sleep(1);
2968 2983
	mwexec("/usr/local/sbin/dhcp6c -d -c {$g['varetc_path']}/dhcp6c_{$interface}.conf {$wanif}");
2969
	// sleep(1);
2970
	// mwexec("/sbin/rtsol -d -O /etc/rc.newwanipv6 {$wanif}");
2984
	sleep(1);
2985
	exec("/sbin/rtsol -d {$wanif} 2>&1", $out, $ret);
2986
	if(!empty($out)) {
2987
		echo "Output from rtsol {$wanif}\n";
2988
		foreach($out as $line) {
2989
			if(stristr($line, "received")) {
2990
				$parts = explode(" ", $line);
2991
				if(is_ipaddrv6($parts[3])) {
2992
					log_error("Found IPv6 default gateway '{$parts[3]}' by RA.");
2993
					file_put_contents("{$g['tmp_path']}/{$wanif}_routerv6", "{$parts[3]}\n");
2994
				}
2995
			}
2996
		}
2997
	}
2998
	if(!empty($out)) {
2999
		print_r($out);
3000
	}
2971 3001

  
2972 3002
	return 0;
2973 3003
}

Also available in: Unified diff