commit 06886ae39b1079733344f75427966ed6d11e1fc9
Author: Ermal <eri@pfsense.org>
Date:   Mon Jun 17 08:59:43 2013 +0000

    * Use when needed the family for get_real_interface
    * During dhcp setup use -n for cp to avoid coping uselessly

diff --git a/etc/inc/interfaces.inc b/etc/inc/interfaces.inc
index d10b3b0765..29ac9e6fe0 100644
--- a/etc/inc/interfaces.inc
+++ b/etc/inc/interfaces.inc
@@ -3415,7 +3415,7 @@ function interface_dhcpv6_configure($interface = "wan", $wancfg) {
 	if (!is_array($wancfg))
 		return;
 
-	$wanif = get_real_interface($interface);
+	$wanif = get_real_interface($interface, "inet6");
 	$dhcp6cconf = "";
 	$dhcp6cconf .= "interface {$wanif} {\n";
 
@@ -4446,7 +4446,8 @@ function get_interface_ipv6($interface = "wan", $flush = false) {
 }
 
 function get_interface_linklocal($interface = "wan") {
-	$realif = get_failover_interface($interface);
+
+	$realif = get_failover_interface($interface, "inet6");
 	if (!$realif) {
 		if (preg_match("/^carp/i", $interface))
 			$realif = $interface;
@@ -4844,26 +4845,24 @@ function interfaces_staticarp_configure($if) {
 
 function get_failover_interface($interface, $family = "all") {
 	global $config;
+
 	/* shortcut to get_real_interface if we find it in the config */
-	if(is_array($config['interfaces'][$interface])) {
-		$wanif = get_real_interface($interface, $family);
-		return $wanif;
+	if (is_array($config['interfaces'][$interface])) {
+		return get_real_interface($interface, $family);
 	}
 
 	/* compare against gateway groups */
 	$a_groups = return_gateway_groups_array();
-	if(is_array($a_groups[$interface])) {
+	if (is_array($a_groups[$interface])) {
 		/* we found a gateway group, fetch the interface or vip */
-		if($a_groups[$interface][0]['vip'] <> "")
-			$wanif = $a_groups[$interface][0]['vip'];
+		if ($a_groups[$interface][0]['vip'] <> "")
+			return $a_groups[$interface][0]['vip'];
 		else
-			$wanif = $a_groups[$interface][0]['int'];
-
-		return $wanif;
+			return $a_groups[$interface][0]['int'];
 	}
 	/* fall through to get_real_interface */
-	$wanif = get_real_interface($interface, $family);
-	return $wanif;
+	/* XXX: Really needed? */
+	return get_real_interface($interface, $family);
 }
 
 function remove_ifindex($ifname) {
diff --git a/etc/inc/services.inc b/etc/inc/services.inc
index c61ea54e22..1ad80ee0d6 100644
--- a/etc/inc/services.inc
+++ b/etc/inc/services.inc
@@ -92,7 +92,7 @@ function services_radvd_configure() {
 			}
 		}
 
-		$realif = get_real_interface($dhcpv6if);
+		$realif = get_real_interface($dhcpv6if, "inet6");
 		if (isset($radvdifs[$realif]))
 			continue;
 
@@ -215,7 +215,7 @@ function services_radvd_configure() {
 		if (empty($config['interfaces'][$trackif]))
 			continue;
 
-		$realif = get_real_interface($if);
+		$realif = get_real_interface($if, "inet6");
 		/* prevent duplicate entries, manual overrides */
 		if (isset($radvdifs[$realif]))
 			continue;
@@ -311,8 +311,8 @@ function services_dhcpd_configure($family = "all") {
 	fwrite($fd, "/bin/mkdir -p {$g['dhcpd_chroot_path']}/lib\n");
 	fwrite($fd, "/bin/mkdir -p {$g['dhcpd_chroot_path']}/run\n");
 	fwrite($fd, "/usr/sbin/chown -R dhcpd:_dhcp {$g['dhcpd_chroot_path']}/*\n");
-	fwrite($fd, "/bin/cp /lib/libc.so.* {$g['dhcpd_chroot_path']}/lib/\n");
-	fwrite($fd, "/bin/cp /usr/local/sbin/dhcpd {$g['dhcpd_chroot_path']}/usr/local/sbin/\n");
+	fwrite($fd, "/bin/cp -n /lib/libc.so.* {$g['dhcpd_chroot_path']}/lib/\n");
+	fwrite($fd, "/bin/cp -n /usr/local/sbin/dhcpd {$g['dhcpd_chroot_path']}/usr/local/sbin/\n");
 	fwrite($fd, "/bin/chmod a+rx {$g['dhcpd_chroot_path']}/usr/local/sbin/dhcpd\n");
 
 	$status = `/sbin/mount | /usr/bin/grep -v grep  | /usr/bin/grep  "{$g['dhcpd_chroot_path']}/dev"`;
@@ -951,7 +951,7 @@ function services_dhcpdv6_configure() {
 	/* we add a fake entry for interfaces that are set to track6 another WAN */
 	foreach ($Iflist as $ifname) {
 		if (!empty($config['interfaces'][$ifname]['track6-interface'])) {
-			$realif = get_real_interface($ifname);
+			$realif = get_real_interface($ifname, "inet6");
 			$ifcfgipv6 = get_interface_ipv6($ifname);
 			if(!is_ipaddrv6($ifcfgipv6))
 				continue;
