Project

General

Profile

Bug #2758 » fix_2758.diff

Renato Botelho, 02/19/2013 12:35 PM

View differences:

etc/inc/interfaces.inc
1133 1133
	if ($g['debug'])
1134 1134
		log_error("Calling interface down for interface {$interface}, destroy is " . (($destroy) ? 'true' : 'false'));
1135 1135

  
1136
	if ($ifacecfg === false)
1136
	if ($ifacecfg === false) {
1137 1137
		$ifcfg = $config['interfaces'][$interface];
1138
	else if (!is_array($ifacecfg))
1138
		$ppps = $config['ppps']['ppp'];
1139
		$realif = get_real_interface($interface);
1140
	} elseif (!is_array($ifacecfg)) {
1139 1141
		log_error(gettext("Wrong parameters used during interface_bring_down"));
1140
	else
1141
		$ifcfg = $ifacecfg;
1142
		
1143

  
1144
	$realif = get_real_interface($interface);
1142
	} else {
1143
		$ifcfg = $ifacecfg['ifcfg'];
1144
		$ppps = $ifacecfg['ppps'];
1145
		if (isset($ifacecfg['ifcfg']['realif']))
1146
			$realif = $ifacecfg['ifcfg']['realif'];
1147
		else
1148
			$realif = get_real_interface($interface);
1149
	}
1145 1150

  
1146 1151
	switch ($ifcfg['ipaddr']) {
1147 1152
	case "ppp":
1148 1153
	case "pppoe":
1149 1154
	case "pptp":
1150 1155
	case "l2tp":
1151
		if (is_array($config['ppps']['ppp']) && count($config['ppps']['ppp'])) {
1152
			foreach ($config['ppps']['ppp'] as $pppid => $ppp) {
1156
		if (is_array($ppps) && count($ppps)) {
1157
			foreach ($ppps as $pppid => $ppp) {
1153 1158
				if ($realif == $ppp['if']) {
1154 1159
					if (isset($ppp['ondemand']) && !$destroy){
1155 1160
						send_event("interface reconfigure {$interface}");
usr/local/www/interfaces.php
86 86

  
87 87
$wancfg = &$config['interfaces'][$if];
88 88
$old_wancfg = $wancfg;
89
$old_wancfg['realif'] = get_real_interface($if);
90
$old_ppps = $a_ppps;
89 91
// Populate page descr if it does not exist.
90 92
if ($if == "wan" && !$wancfg['descr'])
91 93
	$wancfg['descr'] = "WAN";
......
388 390
	} else {
389 391
		$toapplylist = array();
390 392
	}
391
	$toapplylist[$if] = $wancfg;
393
	$toapplylist[$if]['ifcfg'] = $wancfg;
394
	$toapplylist[$if]['ppps'] = $a_ppps;
392 395
	/* we need to be able remove IP aliases for IPv6 */
393 396
	file_put_contents("{$g['tmp_path']}/.interfaces.apply", serialize($toapplylist));
394 397
	header("Location: interfaces.php?if={$if}");
......
891 894
		} else {
892 895
			$toapplylist = array();
893 896
		}
894
		$toapplylist[$if] = $old_wancfg;
897
		$toapplylist[$if]['ifcfg'] = $old_wancfg;
898
		$toapplylist[$if]['ppps'] = $old_ppps;
895 899
		file_put_contents("{$g['tmp_path']}/.interfaces.apply", serialize($toapplylist));
896 900

  
897 901
		mark_subsystem_dirty('interfaces');
(2-2/2)